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
PhantomChess - misha_turnbull working properly, but I'm working on that now and thought I'd share what I have here. Please note that as it is a repo, not a single file, an installer file (in .pyform and .exefor Windows) is provided in the main directory to download, extract, and place in the site-packages folder the main package. Also, the same file can be used to redownload the source every time it's updated. It's extremly simple to use, on the order of 3 lines total to start a game using the scenemodule in Pythonista: import Phantom game = Phantom.ChessGame() game.gui() I hope you like it! (links to screenshots: screenshot0, screenshot1, screenshot2) - misha_turnbull Link to repo is fixed, apologies for the typo. unicode_chess_pieces.py import console console.set_font('Arial', 40) chess_pieces = [unichr(9812+i) for i in xrange(12)] print(' '.join(chess_pieces)) PhantomChesshas been getting quite a few updates in recent weeks and it would be good to get feedback from others. It is a Python-based Chess game that has three modes of operations in Pythonista. It starts up in text-only modewhere it takes commands on the interactive prompt. The guicommand switches it into a ui/scene based gui mode. The skcommand switches it into a ui/sk based gui mode for those who are running the Pythonista v1.6 beta. To install Phantom, copy the text of Phantom_installer.pyinto a new Pythonista script window and run it. A local Phantom directory will be created with a Run_this.pyfile in it. To improve PhantomChess Please open issues or send pull requests.
https://forum.omz-software.com/topic/1771/phantomchess/4
CC-MAIN-2021-49
refinedweb
266
66.84
Are you sure? This action might not be possible to undo. Are you sure you want to continue? Instructions for Form 1120-F U.S. Income Tax Return of a Foreign Corporation 105 hr., 42 min. 42 hr., 22 min. 72 hr., 56 min. The Revenue Reconciliation Act of 1993 (the Act) made changes to the tax law for foreign corporations engaged in a U.S. trade or business. Some of the changes are highlighted below. ● Corporations that are located in an area designated by the Federal government as an “empowerment zone” may be able to claim the credit figured on Form 8844, Empowerment Zone Employment Credit. See page 16. ● The deductible portion of business meals and entertainment expenses has been reduced from 80% to 50%. See page 12. ● Generally, a publicly held corporation cannot deduct compensation paid to certain “covered employees” to the extent the compensation exceeds $1 million. For details and exceptions, see the instructions for Section II, line 12. Copying, assembling, and sending the form to the IRS 7 hr., 47-0126), Washington, DC 20503. DO NOT send the tax form to either of these offices. Instead, see Where To File on page 2. General Instructions Purpose of Form Form 1120-F is used by a foreign corporation to report its income, gains, losses, deductions, and credits, and to figure its U.S. income tax liability. If a refund is due, Form 1120-F may be used to claim it. page 1 of the form and complete Item W at the bottom of page 5 of the form. If the foreign corporation does not owe the branch profits tax or the tax on excess interest because it is claiming a treaty exemption, complete Item W and attach a statement explaining why the corporation is a qualified resident or otherwise qualifies for treaty benefits. Note that an exemption from tax under Section II based on the permanent establishment article of an income tax treaty does not necessarily exempt the corporation from the branch profits tax. A Mexican or Canadian branch of a U.S. mutual life insurance company must file Form 1120-F on the same basis as a foreign corporation if the U.S. company elects to exclude the branch’s income and expenses from its own gross income. A receiver, assignee, or trustee in dissolution or bankruptcy must file Form 1120-F if that person has or holds title to virtually all of a foreign corporation’s property or business. Form 1120-F is due whether or not the property or business is being operated. An agent in the United States must file the return if the foreign corporation has no office or place of business in the United States when the return is due. Consolidated returns.—A foreign corporation cannot belong to an affiliated group of corporations that files a consolidated return unless it is a Canadian or Mexican corporation maintained solely for complying with the laws of Canada or Mexico for title and operation of property. Who Does Not File Form 1120-F A foreign corporation does not need to file Form 1120-F if any of the following apply: ● Its only income is not subject to U.S. taxation under section 881(d). ● It is a beneficiary of an estate or trust engaged in a U.S. trade or business, but would itself otherwise not need to file. ● It files Form 1120-L, U.S. Life Insurance Company Income Tax Return, as a foreign life insurance company, or Form 1120-PC, U.S. Property and Casualty Insurance Company Income Tax Return, as a foreign property and casualty insurance company. ● It did not engage in a U.S. trade or business during the year, and its full U.S. tax was withheld at source. ● It has filed Form 8279, Election To Be Treated as a FSC or as a Small FSC, and the election is still in effect. These corporations must file Form 1120-FSC, U.S. Income Tax Return of a Foreign Sales Corporation. Who Must File Except for corporations described in Who Does Not File Form 1120-F below, every foreign corporation must file Form 1120-F if, during the tax year, it: ● Overpaid income tax that it wants refunded. ● Engaged in a trade or business in the United States, whether or not it had income from that trade or business. ● Had income, gains, or losses treated as if they were effectively connected with that U.S. trade or business. See Section II, for the definition of effectively connected income. ● Had income from any U.S. source (even if its income is tax exempt under an income tax treaty or code section). Note: If the corporation does not owe any tax because it is claiming a treaty exemption, it must still file Form 1120-F to show that the income was exempted by treaty. To show this exemption, complete the identifying information at the top of Changes To Note ● Some foreign corporations are required to use a new method of depositing taxes for taxes due after 1994. Generally, the requirement applies to corporations that maintain an office or place of business in the United States and whose total deposits of certain taxes during the calendar year 1993 exceeded $78 million. Other corporations may use the method voluntarily. For details, see Depositary Method of Tax Payment on page 3. ● Final regulations under section 263A have been adopted. These regulations, which require the capitalization and inclusion in inventory of certain costs, generally are effective for tax years beginnng after 1993. Changes in accounting methods may be necessary as a result of the issuance of the final regulations. These changes must be made under Rev. Proc. 94-49, 1994-30 I.R.B. 31. When To File The requirements for filing Form 1120-F depend on whether the foreign corporation has an office or place of business in the United States. A foreign corporation that does not maintain an office or place of business in the United States must file Form 1120-F by the 15th day of the 6th month after the end of its tax year. A 6-month extension of Cat. No. 11475L time to file can be requested by filing Form 7004, Application for Automatic Extension of Time To File Corporation Income Tax Return. However, this extension does not extend the time for payment of tax. Therefore, if the tax is paid after the 15th day of the 6th month after the end of its tax year, the corporation must pay interest on the late payment and is subject to a penalty for late payment of tax. See Interest and Penalties. A foreign corporation that does maintain an office or place of business in the United States must file Form 1120-F by the 15th day of the 3rd month after the end of its tax year. However, the corporation may get an extension of time to file by: 1. Filing Form 7004 by the 15th day of the 3rd month after the end of its tax year to obtain a 6-month extension. However, the extension that is granted by the timely filing of Form 7004 does not extend the time for payment of the tax. Therefore, if the tax is paid after the 15th day of the 3rd month following the close of the corporation’s tax year, the corporation must pay interest on the late payment and is subject to the penalty for late payment of tax, OR 2. Utilizing the 3-month extension described in Regulations section 1.6081-5 by attaching to Form 1120-F the statement described in those regulations. If this option is chosen, the corporation is not required to file Form 7004 unless it needs additional time beyond the 3-month extension period. If the corporation needs additional time, it must file Form 7004 before the end of the 3-month extension period to obtain up to an additional 3 months to file its return. If the corporation fails to file Form 7004 by the expiration of such 3-month extension period, and files its income tax return after such period, it may be liable for the penalty for failure to file described in Interest and Penalties. In no event may the total extension period exceed 6 months from the original due date of the return (i.e., the return must be filed by the 15th day of the 9th month after the end of its tax year). See Rev. Rul. 93-85, 1993-2 C.B. 297.. Thus, for example, a corporation that chooses the option described in 1 to extend the time to file may not later choose the option described in 2.. Form 1120-F must be filed on a timely basis or the foreign corporation may be denied the benefit of certain deductions and credits. A foreign corporation is only allowed to take deductions and credits against its effectively connected income if it timely files Form 1120-F in a true and accurate manner.. A foreign corporation is allowed the following deductions and credits regardless of whether Form 1120-F is timely filed: ● The charitable contributions deduction (page 3, Section II, line 19); ● The credit from regulated investment companies (page 1, line 6f); ● The credit for Federal tax on fuels (page 1, line 6g); and ● U.S. income tax paid or withheld at source (page 1, line 6h). See Regulations section 1.882-4 for details. Where To File File Form 1120-F, the Paid Preparer’s space should remain blank. Anyone who prepares Form 1120-F or labels are not acceptable). ● Give a copy of Form 1120-F to the taxpayer. Accounting Methods Taxable income must be computed using the method of accounting regularly used in keeping the corporation’s books and records. Generally, permissible methods include the cash, accrual, or any other method authorized by the Internal Revenue Code. In all cases, the method used must clearly show taxable income. Generally, a corporation (other than a qualified personal service corporation) must use the accrual method of accounting if its average annual gross receipts exceed $5 million. See section 448(c). A corporation engaged in farming operations must also use the accrual method. For exceptions, see section 447. corporation may change the method of accounting used to report taxable income (for income as a whole or for any material item) only by getting consent on Form 3115, Application for Change in Accounting Method. For more information, in Section II, line 10) is taken into account ratably over 5 tax years, beginning with the first tax year ending on or after December 31, 1993. For details, including exceptions, see section 475, the related temporary regulations, and Rev. Rul. 94-7, 1994-3 I.R.B. 6. Page 2 Change in Accounting Period Generally, before changing an accounting period, the Commissioner’s approval must be obtained (Regulations section 1.442-1) by filing Form 1128, Application To Adopt, Change, or Retain a Tax Year. Also see Pub. 538. Certain Controlled Foreign Corporations and Certain Foreign Personal Holding Companies The tax year of a specified foreign corporation is generally required to be the tax year of its majority U.S. shareholder (see section 898(c) for details). A specified foreign corporation is any foreign corporation: (a) that is treated as a controlled foreign corporation for any purpose under subpart F (sections 951 through 964) or is a foreign personal holding company (as defined in section 552); and (b) for which the 50% U.S. ownership requirements of section 898(b)(2) are met. Schedule H (Form 1120), Section 280H Limitations for a Personal Service Corporation (PSC), to figure the required minimum distributions and the maximum deductible amount, if applicable.. Rounding Off to Whole Dollars The corporation may show amounts on the return and accompanying schedules as whole dollars. To do so, drop any amount less than 50 cents and increase any amount from 50 cents through 99 cents to the next higher dollar. Recordkeeping The corporation also keep copies of any returns it has filed. They help in preparing future returns and in making computations when filing an amended return. Foreign Corporations That Are Personal Service Corporations Personal service corporations (see the instructions for Item O), must adopt a calendar year unless: (a) the corporation can establish to the satisfaction of the Commissioner that there is a business purpose for having a different tax year, or (b) the corporation elects under section 444 to have a tax year other than a calendar year. Personal service corporations that wish to establish a business purpose for having a different tax year should see Rev. Rul. 87-57, 1987-2 C.B. 117, for more information. Also see Rev. Proc. 87-32, 1987-2 C.B. 396, for procedures to use in adopting, retaining, or changing the corporation’s tax year. Personal service corporations that wish to adopt or retain a non-calendar tax year must file requests to do so on Form 1128 using the procedures outlined in Rev. Proc. 87-32. Personal service corporations that wish to elect under section 444 to have a tax year other than a calendar year must file Form 8716, Election To Have a Tax Year Other Than a Required Tax Year. Generally, Form 8716 must be filed by the earlier of (a) the 15th day of the 5th month following the month that includes the 1st day of the tax year for which the election will be effective, or (b) the due date (not including extensions) of the income tax return resulting from the section 444 election. Electing corporations are subject to minimum distribution requirements under section 280H(c) for each year the election is in effect. If the corporation fails to make the required minimum distributions, the deduction allowable for certain amounts paid to employee-owners is limited to a maximum deductible amount under section 280H(d). Amounts not allowed as a deduction for the tax year are carried over to the following tax year. Complete Payment of Tax Due The requirements for payment of tax depend on whether the foreign corporation has an office or place of business in the United States. Foreign corporations that do not maintain an office or place of business in the United States must pay the tax due (page 1, line 8) in full when they file their tax return, but not later than the 15th day of the 6th month after the end of the tax year. The tax must be paid directly to the IRS (i.e., do not use the depositary method of tax payment described below). The tax may be paid by check or money order, payable to the Internal Revenue Service. To help ensure proper crediting, write the corporation’s employer identification number, 8) in full when they file their tax return, but not later than the 15th day of the 3rd month after the end of the tax year. Depositary Method of Tax Payment.—If the foreign corporation does maintain an office or place of business in the United States, deposit corporate corporation’s geographic area. Make checks or money orders payable to that depositary or FRB. To help ensure proper crediting, write the corporation’s employer identification number, the tax period to which the deposit applies, and “Form 1120-F” about deposits, see the instructions in the coupon booklet (Form 8109) and Pub. 583, Taxpayers Starting a Business. Caution: If the corporation owes tax when it files Form 1120-F, do not include the payment with the tax return. Instead, mail or deliver the payment with Form 8109 to a qualified depositary or FRB. Generally, corporations that maintain an office or place of business in the United States and. Corporations who are not required to make deposits by EFT may voluntarily participate in TAXLINK. For more details on TAXLINK, see Rev. Proc. 94-48, 1994-29 I.R.B. 31. You may also call the toll-free TAXLINK HELPLINE at 1-800-829-5469. Estimated Tax Payments Generally, a foreign corporation must make installment payments of estimated tax if it expects its estimated tax. Foreign corporations that maintain an office or place of business in the United States must use the deposit coupons (Forms 8109) to make deposits of estimated tax. For more information on estimated tax payments, including penalties that apply if the corporation fails to make required payments, see the instructions for page 1, line 7, of Form 1120-F. Page 3 If the corporation the corporation files its income tax return. Do not file Form 4466 before the end of the corporation’s tax year. corporation corporation can show that the failure to file on time was due to reasonable cause. Corporations that file late must attach a statement explaining the reasonable cause. Late payment of tax.—A corporation corporation can show that the failure to pay on time was due to reasonable cause. Other penalties.—Other penalties can be imposed for negligence, substantial understatement of tax, and fraud. See sections 6662 and 6663. Other Forms, Returns, Schedules, and Statements That May Be Required Forms, Returns, and Schedules Form 5471.—Information Return of U.S. Persons With Respect To Certain Foreign Corporations. This form is filed by certain officers, directors, or U.S. shareholders of certain foreign corporations. If the corporation is a foreign personal holding company, certain shareholders of the corporation are required to attach to their personal returns a statement containing the information required by section 551(c). For more information, see section 552 and Regulations section 1.551-4. In addition, section 6035 (and the related regulations) requires certain officers, directors, and shareholders of a foreign personal holding company to file Schedule N (Form 5471) and the appropriate schedules of Form 5471. See the Instructions for Form 5471 for additional information. Form 5472.—Information Return of a 25% Foreign-Owned U.S. Corporation or a Foreign Corporation Engaged in a U.S. Trade or Business. This form is filed by a foreign corporation engaged in a U.S. trade or business that had certain reportable transactions with a related party. See section 6038A and the related regulations, section 6038C, and the instructions for Form 5472 for additional information. Note: A $10,000 penalty applies for failure to file Form 5472. The penalty also applies for failure to maintain records as required by Regulations section 1.6038A-3. For details, see Form 5472. Form W-2, Wage and Tax Statement, and Form W-3, Transmittal of Income and Tax Statements. Form 720.—Quarterly Federal Excise Tax Return. This form is used to report the luxury tax on passenger vehicles, environmental excise taxes, communications and air transportation taxes, fuel taxes, manufacturers taxes, ship passenger tax, and certain other excise taxes. Caution: The trust fund recovery penalty may apply if certain excise taxes that must be collected are not collected the Instructions for Form 720 for more details, including the definition of responsible person. Form 940 or Form 940-EZ.—Employer’s Annual Federal Unemployment (FUTA) Tax Return. The corporation. Use this form U.S. sources. See Special Rules for Foreign Corporations—Source Rules. Also, corporation’s trade or business for any calendar year. Forms 1099-A, B, C, DIV, INT, MISC, R, and S.—These information returns are used to report certain payments, such as dividends and interest. For more information, see the Instructions for Forms 1099, 1098, 5498, and W-2G and Pub. 937, Employment Taxes. Form 5713.—International Boycott Report, for persons having operations in or related to “boycotting” countries. Also, persons who participate in or cooperate with an international boycott may have to complete Schedule A or Schedule B and Schedule C of Form 5713 to compute their loss of the foreign tax credit, the deferral of earnings of a controlled foreign corporation, DISC benefits, and FSC benefits. Form 8264.—Application for Registration of a Tax Shelter. This form is used by tax shelter organizers to register tax shelters with the IRS in order to receive a tax shelter registration number. Form 8271.—Investor Reporting of Tax Shelter Registration Number. This form is used by taxpayers who have acquired an interest in a tax shelter that is required to be registered to report the tax shelter’s registration number. Form 8271 must be attached to any tax return (including an application for tentative refund (Form 1139) and an amended return) on which a deduction, credit, loss, or other tax benefit from a tax shelter is taken or any income from a tax shelter is reported. Page 4 Form 8275.—Disclosure Statement. This form is used by taxpayers and income tax return preparers to disclose items or positions (except those contrary to a regulation. This form. Cashier’s checks (including treasurer’s checks and bank checks), bank drafts, and money orders with face amounts of $10,000 or less are considered cash under certain circumstances. For more information, see Form 8300 and Regulations section 1.6050I-1(c). Form 8594.—Asset Acquisition Statement Under Section 1060. This form must be filed by both the purchaser and seller of a group of assets that make up a trade or business if goodwill or a going concern value attaches, or could attach, to such assets and if the purchaser’s basis in the assets is determined only by the amount paid for the assets. Form 8621.—Return by a Shareholder of a Passive Foreign Investment Company or Qualified Electing Fund. A corporation that was a shareholder in a passive foreign investment company (as defined in section 1296) at any time during the tax year must complete and attach this form to its return.-capitalized cost method or the percentage of completion method. Form 8810.—Corporate Passive Activity Loss and Credit Limitations. Closely held corporations and personal service corporations that are subject to the passive activity limitations of section 469 use this form to compute their allowable passive activity loss and credit. Form 8833.—Treaty-Based Return Position Disclosure Under Section 6114 or 7701(b). Use this form to make the treaty-based return position disclosure required by section 6114. Also complete Item W at the bottom of page 5 of Form 1120-F. Form 8842.—Election To Use Different Annualization Periods for Corporate Estimated Tax. Corporations use this form for each year they want to elect one of the annualization periods in section 6655(e)(2)(C) for figuring estimated tax payments under the annualized income installment method. Form 8848.—Consent To Extend the Time To Assess the Branch Profits Tax Under Regulations Sections 1.884-2T(a) and (c). File this form if the foreign corporation has completely terminated all of its U.S. trade or business within the meaning of Regulations section 1.884-2T(a) during the tax year. Schedule PH (Form 1120).—U.S. Personal Holding Company Tax. See instructions for page 1, line 4 of Form 1120-F. ● The name(s) and address(es) of the U.S. withholding agent(s); ● The U.S. tax identification number of the U.S. withholding agent; ● The name in which the tax was withheld, if different from the name of the taxpayer claiming the refund; and ● If applicable, enough information to show that the taxpayer was entitled to a reduced tax rate under a treaty. Special Rules for Foreign Corporations Source. Exceptions.—The following types of interest income are treated as foreign source income: 1. Interest income received from foreign branches of U.S. banks and savings and loan associations. 2. Interest income received from a U.S. corporation or a resident alien individual, if 80% or more of the U.S. corporation’s (or resident alien individual’s) gross income is active foreign business income during the testing period. less than 3 years before the tax year of the payment, the testing period is the term of the payer’s existence before the current year. If the payment is made during the payer’s first tax year, that year is the testing period. 3. The interest allowable as a deduction to a foreign corporation (under Regulations section 1.882-5) in computing its effectively connected taxable income is treated as paid by a domestic corporation. This interest is treated as U.S. source interest, although the actual payer of the interest is a foreign corporation. For more details, see the instructions for Section III, Part II. Look-thru rule.—If the foreign corporation is a related person to a U.S. corporation or resident alien individual that meets the 80% rule described in 2 above, the foreign corporation will have foreign source income only when the income of the payer was from foreign sources. See section 861(c)(2)(B) for more information. Statements. Statements instead of schedules.—If the foreign corporation has no gross income for the tax year, do not complete the Form 1120-F schedules. Instead, attach a statement to the return showing the types and amounts of income excluded from gross income. Attachments Attach Form 4136, Credit for Federal Tax Paid on Fuels, after page 6, Form 1120-F. Attach schedules in alphabetical order and other forms in numerical order after Form 4136. To assist us in processing the return, complete every applicable entry space on Form 1120-F. Do not write “See attached” instead of completing the entry spaces. If more space is needed on the forms or schedules, attach separate sheets. Use the same size and format as on the printed forms. But show all totals on the printed forms. Attach these separate sheets after all the schedules and forms. Be sure to put the corporation’s name and employer identification number (EIN) on each sheet. Claim for Refund If a foreign corporation has only income that is not effectively connected with the conduct of a U.S. trade or business and Form 1120-F is being used as a claim for refund of tax paid or withheld at source, attach Form(s) 1042-S, 8805, 8288-A, etc., to the return to verify the amount(s) of withholding credit reported. Include all income from U.S. sources on the return, even though all tax due on it was paid or withheld at source. If the refund results from tax that was withheld at source, a statement from the payer/withholding agent (or from an intermediate nominee acting on the corporation’s behalf as the foreign recipient of the income) may be substituted for Form 1042-S. The statement should show: ● The amount(s) of tax withheld; Page 5 relating to U.S. corporation payers.—Dividends paid by a U.S. corporation are foreign source income: 1. If the U.S. corporation has made a valid election under section 936, relating to certain U.S. corporations operating in a U.S. possession, or 2. To the extent the dividends are from qualified export receipts described in section 993(a)(1) (other than interest and gains described in section 995(b)(1)). Exceptions relating to foreign corporation payers.—Dividends paid by a foreign corporation are U.S. source income: 1. If the dividend is treated under section 243(e) as a distribution from the accumulated profits of a predecessor U.S. corporation, or 2. To the extent the foreign corporation’s effectively connected gross income for the testing less property is located. Income From the Sale or Exchange of Personal Property Income from the sale of personal property by a foreign corporation is generally sourced under the following sections: ● Income from the purchase and sale of inventory property is generally sourced under sections 861(a)(6) and 862(a)(6); ● Income from the production and sale of inventory property is generally sourced under section 863(b)(2); ● Income from the sale of depreciable property is generally sourced under section 865(c); and ●. not yet available at the time the corporation is required to file its return. However, the corporation must show its 1995 tax year on the 1994 Form 1120-F and incorporate any tax law changes that are effective for tax years beginning after December 31, 1994. Address and Employer Identification Number (EIN) Address.—Include the suite, room, or other unit number after the street address. If a preaddressed label is used, please include this information on the label. If the Post Office does not deliver mail to the street address and the corporation has a P.O. box, show the box number instead of the street address. If the corporation’s address has changed from the last time Form 1120-F was filed, check the box at the top of page 1. Note: If a change in address occurs after the return is filed, use Form 8822, Change of Address, to notify the IRS of the new address. Employer identification number (EIN).— Show the corporation’s correct EIN. If the corporation does not have an EIN, it should apply for one on Form SS-4, Application for Employer Identification Number. Form SS-4 can be obtained at most IRS or Social Security Administration offices. If the corporation has not received its EIN by the time the return is due, write “Applied for” in the space for the EIN. See Pub. 583 for more information. Other Special Rules Basis of Property and Inventory Costs for Property Imported by a Related Person If property is imported into the United States by a related person in a transaction and the property has a customs value, the basis or inventory cost to the importer cannot exceed the customs value. For more information, see section 1059A. Income of Foreign Governments and International Organizations Income of foreign governments and international organizations from the following sources is generally not subject to taxation: ● Investments in the United States in stocks, bonds, or other domestic securities owned by such foreign government or international organization. ● Interest on deposits in banks in the United States of moneys belonging to such foreign government or international organization. ● Investments in the United States in financial instruments held (by a foreign government) in executing governmental financial or monetary policy. However, the types of income described in section 892(a)(2) that are received directly or indirectly from commercial activities are subject to tax. (They are also subject to withholding.) Computation of Tax Due or Overpayment Line 4. Personal Holding Company Tax If the corporation is a personal holding company (as defined in section 542) but not a foreign personal holding company, it must file Schedule PH (Form 1120) with Form 1120-F and report the personal holding company tax on line 4. See section 542 and Schedule PH (Form 1120) for details. Line estimated tax payment in the total amount entered on line 6b. Write “T” and the payment amount on the dotted line next to the entry space. Line 6g. Credit for Federal Tax on Fuels Complete Form 4136 if the corporation qualifies to take this credit. Attach Form 4136 after page 6 of Form 1120-F. Credit for ozone-depleting chemicals.— Include on line 6g any credit the corporation is claiming under section 4682(g)(4) for tax paid on ozone-depleting chemicals. Write “ODC” on the dotted line to the left of the entry space. Specific Instructions Period covered File the 1994 return for calendar year 1994 and fiscal years that begin in 1994 and end in 1995. For a fiscal year, fill in the tax year space at the top of the form. Note: The 1994 Form 1120-F may also be used if (1) the corporation has a tax year of less than 12 months that begins and ends in 1995 and (2) the 1995 Form 1120-F is Page 6 Line 6i. Total Payments Backup withholding.—If the corporation had income tax withheld from any payments it received, because, for example, it failed to give the payer its correct EIN, include the amount withheld in the total for line 6i. This type of withholding is called backup withholding. Show the amount withheld in the blank space in the right-hand column between lines 5 and 6i, and write “backup withholding.” Line 7. Estimated Tax Penalty A corporation that does not make estimated tax payments when due may be subject to an underpayment penalty for the period of underpayment. Generally, a corporation. Use Form 2220, Underpayment of Estimated Tax by Corporations, to see if the corporation owes a penalty and to figure the amount of the penalty. Generally, the corporation does not have to file this form because the IRS can figure any penalty and bill the corporation for it. However, complete and attach Form 2220 even if the corporation does not owe the penalty if any of the following apply: ● The annualized income or adjusted seasonal installment method is used. ● The corporation is a large corporation computing its first required installment based on the prior year’s tax. (See the Form 2220 instructions for the definition of a large corporation.) If you attach Form 2220, check the box on line 7 of Form 1120-F and enter any penalty on that line. Section I.—Certain Gains, Profits, and Income From U.S. Sources That Are NOT Effectively Connected With the Conduct of a Trade or Business in the United States Include in Section I amounts received by the foreign corporation that meet all of the following conditions: ● The amount received is fixed or determinable, annual or periodic (FDAP). This includes:. ● The amount received is includible in the gross income of the foreign corporation. Therefore, receipts that are excluded from gross income (e.g., interest income received on state and local bonds that is excluded from gross income under section 103) would not be included as income in Section I. ● The amount received is from U.S. sources (see Source Rules on page 5). ● The amount received is not effectively connected with the conduct of a U.S. trade or business. The amount received is generally not effectively connected if neither the asset-use test nor the business-activities test is met. See Section II. ● The amount received is not exempt from taxation. Therefore, receipts that are exempted by code (e.g., interest on deposits that are exempted by section 881(d)) would not be included as income in Section I. For more information, see section 881(a) and Regulations section 1.881-2. Note: A corporation created or organized in Guam, American Samoa, the Northern Mariana Islands, or the Virgin Islands will not be treated as a foreign corporation (for purposes of determining whether its income is taxable under section 881(a)) if it meets the rules of section 881(b). Line 9. Gross Transportation Income A tax of 4% is imposed on a foreign corporation’s U.S. source gross transportation income for the tax year. U.S. source gross transportation income generally is any gross income that is transportation income (defined below) if such income is treated as from U.S. sources (as explained below). However, U.S. source gross transportation income does not include income that is effectively connected with the conduct of a U.S. trade or business (as explained below) or income that is taxable in a possession of the United States under the provisions of the Internal Revenue Code as applied to that possession. Transportation income is any income from, or connected. Generally, 50% of all transportation income that is attributable to transportation that either begins or ends in the United States is treated as from U.S. sources. However, see section 863(c)(2)(B) for a special rule for personal service income. Transportation income of the corporation will not be treated as effectively connected income unless (a) the corporation has a fixed place of business in the United States involved in the earning of transportation income and (b) Be sure to complete all additional information on page 2 that applies to the corporation. Item O A personal service corporation is a corporation whose principal activity during the testing period for the tax year is performing personal services that are substantially performed by employeeowners who own more than 10% of the fair market value of the corporation’s outstanding stock as of the last day of the testing period for the tax year. The testing period for a tax year is generally the tax year preceding the tax year. The testing period for a new corporation in its first tax year is the period beginning on the first day of its first tax year and ending on the earlier of the last day of its first tax year or the last day of the calendar year in which the first tax year began. Personal service activities are those that involve performing services in the health, law, engineering, architecture, accounting, actuarial science, performing arts, or consulting fields (as defined in Temporary Regulations section 1.448-1T(e)). Page 7 Personal services are substantially performed by employee-owners if more than 20% of the corporation’s compensation cost for the testing period for performing the personal services is attributable to personal services performed by employee-owners. A person is considered to be an employee-owner if the person is an employee of the corporation on any day of the testing period and the person owns any outstanding stock of the corporation on any day of the testing period. Stock ownership is determined under the attribution rules of section 318 (except that “any” is substituted for “50%” in section 318(a)(2)(C)). For more details, see Temporary Regulations section 1.441-4T. Item P Enter any tax-exempt interest received or accrued in the space provided. Include any exempt-interest dividends received as a shareholder in a mutual fund or other regulated investment company. Item R Check this box if the corporation elects under section 172(b)(3) to forgo the carryback period for an NOL. If you check this box, do not attach the statement described in Temporary Regulations section 301.9100-12T(d). Item S Enter the net operating loss (NOL) carryover to the tax year from prior years, even if page 3, Section II, line 30a. Pub. 536 has a worksheet for figuring a corporation’s NOL carryover. Item T Check the “Yes” box if the corporation is a subsidiary in a parent-subsidiary controlled group. You must check the “Yes” box even if the corporation is a subsidiary member of one group and the parent corporation of another. Note: If the corporation is an “excluded member” of a controlled group (see section 1563(b)(2)), it is still considered a member of a controlled group for this purpose. A parent-subsidiary controlled group is the stock ownership above. Section II.—Income Effectively Connected With the Conduct of a Trade or Business in the United States Foreign Corporations Engaged in a U.S. Trade or Business These corporations are taxed on their effectively connected income using the same graduated tax rate schedule (see page 15) that applies to domestic corporations. Effectively connected income can be U.S. source or foreign source. U.S. Source Effectively Connected Income Fixed or determinable, annual or periodic (FDAP) items are generally effectively connected income (and are therefore includible in Section II) if one or both of the following tests is met. Asset-use test. The FDAP items are from assets used in, or held for use in, the conduct of the U.S. trade or business. For example, interest income earned on a trade or note receivable acquired in the conduct of the U.S. trade or business would be effectively connected income. Also, interest income earned from the temporary investment of funds needed in the foreign corporation’s U.S. trade or business would be effectively connected income. Business-activities test. The activities of the U.S. trade or business were a material factor in the realization of the FDAP items. If neither test is met, FDAP items are generally not effectively connected income (and are therefore includible in Section I instead of Section II). For more information, see section 864(c)(2) and Regulations section 1.864-4(c), and the examples therein. U.S. source income other than FDAP items is effectively connected income. Foreign Source Effectively Connected Income Foreign source income is generally not effectively connected income. However, if the foreign corporation has an office or other fixed place of business in the United States, the following types of foreign source income it receives that are from that U.S. office are effectively connected income: ● Rents or royalties received for the use outside the United States of intangible personal property described in section 862(a)(4) if from the active conduct of a U.S. trade or business; ● Dividends or interest from foreign sources if from the active conduct of a U.S. banking, financing, or similar business, OR if the principal business of the foreign corporation is trading in stocks or securities for its own account; or ● Income derived from the sale or exchange of inventory outside the United States through the U.S. office, unless the property is sold or exchanged for use, consumption, or disposition outside the United States and an office of the foreign corporation in a foreign country participated materially in the sale. See section 864(c)(5)(A) and Regulations section 1.864-7. Exceptions.—Foreign source income that would otherwise be effectively connected income under any of the above rules for foreign source income is excluded if: 1. It is foreign source dividends, interest, or royalties paid by a foreign corporation in which the taxpayer owns or is considered to own (within the meaning of section 958) 50% or more of the total combined voting power of all classes of stock entitled to vote; or 2. The taxpayer is a controlled foreign corporation (as defined in section 957) and the foreign source income is subpart F income (as defined in section 952). For more information, see section 864(c)(4) and Regulations section 1.864-5. Foreign Corporations NOT Engaged in a U.S. Trade or Business These corporations will not report income in Section II unless they: ● Have current year income or gain from a sale or exchange of property or from performing services (or any other transaction) in any other tax year and that would have been effectively connected income in that other tax year (see section 864(c)(6)); ● Have current year income or gain from disposing of property that is no longer used or held for use in conducting a U.S. trade or business within the 10-year period before the disposition and that would have been effectively connected income immediately before such cessation (see section 864(c)(7)); ● Elect to treat real property income as effectively connected income (see below); ● Were created or organized and are conducting a banking business in a U.S. Page 8 possession, and receive interest on U.S. obligations that is not portfolio interest (see section 882(e)); or ● Have gain or loss from disposing of a U.S. real property interest (see below). Election to Treat Real Property Income as Effectively Connected Income A foreign corporation that receives, during the tax year, any income from real property located in the United States, or from any interest in such real property, may elect, for the tax year, to treat all such income as effectively connected income. Income to which this election applies includes: ● Gains from the sale or exchange of real property or an interest therein; ● Rents or royalties from mines, wells, or other natural deposits; and ●. This gain or loss must be figured on Schedule D (Form 1120), Capital Gains and Losses, and the result must be carried over to Section II, line 8, on page 3 of Form 1120-F. A foreign corporation may elect to be treated as a domestic corporation for purposes of sections 897 and 1445. See sections 897(i) and 882(d). See Temporary Regulations section 1.897-5T for the applicability of section 897 to reorganizations and liquidations. If the corporation had income tax withheld on Form 8288-A, Statement of Withholding on Dispositions by Foreign Persons of U.S. Real Property Interests, include the amount withheld in line 6h, page 1. Income Line 1. Gross Receipts.—Enter gross income that is effectively connected with the conduct of a U.S. trade or business except those income items that must be reported on lines 4 through 10. For reporting advance payments, see Regulations section 1.451-5. To report income from long-term contracts, see section 460. Generally, the installment method cannot be used for dealer dispositions of property. A dealer disposition is any disposition of personal property by a person who regularly sells or otherwise disposes of property of the same type on the installment plan. The disposition of property used or produced in the farming business is not included as a dealer disposition. See section 453(l) for details and exceptions. Enter on line 1 (and carry to line 3), the corporation’s income tax is increased by the interest payable under section 453(l)(3). To report this addition to the tax, see the instructions for Schedule J, line 9. Accrual basis taxpayers do not need to accrue certain amounts to be received from performing services that, on the basis of their experience, will not be collected (section 448(d)(5)). This provision does not apply to any amount if interest is required to be paid on that amount or if there is any penalty for failure to timely pay that amount. Corporations. Line 2. Cost of goods sold.—See instructions for Schedule A. Enter the amount from line 8 of Schedule A. Line 4. Dividends.—See instructions for Schedule C. Enter the amount from line 14 of Schedule C. Line 5. Interest.—Enter taxable interest on U.S. obligations and on loans, notes, mortgages, bonds, bank deposits, corporate bonds, tax refunds, etc. Do not offset interest expense against interest income. Line 6. Gross rents.—Enter the gross amount received for the rent of property. Deduct expenses such as repairs, interest, taxes, and depreciation on the proper lines for deductions. A rental activity held by a closely held corporation or a personal service corporation may be subject to the passive activity loss rules. See Form 8810 and the related instructions. Line 8. Capital gain net income.—Every sale or exchange of a capital asset must be reported in detail on Schedule D (Form 1120), Capital Gains and Losses, even though no gain or loss is indicated. In computing the adjustments to the accumulated earnings tax under section 535(b)(6), foreign corporations must only include capital gains and losses that are effectively connected with a U.S. trade or business.: ● Any adjustment under section 481(a) required to be included in income during the current tax year due to a change in a method of accounting. ● Recoveries of bad debts deducted in prior years under the specific charge-off method. ● The credit for alcohol used as fuel (determined regardless of the limitation based on tax) that was entered on Form 6478, Credit for Alcohol Used as Fuel. ● Refunds of taxes deducted in prior years if they reduced income subject to tax in the year deducted (see section 111). Do not offset current year taxes against tax refunds. ● Any deduction previously taken under section 179A that is subject to recapture. The corporation must recapture the benefit of any allowable deduction for qualified clean-fuel vehicle property (or clean-fuel vehicle refueling property), if, within 3 years of the date the property was placed in service, the property ceases to qualify. See Pub. 535 for details, including how to figure the recapture. Deductions In computing the taxable income of a foreign corporation engaged in a U.S. trade or business, deductions are allowed only if they are connected with income that is effectively connected with the conduct of a trade or business in the United States. Charitable contributions, however, may be deducted whether or not they are so connected. See section 882(c) and Regulations section 1.882-4(b) for more. Page 9 Attach a schedule showing each class of gross income, and the expenses directly allocable to each class. For expenses that are not directly allocable to a class of gross income, show the computation of the expense allocated to each class. Limitations on Deductions Section 263A uniform capitalization rules.—These rules require corporations to capitalize or include in inventory certain costs incurred in producing real and tangible personal property held in inventory or held for sale in the ordinary course of business. Tangible personal property produced by a corporation includes a film, sound recording, video tape, book, or similar property. The rules also apply to personal property (tangible and intangible) acquired for resale. Corporations subject to these rules are required to capitalize not only direct costs but an allocable portion of most indirect costs (including taxes) that relate to the assets produced or acquired for resale. Interest expense paid or incurred during the production period must be capitalized and is governed by special rules. For more information, see Notice 88-99, 1988-2 C.B. 422. The uniform capitalization rules also apply to the production of property constructed or improved by a corporation for use in its corporation if substantial construction occurred before March 1, 1986. For inventory, some of the indirect costs that must be capitalized are administration expenses; taxes; depreciation; insurance; compensation paid to officers corporation. Current deductions may still be claimed for reasonable research and experimental costs under section 174, intangible drilling costs for oil and gas and geothermal property, and mining and exploration and development costs incurred in the conduct of a U.S. trade or business. Regulations section 1.263A-1(e)(3) specifies other indirect costs that may be currently deducted and those that must be capitalized with respect to production or resale activities. For more information,), 163(j), and 267 for limitations on deductions for unpaid interest and expenses. Section 291 limitations.—Corporations may be required to adjust deductions for depletion of iron ore and coal, intangible drilling and exploration and development costs, certain deductions for financial institutions, and the amortizable basis of pollution control facilities. See section 291 to determine the amount are required to be capitalized unless an election is made to amortize them over a period of 60 months. See section 195. Passive activity limitations.—Limitations on passive activity losses and credits under section 469 apply to closely held corporations (defined below) and personal service corporations as defined in Temporary Regulations section 1.441-4T. See the instructions for Item O. For this purpose, a corporation is a closely held corporation if at any time during the last half of the tax year more than 50% in value of its outstanding stock is owned, directly or indirectly, by or for not more than five individuals, and the corporation is not a personal service corporation. Certain organizations are treated as individuals for purposes of this test. (See section 542(a)(2).) For rules of determining stock ownership, see section 544 (as modified by section 465(a)(3)). Generally, there are two kinds of passive activities: trade or business activities in which the corporation did not materially participate (see Temporary Regulations section 1.469-1T(g)(3)) for the tax year, and rental activities regardless of its participation. For exceptions, see Form 8810. An activity is a trade or business activity if the activity involves the conduct of a trade or business (i.e., deductions from the activity would be allowable under section 162 if other limitations, such as the passive loss rules, did not apply), or the activity involves research and experimental costs that are deductible under section 174 (or would be deductible if the corporation chose to deduct rather than capitalize them), and the activity is not a rental activity. Corporations subject to the passive activity limitations must complete Form 8810 to compute their allowable passive activity loss and credit. Before completing Form 8810, see Temporary Regulations section 1.163-8T, which provides rules for allocating interest expense among activities. If a passive activity is also subject to the at-risk rules of section 465, the at-risk rules apply before the passive loss rules. For more information, see section 469, the related regulations, and Pub. 925, Passive Activity and At-Risk Rules. Reducing certain expenses for which credits are allowable.—For each of the credits listed below, the corporation must reduce the otherwise allowable deductions for expenses used to figure the credit by the amount of the current year credit: 1. The orphan drug credit. 2. The credit for increasing research activities. 3. The enhanced oil recovery credit. 4. The disabled access credit. 5. The jobs credit. 6. The employer credit for social security and Medicare taxes paid on tips. 7. The empowerment zone employment credit. 8. The Indian employment credit. If the corporation has any of these credits, be sure to figure each current year credit before figuring the deduction for expenses on which the credit is based. Line 12. Compensation of officers.— Enter deductible officers’ compensation on line 12 and complete Schedule E on page 4 if total receipts (line 1a, plus lines 4 through 10, of page 3) are $500,000 or more. Do not include compensation claimed elsewhere on the return, such as amounts included in cost of goods sold, elective contributions to a section 401(k) cash or deferred arrangement, or amounts contributed under a salary reduction SEP agreement. Include only the deductible part of officers’ compensation on Schedule E. (See Disallowance of deduction for employee compensation in excess of $1 million, below.) Complete Schedule E, line 1, columns (a) through (f), for all officers. The corporation determines who is an officer under the laws where incorporated. Disallowance of deduction for employee compensation in excess of $1 million.— Publicly held corporations may not deduct compensation to a “covered employee” to the extent that the compensation exceeds $1 million. Generally, a covered employee is: ● The chief executive officer of the corporation ; or ● Any benefit paid to an employee that is excluded from the employee’s income. The deduction limit does not apply to: ● Commissions based on individual performance; Page 10-1, C.B. 376. Line 13. Salaries and wages.—Enter the amount of total salaries and wages paid for the tax year, less the amount of any jobs credit from Form 5884, empowerment zone credit from Form 8844, and Indian employment credit from Form 8845. Do not include salaries and wages deductible elsewhere on the return, such as amounts included in cost of goods sold, elective contributions to a section 401(k) cash or deferred arrangement, or amounts contributed under a salary reduction SEP agreement. Caution: If the corporation provided taxable fringe benefits to its employees, such as personal use of a car, do not deduct as wages the amount allocated for depreciation and other expenses claimed on lines 20 and 27. Line 14. Repairs and maintenance.—. Line 15. Bad debts.—Enter the total debts that became worthless in whole or in part during the tax year. A small bank or thrift institution using the reserve method should attach a schedule showing how it arrived at the current year’s provision. Caution: A cash basis taxpayer may not claim a bad debt deduction unless the amount was previously included in income. Line 16. Rents.: And the vehicle’s fair market value on the first day of the lease exceeded: $14,900 $14,300 $13,700 $13,400 $12,800 Line 17. Taxes and licenses.—Enter taxes paid or accrued during the tax year, but do not include any of the following: 1. Federal income taxes (except the environmental tax under section 59A). 2. Foreign or U.S. possession income taxes if a tax credit is claimed (however, see the Instructions for Form 5735 for special rules for possession income taxes). 3. Taxes not imposed on the corporation. 4. Taxes, including state or local sales taxes, that are paid or incurred in acquiring or disposing of property (such taxes must be treated as a part of the cost of the acquired property or, for a disposition, as a reduction in the amount realized on the disposition). 5. Taxes assessed against local benefits that increase the value of the property assessed (such as for paving, etc.). 6. Taxes deducted elsewhere on the return, such as those reflected in cost of goods sold. See section 164(d) for apportionment of taxes on real property between seller and purchaser. If the corporation is liable for the environmental tax under section 59A, see Form 4626, Alternative Minimum Tax— Corporations, for computation of the environmental tax deduction. See section 906(b)(1) for rules concerning certain foreign taxes imposed on income from U.S. sources that may not be deducted or credited. Line 18. Interest.—See section 882(c) and Regulations section 1.882-5 for rules for interest deductions allowed to foreign corporations. Line 19. Charitable Contributions Enter contributions or gifts actually paid within the tax year to or for the use of charitable and governmental organizations described in section 170(c) and any unused contributions carried over from prior years. Note: This deduction is allowed for all contributions, whether or not connected with income that is effectively connected with the conduct of a trade or business in the United States (see section 882(c)(1)(B)). The total amount claimed may not exceed 10% of taxable income (Section II, line 31) computed without regard to the following: 1. Any deduction for contributions; 2. The special deductions on line 30b; 3. The deduction allowed under section 249; 4. Any net operating loss (NOL) carryback to the tax year under section 172; and 5. Any capital loss carryback to the tax year under section 1212(a)(1). Charitable contributions over the 10% limitation may not be deducted for the tax year but may be carried over to the next 5 tax years. The lease term began: After 12/31/93 After 12/31/92 but before 1/1/94 After 12/31/91 but before 1/1/93 After 12/31/90 but before 1/1/92 After 12/31/86 but before 1/1/91 If the lease term began after June 18, 1984, but before January 1, 1987, see Pub. 917, Business Use of a Car, to find out if the corporation has an inclusion amount. Also see Pub. 917 for instructions on figuring the inclusion amount. Special rules apply if the corporation has an NOL carryover to the tax year. In figuring the charitable contributions deduction for the tax year, the 10% limit is applied using the taxable income after the). Corporations on the accrual basis may elect to deduct contributions paid on or before the 15th day of the 3rd month after the end of the tax year if the contributions are authorized by the board of directors during the tax year. Attach to the return a declaration, signed by an officer, stating that the resolution authorizing the contributions was adopted by the board of directors during the tax year. Also attach a copy of the resolution. Substantiation requirements.—New substantiation rules apply for contributions of $250 or more. Generally, no deduction is allowed for any contributions of $250 or more unless the corporation obtains a written acknowledgement from the donee organization that shows the amount of cash contributed, describes any property contributed, and gives an estimate of the value of any goods or services provided in return for the contribution. The acknowledgement must be obtained by the due date (including extensions) of the corporation’s return, or if earlier, the date the return is filed. Do not attach the acknowledgement to the tax return, but keep it with the corporation’s records. These rules apply in addition to the filing requirements for Form 8283 described below. For more information on substantiation and recordkeeping, see the regulations under section 170 and Pub. 526, Charitable Contributions. Contributions of property other than cash.—If a corporation (other than a closely held or personal service corporation) contributes property other than cash and the deduction claimed for the property exceeds $500, the corporation must attach a schedule to the return describing the kind of property contributed and the method used to determine its fair market value. Closely held corporations and personal service corporations must complete Form 8283, Noncash Charitable Contributions, and attach it to Form 1120-F. All other corporations must generally complete and attach Form 8283 for contributions of property other than money if the total claimed deduction for all property contributed was more than $5,000. If the corporation made a “qualified conservation contribution” under section 170(h), also include the fair market value of the underlying property before and after the donation, as well as the type of legal interest contributed, and describe the conservation purpose furthered by the Page 11 donation. If a contribution carryover is included, show the amount and how it was determined. Special rule for contributions of certain property.—For a charitable contribution of property, reduce the contribution by the sum of: the long-term capital gain applies to: 1. Contributions of tangible personal property for use by an exempt organization for a purpose or function unrelated to the basis for its exemption, and 2. Contributions of any property (except stock for which market quotations are readily available—see section 170(e)(5)) to or for the use of certain private foundations. See section 170(e) and Regulations section 1.170A-4. For special rules for contributions of inventory and other property to certain organizations, see section 170(e)(3) and Regulations section 1.170A-4A. Charitable contributions of scientific property used for research.—A corporation (other than a personal holding company or a service organization) can receive a larger deduction for contributing scientific property used for research to an institution of higher education. For more details, see section 170(e). Contributions to organizations conducting lobbying activities.— Contributions made after 1993 to an organization that conducts lobbying activities are not deductible if: 1. The lobbying activities relate to matters of direct financial interest to the donor’s trade or business, and 2. The principal purpose of the contribution was to avoid Federal income tax by obtaining a deduction for activities that would have been nondeductible under the lobbying expense rules if conducted directly by the donor. Line 20. Depreciation.—In addition to depreciation, include on line 20 the part of the cost that the corporation elected to expense under section 179 for certain tangible property placed in service during tax year 1994, or carried over from 1993. See Form 4562, Depreciation and Amortization, and its instructions. Line 23. Depletion.—See sections 613 and 613A for percentage depletion rates applicable to natural deposits. Also, see section 291 for the limitation on the depletion deduction for iron ore and coal (including lignite). Foreign intangible drilling costs and foreign exploration and development costs must either be added to the corporation’s basis for cost depletion purposes or be deducted ratably over a 10-year period. See sections 263(i), 616, and 617 for details. Attach Form T (Timber), Forest Industries Schedules, if a deduction for depletion of timber is claimed. Line 25. Pension, Profit-sharing, etc., Plans Enter the amount of contributions to qualified pension, profit-sharing, or other funded deferred compensation plans. Employers who maintain any such. For more information, see sections 6652(e) and 6662(f). Form 5500.—Complete this form for each plan with 100 or more participants. Form 5500-C/R.—Complete this form for each plan with fewer than 100 participants. Form 5500-EZ.—Complete this form for a one-participant plan. A one-participant plan includes plans that cover the owners and their spouses and plans that cover partners in a business partnership (or the partners and their spouses). Line 26. Employee benefit programs.— Enter contributions to employee benefit programs not claimed elsewhere on the return (e.g., insurance, health, and welfare programs) that are not an incidental part of a pension, profit-sharing, etc., plan included on line 25. Line 27. Other Deductions Note: Do not deduct fines and penalties paid to a government for violating any law. Attach a schedule, listing by type and amount, all allowable deductions that are not deductible elsewhere on Form 1120-F. Include on this line the deduction for amortization of pollution control facilities, organization expenses, etc. See Form 4562. A corporation may deduct dividends it pays in cash on stock held by an employee stock ownership plan. However, a deduction may only be taken if, according to the plan, the dividends are: ● Paid in cash directly to the plan participants or beneficiaries; ● Paid to the plan, which distributes them in cash to the plan participants or their beneficiaries, no later than 90 days after the end of the plan year in which the dividends are paid; or ● Used to make payments on a loan described in section 404(a)(9). See section 404(k) for more details and the limitation on certain dividends. Generally, a deduction may not be taken for any amount that is allocable to a class of exempt income. See section 265(b) for exceptions. Meals, travel, and entertainment.— Generally, the corporation. It cannot, however, deduct an expense paid or incurred for a facility (such as a yacht or hunting lodge) that is used for an activity that is usually considered amusement, entertainment, after June 30, 1993. For more information, see Pub. 535. Lobbying expenses.. However, if certain in-house expenditures do not exceed $2,000, they are deductible. Dues and other similar amounts paid to certain tax-exempt organizations may not be deductible. See section 162(e) and Temporary Regulations section 1.162-2OT(d). For information on Page 12 contributions to charitable organizations that conduct lobbying activities, see the instructions for line 19. For more information on lobbying expenses, see section 162(e). Line 29. Taxable Income Before NOL Deduction and Special Deductions At-risk rules.—Special at-risk rules under section 465 generally apply to closely held corporations (defined under Passive activity limitations on page 10) engaged in any activity as a trade or business, or for the production of income. These corporations may have to adjust the amount on line 29. However, the at-risk rules do not apply to: (a) holding real property placed in service by the taxpayer before 1987; (b) equipment leasing under sections 465(c)(4), (5), and (6); and (c) any qualifying business of a qualified corporation described in section 465(c)(7). However, the at-risk rules do apply to holding net operating loss (NOL) incurred by a corporation in one tax year may be used to reduce the corporation’s taxable income in another year. Generally, a corporation may carry an NOL back to each of the 3 years preceding the year of the loss and then carry any remaining amount over to each of the 15 years following the year of the loss (but see Exceptions to carryback rules below). Enter on line 30a the total NOL carryovers from prior tax years, but do not enter more than the corporation’s taxable income (after special deductions). An NOL deduction cannot be taken in a year in which the corporation has a negative taxable income. Attach a schedule showing the computation of the NOL deduction. Also complete Item S at the bottom of page 2 of the form. For more information about NOLs and the NOL deduction, get Pub. 536, Net Operating Losses. Carryback and carryover rules.— Generally, an NOL first must be carried back to the third tax year preceding the year of the loss. To carry back the loss and obtain a refund of taxes, use Form 1139, Corporation Application for Tentative Refund. Form 1139 must be filed within 12 months after the close of the tax year of the loss. See section 6411 for details. Do not attach Form 1139 to the corporation’s income tax return. Mail it in a separate envelope to the service center where the corporation files its income tax return. For carryback claims filed later than 12 months after the close of the tax year of the loss, file an amended Form 1120-F instead of Form 1139. After the corporationacquistion losses of one corporation to offset recognized built-in gains of another corporation. Exceptions to carryback rules.—A corporation may make an irrevocable election to forego the carryback period and instead carry the NOL over to each of the 15 years following the year of the loss. To make this election, check the box in Item R at the bottom of page 2 of the form. The return must be timely filed (including extensions). Different carryback periods apply for certain losses. The part of an NOL that is from a specified liability loss, including a product liability loss, may be carried back 10 years (section 172(b)(1)(C)). See Regulations section 1.172-13(c) for the statement that must be attached to Form 1120-F if the corporation is claiming the 10-year carryback period for a product liability loss. Special rules apply to the carryback of losses that are from interest paid for corporate equity reduction transactions (CERTs). The rules apply if a corporation has a corporate equity reduction interest loss in a loss limitation year ending after August 2, 1989. See section 172(b)(1)(E). Personal service corporations may not carry back an NOL to or from any tax year to which a section 444 election applies. Line 30b. Special deductions.—See the instructions for Schedule C. Schedule A—Cost of Goods Sold See Section 263A uniform capitalization rules on page 10 before completing Schedule A. Note: If inventories are not an income-determining factor, enter zero on lines 1 and 7 of Schedule A. Line 4. Additional section 263A costs.— that are now required to be capitalized under section 263A. For more details, see Regulations section 1.263A-2(b). For corporations that have elected the simplified resale method, additional section 263A costs are generally those costs incurred for the following categories: off-site storage or warehousing; purchasing; handling, processing, assembly, and repackaging; and general and administrative costs (mixed service costs). For more details, see Regulations section 1.263A-3(d). Enter on line 4 the balance of section 263A costs paid or incurred during the tax. Line 9a. Inventory valuation methods.— Inventories can be valued at (a) cost, (b) cost or market value (whichever is lower), or (c) any other method approved by the IRS that conforms to the provisions of the applicable regulations cited below. Corporations that use erroneous valuation methods must change to a method permitted for Federal income tax purposes. To make this change, use Form 3115. a current bona fide Page 13 corporation changed or extended its inventory method to LIFO and had to write up its opening inventory to cost in the year of election, report the effect of this write up as income (Section II, line 10 on page 3) proportionately over a 3-year period that begins with the year of the LIFO election (see section 472(d)). For more information on inventory valuation methods, see Pub. 538, Accounting Periods and Methods. corporation acquired by incurring a debt (e.g., it borrowed money to buy the stock). Include on line 3 dividends received from a regulated investment company (RIC) on debt-financed stock. The amount of dividends eligible for the dividends-received deduction is limited by section 854(b). The corporation that shows corporation that follows. However, in a year in which an NOL occurs, this limitation does not apply even if the loss is created Schedule C—Dividends and Special Deductions For purposes of the 20% ownership test on lines 1 through 7, the percentage of stock owned by the corporation is based on voting power). Include on this line taxable distributions from an IC-DISC or former DISC that are designated as eligible for the 70% deduction and certain dividends of Federal Home Loan Banks. See section 246(a)(2). Also include on line qualifiy for the deduction. Report so-called dividends or earnings received from mutual savings banks, etc., as interest. Do not treat them as dividends. Line 2, Column (a) Enter dividends (except those received on debt-financed stock acquired after July 18, 1984) that are received from 20%-or-moreowned domestic corporations subject to income tax and that are subject to the 80% deduction under section 243(c). Include on this line taxable distributions from an IC-DISC or former DISC that are considered eligible for the 80% deduction. by the dividends-received deduction. See sections 172(d) and 246(b). Certain financial institutions to which section 593(a) applies should see section 596 for the special limitation on the dividends-received deduction. 1. Refigure Section II, line 29 received from 20%-or-moreowned corporations 4. Enter the smaller of line 2 or line 3. If line 3 is greater than line 2, stop here; enter the amount from line 4 on line 8, column (c), and do not complete the rest of this worksheet 5. Enter the total amount of dividends received from 20%or-more-owned corporations that are included on lines 2, 3, 5, and 7, column (a) 6. Subtract line 5 from line 1 7. Multiply line 6 by 70% 8. Subtract line 3 above from line 8, column (c) 9. Enter the smaller of line 7 or line 8 10. Dividends-received deduction after limitation (sec. 246(b)). Add lines 4 and 9. Enter the result here and on line 8, column (c) Line 9, Column (a) Enter all other dividends received from foreign corporations that are not reportable on lines 3, 6, or 7 of column (a). Also include on line 9 the corporation’s share of the ordinary earnings of a qualified electing fund from Form 8621, line 6c, or the amount of any excess distributions from a passive foreign investment company from Form 8621, line 11b. Exclude distributions constructively taxed in the current year or in prior years under subpart F (sections 951 through 964). Line 10, Column (a) If the corporation claims the foreign tax credit, enter the tax that is deemed paid under sections 902 and 960. See sections 78 and 906(b)(4). Line 11, Column (a): 1. Is paid out of the corporation’s accumulated IC-DISC income or previously taxed income, or Page 14 2. Is a deemed distribution under section 995(b)(1). Line 12, Column (a) Include the following: ● Dividends (other than capital gain dividends and exempt-interest dividends) that are received from regulated investment companies and that are not subject to the 70% deduction. ● Dividends from tax-exempt organizations. ● Dividends (other than capital gain dividends) received from a real estate investment trust that qualifies, for the tax year of the trust in which the dividends are paid, under sections 856 through 860. ● Dividends not eligible for a dividendsreceived deduction because of the holding period of the stock or an obligation to make corresponding payments for similar stock. Two situations in which the dividendsreceived deduction will not be allowed on any share of stock are: 1. If the corporation held it 45 days or less (see section 246(c)(1)(A)), or 2. To the extent the corporation is under an obligation to make related payments for substantially similar or related property. ● Any other taxable dividend income not properly reported above (including distributions under section 936(h)(4)). If patronage dividends or per-unit retain allocations are included on line 12, identify the total of these amounts in a schedule and attach it to Form 1120-F. Line 13, Column (c) Section 247 allows public utilities a deduction of 40% of the smaller of: 1. Dividends paid on their preferred stock during the tax year, or 2. Taxable income computed without regard to this deduction. In a year in which an NOL occurs, compute the deduction without regard to section 247(a)(1)(B). See section 172(d). Schedule J—Tax Computation Lines 1 and 2 Members of a Controlled Group Members of a controlled group (as defined in section 1563) must check the box on line 1 and complete lines 2a and 2b of Schedule J. They. Equal apportionment plan.—If no apportionment plan is adopted, the members of the controlled group must divide the amount in each taxable income bracket equally among themselves. Example. Controlled group AB consists of corporation A and corporation B. They do not elect an apportionment plan. Therefore, both corporation A and corporation B are entitled to $25,000 (one-half of $50,000) in the $50,000 taxable income bracket on line 2a(1), $12,500 (one-half of $25,000) in the $25,000 taxable income bracket on line 2a(2), and $4,962,500 (one-half of $9,925,000) in the $9,925,000 taxable income bracket on line 2a(3). Unequal apportionment plan.—Members of a controlled group may elect an unequal apportionment plan and divide the taxable income bracket amounts as they wish. There is no need for consistency between taxable income brackets. Any member of the controlled group may be entitled to all, some, or none of the taxable income bracket. However, the total amount for all members of the controlled group cannot be more than the total amount in each taxable income bracket. Each member of a controlled group must compute its tax as follows (except qualified personal service corporations): 1. Enter taxable income (Section II, line 31)’s share of the $9,925,000 taxable income bracket, whichever is less 7. Subtract line 6 from line 5 8. Multiply line 2 by 15% 9. Multiply line 4 by 25% 10. Multiply line 6 by 34% 11. Multiply line 7 by 35% 12. If the taxable income of the controlled group exceeds $100,000, enter this member’s share of the smaller of (a) 5% of the excess over $100,000, or (b) $11,750. (See Additional 5% tax below.) 13. If the taxable income of the controlled group exceeds $15 million, enter this member’s share of the smaller of 3% of the taxable income in excess of $15 million, or $100,000 (See Additional 3% tax below.) 14. Add lines 8 through 13. Enter here and on line 3, Schedule J Additional 5% tax.—Members of a controlled group are treated as one corporation in figuring the applicability of tax was figured. Additional 3% tax.—Members of a controlled group are treated as one corporation was figured. Line 3. Income Tax A corporation that is not a qualified personal service corporation or a member of a controlled group must compute its tax on its taxable income as follows: Tax Rate Schedule If its taxable income (Section II, line 31) is: But not over— Of the amount over— Over— Its tax is: $0 $50,000 50,000 75,000 75,000 100,000 100,000 335,000 335,000 10,000,000 10,000,000 15,000,000 15,000,000 18,333,333 18,333,333 ----- $7,500 13,750 22,250 113,900 3,400,000 5,150,000 + + + + + + 15% $0 25% 50,000 34% 75,000 39% 100,000 34% 335,000 35% 10,000,000 38% 15,000,000 35% 0 A qualified personal service corporation is taxed at a flat rate of 35% on its taxable income. A corporation is a qualified personal service corporation if it meets BOTH of the following tests: ● Substantially all of its activities involve performing services in the fields of health, law, engineering, architecture, accounting, actuarial science, performing arts, or consulting, and ● At least 95% of its stock, by value, is owned, directly or indirectly, by (1) employees performing the services, (2) retired employees who had performed the services listed above, (3) any estate of an employee or retiree described above, or (4) any person who acquired the stock of the corporation because of the death of an employee or retiree (but only for the 2-year period beginning on the date of the employee’s or retiree’s death). See Temporary Regulations section 1.448-1T(e) for details. Note: If the corporation meets these tests, check the box on line 3, Schedule J. Additional tax under section 197(f).—A corporation that elects to pay tax on the Page 15a. Foreign Tax Credit A foreign corporation engaged in a U.S. trade or business during the tax year can, for additional information. Line 4b. Orphan drug credit.—To find out when a corporation can take this credit and how it is figured, see section 28 and Form 6765, Credit for Increasing Research Activities (or for claiming the orphan drug credit). Line 4c Complete line 4c if the corporation to the return showing the computation of the credit. Also see Form 8827 if any of the 1993 credit was disallowed solely because of the tentative minimum tax limitation. See section 53(d). Qualified electric vehicle credit.—Include on line 4c any credit from Form 8834, Qualified Electric Vehicle Credit. Vehicles that qualify for this credit are not eligible for the deduction for clean-fuel vehicles under section 179A. Line 4d. General Business Credit Complete this line if the corporation can take any of the following credits. Complete Form 3800, General Business Credit, if the corporation has two or more of these credits, a credit carryforward or carryback (including an ESOP credit), or a passive activity credit. Enter the amount of the general business credit on line 4d and check the box for Form 3800. If the corporation has only one credit, enter on line 4d the amount of the credit from the form. Also be sure to check the appropriate box for that form. Investment credit. This credit was generally repealed for property placed in service after 1985. See Form 3468, Investment Credit, for exceptions. Jobs credit. The corporation may qualify to take this credit if it hired members of special targeted groups during the tax year. See Form 5884, Jobs Credit, for more information. Credit for alcohol used as fuel. A corporation may be able to take a credit for alcohol used as fuel. Use Form 6478, Credit for Alcohol Used as Fuel, to figure the credit. Credit for increasing research activities. See Form 6765, Credit for Increasing Research Activities, and section 41. Low-income housing credit. See Form 8586, Low-Income Housing Credit, and section 42. Enhanced oil recovery credit. A corporation may claim a credit for 15% of its qualified enhanced oil recovery costs. Use Form 8830, Enhanced Oil Recovery Credit, to figure the credit. Disabled access credit. A corporation may be able to take a credit for certain expenditures paid or incurred to assist individuals with disabilities. See Form 8826, Disabled Access Credit, and section 44. Renewable electricity production credit. A corporation may be able to take a credit for electricity produced by the corporation using closed-loop biomass or wind and sold to an unrelated person. See Form 8835, Renewable Electricity Production Credit, for details. Indian employment credit. A corporation may be able to claim a credit of 20% of a limited amount of the wages and health insurance costs paid or incurred by the corporation for qualified employees. A qualified employee is a member of an enrolled Indian tribe (or their spouse), who also meets certain other qualifications. See Form 8845, Indian Employment Credit, and section 45A. Credit for employer social security and Medicare taxes paid on certain employee tips. Food and beverage establishments may claim a credit equal to the employer’s social security and Medicare obligations attributable to tips in excess of those treated as wages for purposes of the minimum wage laws. See Form 8846, Credit for Employer Social Security and Medicare Taxes Paid on Certain Employee Tips, and section 45B. Credit for contributions to certain community development corporations. Corporations may claim a credit of 5% of qualified cash contributions to certain community development corporations (CDCs) selected by the Secretary of Housing and Urban Development. See Form 8847, Credit for Contributions to Selected Community Development Corporations. Note: The empowerment zone employment credit (described below), is a component of the general business credit, but is figured separately and is not carried to Form 3800. Empowerment zone employment credit. A corporation that has employees that live and work for the corporation in an area designated by the Federal government as an “empowerment zone” may be able to take a credit for wages paid to certain employees. The credit is equal to 20% of the first $15,000 of qualified wages and is limited to $3,000 per year per employee. See Form 8844, Empowerment Zone Employment Credit, and section 1396. Line 4e. Credit for Prior Year Minimum Tax To figure the minimum tax credit and any carryforward of the credit, use Form 8827, Credit for Prior Year Minimum Tax— Corporations. Line 7. Recapture Taxes Recapture of investment credit. If the corporation disposed of investment credit property or changed its use before the end of its useful life or recovery period, it may owe a tax. See Form 4255, Recapture of Investment Credit, for details. Recapture of low-income housing credit. If the corporation disposed of property (or there was a reduction in the qualified basis of the property) on which it took the low-income housing credit, it may owe a tax. See Form 8611, Recapture of Low-Income Housing Credit, and section 42(j) for details. Recapture of qualified electric vehicle (QEV) credit. The corporation must recapture part of the QEV credit it claimed in a prior year, if, within 3 years of the date the vehicle was placed in service, it ceases to qualify for the credit. Get Pub. 535 to see how to figure the recapture. Include the amount of the recapture in the total for line 7, Schedule J. by reason of wages paid or incurred to that employee must be recaptured. For details, see Form 8845 and section 45A. Include the amount of the recapture in the total for line 7, Schedule J. On the dotted line next to the entry space, write “IEC recapture” and the amount. Line 8a. Alternative Minimum Tax The corporation may owe the alternative minimum tax if it has any of the adjustments and tax preference items (including the adjusted current earnings adjustment) listed on Form 4626, Alternative Minimum Tax–Corporations. The corporation must file Form 4626 if its taxable income (loss) combined with these adjustments and tax preference items is more than the smaller of (a) $40,000 or (b) the corporation’s allowable exemption amount (from Form 4626). See Form 4626 for details. Reduce alternative minimum tax by the amount on Form 3800, Schedule A, line 34 (or Form 8844, line 20). On the dotted line to the left of the entry space on line 8a, write “Section 38(c)(3)” (or “EZE”) and the amounts. Line 8b. Environmental Tax The corporation may be liable for the environmental tax if its modified alternative minimum taxable income exceeds $2 million. See Form 4626 for details. Page 16 Line 9 Interest on tax attributable to payments received on installment sales of certain timeshares and residential lots. If the corporation elected to pay interest on the tax attributable to payments received on installment obligations from disposing of certain timeshares and residential lots under section 453(l)(3), it must include the interest due in the amount to be entered on line 9, Schedule J. In the margin below line 9, write “Section tax year, the corporation must include the interest due under section 453A(c) in the amount to be entered on line 9, Schedule J. Write in the margin below line 9, “Section 453A(c) interest” and the amount. Attach a schedule showing the computation. Interest under the look-back method for completed long-term contracts. Include the interest due under the look-back method of section 460(b)(2) on line 9, Schedule J. In the margin below line 9, write “From Form 8697” and the amount of interest due. corporation is exempt from such tax, skip Section III, Part I, but be sure to complete Items W and X at the bottom of page 5 of the form. Partnerships engaged in a U.S. trade or business.—A foreign corporate partner of a partnership engaged in a U.S. trade or business is subject to the branch profits tax on its ECEP attributable to its distributive share of effectively connected income. Foreign governments.—A foreign government is subject to both the branch profits tax and the branch-level interest taxes. However, no branch profits tax or branch-level interest taxes: 1. Positive adjustments for certain effectively connected income items that are excluded from ECTI but must be included in computing ECEP (such as tax-exempt interest income). 2. Positive adjustments for certain items deducted in computing ECTI but cannot be deducted in computing ECEP. Include adjustments for certain deductions claimed in computing ECTI, such as (a) excess of percentage depletion over cost depletion, (b) excess of accelerated depreciation over straight line depreciation (but only if 20% or more of the foreign corporation’s gross income from all sources is U.S. source), and (c) capital loss carrybacks and carryovers. 3. Negative adjustments for certain deductible items (that are allocable to effectively connected income) that cannot be deducted in computing ECTI but must be deducted in computing ECEP (such: 1. Income from the operation of ships or aircraft that is exempt from taxation under section 883(a)(1) or (2). 2. FSC income and distributions treated as effectively connected income under section 921(d) or section 926(b) that are not otherwise effectively connected income. 3. Gain on the disposition of an interest in a domestic corporation that is a U.S. real property interest under section 897(c)(1)(A)(ii) if the gain is not otherwise effectively connected income. 4. Related person insurance company income that a taxpayer elects to treat as effectively connected income under section 953(c)(3)(C) if the income is not otherwise effectively connected income. 5. Income that is exempt from tax under section 892. 6. in the event of a reorganization, liquidation, or incorporation.). In general, U.S. liabilities are U.S.-connected liabilities of a foreign corporation under Regulations section 1.882-5, computed as of the end of the tax year, rather than as an average, as required under Regulations section 1.882-5. Special rules may apply to foreign insurance companies. See Regulations section 1.884-1(e) for more details. Election to reduce liabilities.—If the corporation is electing to reduce liabilities according to Regulations section 1.884-1(e)(3), attach a statement that it is making the election and indicate the amount of the reduction of U.S. liabilities and the corresponding reduction in interest expense. Reporting requirements for schedules the instructions for Item X) in the tax year in which it has a Section III—Branch Profits Tax and Tax on Excess Interest Part I—Branch Profits Tax In general, section 884(a) imposes a 30% branch profits tax on the aftertax. Corporations exempt from the branch profits tax.—In general, a foreign corporation is exempt from the branch profits tax on its dividend equivalent amount if it is a qualified resident of a country listed in Regulations section 1.884-1(g)(3) for the year in which the dividend equivalent arises, if the income tax treaty with that country has not been modified on or after January 1, 1987. See the instructions for Item X for the definition of qualified resident. If the foreign Page 17 a foreign corporation must be a qualified resident. (See the instructions for Item.—In general, if a foreign corporation is subject to the branch profits tax in a tax year, it will not be subject to withholding at source (sections 871(a), 881(a), 1441, or 1442) on dividends paid out of earnings and profits for the tax year. the tax, and not simply subject to a reduced rate of tax, skip Section III, Part II, but be sure to complete Items W and X at the bottom of page 5 of the form. Line 8. Branch Interest Foreign banks.—In general, branch interest of a foreign bank is limited to (a) interest paid for branch liabilities that are reported to bank regulatory authorities; (b) interest paid for offshore shell branches, if the U.S. branch performs substantially all the activities required to incur the liability; and (c) interest on liabilities that are secured predominantly by U.S. assets or that cause certain nondeductible interest (such as capitalized interest) related to U.S. assets. All other foreign corporations.—In general, branch interest of foreign corporations (other than banks) includes (a) interest on liabilities shown on the books and records of the U.S. trade or business for purposes of Regulations section 1.882-5; (b) interest on liabilities that are secured predominantly by U.S. assets or that cause certain nondeductible interest (such as capitalized interest) related to U.S. assets; and (c) (c) if the liability is incurred in the ordinary course of the foreign corporation’s trade or business, or if the liability is secured predominantly by assets that are not U.S. assets. The interest on liabilities identified in (c) that will be treated as interest paid by the U.S. trade or business is capped at 85% of the interest of the foreign corporation that would be excess interest before considering interest on liabilities identified in (c). However, any interest included on line 7 as required under Regulations sections 1.1461-2 and 35a.9999-5. Caution: the instructions for line 6 above and Item X below. The corporation is exempt from the tax on excess interest if the rate of tax that would apply to interest paid to the foreign corporation by a wholly owned domestic corporation is zero and the foreign corporation qualifies for treaty benefits. Additional Information Required Be sure to complete all additional information on page 5 that applies to the corporation. Item X Definition of qualified resident.—A foreign corporation is a qualified resident of a country if it meets one of the three tests explained below. See the regulations under section 884 for detailed rules on these tests and certain circumstances in which a foreign corporation that does not meet these tests may obtain a ruling that it will be treated as a qualified resident. Two-part ownership and base erosion test. A foreign corporation meets this test if (1) more than 50% of its stock (by value) is owned (directly or indirectly) during at least half the number of days in the tax year by qualifying shareholders, and (2) less than 50% of its income is used (directly or indirectly) to meet liabilities to persons who are not residents of such foreign country or U.S. citizens or residents.). Corporations exempt from the tax on excess interest.—See the instructions for line 10 below to determine if the foreign corporation is exempt. If it is exempt from Page 18 1120-F for the tax year, obtain certain written documentation from the requisite number of its direct and indirect shareholders to show that it meets the test, including a certificate (a) the foreign corporation was a qualified resident for all tax years within the 36-month period that includes the tax year of the dividend equivalent amount, or the United States, or (2) 90% or more of its stock is owned (directly or indirectly) by another corporation that meets the requirements of (1)). 2. Stock in a mutual fund or other regulated investment company that distributed exempt-interest dividends during the tax year of the corporation. Schedule M-1 Reconciliation of Income or (Loss) per Books With Income per Return Line 5c. Travel and entertainment expenses.—Include the 50% disallowance under section 274(n)). ● The cost of skyboxes over the face value of nonluxury box seat tickets. ● The part of the cost of luxury water travel not allowed under section 274(m). ● Expenses for travel as a form of education. ● Other travel and entertainment expenses not allowed as a deduction. For more information, see Pub. 542. Line 7a. Tax-exempt interest.—Include any exempt-interest dividends received as a shareholder in a mutual fund or other regulated investment company. Schedules L, M-1, and M-2 A foreign corporation may limit Schedules L, M-1, and M-2 to: 1. The corporation’s U.S. assets and its other assets effectively connected with its U.S. trade or business and liabilities reported on its U.S. books and records; and 2. Its effectively connected income and its other U.S. source income. Do not complete Schedules M-1 and M-2 if total assets at the end of the tax year (line 15, column (d) of Schedule L) are less than $25,000. Schedule L—Balance Sheets Line 5. Tax-exempt securities.—Include: 1. State and local government obligations, the interest on which is excludible from gross income under section 103(a); and Page 19 page 1, under Question F, the code number for the specific industry group from which the largest percentage of total receipts is derived. “Total receipts” means gross receipts (line 1a, page 3) plus all other income (lines 4 through 10, page 3). Also, on page 1, under Question F, state the principal business activity and principal product or service that account for the largest percentage of total receipts. For example, if the principal business activity is “Grain mill products,” the principal product or service may be “Cereal preparations.” If, as its principal business activity, the corporation (1) purchases raw materials, (2) subcontracts out for labor to make a finished product from the raw materials, and (3) retains title to the goods, the corporation is considered to be a manufacturer and must enter one of the codes (2010 through 3998) under “Manufacturing.”. Holding and other investment companies, except bank holding companies: 6744 Small business investment companies. 6749 Other. Construction General building contractors and operative builders: 1510 General building contractors. 1531 Operative builders. 1600 Heavy construction contractors. Special trade contractors: 1711 Plumbing, heating, and air conditioning. 1731 Electrical work. 1798 Other special trade contractors. Misc.. Misc. retail stores: 5912 Drug stores and proprietary stores. 5921 Liquor stores. 5995 Other retail stores. Printed on recycled paper Page 20
https://www.scribd.com/document/544166/US-Internal-Revenue-Service-i1120f-1994
CC-MAIN-2018-26
refinedweb
16,461
54.22
I could use a raise…. Oh, arrays. Sorry. Arrays are an important aspect of any programming language, and Java is no exception. In this chapter, you discover just about everything you need to know about using arrays. I cover run-of-the-mill one-dimensional arrays, multi-dimensional arrays, and two classes that are used to work with arrays, named Array and Arrays.. For example, an int array can contain int values, and a String array can contain strings. The index number is written after the variable name and enclosed in brackets. So, if the variable name is x, you could access a specific element with an expression like x. You see plenty of examples of index variables throughout this chapter. Here are a few additional tidbits of array information to ponder before you get into the details of creating and using arrays: Before you can create an array, you must first declare a variable that refers to the array. This variable declaration should indicate the type of elements that are stored by the array followed by a set of empty brackets, like this: String[] names; Here a variable named names is declared. Its type is an array of String objects. Both of these statements have exactly the same effect. Most Java programmers prefer to put the brackets on the type rather than the variable name. By itself, that statement doesn't create an array. It merely declares a variable that can refer to an array. You can actually create the array in two ways: String[] names; names = new String[10]; Here, an array of String objects that can hold ten strings is created. Each of the strings in this array are initialized to an empty string. String[] names = new String[10]; Here, the array variable is declared, and an array is created in one statement. One way to initialize the values in an array is to simply assign them one by one: String[] days = new Array[7]; Days[0] = "Sunday"; Days[1] = "Monday"; Days[2] = "Tuesday"; Days[3] = "Wednesday"; Days[4] = "Thursday"; Days[5] = "Friday"; Days[6] = "Saturday"; Java has a shorthand way to create an array and initialize it with constant values: String[] days = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; Here each element to be assigned to the array is listed in an array initializer. Here's an example of an array initializer for an int array: int[] primes = { 2, 3, 5, 7, 11, 13, 17 }; An alternative way to code an initializer is like this: int[] primes = new int[] { 2, 3, 5, 7, 11, 13, 17 }; To use this type of initializer, you use the new keyword followed by the array type and a set of empty brackets. Then you code the initializer. One of the most common ways to process an array is with a for loop. In fact, for loops were invented specifically to deal with arrays. For example, here's a for loop that creates an array of 100 random numbers, with values from 1 to 100: int[] numbers = new int[100]; for (int i = 0; i < 100; i++) numbers[i] = (int)(Math.random() * 100) + 1; And here's a loop that fills an array of player names with strings entered by the user: String[] players = new String[count]; for (int i = 0; i < count; i++) { System.out.print("Enter player name: "); players[i] = sc.nextLine(); // sc is a Scanner } For this example, assume count is an int variable that holds the number of players to enter. You can also use a for loop to print the contents of an array. For example: for (int i = 0; i < count; i++) System.out.println(players[i]); Here the elements of a String array named players are printed to the console. The previous example assumes that the length of the array was stored in a variable before the loop was executed. If you don't have the array length handy, you can get it from the array's length property: for (int i = 0; i < players.length; i++) System.out.println(players[i]); Every once in awhile, an array and a for loop or two can help you solve your kids' homework problems for them. For example, I once helped my daughter solve a tough homework assignment for a seventh grade math class. The problem was stated something like this: Bobo (these problems always had a character named Bobo in them) visits the local high school on a Saturday and finds that all the school's 1,000 lockers are neatly closed. So he starts at one end of the school and opens them all. Then he goes back to the start and closes every other locker (lockers 2, 4, 6, and so on). Then he goes back to the start and hits every third locker: If it's open, he closes it. If it's closed, he opens it. Then he hits every fourth locker, every fifth locker, and so on. He keeps doing this all weekend long, walking the hallways opening and closing lockers 1,000 times. Then he gets bored and goes home. How many of the school's 1,000 lockers are left open, and which ones are they? Sheesh! This problem presented a challenge, and being the computer-nerd father I am, I figured this was the time to teach my daughter about for loops and arrays. So I wrote a little program that set up an array of 1,000 booleans. Each represented a locker: true meant open, false meant closed. Then I wrote a pair of nested for loops to do the calculation. My first attempt told me that 10,000 of the 1,000 lockers were opened, so I figured I had made a mistake somewhere. And while I was looking at it, I realized that the lockers were numbered 1 to 1,000, but the elements in my array were numbered 0 to 999, and that was part of what led to the confusion that caused my first answer to be ridiculous. So I decided to create the array with 1,001 elements and ignore the first one. That way the indexes corresponded nicely to the locker numbers. After a few hours of work, I came up with the program in Listing 2-1. Listing 2-1: The Classic Locker Problem Solved! public class BoboAndTheLockers { public static void main(String[] args) { // true = open; false = closed boolean[] lockers = new boolean[1001]; → 6 // close all the lockers for (int i = 1; i <= 1000; i++) → 9 lockers[i] = false; for (int skip = 1; skip <= 1000; skip++)→ 12 { System.out.println("Bobo is changing every " + skip + " lockers."); for (int locker = skip; locker < 1000; → 16 locker += skip) lockers[locker] = !lockers[locker]; → 18 } System.out.println("Bobo is bored" + " now so he's going home."); // count and list the open lockers String list = ""; int openCount = 0; for (int i = 1; i <= 1000; i++) → 27 if (lockers[i]) { openCount++; list += i + " "; } System.out.println("Bobo left " + openCount + " lockers open."); System.out.println("The open lockers are: " + list); } } Here are the highlights of how this program works: Open table as spreadsheet This program produces more than 1,000 lines of output. But only the last few lines are important. Here they are: Bobo is bored now so he's going home. Bobo left 31 lockers open. The open lockers are: 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 441 484 529 576 625 676 729 784 841 900 961 So there's the answer: 31 lockers are left open. I got an A. (I mean, my daughter got an A.) Java 1.5 introduced a new type of for loop called an enhanced for loop that's designed to simplify loops that process arrays and collections (which I cover in the next chapter). When used with an array, the enhanced for loop has this format: for (type identifier: array) { statements... } The type identifies the type of the elements in the array, and the identifier provides a name for a local variable that is used to access each element. And array names the array you want to process. Here's an example: String[] days = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; for (String day: days) { System.out.println(day); } This loop prints the following lines to the console: Sunday Monday Tuesday Wednesday Thursday Friday Saturday In other words, it prints each of the strings in the array on a separate line. You can write methods that accept arrays as parameters and return arrays as return values. You just use an empty set of brackets to indicate that the parameter type or return type is an array. For example,Array method as a parameter. The elements of an array can be any type of object you want, including another array. This is called a two-dimensional array or, sometimes, an array of arrays. Two-dimensional arrays are often used to track data in a column and row format, much the way a spreadsheet works. For example, suppose you're working on a program that tracks five years' worth of sales (2001 through 2005) for a company, with the data broken down for each of four sales territories (North, South, East, and West). You could create 20 separate variables, with names such as sales2001North, sales2001South, sales2001East, and so on. But that gets a little tedious. Alternatively, you could create an array with 20 elements, like this: double[] sales = new sales[20]; But then, how would you organize the data in this array so you know the year and sales region for each element? With a two-dimensional array, you can create an array with an element for each year. Each of those elements, in turn, is another array with an element for each region. Thinking of a two-dimensional array as a table or spreadsheet is common, like this: Open table as spreadsheet Here each row of the spreadsheet represents a year of sales, and each column represents one of the four sales regions. To declare a two-dimensional array for this sales data, you simply list two sets of empty brackets, like this: double sales[][]; Here sales is a two-dimensional array of type double. Or, to put it another way, sales is an array of double arrays. To actually create the array, you use the new keyword and provide lengths for each set of brackets, as in this example: sales = new double[5][4]; Here the first dimension specifies that the sales array has five elements. This array represents the rows in the table. The second dimension specifies that each of those elements has an array of type double with four elements. This array represents the columns in the table. Note that as with a one-dimensional array, you can declare and create a two-dimensional array in one statement, like this: double[][] sales = new double[5][4]; Here the sales array is declared and created all in one statement. To access the elements of a two-dimensional array, you use two indexes. For example, this statement sets the 2001 sales for the North region: sales[0][0] = 23853.0; As you might imagine, accessing the data in a two-dimensional array by hard-coding each index value can get tedious. No wonder for loops are normally used instead. For example, the following bit of code uses a for loop to print the contents of the sales array to the console, separated by tabs. Each year is printed on a separate line, with the year at the beginning of the line. In addition, a line of headings for the sales regions is printed before the sales data. Here's the code: NumberFormat cf = NumberFormat.getCurrencyInstance(); System.out.println(" North South East West"); int year = 2001; for (int y = 0; y < 5; y++) { System.out.print(year + " "); for (int region = 0; region < 4; region++) { System.out.print(cf.format(sales[y][region])); System.out.print(" "); } year++; System.out.println(); } Assuming the sales array has already been initialized, this code produces the following output on the console: North South East West 2001 $23,853.00 $22,838.00 $36,483.00 $31,352.00 2002 $25,483.00 $22,943.00 $38,274.00 $33,294.00 2003 $24,872.00 $23,049.00 $39,002.00 $36,888.00 2004 $28,492.00 $23,784.00 $42,374.00 $39,573.00 2005 $31,932.00 $23,732.00 $42,943.00 $41,734.00 Here the outer loop indexes the region, and the inner loop indexes the year. $23,853.00 $25,483.00 $24,872.00 $28,492.00 $31,932.00 $22,838.00 $22,943.00 $23,049.00 $23,784.00 $23,732.00 $36,483.00 $38,274.00 $39,002.00 $42,374.00 $42,943.00 $31,352.00 $33,294.00 $36,888.00 $39,573.00 $41,734.00 The technique for initializing arrays by coding the array element values in curly braces works for two-dimensional arrays too. You just have to remember that each element of the main array is actually another array. So, you have to nest the array initializers. Here's an example that initializes the sales array: double[][] sales = { {23853.0, 22838.0, 36483.0, 31352.0}, // 2001 {25483.0, 22943.0, 38274.0, 33294.0}, // 2002 {24872.0, 23049.0, 39002.0, 36888.0}, // 2003 {28492.0, 23784.0, 42374.0, 39573.0}, // 2004 {31932.0, 23732.0, 42943.0, 41734.0} }; // 2005 Here I added a comment to the end of each line to show the year the line initializes. Notice that the left brace for the entire initializer is at the beginning of the second line, and the right brace that closes the entire initializer is at the end of the last line. Then the initializer for each year is contained in its own set of braces. When you create an array with an expression such as new int[5][3], you're specifying that each element of the main array is actually an array of type int with three elements. However, Java lets you create two-dimensional arrays in which the length of each element of the main array is different. This is sometimes called a jagged array because the array doesn't form a nice rectangle. Instead, its edges are jagged. For example, suppose you need to keep track of four teams, each consisting of two or three people. The teams are as follows: Open table as spreadsheet The following code creates a jagged array for these teams: String[][] teams = { {"Henry Blake", "Johnny Mulcahy"}, {"Benjamin Pierce", "John McIntyre", "Jonathan Tuttle"}, {"Margaret Houlihan", "Frank Burns"}, {"Max Klinger", "Radar O'Reilly", "Igor Straminsky"} }; Here each nested array initializer indicates the number of strings for each subarray. For example, the first subarray has two strings, the second has three strings, and so on. You can use nested for loops to access the individual elements in a jagged array. For each element of the main array, you can use the length property to determine how many entries are in that element's subarray. For example: for (int i = 0; i < teams.length; i++) { for (int j = 0; j < teams[i].length; j++) System.out.println(teams[i][j]); System.out.println(); } Notice that the length of each subarray is determined with the expression teams[i].length. This for loop prints one name on each line, with a blank line between teams, like this: Margaret Houlihan Frank Burns Max Klinger Radar O'Reilly Igor Straminsky Henry Blake Johnny Mulcahy Benjamin Pierce John McIntyre Jonathan Tuttle If you don't want to fuss with keeping track of the indexes yourself, you can use an enhanced for loop and let Java take care of the indexes. For example: for (String[] team: teams) { for (String player: team) System.out.println(player); System.out.println(); } Here the first enhanced for statement specifies that the type for the team variable is String[]. As a result, each cycle of this loop sets team to one of the subarrays in the main teams array. Then the second enhanced for loop accesses the individual strings in each subarray. Here a three-dimensional array is created, with each dimension having three elements. You can think of this array as a cube. Each element requires three indexes to access. You can access an element in a multi-dimensional. For example,++; Okay, so much for the business examples. Here's an example that's more fun, at least if you think chess is fun. The program in Listing 2-2 uses a two-dimensional array to represent a chessboard. Its sole purpose is to figure out the possible moves for a knight (that's the horse for those of you in Rio Linda) given its starting position. The user is asked to enter a starting position (such as f1), and the program responds by displaying the possible squares. Then the program prints out a crude but recognizable representation of the board with the knight's position indicated with an X and his possible moves indicated with question marks. Figure 2-1: A classic chessboard. Here's a sample of what the console looks like if you enter e4 for the knight's position: Welcome to the Knight Move calculator. Enter knight's e4 The knight is at square e4 From here the knight can move to: c5 d6 f6 g5 g3 f2 d2 c3 - - - - - - - - - - - - - - - - - - - ? - ? - - - - ? - - - ? - - - - - X - - - - - ? - - - ? - - - - ? - ? - - - - - - - - - - Do it again? (Y or N) n As you can see, the program indicates that the knight's legal moves from e4 are c5, d6, f6, g5, g3, f2, d2, and c3. And the graphic representation of the board indicates where the knight is and where he can go. Listing 2-2: Playing Chess in a For DummiesBook? import java.util.Scanner; public class KnightMoves { static Scanner sc = new Scanner(System.in); // the following static array represents the 8 // possible moves a knight can make // this is an 8 x 2 array static int[][] moves = { {-2, +1}, → 10 {-1, +2}, {+1, +2}, {+2, +1}, {+2, -1}, {+1, -2}, {-1, -2}, {-2, -1} }; public static void main(String[] args) { System.out.println("Welcome to the " + "Knight Move calculator. "); do { showKnightMoves(); → 26 } while (getYorN("Do it again?")); } public static void showKnightMoves() → 31 { // The first dimension is the file (a, b, c, etc.) // The second dimension is the rank (1, 2, 3, etc.) // Thus, board[3][4] is square d5. // A value of 0 means the square is empty // 1 means the knight is in the square // 2 means the knight could move to the square int[][] board = new int[8][8]; → 39 String kSquare; // the knight's position as a square Pos kPos; // the knight's position as a Pos // get the knight's initial position do → 45 { System.out.print("Enter knight's position: "); kSquare = sc.nextLine(); kPos = convertSquareToPos(kSquare); } while (kPos == null); board[kPos.x][kPos.y] = 1; → 52 System.out.println(" The knight is at square " + convertPosToSquare(kPos)); System.out.println( "From here the knight can move to:"); for (int move = 0; move < moves.length; move ++) → 59 { int x, y; x = moves[move][0]; // the x for this move y = moves[move][1]; // the y for this move Pos p = calculateNewPos(kPos, x, y); if (p != null) { System.out.println(convertPosToSquare(p)); board[p.x][p.y] = 2; } } printBoard(board); → 72 } // this method converts squares such as a1 or d5 to // x, y coordinates such as [0][0] or [3][4] public static Pos convertSquareToPos(String square) → 78 { int x = -1; int y = -1; char rank, file; file = square.charAt(0); if (file == 'a') x = 0; if (file == 'b') x = 1; if (file == 'c') x = 2; if (file == 'd') x = 3; if (file == 'e') x = 4; if (file == 'f') x = 5; if (file == 'g') x = 6; if (file == 'h') x = 7; rank = square.charAt(1); if (rank == '1') y = 0; if (rank == '2') y = 1; if (rank == '3') y = 2; if (rank == '4') y = 3; if (rank == '5') y = 4; if (rank == '6') y = 5; if (rank == '7') y = 6; if (rank == '8') y = 7; if (x == -1 || y == -1) { return null; } else return new Pos(x, y); } // this method converts x, y coordinates such as // [0][0] or [3][4] to squares such as a1 or d5. public static String convertPosToSquare(Pos p) → 114 { String file = ""; if (p.x == 0) file = "a"; if (p.x == 1) file = "b"; if (p.x == 2) file = "c"; if (p.x == 3) file = "d"; if (p.x == 4) file = "e"; if (p.x == 5) file = "f"; if (p.x == 6) file = "g"; if (p.x == 7) file = "h"; return file + (p.y + 1); } // this method calculates a new Pos given a // starting Pos, an x move, and a y move // it returns null if the resulting move would // be off the board. public static Pos calculateNewPos(Pos p, int x, int y) → 134 { // rule out legal moves if (p.x + x < 0) return null; if (p.x + x > 7) return null; if (p.y + y < 0) return null; if (p.y + y > 7) return null; // return new position return new Pos(p.x + x, p.y + y); } public static void printBoard(int[][] b) → 150 { for (int y = 7; y >= 0; y--) { for (int x = 0; x < 8; x++) { if (b[x][y] == 1) System.out.print(" X "); else if (b[x][y] == 2) System.out.print(" ? "); else System.out.print(" - "); } System.out.println(); } } public static boolean getYorN(String prompt) → 167 { while (true) { String answer; System.out.print(" " + prompt + " (Y or N) "); answer = sc.nextLine(); if (answer.equalsIgnoreCase("Y")) return true; else if (answer.equalsIgnoreCase("N")) return false; } } } // this class represents x, y coordinates on the board class Pos → 183 { public int x; public int y; public Pos(int x, int y) { this.x = x; this.y = y; } } The final topic for this chapter is the Arrays class, which provides a collection of static methods that are useful for working with arrays. The Arrays class is in the java.util package, so you have to use an import statement for the java.util.Arrays class or the entire java.util.* package to use this class. Table 2-1 lists the most commonly used methods of the Arrays class. The fill method can be handy if you want to pre-fill an array with values other than the default values for the array type. For example, here's a routine that creates an array of integers and initializes each element to 100: int[] startValues = new int[10]; Arrays.fill(startValues, 100); For example, you might think you could fill an array of 1,000 integers with random numbers from 1 to 100 like this: int[] ran = new int[1000] Arrays.fill(ran, (int)(Math.random() * 100) + 1); Unfortunately, this won't work. What happens is that the expression is evaluated once to get a random number. Then all 1,000 elements in the array are set to that random number. In Java 1.6, the Arrays class has some useful new methods. Using the new copyOf and copyOfRange methods, you can copy a bunch of elements from an existing array into a brand-new array. For example, if you start with something named arrayOriginal, you can copy the arrayOriginal elements to something named arrayNew as shown in Listing 2-3. Listing 2-3: The Copycat import java.util.Arrays; class CopyDemo { public static void main(String args[]) { int arrayOriginal[] = {42, 55, 21}; int arrayNew[] = Arrays.copyOf(arrayOriginal, 3); →9 printIntArray(arrayNew); } static void printIntArray(int arrayNew[]) { for (int i : arrayNew) { System.out.print(i); System.out.print(' '); } System.out.println(); } } The output of the CopyDemo program looks like this: 42 55 21 For example, you do the following: int arrayNew[] = Arrays.copyOf(arrayOriginal, 2); If you do, then arrayNew has fewer than three elements: 42 55 You can also change the number 3 to something larger: int arrayNew[] = Arrays.copyOf(arrayOriginal, 8); Then arrayNew has more than three elements: 42 55 21 0 0 0 0 0 The copyOfRange method is even more versatile. For example, execute the following instructions int arrayOriginal[] = {42, 55, 21, 16, 100, 88}; int arrayNew[] = Arrays.copyOfRange(arrayOriginal, 2, 5); Then the values in arrayNew are 21 16 100 The sort method is a quick way to sort an array into sequence. For example, these statements create an array with 100 random numbers, and then sort the array into sequence so the random numbers are in order: int[] lotto = new int[6]; for (int i = 0; i < 6; i++) lotto[i] = (int)(Math.random() * 100) + 1; Arrays.sort(lotto); The binarySearch method is an efficient way to locate an item in an array by its value. For example, suppose you want to find out if your lucky number is in the lotto array created in the previous example. You could just use a for loop, like this: int lucky = 13; int foundAt = -1; for (int i = 0; i < lotto.length; i++) if (lotto[i] == lucky) foundAt = i; if (foundAt > -1) System.out.println("My number came up!"); else System.out.out.println("I'm not lucky today."); Here the for loop compares each element in the array with my lucky number. This works fine for small arrays, but what if the array had 1,000,000 elements instead of 6? In that case, it would take a while to look at each element. If the array is sorted into sequence, the binarySearch method can find your lucky number more efficiently and with less code: int lucky = 13; int foundAt = Arrays.binarySearch(lotto, lucky); if (foundAt > -1) System.out.println("My number came up!"); else System.out.println("I'm not lucky today."); If you use the equality operator (==) to compare array variables, the array variables are considered equal only if both variables point to the exact same array instance. To compare two arrays element by element, you should use the Arrays.equal method instead. For example: if (Arrays.equal(array1, array2)) System.out.println("The arrays are equal!"); Here the two arrays array1 and array2 are compared element by element. If both arrays have the same number of elements and each element has the same value, the equals method returns true. If any of the elements are not equal, or if one array has more elements than the other, the equals method returns false. The toString method of the Arrays class is handy if you want to quickly dump the contents of an array to the console to see what it contains. This method returns a string that shows the array's elements enclosed in brackets, with the elements separated by commas. For example, here's a routine that creates an array, fills it with random numbers, and then uses the toString method to print the array elements: int[] lotto = new int[6]; for (int i = 0; i < 6; i++) lotto[i] = (int)(Math.random() * 100) + 1; System.out.println(Arrays.toString(lotto)); Here's a sample of the console output created by this code: [4, 90, 65, 84, 99, 81] Note that the toString method works only for one-dimensional arrays. To print the contents of a two-dimensional array with the toString method, use a for loop to call the toString method for each subarray. Book I - Java Basics Book II - Programming Basics Book III - Object-Oriented Programming Book IV - Strings, Arrays, and Collections Book V - Programming Techniques Book VI - Swing Book VII - Web Programming Book VIII - Files and Databases Book IX - Fun and Games
https://flylib.com/books/en/2.706.1/using_arrays.html
CC-MAIN-2021-31
refinedweb
4,613
71.75
Unless you’ve been living under a rock these last few years, you’ll have heard of Go (sometimes referred to as Golang), a language originating from Google, some years ago. …an open source programming language that makes it easy to build simple, reliable, and efficient software. Quoting another source, Go is a statically-typed language with syntax loosely derived from that of C, adding automatic memory management, type safety, some dynamic-typing capabilities, additional built-in types such as variable-length arrays and key-value maps, and a large standard library. Available for most modern operating systems, including Mac OS X, Linux, BSD and Microsoft Windows, it was conceived and initially created at Google, back in 2007, by Robert Griesemer, Rob Pike, and Ken Thompson. Each of these three developers have quite impressive pedigrees. Robert Griesemer was involved in Google’s V8 JavaScript engine and the Java HotSpot virtual machine; Rob Pike and Ken Thompson both worked at Bell Labs implementing the original UNIX operating system. Most programming languages, especially one with such a strong C heritage, can be difficult to get started with. Go on the other hand, is quite the opposite. And in today’s tutorial, I’m going to show you how to get started developing with Google Go, right from installation to a running application. Go Installation Whether you’re on Mac OS X, Linux and FreeBSD, or Windows, Go is easy to install and configure. I’m assuming in this tutorial that you have a UNIX/Linux operating system. When I first installed Go, being on a Mac, I used the latest package file. But you can just as easily install, from source, using the following commands: tar -C /usr/local -xzf go1.2.1.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin If you’re not familiar, these will extract a copy of the go files, from go1.2.1.linux-amd64.tar.gz, to /usr/local/go in your filesystem, and add the bin directory within it to your profile path. Alternatively, if you’re on Windows, download and run the MSI Installer. When the installer’s complete, you’ll find the installed files under c:\Go; and the installer should have added c:\Go\bin to your PATH environment variable. You may want to check, just to be sure though. Configuring Your Environment With that done, we have the binaries required to begin. But we need to ensure that our environment’s also ready, which requires one more step and a bit of background. Go development uses the concept of a workspace, which contains the source files (src), compiled binary files (bin) and packages (pkg). The source file directory structure, generally, models open source code repositories, such as Github. So a typical source directory could look as follows: src github.com settermjd sitepoint hello-world.go You can see that under src, I’ve linked to my Github repository, called sitepoint, and in it is one file, hello-world.go. I could have multiple repositories, and link to multiple hosts, including Bitbucket and Codebase. By taking this approach, I believe that Go inherently keeps code very well structured and organized. Because of that structure, the Go compiler requires a system variable, GOPATH, to be set, pointing to the root of this directory. So, let’s get our GOPATH directory created and the environment variable set. In today’s tutorial, I’ll be creating it in my home directory. But depending on where you usually keep your code files, feel free use that instead. Running the following command will create the required directory structure, via the -p switch, in one step and set the GOPATH environment variable. mkdir -p /Users/settermjd/go/src/github.com/settermjd/sitepoint export GOPATH=/Users/settermjd/go If you’re using Windows, don’t forget to add a GOPATH environment variable. With that done, we’re ready to create our first Go application. A Simple Application To keep things simple, I’ve only covered a small set of the language features. But in future posts, we’ll build on what we’ve covered here. Instead of looking at a set of language features, we’ll be working through an annotated application which shows how to print out a simple statement, based on reading the contents of a JSON string, along with some conditional logic. An unannotated version of the code below is available on Github. Feel free to clone it and work through it as you step through the tutorial. But otherwise, lets work through the annotated version below. package main Every Go application is made up of packages and, using a Java reference, programs use the main package as the default. import ( "encoding/json" "fmt" "strings" ) As I mentioned at the start of the tutorial, Go has a rather large standard library. To access that functionality, you need to import the specific packages you need. Here, I’ve imported three: encoding/json, fmt, and strings. If it seems foreign, it really shouldn’t. In PHP and C you’d use includes (or requires), in Python you’d use imports and in Ruby you’d use require. The available package list is quite extensive. So if you’re curious about the rest, or want more specific information on the above three, grab yourself a coffee and checkout the documentation. Full coverage is well outside of the limits of this tutorial. type User struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Age int Languages []string `json:"languages"` } Go doesn’t implement classes, but Structs go a long way to providing that functionality, which we’ll see in later tutorials. For now, structs are a handy way of storing collections of named information. In the above example, I’ve declared a struct, called User. It has four fields: FirstName, LastName, Age and Languages. Here we can see usage of some of the core Go Data Types. FirstName and LastName are strings, Age is an int and Languages is an array of strings. At the end of each of these, you’ll see json:"first_name". What this does, potentially a bit beyond the scope of an intro example, is help map the struct field to a field in a JSON string we’ll see shortly. func printUserData(jsonData string, age int) string { Here we’ve defined a function called printUserData, which takes two parameters, a string called jsonData and an int called age, and will return a string. var output string Here I’ve declared a variable called output, which has the type string. res := &User{} Here I’ve both declared a variable, res which will be the of the custom User struct we defined earlier. Here’s an example of both defining a variable to a set type and initializing it in one go. json.Unmarshal([]byte(jsonData), &res) Here we’ve called the Unmarshal function in the json package, passing in the first argument jsonData, and the res Struct variable. if res.Age > age { output = fmt.Sprintf("User %s %s, who's %d can code in the following languages: %s\n", res.FirstName, res.LastName, res.Age, strings.Join(res.Languages, ", ")) } else { output = fmt.Sprintf("User %s %s must be over %d before we can print their details", res.FirstName, res.LastName, age) } This section will likely seem quite familiar, whether your background is PHP, Java, C/C++, Python, Ruby, or JavaScript; with one small change. In Go, if statements don’t require parenthesis, but do require curly braces. Here I’m checking if the age of the person, in the converted JSON object, is greater than the age that was passed in as the second function argument. If so, we print out their full name, age and the languages they can code in. If not, we print a different message, saying that we can’t show details about them. Here we see examples of two further standard library packages: fmt.Sprintf and strings.Join. I chose these examples deliberately as they’re likely used in most common web scripting languages which you’re likely familiar with, especially PHP. fmt.Sprintf will replace placeholders in the first argument string, with those supplied. As languages is an array, I’ve used the strings.Join function, analogous to PHP’s implode function, to convert the array to a string, separating the elements with “’, “. The result is then assigned to the string variable output. return output } At the end of the function, we return output. func main() { var age int = 24 str := `{"first_name": "Matthew", "last_name": "Setter", "age": 21, "languages": ["php", "javascript", "go"]}` fmt.Println(printUserData(str, age)) } A Go application is launched from the main function in the main package. So I’ve implemented main, initializing an integer variable to the value 24, then initialized a string variable, str, to a simple JSON string. You can see that it contains four components: - age - languages Finally I’ve called the fmt.Println method, passing in a call to the printUserData function, where I’ve passed in the str and age variables. Compiling The Code Unlike PHP, Ruby, Python etc, Go is a compiled language. So from your project directory, in my case /Users/settermjd/go/src/github.com/settermjd/sitepoint, run the following command: go install This will compile a go binary in the bin/ directory, naming it sitepoint, after the package name. To run it, just call it as you would any other system binary, or executable, e.g. $GOPATH/bin/sitepoint The result will be: User Matthew Setter must be over 24 before we can print their details In Conclusion So there you go, a hands on example, showing the basics of how to develop with Go. I hope that this example’s given you both a good introduction to Go basics, as well as shown you just how easy it is to get started. I’m relatively new to Go myself, and actively learning. But if you’re interested in exploring Go with me, then join me in the upcoming tutorials, over the coming weeks and months, and let’s learn this exciting, fun, and very interesting language together. If you’d like more information check out the following, excellent, examples: - Jeffrey Berthiaume - Jamie Devine - Evan - Taylor Ren - Jamie Devine - Matthew Setter - Taylor Ren - Matthew Setter - ch.linghu - Taylor Ren - Matthew Setter - Taylor Ren - Matthew Setter - Matthew Setter - Abu Ashraf Masnun - Matthew Setter - Evan Byrne - Matthew Setter - Evan - Jamie Devine - Matthew Setter - Anthony - Matthew Setter - John_Betong - LouisLazaris - Matthew Setter
http://www.sitepoint.com/getting-started-go/
CC-MAIN-2016-07
refinedweb
1,754
62.68
{-# LANGUAGE ExistentialQuantification, GeneralizedNewtypeDeriving #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} {-| =H ss r -> age ss dt >> readIORef r >>= \s -> age s dt SNM b sm -> age b dt >> age smH ss r -> commit ss >> readIORef r >>= \s -> commit s SNM b sm -> commit b >> commit sm (SND _ s) _ dt = do x <- signalValue s dt return (SND x s) advance s _ _ = return s {-| Sampling the signal at the current moment. This is where static nodes propagate changes to those they depend on. Transfer functions ('SNT')H. -} sampleDelayed :: SignalNode a -> DTime -> IO a sampleDelayed (SNT _ x _) _ = return x sampleDelayed sn dt = sample sn dt -- ** Userland combinators {-|Mon {-|Monad (Signal a) delay x0 s = makeS = makeSignalUnsafe (SNKA s l)
http://hackage.haskell.org/packages/archive/elerea/1.2.3/doc/html/src/FRP-Elerea-Internal.html#DTime
crawl-003
refinedweb
121
50.2
Hi, The Pioneers upstream have released 0.12.3.1 (0.12.3-1 is in squeeze now). They call it a "translation update", which is the major part of it. However, it also contains a few code changes to make it use gtk+ 2.20. I listed the changes below. The upstream changelog entry is: +2010-09-26 Roland Clobus <rclobus@rclobus.nl> * configure.ac: Release 0.12.3.1 * common/gtk/gtkbugs.c, common/gtk/guimap.c, client/gtk/histogram.c: Build with Gtk+-2.20 * client/gtk/monopoly.c, client/common/player.c: Use en_US * client/gtk/data/themes/Wesnoth-like/theme.cfg, client/gtk/data/themes/Freeciv-like/theme.cfg: Fix themes * Released 0.12.3.1 (Translation update) My question is: what should I do? I want at least the translations to go in squeeze; the theme fixes are colors; I think it should be fine to let them in as well. Is it ok to just package the new version and include the gtk stuff as well? Or should I put the translations in a patch and release them as 0.12.3-2? Is it ok to include the color fixes also in that case? Thanks, Bas Wijnen (packager for pioneers) - if (histogram_dlg && GTK_WIDGET_VISIBLE(histogram_dlg)) + if (histogram_dlg) - gtk_widget_destroyed(widget, arg); gtk_widget_destroyed(histogram_area, &histogram_area); + gtk_widget_destroyed(widget, arg); +#if (GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION <= 18 && GTK_MICRO_VERSION < 2) GtkWidget *button; +#endif gtk_widget_set_sensitive(widget, sensitive); +#if (GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION <= 18 && GTK_MICRO_VERSION < 2) /** @bug Gtk bug 56070. If the mouse is over a toolbar button that * becomes sensitive, one can't click it without moving the mouse out * and in again. This bug is registered in Bugzilla as a Gtk bug. The * workaround tests if the mouse is inside the currently sensitivized * button, and if yes call button_enter() + * + * Fixed in Gtk 2.18.2 */ if (!GTK_IS_BIN(widget)) return; @@ -88,6 +93,7 @@ void widget_set_sensitive(GtkWidget * wi gtk_widget_set_state(widget, GTK_STATE_PRELIGHT); } } +#endif - area->style->fg_gc[GTK_WIDGET_STATE(area)], + area->style->fg_gc[GTK_STATE_NORMAL], Attachment: signature.asc Description: OpenPGP digital signature
https://lists.debian.org/debian-release/2010/10/msg01278.html
CC-MAIN-2016-30
refinedweb
336
58.79
Japan From Progteam Latest revision as of 20:34, 29 March 2008 Japan is problem number 3067 on the Peking University ACM site. This solution gives correct answers for all the input I tested, but exceeds the time limit on PKU. The problem : Given a list of roads connecting cities on the west and east coasts of Japan, calculate the number of intersections. The cities are placed in numerical order down the coast. This solution represents the input as an array, where if cities n and m are connected by a road, then array[n][m] = 1 . A road intersects with any road contained in the sub-array formed by the upper left corner, starting from the row and column following n and m. If anyone can think of a way of optimizing this solution or just a more efficient method, please post ^__^ . import java.util.*; public class Main{ public static Scanner in; public static int theCount[][] = new int[1001][1001]; public static void main(String[] args){ in=new Scanner(System.in); doStuff(); } public static void doStuff(){ int T=in.nextInt(); for(int i = 0; i < T; i++){ int N = in.nextInt(); int M = in.nextInt(); int K = in.nextInt(); int[][] cross = new int[N+1][M+1]; for(int j = 0; j < K; j++){ int n = in.nextInt(); int m = in.nextInt(); cross[n][m] = 1; } for(int p = 0; p<=N; p++){ for(int q = 0; q<=M; q++){ theCount[p][q] = -1; } } System.out.print("Test case " + (i+1) +": " ); solve(cross, N, M); System.out.println(); } } public static void solve(int[][] cross, int N, int M){ int count = 0; for(int i = 0; i <= N; i++){ for(int j = M; j > 0; j--){ if(cross[i][j] == 1){ count += countEm(cross, i, j, M); } } } System.out.print(count); } public static int countEm(int[][] array, int n, int m, int M){ int count = 0; if(theCount[n][m] != -1){ return theCount[n][m]; } else{ for(int i = 0; i < n; i++){ for(int j = M; j > m; j--){ count += array[i][j]; } } theCount[n][m] = count; return count; } } } Well I was looking at this problem, and after discussing with Hunter a bit, it seems that this problem can be reduced to the DNA Sorting problem. For instance if you have a list of the edges, and you sort using say the "N" values as the key, then the degree of unsortedness is equivalent to how many intersections there are. However Hunter solved DNA Sorting using the naive method, which worked for that problem since the string was limited to 50 characters, but doesn't work here since the list could potentially have thousands of edges in it. So yeah...at this point I'm stumped. Hunter said that Prof. Siegel mentioned some nifty tree data structure that would do the trick, but I didn't quite understand what he meant. Anyone else have any ideas? Yay! Finally conquered Japan. The dastardly PKU people made some of the inputs require longs, which is what tripped me up. Also PKU doesn't seem to like comments either. Here's the code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> typedef struct { int n; int m; } hw; //stands for "highway" int compareN(const void* a, const void* b) { if(((hw*)a)->n == ((hw*)b)->n) return (((hw*)a)->m - ((hw*)b)->m); else return(((hw*)a)->n - ((hw*)b)->n); } long long merge_inv(int* array, int p, int q, int r) //all this function does is the merge procedure from merge-sort except it also counts inversions { int n1, n2, i, j, k, counted; long long inv; n1 = q - p + 1; n2 = r - q; int L[n1+1]; int R[n2+1]; for (i = 0; i < n1; i++) L[i] = array[p+i]; for (j = 0; j < n2; j++) R[j] = array[q+j+1]; L[n1] = INT_MAX; R[n2] = INT_MAX; i = j = inv = 0; for (k = p; k <= r; k++) { if (R[j] < L[i]) { inv += n1 - i; } //counting inversions here if (L[i] <= R[j]) { array[k] = L[i]; ++i; } else { array[k] = R[j]; ++j; } } return inv; } long long count_inv(int* array, int p, int r) { long long inv; int q; inv = 0; if (p < r) { q = (p+r)/2; inv += count_inv(array, p, q); inv += count_inv(array, q+1, r); inv += merge_inv(array, p, q, r); } return inv; } int main() { int t, n, m, k, i, j; long long tot; scanf("%d", &t); int cnt; cnt = 0; while (cnt < t) { scanf("%d %d %d", &n, &m, &k); hw* h = (hw*)malloc(sizeof(hw) * k); for (i = 0; i < k; i++) { scanf("%d %d", &h[i].n, &h[i].m); } qsort(h, k, sizeof(hw), compareN); int japan[k]; for (i = 0; i < k; i++) { japan[i] = h[i].m; } tot = count_inv(japan, 0, k-1); printf("Test case %d: %lld\n", ++cnt, tot); //change "%lld" to "%I64d" when submitting to PKU free(h); } return 0; }
http://cs.nyu.edu/~icpc/wiki/index.php?title=Japan&diff=prev&oldid=6802
CC-MAIN-2014-35
refinedweb
833
76.66
Hi. I understand that a Native Extension is needed to get the IMEI or UDID of the Android device. I found one here: I ran the compiled sample this site provided and it retrieved my IMEI fine, so I know it works. However, the code for this sample is in Flex. When I tried to incorporate it into my Flash CS6 .fla it didn't work. There were no errors, but when I ran in on the Android device nothing happened when I clicked on the button to retrieve the IMEI. I don't know what went wrong. Here is what I did: 1. First, I imported the "IMEI.ane" file using the steps below: 2. Then in my AIR 3.2 for Android settings I included the "IMEI.ane" file in the publish General settings. 3. In my program there is a textbox and a button. When the button is clicked with a mouse, it calls the function below and places the returned string in the textbox. I know the string to textbox part works, however, when I call the function below it doesn't. import com.chi.imei.Deviceimei; import com.chi.imei.DeviceStats; private function mGetImei():String { var tImeiStr:String = " "; var obj:DeviceStats = Deviceimei.deviceimei.deviceinfo(); tImeiStr = obj.imei.toString(); return tImeiStr; } 4. My FlashDevelop intellisense recognizes all the lines above so I think it properly found the classes. However, it doesn't work on the device! Can anyone tell me how to fix this? Thank you! As usual, this problem which frustrated me for days had a very simple solution. To others who also ran into the same problem, remember to set Android's READ_PHONE_STATE permission to TRUE. And voila! It will work.
https://forums.adobe.com/thread/1129195
CC-MAIN-2016-40
refinedweb
287
78.04
Bi. In the bad old days of AS2, Actionscript-to-Javascript was handled using fscomand(). In my experience with fscommand(), there were a lot of browser issues and its functionality was much more limited. Now, in AS3, we have a fully functional API that uses the ExternalInterface class. EXAMPLE Please upgrade your Flash player. Move Box ACTIONSCRIPT We are going to do some tweening here, so we need to import a few Tween classes: import fl.transitions.Tween; import fl.transitions.TweenEvent; import fl.transitions.easing.*; Next, we set up our calls using the ExternalInterface class. //call to javascript ExternalInterface.call("sendToJavaScript"); //call from javascript ExternalInterface.addCallback("sendToActionscript", callFromJavaScript); Once you have set up ExternalInterface, you have established 2-way communication, which means code can now begin to flow freely back-and-forth between Actionscript and Javascript functions. So now the next thing is to create the call to Javascript: function callFromJavaScript(dir):void { if(dir == 'right') { var tweenR = new Tween(box, 'x', None.easeNone, box.x, 145, 1, true); } if(dir == 'left') { var tweenL = new Tween(box, 'x', None.easeNone, box.x, 23, 1, true); } } JAVASCRIPT First you need to write a function that will detect your operating system. This is important because Microsoft uses "Document" when referring to the page and Mac uses "Window." function getFlashMovie(movieName) { var isIE = navigator.appName.indexOf("Microsoft") != -1; return (isIE) ? window[movieName] : document[movieName]; } Once we have established which OS we are working with, we need to write a function that will make the call to Actionscript. function callToActionscript(str) { getFlashMovie("nameOfFlashMovie").sendToActionscript(str); } HTML On a simple button, you only need to call the function callToActionscript('right') depending on which direction you are asking the box to slide. At this point, we have only sent a call to our Actionscript but nothing has come back from it . To illustrate the call back to Javascript, we can do the following. Please upgrade your Flash player. Move Box For the call back to Javascript, we add this into our Actionscript: this.addEventListener(Event.ENTER_FRAME, callJs); function callJs(e:Event):void { ExternalInterface.call("sendToJavaScript", box.x); } We already added this function to our Actionscript; however, two things have changed. First, the ExternalInterface is placed inside a function, which is being called by an Enter Frame eventlistener. Second, we have added the argument "box.x," which will be passed to the Javascript function. And finally, we add the following function to the Javascript: function sendToJavaScript(val) { document.getElementById('boxX').value = val; } And that's it! If you would like to see the source files, you can download them all here. When testing files using the ExternalInterface API, make sure your files are either on a live site or are running off a local server on your machine. As a final note, I want to add that I really like this functionality. In fact, any technology that opens up Flash to other elements on an HTML page is wonderful and welcomed in my book. There has always been a disconnect between Flash and "the rest" of the web, and I have become frustrated by the notion of Flash being inaccessible and self-contained. Flash can be both, but it doesn't have to be! Bi-directional communication is a simple and easy way to start breaking down these barriers.
https://www.viget.com/articles/bi-directional-actionscript-javascript-communication
CC-MAIN-2016-50
refinedweb
553
58.18
Sorry for the lack of posts - April has been busy! A combination of holidays, work deadlines and writing a book has made blogging impossible. The good news is that it is a Dart book - more details as I can share them! Who is ready for another - Dart POW? A weekly look at an interesting Package on pub.dartlang.org timeago is a Dart library for creating fuzzy timestamps, such as "15 minutes ago". Great for human friendly labeling of dynamic interfaces. import 'package:timeago/timeago.dart'; main() async { TimeAgo time = new TimeAgo(); int current = new DateTime.now().millisecondsSinceEpoch; print(time.timeAgo(current - (15 * 60 * 1000))); // 15 minutes ago //change locale await time.changeLocale("es"); print(time.timeAgo(current - (15 * 60 * 1000))); // hace 15 minutos } Try out the live demo here. Feel free to leave a comment with suggestions for the next Dart POW post! Don't be too shy to suggest your own package :-)
http://divingintodart.blogspot.com/2015/04/dart-pow-package-of-week-5-timeago.html
CC-MAIN-2017-17
refinedweb
154
68.26
Agenda See also: IRC log VQ: Any regrets for a call next week on 26 Sept? NM: Hoping to be there but at risk. VQ: Dan, can you scribe next week? DC: Yes. TV: Suggest we do more of call planning, regrets, etc. via email to save call time. VQ: Let's discuss briefly at F2F. <DanC> +1 approve VQ: Minutes of 5 September are at ... Any objections to approving? None. RESOLUTION: Minutes of 5 September 2006 at are approved. VQ: Comments were received from Noah at ... Response from Raman was at <Rotan> In indicating to DI chair that I could join the call, I also made comments on the issue, here - (W3C Member-only: see para.4) VQ: We have visitors Rotan Hanrahan and Rhys Lewis TV: Here's quick overview of goals of this work. ... I've worked in a number of related areas, such as multimodal, and we know there are multiple solutions. ... The finding is trying to set out good practices for Web content deployers. ... Specifically, we're looking for design patterns that meet particular use cases. ... Sample use case is I send a URI from desktop to cellphone, it should still get you what you need. Suggests Generic URI. ... In other cases you want a URI for a specific representation. ... Having discovered that you will need URIs for both generic and specific, the question is to get an appopriate relationship between them. ... Also need to be able to find generic URI given that you've been handed one for a specific representation. <Rotan> My first observation - It's not just UA string that influences the representation of the resource in response to the query. RL: We need to go from the canonical to the specific. In the practical world of mobile phones today, that mapping is very complicated. It depends on device characteristics, network parms, and user preferences, among others. <DanC> (er... hypertext links are a pretty straghtforward way to represent the relationship, no?) RL: You are only trying to cover the existence of a relationship, but not all the complex details. TV: Well, having the existence and the linking is an important start. <Rotan> There is no vocabulary that captures *all* of the possible delivery context variables that could influence the creation of representations. RH: The number of parameters that could influence the representation is increasing all the time (bandwidth, user preference, etc.) We don't have a vocabulary for that now. There is therefore no way to write down specifics. TV: Yes and no. ... The HTTP headers (e.g. accept) you get a degree of late vs. early binding. ... Since URIs are key, and given that there will be different streams coming back, you might want to have a different URI for each one. RL: In commercial systems I know, it works the way you say. There is a corner case, which is where the concrete representation is being generated as a transient thing. TV: By looking at a URL you don't know whether the referent is permanent on my desktop or not. <DanC> (for example, /image23?size=48x48 ; you might keep the 48x48 image permanently or generate it on the fly; in either case, the URI works indefinitely.) TV: The fact that you are creating the image on the fly doesn't keep you from generating a URI for it. RL: Question of degree. TV: You might have a space of many devices. RL: Yes, thousands. TV: Right, so canonical representation can't point to 4000 specific representations. Good point. DC: You can use forms for thousands of links. TV: If the canonical URI gives you a form with 3 parameters, you can use it to conjure up thousands of URLs. You can publish that form as your canonical one. It doesn't quite solve the discoverability problem, unless the agent can reverse engineer the form. RL: Rather than hard wiring, what we're saying is there a way for an end user to provide equivalent information. <Zakim> noah, you wanted to discuss crawling vs. convenience. NM: URIs can be opaque. <Zakim> Rotan, you wanted to say that perhaps one could define a small set of "virtual" devices to represent the general device space and create some UAs for these. This could be a <DanC> NM: separate (1) existence of uris (2) [darn; leaked out already] NM: We should be able to separately consider (1) whether there is a separate possibly opaque URI for each of the thousands of representations; (2) whether the device characteristics are manifest as metadata in the URIS; and (3) how to get transitive linking across potentially thousands of representations of the same generic resource. <Vincent> sorry, Rotan TV: I agree that to deploy an end-to-end solution you need to get all those device parms, but the TAG's probably not the place to do that. We should leave such things to domain experts, in this case folks like the device independence workgroups. <Zakim> Rotan, you wanted to make previous point about virtual devices. TV: Our piece of the puzzle should be to suggest that the URIs exist. RH: The problem is that crawlers would have to "prompt" the servers to cause creation of the various device forms of content. <nm> (Noah wonders why the servers wouldn't post pages populated with lots of links, possibly opaque, which if followed would cause the necessary representations to be generated.) RH: Most of what's returned across devices is thematically consistent (e.g. you always get the weather, albeit sometimes in black and white and sometimes in color) ... Not clear that it's worth the trouble to force pregeneration of all possible combinations, given that many of the differences are likely to be uninteresting. ... So, I think a small subset of virtual devices would be sufficient. <DanC> (I think it's pretty routine to put "nofollow" on links from generic to device-specific stuff) <DanC> (er... or is it "noindex"... one of the old ones, not the new "nofollow") NM: If a crawler caches a representation for a generic device, how does it serve the correct representation when queried, e.g., from some particular mobile device? TV: To enable discoverability, available representations should be hyperlinked from the generic. In this particular case there happen to be, say, 4000. We can see ways like spanning trees or generic devices, that allow you to either aggregate them or reach them transitively. My main point is that I don't think the TAG needs to get into that level of detail. The key point of the finding is the discoverability. The rest of this is in the DI working group, mobile web initiative, etc. RL: Wholeheartedly agree. TV: Rhys or Rotan, please point me to any specific references I should know about. RL: One more comment on the document: See section 2.1.1 . This suggests using redirection. Unfortunately, on most mobile networks, redirection is extremely expensive due to latency. TV: You have redirection, HTTP VARY headers, and content negotiation. Use the one that works for you. DC: Did you say this document discusses all three? TV: People coming from different perspectives have different viewpoints on this. VQ: Are you (Rotan or Rhys) asking for any changes? RL: No, I wanted to hit the expense of redirects. <Rotan> I said, look at "Thematic Consistency" concept introduced by MWI BPWG, as it is relevant to concept of multiple representations of an underlying resource. Would be good to reference it in the doc. TV: I think the story about either virtual devices or spanning tries should be told by groups like DI. <DanC> (when I think of concerns around this issue, I find I'm content with the way the draft currently discusses them, so I concur that few changes are needed.) RL: I think I know where I'd want to do that. VQ: Rhys, can you send us pointers to the www-tag@w3.org mailing list? RL: Looking in particular for links to things that relate generic to specific resources, and also on Rotan's point about thematic consistency. DC: Thematic consistency and generic resources are either synonyms or duals. Should we aim to converge terminology. <Rotan> See - RL: One is a goal, one is a technology to achieve it? Thematic consistency is an aspiration. DC: Teach people both terms? RL: They have different, if not completely orthogonal meanings. DC: I'm just saying that everywhere we say generic, we could consider saying "thematically consistent" RL: But that's not the only reason for having generics <Rotan> The BP doc says - ." NM: "thematically consistent" seems to be a pairwise relationship, but "generic" seems to be the nth+1st resource that has "aspirations" to meet the fuzzy common needs of all users. VQ: Do you plan to change anything? TV: Plan to add the references from Rotan and Rhys, finalize at F2F and publish. Would prefer to publish and let people read. DC: Worth time at F2F? Maybe we're done sooner. Maybe we could be done sooner or now. NM: What about the diagram? TV: Oops yes. Do we still need the diagram? Are we comfortable with this finding modulo adding the references? We can discuss the diagram separately too. DC: I think the diagram is pretty close to necessary. TV: I would add diagram and the text. <DanC> (I prefer publishing the diagram in SVG and in PNG and in whatever the source is (tex?)) DC: Put it at the end. NM: or in 2.2.1 ... How about dotted lines showing selective linking from specific representations to other popular specific representations (e.g. to English and French forms of a press release if links to all of them don't fit) TV: OK, but then I'd put it at the end. ... Typographically, will it fit if I spell out the languages? Various: Yes probably, we'll check for you. TV: OK to discuss formatting details on tag@w3.org? Not worth bothering main list, I think. VQ: I would prefer to have final version before we approve. DC: Seems reasonable. VQ: Can we have final version for F2F in two weeks? TV: Yes, that's the plan. <DanC> (I'll try to read it before the f2f, tv) <scribe> ACTION: T.V. Raman to produce proposed final genericResources draft for approval at Vancouver F2F [recorded in] VQ: Thanks to Rhys and Rotan for joining us. RL: Thank you. RH: Yes, thank you! See email at Announcing new draft at: <DanC> (it's always worth noting security issues like the .jpeg/exe bit; I'm scanning it now...) NM: I propose we leave this for about 9 days. Ed has approved publication, but I know he's still concerned about lack of tie in between, e.g. a .jpeg suffix and image/jpeg ... I could add a warning about the security issue but would do it as warning, not a Web architecture violation. DC: I think adding a security warning in a separate section would be good. VQ: Publish in 9 days? NM: Only if you want the current text. If you need new text, I'd say draft for public review in advance of F2F decision. <scribe> ACTION: Noah to add security section on risks of serving executables as .jpeg to metadataInURI draft. For review and approval at F2F. [recorded in] According to today's agenda, potential topics for the Vancouver F2F include: VQ: Are these the right ones? ... On generic resources and metadata we've just done status checks. <DanC> (I concur that XMLVersioning-41 and URNsAndRegistries-50 are high priority... I can't think of anything I'd rather spend my time on... oh... except issue namespaceDocument-8 ) <nm> Suits me. I wonder if we should think about what our priorities are for months after F2F? Might be worth an hour at one point. VQ: TV was asking about making our calls more efficient. DC: Namespace document-8? NW: Not quite sure I'll make progress for F2F but will try. VQ: We just have 2 days in Vancouver. ... Please give me input on F2F agenda for next Tues.
http://www.w3.org/2001/tag/2006/09/19-minutes
CC-MAIN-2014-52
refinedweb
2,025
67.15
* A friendly place for programming greenhorns! Big Moose Saloon Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies Register / Login JavaRanch » Java Forums » Java » Beginning Java Author GRRRR! compile error!!! fred fredricks Greenhorn Joined: Mar 04, 2003 Posts: 16 posted Mar 30, 2003 15:56:00 0 hey, i just cant see the error guys...maybe you can see and help me out? its between two files, so i hope you dont mind me posting both class's and the respective compile errors.. import java.awt.Graphics ; abstract class Ship extends MoveableObject { public Weapon shoot() { return myWeapon.shoot( this.x + width / 2 - myWeapon.getWidth() / 2 , this.y + this.height / 2 - myWeapon.getHeight() / 2 ) ; } public int getX() { return x ; } public int getY() { return y ; } protected Weapon myWeapon ; } COMPILE ERRORR: C:\Documents and Settings\Michael Brindley.BRINDO\Desktop\SpaceInvader\ MoveableObject\Ship.java:11: cannot resolve symbol symbol : method getHeight () location: class Weapon this.y+this.height/2-myWeapon.getHeight()/2); ^ C:\Documents and Settings\Michael Brindley.BRINDO\Desktop\SpaceInvader\ MoveableObject\Weapon.java:14: cannot resolve symbol symbol : method getHeight () location: class Ship int h = myShip.getHeight(); ^ 2 errors Finished import java.awt.Graphics ; abstract class Weapon extends MoveableObject { abstract Weapon shoot( int x , int y ) ; public boolean hasIntersected( Ship myShip ) { int x = myShip.getX() ; int y = myShip.getY() ; int w = myShip.getWidth() ; int h = myShip.getHeight() ; int x1s = x ; int x2s = x + w ; int y1s = y ; int y2s = y + h ; int x1w = this.x ; int x2w = this.x + width ; int y1w = this.y ; int y2w = this.y + height ; if ( ( x1s <= x1w && x1w <= x2s ) && ( y1s <= y1w && y1w <= y2s ) || ( x1s <= x2w && x2w <= x2s ) && ( y1s <= y1w && y1w <= y2s ) || ( x1s <= x1w && x1w <= x2s ) && ( y1s <= y2w && y2w <= y2s ) || ( x1s <= x2w && x2w <= x2s ) && ( y1s <= y2w && y2w <= y2s ) ) { return true ; } else return false ; } } COMPILE ERROR: C:\Documents and Settings\Michael Brindley.BRINDO\Desktop\SpaceInvader\ MoveableObject\Weapon.java:14: cannot resolve symbol symbol : method getHeight () location: class Ship int h = myShip.getHeight(); ^ C:\Documents and Settings\Michael Brindley.BRINDO\Desktop\SpaceInvader\ MoveableObject\Ship.java:11: cannot resolve symbol symbol : method getHeight () location: class Weapon this.y+this.height/2-myWeapon.getHeight()/2); ^ 2 errors Finished [ edited to preserve formatting using the [code] and [/code] UBB tags -ds ] [ March 30, 2003: Message edited by: Dirk Schreckmann ] Layne Lund Ranch Hand Joined: Dec 06, 2001 Posts: 3061 posted Mar 30, 2003 16:07:00 0 Well, I tried to make some suggestions earlier, but you must have deleted your post before I finished...hehe, things happen like that sometimes. Also, your new post gives me a better idea of what is going on. The compiler is still complaining that it can't find the getHeight() method. Is this implemented in the MoveableObject class? If so, please post it, too. Also be sure to use the CODE tags to preserve the indentation in your code. It sure makes it much easier to read. HTH Layne Java API Documentation The Java Tutorial fred fredricks Greenhorn Joined: Mar 04, 2003 Posts: 16 posted Mar 30, 2003 16:18:00 0 hi, sorry, i didnt mean to do it...newbie, i am playin around trying to see what does what etc...thanks for the help...here is the other class /* // header - edit "Data/yourJavaAppletHeader" to customize // contents - edit "EventHandlers/Java Applet/onCreate" to customize */ import java.awt.*; /* public class MoveableObject extends java.applet.Applet { public void init() { resize(300,300); } public void paint(Graphics g) { g.drawString("Hello MoveableObject!", 50, 50); } } */ import java.awt.Graphics; abstract class MoveableObject { //Draw abstract void draw(Graphics g); //Move, specify the speed public void move (int direction, int s) { if(direction == this.RIGHT) this.x = x + s; if(direction == this.LEFT) this.x = x - s; if(direction == this.DOWN) this.y = y + s; if(direction == this.UP) this.y = y - s; } //Overloaded, use default speed public void move(int direction) { move(direction, speed); } // True is this object is out of the given boundary public int outOfBound(int xBound, int yBound, int h, int w) { if (x < xBound) return LEFTBOUND; else if (x+width > xBound+w) return RIGHTBOUND; else if (y < yBound) return TOPBOUND; else if (y+height > yBound+h) return LOWBOUND; else return INBOUND; } //Accessor public int getWidth() { return width; } public int getHight() { return height; } //States protected int x; protected int y; protected int width; protected int height; protected int speed; public static final int RIGHT = 0; public static final int LEFT = 1; public static final int UP = 2; public static final int DOWN = 3; public static final int RIGHTBOUND = 0; public static final int LEFTBOUND = 1; public static final int TOPBOUND = 2; public static final int LOWBOUND = 3; public static final int INBOUND = 4; } Layne Lund Ranch Hand Joined: Dec 06, 2001 Posts: 3061 posted Mar 30, 2003 16:42:00 0 Okay, one problem is that MoveableObject needs to be declared public. If that doesn't fix all the problems, you should then remove all of your .class files and start the compilation over again. Sometimes this is the only thing necessary to fix such problems because some of the current .class files were generated from an old version of the code. Barry Gaunt Ranch Hand Joined: Aug 03, 2002 Posts: 7729 posted Mar 30, 2003 22:49:00 0 Schpellink eror: getHight() should be getHeight() PS. Funny, I thought Laine was our spelling expert :rotten joke: Sorry Layne, really [ March 31, 2003: Message edited by: Barry Gaunt ] Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch Getting someone to think and try something out is much more useful than just telling them the answer. I agree. Here's the link: subject: GRRRR! compile error!!! Similar Threads getting to a 300 answer to compile java.lang.NoSuchMethodError ??????? Button Problems compilation error Assigment operation in Rectangle2D class All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter JForum | Paul Wheaton
http://www.coderanch.com/t/393524/java/java/GRRRR-compile-error
CC-MAIN-2014-41
refinedweb
974
64.2
User talk:Caius/masterarchive [edit] Yo (This section was lost in translation so it has been archived prematurely humanbe in 20:24, 17 June 2007 (CDT)) Archive yo shit, Ames! And peep my new sig! G dlessLiberal 12:15, 16 June 2007 (CDT) - I was just chatting with Ames and he said he was sure Jtl would be doing it for him.:p --Ë. 22:31, 16 June 2007 (CDT) - I only archive material I notice has been removed and not archived. Has something been removed here and not archived? Also, why this edit? That section is still on TK's talk page. --jtltalk 22:38, 16 June 2007 (CDT) - I think AmesG's little laugh was that many try to notice too many inconsequential things in an manner that makes many feel unwelcome, and reminds him of other places where Sysops too tightly control things, is all. Nothing personal, Jtl...have some of our fine goat cheese! --Ë. 22:48, 16 June 2007 (CDT) More trying to out people, Jtl? The "community" might not think that wise. Better check. Have some of this delicious Goat Fondue! --Ë. 23:06, 16 June 2007 (CDT) - More? Do you, too, object to people linking to Is there something to 'out'? Maybe if you don't like me talking about you, you should stop talking about me? --jtltalk 23:20, 16 June 2007 (CDT) (end premature archive section humanbe in 20:24, 17 June 2007 (CDT)) [edit] Start! What do you want me to say? --Kels 19:27, 22 May 2007 (CDT) Everything is still there, it will all be set right momentarily :). Good to see you on RW 2.0 Tmtoulouse 19:37, 22 May 2007 (CDT) Check youre email, counsellor.--PalMD-Talk 20:15, 22 May 2007 (CDT) [edit] law I'm busy as fuck, you're busy as fuck. We still want to get some top-quality shit on here. What's your vision? --Huey gunna getcha 21:55, 22 May 2007 (CDT) - As of tomorrow, all I have to do is work 8:30 - 5:30 :-). Then I can contribute!-AmesG 23:16, 22 May 2007 (CDT) [edit] Machinations I have a few ideas up my sleeve for getting people interested in our project. At the moment I am trying to work on getting a solid article about the creation museum to submit to PZ Myers carnival. Myers gets about 20,000-30,000 views a day. Tmtoulouse 21:57, 22 May 2007 (CDT) - I wouldn't mind helping, but my brain hurts User:PalMD - I see your sock got canned. :( RAVEN 00:07, 23 May 2007 (CDT) - FYI...Ames, all of it. Copied ever blessed page of 1.0, and some of them even before you guys had a chance to delete them, wild as the place was then, lol. --TK /MyTalk 02:04, 23 May 2007 (CDT) [edit] Need help already...and from all places Can we remove information that may identify me? Thanks. HGHeartOfGold talk 02:06, 23 May 2007 (CDT) - Gosh! Here for a matter of an hour, and already one blaming me for leaving! A new record! --TK /MyTalk 02:08, 23 May 2007 (CDT) - I am not blaming you. Where did I blame you? I resigned over a quantity v. quality perspective--which is a difference in values, and I am not sure you and I disagree on this. Don't misconstrue my presence here as intentional retaliation. If I wrote anything that appears to blame you, let me know where, and I will clarify it. HGHeartOfGold talk 02:16, 23 May 2007 (CDT) Hey HoG! Hope you got helped; sorry I can't help now. Off to work. I promise I will try when I get back.-AmesG 08:01, 23 May 2007 (CDT) [edit] your essay Yo G, I should be working on merging that essay of yours with a copy of Andy's tonight sometime. Sorry I didn't get to it sooner. humanbe in 19:53, 23 May 2007 (CDT) - Talk to me. I have been working with a "current" version of ashfly's essay, and he not only has added some new gripes, but the order has changed (he put new ones at the top). I'll have all the "text" available to me at user:human/sandbox2 by the time you read this, but you should guide me how to move it around (I have an easier to work on text version on my desktop) and add some new comments after that. OR, if you have the version you were mirroring bookmarked somewhere I can use his text from that (never mind, yours was dated 4/9 or so, he moved the file around 5/1 so history is probably lost). I think it would be cooler if you update it, of course. But you might also have a life, eh? humanbe in 21:17, 23 May 2007 (CDT) Human rocks. That setup is real sexy.-AmesG 23:39, 23 May 2007 (CDT) [edit] gay is ok template Hey, some of us were using that the way it was! Can you make another one? like gay-lawrence or something? Change the colors too, so we can stack 'em and have it be purdy! humanbe in 23:36, 23 May 2007 (CDT) - Yeah, sorry man, now I feel badly :-( :-( :-(. I'll change it posthaste!-AmesG 23:37, 23 May 2007 (CDT) [edit] CWV If you have some time, and wnat to offer constructive advice, please see User:HeartOfGold/ChristianWorldViewEncyclopedia. Thanks. HGHeartOfGold talk 01:06, 24 May 2007 (CDT) [edit] Physics yo, i've done a postgrad work on theoretical physics. if you want a proper article on QM and ramifications of altering constants i'll break out my books in a few days time (tues) and we can get down to business... Airdish 02:34, 24 May 2007 (CDT) - That would be great Airdish! Try and get in a bit about how physics goes a bit of the way towards disproving God as well. -Icewedge 02:36, 24 May 2007 (CDT) Airdish, I would LOVE that. Please let me help you but I don't know much :-( .-AmesG 07:57, 24 May 2007 (CDT) - I think "disproving God" is probably not a reachable goal. Showing him as "improbable" is easier.DocSock 07:59, 24 May 2007 (CDT) Agreed. I do want to see the physical constant page though-AmesG 08:01, 24 May 2007 (CDT) [edit] I lost my PW I lost my password for HG (HeartOfGold). I changed it and forgot to save my password file. How do I reset it? I do have an email set up on my other account. Thanks. HG2 11:04, 24 May 2007 (CDT) Sock oooooh, ban him!!!--CatWatcher 11:06, 24 May 2007 (CDT) [edit] faulty research Ames G, In your zeal to slander, you erred with this insinuation, - Many creationists are in favor of the suppression of all dissident thought. Otherwise, the obvious flaws in their "logic" might be revealed. They also fear dissident thought, and in fact any difference whatsoever, and applaud cp:user:RobS|those who censor dissent. [1] Please produce one singular edit Rob Smith ever made to any Creationist, or Evolution article. And note, I am a public person whose real identity is known, as yours is, hence Ames can not claim immunity under to Sec. 230 of the Internet Decency Act. Thank you. RobS 11:48, 24 May 2007 (CDT) - Linking to my user/sandbox seems odd, why didn't you link to the older live version? Anyway (dunks my head in a nice cold bucket of water), I checked out your edit (removing the ref to you) and even on my power trip I saw no reason to argue with it. It still says what it meant, without the unsourced naming. Has someone reverted it? If so, I would expect a ref link to a diff at CP. If not, well, you fixed it and made it better. I came off my power trip and liked what you did. Just my .02, is all. humanbe in 16:28, 24 May 2007 (CDT) - If we're going to get all legal-like, "Many creationists are in favor of the suppression of all dissident thought." He doesn't mention Creation/Evolution directly. "But it can be assumed from context!" one might reply. Later in the article he makes the point that "conservative" and "creationist" are conflated. Whether that's true or not, he certainly seems to believe it. So, RobS doesn't need to be shown making an edit to a Creationist or Evolution article, but to a conservative or liberal article. - I have no dog in this fight, so I'm not going to go do the research, but if he's edited at CP much at all the odds are good that this has occurred. Were they censoring? I also don't know that. - AndyS has done these conversations no favors by pushing rules of trial law into conversations between "civilians," but if them's the rules then let's play, I guess. Aziraphale 17:06, 24 May 2007 (CDT) RobS, you're right. I'll remove the reference, and I sincerely apologize. However, I take your language as doubly threatening - first, threatening me with my "real name," and second, by threatening legal action (?). Repeated legal threats will not be tolerated on RW. Be advised. But, still, I apologize sincerely.-AmesG 21:44, 24 May 2007 (CDT) - I notice CP Sysops are being politically profiled in the fascism article. It may be helpful to advise your contributors on Sec. 230. The Wikimmunity article is available on my userpage. It only applies to the hosting service, not a person who can be identified as posting libelous and defamatory content in an open forum. RobS 10:37, 25 May 2007 (CDT) RobS, I see you have retired from RW. That's probably for the better. You seem to have some... err... issues, and perhaps I didn't make myself clear, but legal threats are not to be tolerated here. I'll pull the "Act" you cite tomorrow and do a bit of research on it, but I pulled the law review article you cite. Did you... read it? Did you know that law reviews are not authoritative, or binding law, but mere suggestions? I don't think you knew any of this...-AmesG 01:22, 26 May 2007 (CDT) [edit] Temptation It was too great--had to block you. I know you'd do the same for me ;) Flippin;-) 15:26, 24 May 2007 (CDT) [edit] HEY! You may not have noticed my comment under the heading "law" above. --Horace 23:32, 25 May 2007 (CDT) HAHAHAH!!!!! SO SORRY HORACE. My time here has been short lately, will you forgive me? As of right now I have no clue where TK and RobS are... could you fill me in on some exciting stuff that's happened here recently? I dunno what might be useful... but I'll fill in the page Law and let's use its talk page as a planning page for what articles are needed.-AmesG 23:40, 25 May 2007 (CDT) WTF was that weird-ass discussion about above?--PalMD-Talk 23:53, 25 May 2007 (CDT) [edit] libel & defamation Just out of idle curiosity, of course, are there circumstances under which calling someone a 'terrorist' might be libel and/or defamation? --jtltalk 01:27, 26 May 2007 (CDT) - Probably not... would you believe we didn't cover libel, slander, et al in Torts? I had an awful Torts professor. FAIL, NYU, fail... but I'll look it up. I think my Lexis account is still valid for the summer?-AmesG 01:32, 26 May 2007 (CDT) - I would certainly be delighted to provide you with my Attorney's address for service of process, Jtl. Please make me a really happy man, okay? --TK/MyTalk 03:04, 26 May 2007 (CDT) - I have no intent to sue, TK. I was trying to subtly point out to RobS that maybe he shouldn't imply he would. It was the wrong tack to take, though, inflammatory rather than calming, so I apologize. --jtltalk 03:42, 26 May 2007 (CDT) Horace, you make me happy. Good man. I like it. Also, go to [[talk:Law]] to see some articles that might need doin.-AmesG 01:44, 26 May 2007 (CDT) - I will take a look, but not today (because I am about to attend a birthday dinner). See you later. --Horace 02:12, 26 May 2007 (CDT) - For months-later readers: that page is now at Talk:Law (disambiguation). --jtltalk 01:12, 7 July 2007 (CDT) [edit] Concern is scientific? Maybe it should be moved to metaphysics instead of science, or maybe religion?:) Heart♥Gold tx 15:24, 26 May 2007 (CDT) - ...When the majority of scientists fall on one side, and oil-company paid scientists fall on the other side, it's still science :-). Creating a "controversy" where there properly is none, does not make something metaphysics.-AmesG 15:26, 26 May 2007 (CDT) - Science is up for a vote? And why not also look at how the majority in question is funded? Ah, that could be a good debate for some other day. You need to attract more conservatives here if you want to have rational discussions--I can't do it all. Maybe you should put a "recruiting unsuspecting conservatives" on the main page? Heart♥Gold tx 15:29, 26 May 2007 (CDT) I guess I don't follow your last two sentences. But as for the first two, science isn't up for a vote but it is up for peer review & critique...-AmesG 15:30, 26 May 2007 (CDT) - This "science is up for a vote" gag has kinda been worn thin by the scienceglobal warming deniers. It's an overused tactic to try to discredit mainstream scientific opinion and try to exaggerate the so-called "controversy", largely driven by corporate and political vested interests. --Kels 15:32, 26 May 2007 (CDT) - Why not also look at how the majority in question is funded? Heart♥Gold tx 15:46, 26 May 2007 (CDT) Burden of proof is on you.-AmesG 15:48, 26 May 2007 (CDT) [edit] Conservapedia concepts A few hanging sentences there at the moment.--Mad Min 11:31, 27 May 2007 (CDT) - Thanks dude, I'll fix them! Help me write more :-) [edit] Here This time it's really me. Nice to see you again, Ames. --Hojimachong 19:37, 27 May 2007 (CDT) - Awww... Conservative would be so proud of you for abusing your powers! --Hojimachong 19:52, 27 May 2007 (CDT) [edit] Refutation? You gonna do an article refuting Jack Bauer's foreign policy skills? --Kels 21:22, 27 May 2007 (CDT) - Maybe. I could read the Torture memo that Gonzalez wrote and comment on it...-AmesG 21:28, 27 May 2007 (CDT) - I wonder how one switches the point of an article about Olbermann going whacked on the air, to being something about the WOT? Oh, wait, it does when some are training to obfuscate in the courtroom. Sorry. Carry on. --TK/MyTalk 23:42, 27 May 2007 (CDT) [edit] Sorry if I am being too hard on TK I am guessing that you view his shenanigans as tolerable. Shall I just put TK on the ignore list? Heart♥Gold tx 00:47, 28 May 2007 (CDT) - Goodness, tantamount to trolling isn't your post, HOG? Since all I can see is me supporting you since arrival here, and on CP, perhaps you are privy to something I am not? (Darn thing logged me out!) --TK/MyTalk 01:17, 28 May 2007 (CDT) - TK, you have supported me at times. I am asking AmesG if s/he thinks I am one of the people making you feel unwelcome, and if so, should I put you on my ignore list. Heart♥Gold tx 01:23, 28 May 2007 (CDT) - Surely Ames is a boy's name. And, btw, I'm assuming that anyone who has a heart as a part of their signature is a girl. --Horace 01:31, 28 May 2007 (CDT) - In case your not joking about your assumption, no, Heart Of Gold is the name of a spaceship in Douglas Adams' Hitchhiker's Guide to the Galaxy. And I honestly did not know AmesG was a guy. Heart♥Gold tx 01:34, 28 May 2007 (CDT) LOL! Horace...be nice! Heart, if that is what you were asking, most likely better for this medium to have actually said that. Just my suggestion. I think when you allowed yourself to be manipulated by others, such as the whole "plot" deal, and began to think it was true, your attitude and posts changed, as your messages to others. In a perfect world feelings wouldn't get hurt, and all of us wouldn't be guilty at times of allowing rumors to make ourselves shut out others. It isn't a perfect world. All any of us can do is leave the past, and all its buckets of shit, in the past, and move on. --TK/MyTalk 01:38, 28 May 2007 (CDT) - When did I say you were in a plot? That there was a plot, I think, is now admitted. It's effectiveness, I can only speculate. Whether or not you were in it, I doubted you were. Not sure how I was manipulated. Heart♥Gold tx 01:41, 28 May 2007 (CDT) - I don't think RobS sending out some email, or anyone doing so, constitutes a plot. I merely am saying some here wanted others to believe that was the case, both my "involvement" and a plot as some actual fact. Was there plenty of speculation that someone who was about to be made a Sysop quit? Yes. About as much as my participating here is making. ;-) --TK/MyTalk 01:48, 28 May 2007 (CDT) Heart of Gold, I rarely care if people guess my gender wrong... I'm a big musical fan, so I'm pegged as a girl online very frequently, but I am male :-). So no worries! And as for TK, I really wanted to give him a second chance, but geez, I don't think he understands the meaning of the word "Truce." It seems as many times as we give him chances, he'll show his vitriolic side all the more. So no worries, Heart.-AmesG 10:09, 28 May 2007 (CDT) - I'd be more tolerant of TK if he were more entertaining, or at least more original. But honestly, the famous One-Trick Pony just looked at the guy and said "what else you got?" --Kels 14:12, 28 May 2007 (CDT) [edit] Hello hello Amesg, you might not remember me, as I never really communicated with you on CP. I just wanted to let you know that sockpuppetry is, well, deceitful. :)Bohdan 17:20, 28 May 2007 (CDT) - If that link doesnt work, I think you know its target. :)Bohdan 17:23, 28 May 2007 (CDT) I am no longer inclined to be charitable toward Karajou. He is a simple bully. And an asshole. And I'd tell it to his face if I wasnt permablocked--PalMD-yada yada 21:29, 28 May 2007 (CDT) - Dude, I agree, but what'd he do to you this time (again though I agree)? Also, did you know that brownnosing Andy is TK's new favorite activity?-AmesG 21:31, 28 May 2007 (CDT) Yeah I saw his nose halfway up to andy's prostate. KooKoo is being the "enforcer" and bullying the folks in the Franklin debate.--PalMD-yada yada 21:33, 28 May 2007 (CDT) Let me get this straight, TK is waxing poetic about how wonderful Phyllis is, based on the fact that she was totally fucking wrong? --Kels 21:37, 28 May 2007 (CDT) - I fail to see how spreading alarmist, hateful, insane & bigoted right-wing rhetoric is something heroic.-AmesG 21:38, 28 May 2007 (CDT) They are going batshit crazy, esp andy, giving us lots to do. I love mostly because i had something to do with it.--PalMD-yada yada 21:40, 28 May 2007 (CDT) - It amazes me that a woman who managed to reap the benefits of feminism (college educated, etc.) can be so dead-set against the very movement that gave her those benefits. On the other hand I'm not at all surprised to see her lauded by this largely male group... --Kels 21:43, 28 May 2007 (CDT) Could someone please please do some commentary on this? I have to go pretty soon, but SOMEONE please, this is GOLD.-AmesG 21:45, 28 May 2007 (CDT) [edit] sysop template Thanks for the fixing the "retard", Ames, I usually sub in fucktard, just to not offend the developmentally disabled. Moron is better, as it is self-referential, so less "dumb". Dumbass would have worked, too. Maybe the word itself should be a template and we'll randomly change it? "As a confirmed mustard bottle for taking ...." humanbe in 21:34, 28 May 2007 (CDT) [edit] You make me sad... ...with your unblocks and the like. Okay so maybe I don't really mind. GodlessLiberal 15:49, 29 May 2007 (CDT) [edit] I could use your expertise You have far more knowledge of US law than I ever will, and you've gone to bat over at CP on gay rights issues before, so could you provide some insight over here? The specific legal differences between marriage and civil union are more your bailiwick. --Kels 10:40, 30 May 2007 (CDT) - I'll get to it ASAP when I get home; trust me that HG got a LOT wrong.-AmesG 11:12, 30 May 2007 (CDT) And what about this? Would that be legally possible? MiddleMan I need your help too...on Sodomite [edit] Don't minimize the picture, it is funny But if you insist, let me know, and I will try to fix it. Heart♥Gold tx 23:04, 30 May 2007 (CDT) - The trouble is, it's huge and garish. Funny, yes. (realistic? no). I tried making it into a thumbnail, which is appropriate for something that large, and for some reason it doesn't work. Can you play with it in a sandbox until it works? Or do you want me to take a whack at making a smaller version that is still clear (I'd upload it under another name, to get your approval)? humanbe in 23:24, 30 May 2007 (CDT) [edit] Thanx! Thanks for the welcome and the goat! Ok, I have been busy reading, and only learning stupipedia is worse than I imagined. Whenever, however, I want to help. Just let me know, and show me how. Can I be blocked now for suggesting trouble? --E 23:40, 30 May 2007 (CDT) [edit] My Talk AmesG, please remove my account. While I have tried to show good faith by unblocking Leopeodeo, Wikinterpreter, several others, it is obvious my account here will serve as nothing more than a place for others to bitch about my actions at some other board, with different rules and expectations of what sysops are supposed to do. No matter how I address that, someone always has another justification or argument as to how I should have done something differently, and obviously most users here still judge what is done on CP by their expectations of what they should or could be, rather than what they actually are. Since I was told by at least two bureaucrats it wasn't going to be allowed to hold my feet to the fire for actions somewhere else, and that hasn't been enforced, or even mildly suggested it isn't right, the only solution I can think of is to resign, which makes my treatment here good (and perhaps justified) revenge for some. However them treating me the same as they claim to have been treated elsewhere, makes them what? Would you please consider removing my account? Thank you. --TK/MyTalk 20:36, 31 May 2007 (CDT) No objection to template removal.--PalMD-yada yada 22:19, 31 May 2007 (CDT) - Thanks buddy. Sorry I didn't ask you first - the idea's funny but the pic's a bit...?-AmesG 22:20, 31 May 2007 (CDT) [edit] Listen to me! - Why does everyone here refuse to follow their own rules? Why don't you accede to my reasonable demands? Why are you all so confused about how to follow rules? Make me a sysop! Bet you thought this was someone else. humanbe in 21:57, 1 June 2007 (CDT) [edit] Award [edit] InfoWarrior's Handbook AmesG, you seem reasonable. You are highly educated. Do you really approve of this? Bohdan 18:38, 4 June 2007 (CDT) - Thanks for the compliments, Bohdan! I'll take a look. I'm busy right now but in a few hours time I'll review it.-AmesG 18:43, 4 June 2007 (CDT) Bohdan, what's your problem with the article? Just curious.-AmesG 19:21, 4 June 2007 (CDT) - He obviosly like any rational person thinks things that are intended to promote distructive behavior are unaceptable. I would agree with him but....... -Ĭ₠ŴΣĐĝё 19:28, 4 June 2007 (CDT) - Yes, that is the reason. I don't see why one must destroy something he disagrees with. I disagree with many of you on most issues, but I don't think that deceitful vandalism is the way to solve any problems. Its counterproductive, and serves no purpose but to alienate and divide.Bohdan 21:11, 4 June 2007 (CDT) - It's honest vandalism, I think. And I think the goal is to alienate and divide CP users & sysops. You're immune, though, as you were inoculated with the LULZ vaccine during your forays here on the Dollhouse side. Some people write articles about things, others write essays, some produce counter-terrorism pamphlets. We welcome all loonies, purple or green spotted, here. humanbe in 21:25, 4 June 2007 (CDT) So Bohdan, I am opposed per se to things like that. I personally won't engage in them anymore; I have sworn off CP entirely, even as entertainment, as a result of my opinion on that. BUT. I consider Conservapedia to be morally bankrupt. It targets schoolchildren and inculcates them with not only false science and bad law, but with viewpoints that could actually damage them. Squelching contraception? Pushing reparative therapy? I consider it actively evil. Anything that can end it, even fighting fire with fire, is justified. Also, I don't consider the tactics evil per se. Rather, they expose hypocrisy and latent character flaws in the site. They're adding nothing. SO. I don't think it's that bad. I am sorry that I cannot join you, and I do consider myself reasonable. But I do not consider Andy reasonable.-AmesG 22:22, 4 June 2007 (CDT) - I'm in favor of it. Any structure that can't survive a little ideological dissonance is a BAD system and needs to be cleansed with fire. Look how CP treats anyone 'guilty' of even minor heresy against the Revealed Word of Aschlafly and His sidekick, God. Now compare that to THIS rat's nest of snickering anarchy--even someone using ALL the IW's Dark Arts would get. at most. a new laughs. Which system is more robust, and why do you think that is? - The basic problems with Conservapedia, as I see 'em, are firstly, a deeply delusional worldview, and. secondly, trying to enforce that worldview on the inherent anarchy of a wiki with a hamfisted editing regime that leaves half the interesting pages blocked at any one time, and the other half reverted at a moment's notice. And then you bozos complain nobody wants to edit anything! --Gulik 23:17, 4 June 2007 (CDT) Me too, adding false information is wrong, that's why CP has to go. MiddleMan 12:33, 5 June 2007 (CDT) Oh, come on, besides that one suicide sock, I didn't cause to much damage (I don't even have a variable IP.) But my answer stands, writing ICEWEDGE PWNS hurts no one, however lying to children about science and history does. MiddleMan 12:38, 5 June 2007 (CDT) Well, my loyal sock did use the MiddleMan IP... MiddleMan 12:58, 5 June 2007 (CDT) - I guess I'll throw in my 2 pesos. I think that if it is legal, it is probably ok in this situation, given the current set up. My reasoning below: - Speech is best countered with speech - CP is an open wiki - CP publishes blatent, harmful falsehoods - CP blocks those it doesn't like - Therefore, anything that helps counter their speech and gets other views across is ok. - If they close their wiki, the above is likely invalidated, as they have created a private space that is morally off limits.DocSock 12:43, 5 June 2007 (CDT) - I think it depends on how you define "vandalize and destroy". I mean, I understand where you are coming from, but if they do not want divergent view points, they can close the door.DocSock 12:48, 5 June 2007 (CDT) - "Cp does welcome other views." -- Bohdan - See that quote, there? That is what is called a BIG FAT LIE. I'll refrain from impugning your character or intelligence by speculating as to WHY you'd say something so obviously contrafactual in a forum crammed to the rafters with people who all have firsthand knowledge of HOW big and fat said lie is, but if you're going say it again, you might want to consider providing a little proof. --16:57, 5 June 2007 (CDT) - I have a great deal of respect for you, not least of all for agreeing to stick it out here. We welcome any views, just about. CP certainly does not. I think you can probably agree to that if you think about the EVO debate, and countless others.DocSock 12:52, 5 June 2007 (CDT) - Quod erat demonstratum. "Cp does welcome other views" "Obviously they are not going to allow certain edits". I do agree with you that they would be better off if that were not true. Allowing correct scientific information is not the same as, say, creating an article on why Jesus is Satan or some such stupidity.DocSock 12:59, 5 June 2007 (CDT) - Obviously they are not going to allow certain edits. You're kind of proving our point, here. If Conservatives are Always Right (tm), why are they (and YOU) so hell-bent on keeping certain inconvenient truths(r) off of Conservapedia? Printing the truth is not "vandalism", but in a tyranny, it's very subversive. --User:Gulik(wasn't logged in) 13:19, 5 June 2007 (CDT) Bodhan, maybe you are open to our edits, but TK and Conservative certainly aren't, if you wish to include lots of articles on the Bible and Biblical figures or advocate the benefits of a stable marriage vs promiscuity, then go ahead, but 1+1 is not 3, and all animals don't fit into a 150m boat, that's where CP crossed the line from being conservative to being looney. You'll see most of us libruls and moderates contributed almost exclusively to science related articles (areas TK and Conservative were not schooled in), because they were not factual, I'd call those positive contributions, but clearly TK and Conservative seem to disagree. MiddleMan 13:09, 5 June 2007 (CDT) - Oh, they've been schooled in them PLENTY of times now. :D --User:Gulik(wasn't logged in) 13:19, 5 June 2007 (CDT) In the the weeks leading up to the Night Of The Blunt Knives, TK's Stalinesque paranoia overtook his anti-science drive, nevertheless it was there, I didn't mention Karajou, did I? MiddleMan 13:20, 5 June 2007 (CDT) Cheap shot and parting thought: If this is how Conservatives run a webpage, what would a GOVERNMENT made of them look like? Oh, wait... we're seeing it right now, and it plainly SUCKS. --User:Gulik(wasn't logged in) 13:19, 5 June 2007 (CDT) - Apologies for cluttering up your talk page AmesG, I 'd just like to say to Bohdan (expanding on MM's point) that CP is already filled with falsehoods generated by the lunocracy. When editors who see through the lies and disinformation have attempted to write the truth they have either been reverted, banned or the article locked. Even trying to present two sides of an argument is impossible as one view is held inviolable while the other has to be dismissed with smears, overgeneralizations and spurious "facts". Rational knowledge is rejected in favour of bronze-age myths handed down through oral tradition (ever heard of Chinese whispers?) then committed to parchment, translated several times and regarded as the inerrant word of an invisible supernatural being. How come there hasn't been any further communication in the last 2000 years? Is God on vacation or having lunch in the restaurant at the end of the universe? If mankind is to survive we have to have rational common ground not name calling that my God is better than your god/goat/teapot/spaghetti monster. So subtle vandalism or mockery (a uniquely "liberal" trait according to Andy) serves to question the authority of people who think they know best. If something or someone is robust enough to accept mockery then it must have some value, note that the greatest opponents of mockery have been the biggest dictators in history. I could go on about this but maybe I'll save if for an essay Mocking Mohammed is not the same as Vandalising Conservapedia. Babel fishÅЯ†ђŮŖ ÐΣй†Now look here! 13:20, 5 June 2007 (CDT) - Your all getting off topic. Is it OK to vandalize and attempt to destroy something you disagree with?Bohdan 13:49, 5 June 2007 (CDT) - When it's actually HURTING PEOPLE, (which CP's not-so-crypto-fascist views do), then, yes. I'd rather disagree with facts and reason than with sabotage and mockery, but you hamfisted twits won't let us, so I use what I've got. --Gulik 16:50, 5 June 2007 (CDT) - Are you a Christian Bohdan? Because Jesus didn't think twice about his act of "vandalism" in throwing the money lenders out of the temple!! Babel fishÅЯ†ђŮŖ ÐΣй†Now look here! 16:56, 5 June 2007 (CDT) - There's also that bit about 'not bearing false witness'--I think that got thrown out (along with the rest of Jesus' hippie bullshit about 'helping the poor' and 'loving your neighbor') when Ronald Reagan came down from Mt. Sinai with the Third Testament. --Gulik 17:02, 5 June 2007 (CDT) - Bohdan, you asked if vandalism is justified to destroy something you didn't agree with. I'm just pointing out that in Jesus's eyes it was. We can get into a debate about whether there is an equivalency between the two things (see HoG's article on gays and lobsters) but the precedent was set and the Church (particularly the Catholic segment) has had no compunction about destroying heretics. The problem with CP is that despite the stated principles of welcoming all points of view, anything that doesn't comply with their preconceptions is exterminated. There is no debate, just fascist revisionism. As someone who cares about what sort of world will be left for future generations (an altruistic liberal concept as I have no children that I know of) it behoves me to try and bring common sense and rational discourse to the gullible. If I can point out that the emperor has no clothes (see Hans Christian Anderson) then I am doing a public service. I don't deny that some religion has some benefits. There has to be some sort of moral code for society to function smoothly, and six or seven of the Ten Commandments are perfectly acceptable in my view. However, despite their professed religious beliefs many Conservatives disagree with at least one of them - thou shall not kill. Jesus said turn the other cheek but most C's want an eye for an eye. This is pick and mix religion. If you don't like what Jesus said, exchange it for something from the Old Testament. Babel fishÅЯ†ђŮŖ ÐΣй†Now look here! 17:19, 5 June 2007 (CDT) If it is a harmful lie, presented as truth to the ignorant, then yes. MiddleMan 13:53, 5 June 2007 (CDT) - Thanks for reminding me, I've got to get around to working on that Propaganda article. --Kels 14:30, 5 June 2007 (CDT) - Here is another case of people, several of them, seeming to get their facts from oribiting UFO's, I guess. I am a lapsed Catholic, by conversion from basically non-attending Methodist. I have two advanced degrees, one of them being in the sciences. I have never made it a point to edit science or religious articles on CP. And anyone with a third grade ability to read should know of my many public arguments with Conservative. Thanks, Doc for attempting to introduce fact here, amongst what are essentially trolling posts. --TK/MyTalk 15:45, 5 June 2007 (CDT) I'll just ignore these edits edits[2][3][4][5], but still I guess I got you mixed up with Karajou. Btw, are you a creationist or not? It's hard to tell from your edits, and in what science do you have a degree? MiddleMan 17:04, 5 June 2007 (CDT) - "If it is a harmful lie, presented as truth to the ignorant, then yes" (Its OK to vandalize and attempt to destroy something you disagree with). Its a sad world we live in. Bohdan 16:38, 5 June 2007 (CDT) Straight answer to Bohdan's earlier question: In this case, yes. Most of the contributors here bent over backwards to accomodate YEC nonsense in CP articles. All they wanted was the right of fair reply within those same articles that they had been initially promised. They were systematically obstructed from doing so and then blocked for protesting. Schlafly is engaged in a major act of deceit, namely attempting to present his world-view as internally consistent and uncontroversial. He should not be allowed to get away with it. --Robledo 16:45, 5 June 2007 (CDT) - Is this a good place for a quote? "All that is necessary for the triumph of evil is for good men to do nothing." - Edmund Burke --Kels 17:11, 5 June 2007 (CDT) - I guess it all depends on who is good and who is evil, no? Simply disagreeing with someone doesn't make them evil. It looks like AmesG talk is now passing my talk in this sites page view statistics. I'm going to have to stop this so I don't lose my place. Bohdan 17:16, 5 June 2007 (CDT) Definitely a good place, K. No place for a goat, though ;) --Robledo 17:21, 5 June 2007 (CDT) - Oh, here's another quote, then. "I am a goat-fucker!" - Richard M. Stallman, 1994 --Kels 17:47, 5 June 2007 (CDT) Will add my thoughts later...this is an important topic.-AmesG 09:00, 6 June 2007 (CDT) - Side note: Wow! Thanks to Bohdan for leaving that comment on TK's CP talk page. Otherwise I would've overlooked this thing. Love how things went from "Cp does welcome other views" to "Obviously they are not going to allow certain edits", by the way. That's like "You're allowed to have your own opinion. Being allowed to voice it is another thing." XD --Sid 10:07, 6 June 2007 (CDT) To get back to the point about InfoWarrior's Handbook, I must say that I don't feel to happy about it. Generally posts here supporting it have been about how bad CP is. I would agree with a lot of that. But are we really going to use an "end justifies the means" argument to support vandalism? Surely if something is wrong we should not do it. It doesn't matter how bad the other guy is - our moral judgments are our own, and should not be based on how bad the other guy is. "The end justifies the means" starts you on a very slippery slope - I hope we don't slide on it.--Bob_M (talk) 10:10, 8 June 2007 (CDT) - Where CP is concerned, and kids, yes the ends do justify the means! Vandalism, disinformation, sowing dissention and argument, pitting one sysop against the others, all that distracts them from their task at hand of brainwashing young kids. To do otherwise conjures up thoughts of the French in WW2, not joining the resistance, thinking the Germans would just go away.....--Ë. 17:58, 8 June 2007 (CDT) You appear to ducking this one, Bohdan, so I'll reiterate: Schlafly is engaged in a major act of deceit, namely attempting to present his world-view as internally consistent and uncontroversial. He should not be allowed to get away with it. --Robledo 18:23, 8 June 2007 (CDT) - I think the issue might be that we're not really doing anything wrong... we're making them reveal their own totalitarian tendencies, which is I think good... I fail to see how "ic3w3dg3=j3sus" is as evil as it is said to be.-AmesG 18:31, 8 June 2007 (CDT) - On Islamopedia, Icewedge=Muhammed could get your head taken off. But thats beyond the point. As icewedge himself stated "things that are intended to promote distructive behavior are unaceptable". Your sockpuppets, adding of false information, and everything else you people are engaging in is deliberately breaking the rules and causing harm to something you disagree with. Thats whats wrong. Bohdan 18:36, 8 June 2007 (CDT) - I don't support vandalism, but the problem with your argument, Bohdan, is that there are in effect no rules on Conservapedia. The sysops are allowed to do pretty much as they please, regardless of whether or not they can find justification in the rules for what they do. Criticising others for breaking the rules seems somewhat untenable, when the very people who ought to enforce them make mockeries out of them. --AKjeldsen 18:54, 8 June 2007 (CDT) - Bohdan - Mohammed (pbuh) doesn't (or at least shouldn't) hold an equivalent place in Islam to that which Jesus holds in Christianity. Hence all the, y'know, times he said not to worship him, only God. On this hypothetical Islamopedia, they may react in the way that you describe, but then they are moving against what their religion teaches; a somewhat familiar situation, methinks. --ויִכִּ נתֶּרֶפּרֶתֵּר שְׁלֹום! This doesn't necessarily follow from where the conversation is at now, but how is this any different from The Anarchist's Cookbook being available on Amazon or whatever? It's a manual for inforevolutionaries in general, just using CP as a source of examples, not necessarily as sole target. None of the stuff in it is exactly all that secret, or even that hard to find out, it's just presented in a way that saves a lot of time on making mistakes to learn from. Is it justified? Well, is any struggle justified? --Kels 19:02, 8 June 2007 (CDT) - I made the point somewhere on the talk page (which is actually where this discussion should be held, by the way), somewhat ironically, that this article is exactly has the same status as the artefacts created by an arms manufacturer, and purveyed by an arms dealer. I think, and continue to think, that anyone who believes that it is valid to sell weapons should not be surprised when they are at the wrong end of one. In the same way, if your avowed intent is to set up a website which purveys a single point of view, which is dangerous nonsense, and deliberately and pre-meditatedly prevents others from voicing rational and legitimate arguments which counter that point of view, you should not be surprised if those others find alternative means of getting their voices heard - even if those means consist of diluting, subverting or mis-representing your views.--CatWatcher 04:24, 9 June 2007 (CDT) [edit] Sodomite Also, when you have time, check out Sodomite. (That's more innocent than it sounds).DocSock 18:45, 4 June 2007 (CDT) [edit] Ave Ames! When you're not too busy, could you give me a hand on the Conservapedia:Timeline article? I'm sort of ... stuck, with regard to major events, and humbly request the aid of the old guard. --ויִכִּ נתֶּרֶפּרֶתֵּר שְׁלֹום! [edit] Please feel free to use my talk page It is an open forum for all debate. Fun to watch, too. [edit] Look… I don't know what the issue here was, but jtl and E: Just leave each other alone. There's no reason for you to fight over minutia. Any complaints about the way I handled things will be listened to, don't worry. --Linus(plot evil tech) 23:49, 16 June 2007 (CDT) - No problem here, chief! Pull up one of Ames chairs, and have some of this exceptional fondue Doc sent over! --Ë. 00:03, 17 June 2007 (CDT) - I'm going to go through tomorrow and see exactly what the problem was. I'm incredibly sleepy right now (it's 1 AM), and can't deal with it. Again, complaints are welcome. This bloody rubbish wouldn't occur if people would behave with an ounce of civility. --Linus(plot evil tech) 00:11, 17 June 2007 (CDT) What happened, guys? Sorry, been completely out :-( . Back soon though! -AmesG 00:22, 17 June 2007 (CDT) [edit] Welcome back Did you go somewhere? Somewhere cool? Anyway, it's nice to have you around again! humanbe in 22:22, 19 June 2007 (CDT) - Glad to be back! Work's just been busy lately! I can't even promise I'm back for long... but I try!!!!-AmesG 22:28, 19 June 2007 (CDT) - AMES!!!!!!!!!! - Good thing your back, we need your stabilization is our myriad flamewars. --Linus(plot evil tech) 22:30, 19 June 2007 (CDT) - By the way, a link to "" is not permanent. You gotta dig up the template behind it and link to that. A pita, I know, and I should do it for you... (re: your link on the timeline, which maybe should be on "in the media", but it's all good, as the neo-hippies say, when they've just behaved atrociously. Whup! Was that me?) humanbe in 22:54, 19 June 2007 (CDT) Thanks buddy ;-)-AmesG 22:59, 19 June 2007 (CDT) - Now that we have you back, ?archive time?--PalMD-yada yada 23:02, 19 June 2007 (CDT) Prolly :-)-AmesG 23:24, 19 June 2007 (CDT) [edit] Doin's afoot & what have I missed I don't want to alarm, but there are doin's afoot. We have some exciting Conservapedia contacts (having sworn off that rag myself, I've taken to recruitment). Additionally, is there anything I should be paying attention to/should have been paying attention to and should now try to correct? Sorry again :-/-AmesG 00:03, 20 June 2007 (CDT) - Incessant unmoderated flamewars, perhaps? :) --Linus(plot evil tech) 00:12, 20 June 2007 (CDT) S'what I'm here for :-P -AmesG 00:52, 20 June 2007 (CDT) [edit] are your ears burning? They're talking about you over at CP Jrssr5 13:24, 20 June 2007 (CDT) - And Planned Parenthood is making big $$ off abortions. Who knew? MyaR 13:28, 20 June 2007 (CDT) - If you read Ashfly's wording there, he basically equates Liberal with the medieval and fundie concept of Satan: the pleasant deceiver, etc.--PalMD-yada yada 13:30, 20 June 2007 (CDT) - Poor Will N. So naive. Someone should get him over here, there's still hope he can escape becoming a mindless assfly drone. Jrssr5 14:07, 20 June 2007 (CDT) - Well, he is only about 14 (and posting things he really shouldn't be on the internets), although he's also the one who likes banning people most because then they can't defend themselves, and would like to get a gun... Sometimes I think the only hope for these kids is to be completely removed from their families somehow, and that just won't happen. MyaR 14:12, 20 June 2007 (CDT) - Not to say I think these kids should be taken away, but that I hope that they all get to college or a good high school where they're exposed to more actual science and dissent, and have to learn to actually think about things and not stay cocooned from nasty, deceitful liberals who are out to lead them astray with false helpfulness. MyaR 14:21, 20 June 2007 (CDT) - Seems like poor Will's got a bad case of hero worship. Perfectly normal, just the wrong object. --AKjeldsenGodspeed! 14:26, 20 June 2007 (CDT) - He still acts older than Andy. olliegrind 14:30, 20 June 2007 (CDT) - If AmesG isn't an appropriate object of worship, I don't know who is!162.82.215.199 14:33, 20 June 2007 (CDT) Yeah, I saw that. I shot SharonS a message using my PocketPC from the Starbucks in my office building :-) and he seemed to not like that. No worries, though, Andy'll have another message from another Starbucks, soon.-AmesG 18:10, 20 June 2007 (CDT) - Sorry to be subjecting your usertalk to this, Ames, but since this is where the original comment is -- this is odd. Did anyone really think I meant that CPS should go in and tear kids away from their parents? Just to clarify, I meant that these kids need to be exposed to more than they are now, which, practically speaking, means they need to be removed from (in a distance sense, which was an admittedly poor word choice on my part) their current environment. But then, they do believe that quote-mining is the best way to support an argument (or attack, which really is the same thing for them, mostly). MyaR 09:10, 21 June 2007 (CDT) - I don't think anyone made a serious suggestion to send homeschooled kids to reeducation camps. Many have made the point that they are too isolated from the real world and real knowledge. I have know doubt that their spiritual needs are cared for, but they also need to know why their PCs work.--PalMD-yada yada 09:20, 21 June 2007 (CDT) - Well, sure, that was exactly my point. But apparently, that's the 'sickest thing' they've ever heard. I'm extremely grateful that college allowed me to get away from the religiosity of my family (and they're much less crazy -- they knew they had to raise their kids to live in the real world and think for themselves). While I had a certain amount of insularity growing up (we lived on a farm), my parents didn't want us to want to stay close to home. They felt their biggest responsibility in raising us was to teach us to be responsible, independent people. (And yes, they're YECs. Proof that they're not all completely batshit crazy.) MyaR 09:33, 21 June 2007 (CDT) - The scary thing is, even the westboro baptist church folks (those of godhatesfags fame) don't homeschool their children. At least they're confident enough of their beliefs to give their kids the chance to be around other kids and ideas. How scary do andy&co seem now? (i am willing to be contradicted on this, i've only seen the louis theroux documentary - it's on youtube). Oh, and just in case there's any doubt (i'm looking at you Andy, hehe) I think the westboro people are evil evil evil fucks and i feel so sad for their kids. δαιισρΗταλκ 09:46, 21 June 2007 (CDT) [edit] Re:must be nice..... We are not pushing an ideology. We are not pushing a world-view. We are not suppressing faith. We respect faith. Oh really..... Bohdan 19:31, 20 June 2007 (CDT) - Before your post on Mr. Schlafly's talk, his page was replaced with "'ASCHLAFLY EATS JEWS!!!!!!!!!!!!!!!!!!!'" and '1(EvvEDGE PWNS U!!!!'. These were most likely your vandals..... Bohdan 19:34, 20 June 2007 (CDT) - Because all vandalism at CP must come from rationalwiki right? Tmtoulouse 19:36, 20 June 2007 (CDT) - Isn't Icewedge yours? Bohdan 19:37, 20 June 2007 (CDT) - And, more importantly, each person here is responsible for what each other person here does or doesn't do, right? MyaR 19:37, 20 June 2007 (CDT) - Icewedge is the sign off for probably half a dozen or more vandals. Tmtoulouse 19:38, 20 June 2007 (CDT) - The same (*cough*) "half dozen" who always tests out histheir latest vandal schemes on RW sandboxes... לול 20:26, 20 June 2007 (CDT) - If you want to attribute all the vandalism to one person so be it....the legend lives. Tmtoulouse 20:29, 20 June 2007 (CDT) - And they chose this name because.... Bohdan 19:39, 20 June 2007 (CDT) - Old school psychological warfare.....attribute everything you do to a single person that may or may not exist but certainly isn't doing it all and you create a "legend" a "force" much more effective. Tmtoulouse 19:41, 20 June 2007 (CDT) - So..... Icewedge is Keyser Soze? olliegrind 06:28, 21 June 2007 (CDT) - This is my personal opinion...don't anyone generalize it. Mocking a religious belief is not inherently disrespectful...mocking a person is. Religious beliefs are prima facie ridiculous to anyone who doesn't share them (e.g. FSM, IPU, Xenu, Jesus). If it bothers you, don't read it. It is NOT in any way akin to actual persecution or racism...if you say "All Christians should be jailed" or some such nonsense, that is unpleasant (but NO hate crime laws, remember?), but different from "Resurrection is a silly idea."--PalMD-yada yada 19:40, 20 June 2007 (CDT) - Hate the sin not the sinner....Tmtoulouse 19:43, 20 June 2007 (CDT) - Can you prove to me Ashfly doesnt eat Jews. I mean, I do truly believe it. Where is you attribution?--PalMD-yada yada 19:42, 20 June 2007 (CDT) - I assume this is a joke? Bohdan 19:42, 20 June 2007 (CDT) - Is it any sillier than saying that God created the Earth in 7 days cuz i read it in a book? Same level of evidence.--PalMD-yada yada 19:43, 20 June 2007 (CDT) - Lets not get into that. Wheres Ames? Bohdan 19:46, 20 June 2007 (CDT) - Check the wet bar downstairs....Tmtoulouse 19:47, 20 June 2007 (CDT) - You and I both know that this wiki does not have a downstairs! Bohdan 19:53, 20 June 2007 (CDT) - Its for the goats only. Tmtoulouse 19:59, 20 June 2007 (CDT) - Who said anything about a cabal? Tmtoulouse 20:06, 20 June 2007 (CDT) - I'm just pointing out that respecting someone of faith does not mean i have to respect their beliefs as well.--PalMD-yada yada 19:48, 20 June 2007 (CDT) Bohdan, I don't support meaningless vandalism like the "Schlafly eats Jews" stuff. Is that all you have to say?-AmesG 21:21, 20 June 2007 (CDT) - By the way, Bohdan, did it ever occur to you that there is a whole world of people out there who think CP is a little, um, silly, and every time another glowing press piece comes out, they flock there to insert their mocking, deceitful comments? humanbe in 21:54, 20 June 2007 (CDT) Bohdan, at least 75% of us here are not vandals. However, less than 1% of Conservapedia sysops are not filling young children's minds with bullshit, and teaching them closed-minded bigotry.-AmesG 22:11, 20 June 2007 (CDT) Re vandalism, prove it. And no, just because we disagree doesn't make it closed-minded bigotry. However, insistence on the validity of only one viewpoint, and the refusal to permit any dissent, DOES make it closed-minded bigotry.-AmesG 22:19, 20 June 2007 (CDT) Ames - by your reckoning, there are less than 0.29 decent sysops in CP - the question remains, which ones? --ויִכִּ נתֶּרֶפּרֶתֵּר שְׁלֹום! [edit] It's hard to live up to our principles. But at least we have principles. Many people have noted that it's almost impossible for us to live up to the principle of acceptance and complete free thought. It's something we deal with every day. However, I would like to state that by merely having this goal, and making a good faith, legitimate, and significant effort to live up to it, we already surpass Conservapedia 100%. Please keep in mind that we're trying, and we will keep trying until we get it right.-AmesG 22:18, 20 June 2007 (CDT) - I assume this is directed to me, right? Bohdan 22:28, 20 June 2007 (CDT) - Many people have noted that it's almost impossible for us to live up to the principles that G-d and Yeshua haMosiach outlined for us. It's something we deal with every day. However, I would like to state that by merely having this goal, and making a good faith, legitimate, and significant effort to live up to it, we already surpass Rationalwiki 100%. Please keep in mind that we're trying, and we will keep trying until we get it right. לול 22:33, 20 June 2007 (CDT) - It depends on who "we" is. I think anyone who has an exclusionary view of the universe (believe as I do or rot in hell) is not going to live up to any great principles except with fellow believers.--DoxXox-DawkT0wk 22:37, 20 June 2007 (CDT) - ROTFL! CP living up to god's and whoever that other person is' principles? Give me a break! It was at CP that I learned that "turn the othe cheek" means "so you can aim better down the barrel! Godspeed! humanbe in 22:40, 20 June 2007 (CDT) - LoL - funny how that only applies to Christians, not atheists :D You people are such hypocrites :D "I think anyone who has an exclusionary view of the universe (believe as I do or you are a moron/need to be removed from your family/are of inferior intellect/deserve to be vandalized) is not going to live up to any great principles except with fellow believers... לול 22:43, 20 June 2007 (CDT) - It is an interesting discussion, that would have been shut down on CP. QED.--DoxXox-DawkT0wk 22:46, 20 June 2007 (CDT) - Hey, Im just the chef. However, i dont think you can deny that this discussion would be quickly shut down. I suffered many a ban this way. 90/10, remember?--DoxXox-DawkT0wk 22:50, 20 June 2007 (CDT) Yeah, I have to say, for being good "Christians," CP doesn't speak well for living up to any principles other than sheer vindictiveness. Andy just deleted my letter to Sharon, encouraging her to keep an open mind, proving my point once and for all, and I heard through secret communiques that the same letter made Karajou want to hunt me down and punch me! Christian charity indeed! Honestly, I believe Christianity can inculcate good morals, but who here seriously believes that Conservapedia is anywhere near that goal? Rather, who here honestly believes that Conservapedia hasn't run so far in the opposite direction that it can't even see the starting point anymore?-AmesG 23:36, 20 June 2007 (CDT) - Your letter was inappropriate for Conservapedia.¿ Sta’le ? 23:47, 20 June 2007 (CDT) - It makes me smile when Andy falls right into our traps. He can delete all he wants, but it's in the page history, and he's going to look like a loser to anyone who realizes that he censored a letter about him censoring content.-AmesG 23:49, 20 June 2007 (CDT) That is the point! How can one claim to be open, and welcome intellectual discourse, but stifle all debate? More and more CP tilts towards YEC, with them now even removing Mormons from the rolls of those considered "Christian". Conservative is quite a busy beaver inviting "experts" to comb through articles, changing and reverting on a daily basis. Removing anything considered offensive or questionable by these "scholars". Ames hit the nail on the head, with posting to Sharon. It so infuriated him, anyone who might dare to try and free one of his robots, so they might somehow live a normal life, he is trying to eradicate all signs of it happening. --Ë. 04:29, 21 June 2007 (CDT) [edit] Case in point Aschlafly's Contribs: - 00:24, 21 June 2007 (hist) (diff) User talk:TK (→Comments: - enough said) (top) (removing comments to Open Letter) - 00:23, 21 June 2007 (hist) (diff) User talk:TK (→Open Letter - inappropriate letter) (removing Open Letter) - 00:21, 21 June 2007 (hist) (diff) User talk:SharonS (talk page is one's castle here) (top) (removing notice of Open Letter) So, according to Aschlafly, a user's page is one's castle, but when something's on it that Aschlafly doesn't like, then he deletes it for you, to "protect" it, your wishes as to this protection be damned. Further, Aschlafly deletes a letter that lambasts him for deleting things that lambast him. Check, and mate.-AmesG 23:44, 20 June 2007 (CDT) - Good job AmesG! Two people were banned trying to revert Andy's edits. ¿ Sta’le ? 00:06, 21 June 2007 (CDT) One was me; the other is a hero!-AmesG 00:06, 21 June 2007 (CDT) NICE DUDE.-AmesG 00:10, 21 June 2007 (CDT) - (diff) (hist) . . User talk:SharonS; 01:04 . . (-227) . . Aschlafly (Talk | contribs) (one's talk page is his castle; all violators will be blocked) Of course! I mean, he's talked himself into a corner before, but shit, this is some kind of record.-AmesG 00:13, 21 June 2007 (CDT) [edit] Missing.... CPWebmaster, Philip. Anyone know what is going on? --Ë. 04:33, 21 June 2007 (CDT) - Good point. No idea! Karajou's been less active, too.-AmesG 07:13, 21 June 2007 (CDT) [edit] TK "retirement" Please see his comment near the end of the section titled "block" on my talk page to see what I am asking or talking about. No point in more than one person working on this until a "compromise" is reached, then we can "all" decide if it seems appropriate. Although, apparently, "7 out 10 members polled told me anything you would come up with would neither be graceful or a compromise" so I might not be much help. humanbe in 11:14, 22 June 2007 (CDT) - I hope he doesn't try to break The Who's record of number of "farewell tours"... --Kels 16:03, 22 June 2007 (CDT) Jesvs tap dancing Christ. If that's everyone's attitude - snipe bitch bitch - it's not worth it. We need all sides to make a bona fide effort here.AmesG 16:13, 22 June 2007 (CDT) - Hi AmesG, apparently I forgot to check the box that enables users to email me - what a maroon! EW forwarded me a note on the forum saying you were trying to email me? And, that's 'Jesus on an Easter Tree' to you! humanbe in 20:54, 22 June 2007 (CDT) [edit] Will and Andy Thought you might be interested in this. G dlessLiberal 18:12, 22 June 2007 (CDT) - I thought you might be intersted in your new and better sig. humanbe in 01:10, 24 June 2007 (CDT) - oooooooooh gold. G dlessLiberal 15:16, 25 June 2007 (CDT) - Human, you are just so creative, you should make a page here on signature minipulations, tips and tricks! --TK/MyTalk 16:06, 25 June 2007 (CDT) - Gee thanks... I was just ehlping him further "commify" his sig. Yours could use some nice Greek characters (Oh, wait, Tau and Kappa look exactly like T and K...), in your favorite colors... humanbe in 16:19, 25 June 2007 (CDT) - Yes, I thought of that....:-( Maybe I need a nick in place of the user name, "TK" so it could be more in step with this community....--TK/MyTalk 16:37, 25 June 2007 (CDT) - Wiki has Hebrew characters for his sig. They don't look the same as the Greek and Latin. G dlessLiberal 11:06, 29 June 2007 (CDT) [edit] If Only I'd Known... I'd have come here a lot earlier. I didn't know this existed until I saw the LA Times article.--Dave3172 18:34, 23 June 2007 (CDT) - WELCOME, DUDE. So glad to have you here! I'll be on more later...-AmesG 00:53, 24 June 2007 (CDT) - You bastard, it takes me twelve minutes to fuck up a CP article because of the great pic, and you get to be cool by adding to it in 3 seconds! humanbe in 01:10, 24 June 2007 (CDT) - Dave! How did we not recruit him? G dlessLiberal 15:16, 25 June 2007 (CDT) [edit] Hein v. Freedom From Religion Foundation Inc If you have some time it would be awesome if you could help us parse out this case...what exactly is the consequence of having a 3-2-4 split decision? How might this effect future cases on Establishment clause violations? Do you think this bodes ill for Flast v. Cohen in general? I think it is very important to understand, and I am really struggling with it. Tmtoulouse 20:43, 25 June 2007 (CDT) - Got it, but first amendment isn't my specialty. I'll read over it tomorrow at work. Can you give me a citation for Flast, though? Good to hear from you!-AmesG 22:57, 25 June 2007 (CDT) - Here is Flast, its the main ruling that gives tax payers standing for Establishment violations that involve distribution of tax money. I would have an easier time dealing with the Hein ruling if it wasn't a plurality decision. I have never understood the precedent effects of plurality, from what I can gather it both does have and does not have precedent.....anyway, I think the Hein case is important for a lot Establishment cases and is certainly related to issues we talk about around these here parts! If you have time some information about all this would be awesome...playing to our strengths and all :). 24.141.169.255 23:24, 25 June 2007 (CDT) Happy to help tomorrow :-). Plurality opinions are fucked up, by way of quick statement: look, for example, at Bakke, the original affirmative action opinion saying that diversity is a legitimate reason for state action in affirmative action. That was a plurality opinion. If you view lawsuits as a syllogism, while Bakke resolved the conflict at issue (the Minor Principle), allowing the instant affirmative action case to stand, it did not solve the issue of whether diversity is a compelling state rationale in other cases (the Major Principle). 20 years of legal wrangling ensued. Then we got Grutter. So, plurality opinions don't do much. They indicate which way the Court is thinking, and give guidance to lower courts in some semblance, but there's still room for litigation. It's ugly. That's why it was essential, too, that Brown was unanimous: there's always room for litigation with even 1 dissenter. With 3-2-4, well...-AmesG 00:19, 26 June 2007 (CDT) [edit] Purge? So, got more info?--DoxXox-DawkT0wk 13:35, 27 June 2007 (CDT) Comes from our best & highest-placed source: every reason to trust him/her.AmesG 13:48, 27 June 2007 (CDT) - Nothing's beyond our Ken. Geddit? God's peed Babel fishÅЯ†ђŮŖ ÐΣй†Now look here! 13:59, 27 June 2007 (CDT) Maybe we averted it by talking about it? I hope CP is getting the message: we know everything :-). -AmesG 20:28, 27 June 2007 (CDT) [edit] Sorry I reverted your hilarious Wandalism to Staple's sig. ɧєɭıסş-get sunburn! 00:03, 28 June 2007 (CDT) - Dude, it was the best wandalism ever! Ah, I remember why you guys are fun. I should stop my boring, pointless CP attacks, shouldn't I?-AmesG 00:07, 28 June 2007 (CDT) Blocking a sysop is a blockable offense!!! Go to Wikipedia with your liberal blocking.-αmεσG 08:53, 28 June 2007 (CDT) [edit] Re:welcome [edit] sorry to implicate you, just having fun No hard feelings, I hope. Heart♥Gold tx 00:41, 30 June 2007 (CDT) - Heart! What'd you implicate me in? I feel badly, you incorporated one of my joking criticisms of you into a criticism of yourself. I guess it sounded mean because I made it when I was in a bad mood. I actually really like you, and I apologize deeply if you got the wrong impression. I can understand why you would have. My responses to your RFC will all be positive. We disagree on a lot, but I respect you a lot for being here and putting in commentary. So I'll start acting like it. Sorry again :-(. But what'd you implicate me in?-αmεσG 00:48, 30 June 2007 (CDT) - If I did include it, it was really a coincidence, I don't keep scores on RW...I just saw you contributed tonight, and were on line. Don't even respond...just playing around. Bored. Leaving tomorrow, gotta get some sleep. Heart♥Gold tx 00:50, 30 June 2007 (CDT) [edit] lol i know you Yes, I have seen many of your edits on many a talk page over on CP. I like your style, stranger. OUPS I FORGOTS TO SIGN MY EDIT GrandSoviet 00:45, 30 June 2007 (CDT) - Thanks dude! We'll hang out, plot some evil, enjoy some goat. Glad to have you over here! I like the style of anyone who gets blocked out of CP...-00:49, 30 June 2007 (CDT) - Well, I smoothed things over and I'm not blocked anymore. I'll tell ya the full story sometime. But, uh, can I get something with less goat in it? GrandSoviet 01:03, 30 June 2007 (CDT) [edit] Phoenix Clearly this is still more evidence that the CP sysops assume there's only one user per city. I believe DanH was intimating on my talk page that since I'm from Halifax (ish), I must be DemocraticUnderground, although he was pretty vague about it. --Kels 18:35, 30 June 2007 (CDT) - Hoji and I are both from the Seattle area -- does that mean I'm a CP sysop and don't even know it? --jtltalk 19:37, 30 June 2007 (CDT) Well, you didn't specifically say you were from Halifax, and I know that it's a fairly large city, so I figured that it was a possibility, but I didn't necessarily think it was conclusive. DanH 22:12, 1 July 2007 (CDT) [edit] CALL TO ARMS (Main Page on CP) ALL GOOD RW MEMBERS: - Log onto Conservapedia now, with your socks or what have you, and defend the good efforts of Mtur and JoshuaZ in pwning Philip & Andy in an easily-winnable YEC science debate. Please! I'm out of IPs, but this is a cool debate, and we're doing well! Go here to fight the good fight!-αmεσG 20:38, 1 July 2007 (CDT) ɥοםЄʟβЯƏакĐΩωΝ 05:01, 2 July 2007 (CDT) [edit] Hope in Houston, TX At a restaurant on the outskirts of Houston, TX, I saw a young kid reading "The Blind Watchmaker." Maybe there's hope after all!-αmεσG 20:10, 2 July 2007 (CDT) [edit] oops sorry about the "idiot" part there in the block reason, ames. Nothing personal. I just didn't like the "Failure at life" line. it was cruel and uncalled for. Bohdan 20:19, 2 July 2007 (CDT) - Hi Bohdan! I thought you retired? Speaking of retirement, any ideas why Kangaroo retired? Baramin trouble? humanbe in 20:47, 2 July 2007 (CDT) - I still am retired. I just came to tell Ames not to take the idiot part personally. As far as Karajou, I haven't any idea. It was shocking news to me. Bohdan 20:49, 2 July 2007 (CDT) - B, if you don't mind, I have a quick question. I presume you are blocking "editors" at CP who are socks of people you know over here (and from there). How on earth do you know whose socks they are? humanbe in 21:00, 2 July 2007 (CDT) I did put that on my user page. Danny Ocean I am not. Well, I can be if I try. But yeah, sorry Bohdan. Nothing personal against you, either: I actually like you quite a bit, since I think you're very honest & kind. I would never call you a failure at life; that would be cruel, because you're a nice guy. But Roger Schlafly really is a failure at life. Also, I had the spread the word about KDBuffalo = KevinConley.-αmεσG 21:13, 2 July 2007 (CDT) - Kevin Connolly? I take it we're not talking about the Holy Cross hockey player. But come on Ames, you really don't even know Roger Schlafly. Even if you disagree with him, that doesn't make him a failure at life. Lets be reasonable. Bohdan 21:20, 2 July 2007 (CDT) His edits are just shy of the IQ of a rock, and exemplify the uber-moronic to such a shocking degree that even Aschlafly distances himself from some of them. Come on. On the genetic Wheel of Fortune, he never even had the chance to buy a vowel. Oh, and I think I meant KevinK, the guy who wrote that forgery about TK.-αmεσG 21:23, 2 July 2007 (CDT) - I don't agree with you at all, but I have to say that is one funny analogy! Bohdan 21:25, 2 July 2007 (CDT) Hmmm. I am le curious. So what's the chance of us being able to keep you around, Bohdan? You seem to enjoy the debate et al, and it's nice to have people like that around. Are you still going to R E T I R E after this debate is over, or will you pull up a goat and stay a while? We've kept your goat warm for you :-). Well, Human did, at least. -αmεσG 21:29, 2 July 2007 (CDT) - I actually only came to apologize for the idiot remark. I'll probably leave now. This was pretty fun. Bohdan 21:31, 2 July 2007 (CDT) d00d, I will pwn Human for you. And we're always glad to have you, stop in for a laugh sometime :-). Has the TK fallout almost died down, or have TK & RobS killed each other, or what's going on? Oh, and one more thing: have Andy Schlafly e-mail me. I offered to take him out to lunch, my treat, in New York when I move back in the fall, but he never got back to me. How rude!-αmεσG 21:34, 2 July 2007 (CDT) [edit] PalMD likes teh Sodomites Get your underpaid, overworked tush over to Sodomite if you ever get a chance and it seems worthwhile. --PalMD-Goatspeed! 22:02, 2 July 2007 (CDT) - Done.-αmεσG 22:04, 2 July 2007 (CDT) - Better?-αmεσG 22:49, 2 July 2007 (CDT) - Much appreciated, counselor.--PalMD-Goatspeed! 22:51, 2 July 2007 (CDT) Thank you, Doctor! Writey writey shakey shakey. Any other suggestions?-αmεσG 22:52, 2 July 2007 (CDT) - Nah...now that i dont have tonsils, i dont snore, which means i can sleep in my bed with my wife, wink wink, nudge nudge.--PalMD-Goatspeed! 22:53, 2 July 2007 (CDT) Did you get them removed? Oh, and good boy, go do that. Good stuff.-αmεσG 23:13, 2 July 2007 (CDT) [edit] if you feel like it I'm working on the Karajou thing you forced on me, and he has a poor reading of the basic documents establishing the USA. I'm working on it, but if you feel like cutting short my research by putting in the stuff you already know, feel free.--PalMD-Goatspeed! 12:46, 4 July 2007 (CDT) - Awwwww yeah. Edit conflict time. Gotta go for a bit pretty soon, but I'll see what I can do.-αmεσG 12:47, 4 July 2007 (CDT) - Ok, if you want, ill keep plugging away for now.--PalMD-Goatspeed! 12:49, 4 July 2007 (CDT) [edit] PF Fox's Blogs PF Fox is going to join us soon. I told her she's a hero of ours for fighting the good fight on Conservapedia, and she has a few blogs that some of us might want to check out. She has a five-part section on Conservapedia currently under development. Clearly, she's pretty awesome. - - - - -αmεσg 20:36, 5 July 2007 (CDT) [edit] Cleaning up Now that you've moved your sig template to User:AmesG/AmesGsig, I was wondering if the leftover redirects [[Template:AmesGsig]] and [[Template talk:AmesGsig]] could be deleted? There's nothing linking to them at the moment. -- Stevo (talk) 09:06, 6 July 2007 (CDT) - That's fine, we're just having fun cleaning up all the linkless redirects at the moment. Thanks -- Stevo (talk) 10:10, 6 July 2007 (CDT) [edit] Oh great NYU Lawyer[sic], "loser"? Now I have been known to parse some nasty legalize in my time on this here Earth and I think I knows what this says, I think it says that we can assign additional copy rights beyond GNU FDL to original works here at RW even though we use mediawiki and wikipedia documents. But why don't ya have a look and see if ya agree with my legal like analysis: ." Tmtoulouse 10:22, 7 July 2007 (CDT) - I think it means that the site's copyright would not be imputed to all documents: "the whole is [less] than the sum of its parts"? What are you pulling this from? If you give me the name of the primary source, I can tell you more about it by seeing what secondary sources (treatises) say about it, to make sure that as-applied it's what we want.-αmεσ (!) 11:43, 7 July 2007 (CDT) - Here is the source. Again the question is, can we release specific works under a MORE restrictive copyright than GNU FDL on our site, using mediawiki, if it does not use any GNU FDL document material. Tmtoulouse 11:47, 7 July 2007 (CDT) Shit, this is complicated. To clarify, it matters that we're using MediaWiki because MediaWiki requires GDFL. We want to release some articles under more restrictive rights, though. Right?-αmεσ (!) 12:31, 7 July 2007 (CDT) - Right thats what I am afraid of, that use of mediawiki means anything on mediawiki will require a GDFL copyright. I know you can release stuff on a more "open" copyright...but yes...the question is can you release something thats more restrictive. Tmtoulouse 12:36, 7 July 2007 (CDT) *Searching.* I'll let you know what I find.-αmεσ (!) 12:46, 7 July 2007 (CDT) - By the way, the issue here is small, but in a nutshell, if someone wants to post something and keep the copyright as an original work (like a poem or essay), can they? I do have one thought, and that is to essentially put it in quote marks. So if I wanted to post the lyrics of one of my songs under essay:, I could start the essay "So and so wrote this, quoted in its entirety by permission of the copyright holder", and then quote the whole damn thing and provide a source. Clumsy, but workable? humanbe in 13:54, 7 July 2007 (CDT) I have no idea yet. I'm looking through some stuff, but unfortunately have a bit more to do today :-P. I'll keep you aprised Human, though. I'm thinking of writing some of my friends who know copyright law...-αmεσ (!) 15:06, 7 July 2007 (CDT) BTW I'm still working on this, I haven't forgotten :-)-αmεσ (!) 00:18, 9 July 2007 (CDT) [edit] Interesting article Thought you might find it interesting. Tmtoulouse 13:14, 7 July 2007 (CDT) - Supreme Court opinions truly do make for good reading :-). Especially Scalia's (I hate to admit it), because he's SO DAMN ANGRY. You can almost see the veins pumping while reading his opinions on the "homosexual agenda."-αmεσ (!) 01:11, 8 July 2007 (CDT) [edit] Facilitated communication I'm working on the legal section...if you see anything you want to contribute....--PalMD-Goatspeed! 15:02, 9 July 2007 (CDT) [edit] mottoes and slogans Hey, I took out that you inserted, all it does is make fat white space. Maybe one of the divs can be edited to add a few pixels if necessary? And, if you add any more great slogans under the current system, can you also add them to the list here: Template:RationalWiki Slogan for when we get RandomSelection running? humanbe in 21:13, 9 July 2007 (CDT) Dude, it was funnier when you didn't have the nowiki tags, and I had to figure out what you meant :-).-αmεσ (!) 21:26, 9 July 2007 (CDT) Ass.-αmεσ (!) 21:32, 9 July 2007 (CDT) - Wipe ~~~~ "Human's undo undid inclusion of my latest motto :-(" Oops, sorry, I shoulda known better... clueless wikian here! (actually too lazy to edit instead of undo) And hang on a with the new ones, it's just more pagedelete work once we get that extension installed by one of our absent back end boys. humanbe in 21:39, 9 July 2007 (CDT) Daaaaaaaaaaaaaaamn you clever. Do you like my new retired template :-) -αmεσ (!) 21:43, 9 July 2007 (CDT) [edit] Article idea I have been doing something thinking, with the way that a lot of issues that involve science seem to be getting settled before courts these days I think an interesting article would be the discussion about the difference between "standards of evidence" for how a court might decide one way or another, versus how science ultimately decides between two competing ideas. Tmtoulouse 21:45, 9 July 2007 (CDT) - It would be. Let me first take Evidence... :-). Nah, I'll look into it. That's a real good idea actually...-αmεσ (!) 21:48, 9 July 2007 (CDT) We also could really use a good solid discussion of Daubert but that could be worked into the above article. tmtoulouse annoy 11:08, 11 July 2007 (CDT) [edit] Autism Hey we are working on a series of articles on autism and the likely "hook" is Autism omnibus trial, its got a lot of legal perspective that needs analysis and what not. If you can would you review it? Thanks. Tmtoulouse 16:58, 10 July 2007 (CDT) [edit] LLC Hey Ames how is your working knowledge of LLCs? tmtoulouse annoy 15:36, 13 July 2007 (CDT) - Zero, but I have friends who took corporations. What do you need to know and I'll forward on the question. Sorry I've been away for a million years - just finished my last week with Firm #1, so I had to finish a lot of work :-) -αmεσ (!) 19:57, 13 July 2007 (CDT) - Check the forums, you should be able to find the topics. tmtoulouse annoy 19:59, 13 July 2007 (CDT) [edit] AMES! HUGS AMES how ya been? --Hojimachong 19:59, 13 July 2007 (CDT) [edit] Need help at Freedom of Speech.162.82.215.199 16:39, 15 July 2007 (CDT) at Common law?--PalMD-Goatspeed! 19:45, 16 July 2007 (CDT) - I know NOTHING about free speech yet, at least comparatively. I will in a month or so... but I'll help on Common Law now :-) -αmεσ (!) 19:50, 16 July 2007 (CDT) - I feel good about common law. I take orders from Pal.-αmεσ (!) 21:35, 16 July 2007 (CDT) [edit] Internet Crime Ames - do you have anything to contribute to the issue of whether a) Stevecarson's bot [6] IS actually against some law; b) whether that law applies in the case of an open wiki; c) whether the FBI can or will pursue the miscreant; and d) is it possible the FBI will see the (two[7]) reports as nuisance, and would they do anything to make Andy desist? Your insight on a napkin? Doggedpersistance 19:57, 16 July 2007 (CDT) - Yeah, I'm working on this for Toulouse, too, but I've had shit time to work on it lately (sorry). Texas firms require you to split your summer between two firms rather than spending it all at one... so I just finished firm 1, started at firm 2, and the transition takes a lotta time & stress, lessening my RW time, unfortunately. As soon as that's through I'll give my opinion. A good starting place might be here: my journal actually did an issue on DMCA, and it might have some useful insights. I SERIOUSLY doubt Andy has a cause of action, though, and would be shocked if the FBI gave a shit. Using bots might be a different story, though. But lemme get back to ya.-αmεσ (!) 20:12, 16 July 2007 (CDT) Cool. Sheesh, you're busy! Doggedpersistance 20:26, 16 July 2007 (CDT) I've been bashing away a bit at archiving the entire farce since - see if there's anything you want to contribute [8]. Doggedpersistance 15:18, 5 August 2007 (CDT) [edit] Corporate Shield i am working with Trent on a corporate shield for Rationalwiki. Dagomar 19:45, 16 July 2007 (CDT) - You're a good guy. Thanks buddy! You've answered the questions I posed to you ;-). Glad to have you!-αmεσ (!) 19:50, 16 July 2007 (CDT) - I wish I had the expertise to help. Dagomar, feel free to jump in and play any time. I'm interested in hearing about your poison thing, if you want to collaborate. Need an RW angle to it.--PalMD-Goatspeed! 21:38, 16 July 2007 (CDT) [edit] is that it? One minute? Come on, Ames... Resident vandalcomplain here 21:30, 19 July 2007 (CDT) - The problem is I like you: you're the one CP'er that actually plays our game :-) -αmεσ (!) 21:41, 19 July 2007 (CDT) - I hope I am winning? Resident vandal 22:21, 19 July 2007 (CDT) [edit] dossiers on all presumptive Cabal members? I haven't seen them, are you sure they are real? Resident vandal Bohdan, you might not be party to them. I know TK is. And another unnamed source.-αmεσ (!) 01:18, 22 July 2007 (CDT) - Wow, color me paranoid! [edit] This They don't know anything about me! ɧєɭıסş-get sunburn! 03:36, 22 July 2007 (CDT) I actually don't know who they have profiles on other than me, but apparently they keep full "character profiles" in order to (presumptively) blackmail us, as TK has suggested, or, just to understand where we're coming from, as another sysop has suggested. Either way, it's creepy. Very creepy.-αmεσ (!) 14:03, 22 July 2007 (CDT) [edit] Damn you, John Law! A stain on my perfect record! However shall I live now? --Kels 17:04, 29 July 2007 (CDT) [edit] A message from Conservative:08, 9 August 2007 (CDT) Ask him to provide the full article, then we'll talk.-αmεσ (!) 23:22, 9 August 2007 (CDT) [edit] QuaeCumItaSint What does it mean? Bohdan 15:19, 14 August 2007 (CDT) - Cicero ended his debates with the statement: it means, "since these things themselves are true," and follows with a whopping conclusion, like, "since these things themselves are true, we must execute Catiline the traitor," etc.-αmεσ (!) 15:24, 14 August 2007 (CDT) Ames is a Latin & Roman Republican history scholar :-) -αmεσ (!) 15:31, 14 August 2007 (CDT) I am many things. Tinker, tailor, soldier, ninja... and lawyer, and historian.-αmεσ (!) 15:33, 14 August 2007 (CDT) Historically, kind of. My expertise was in (chronologically) the Hellenistic Era, the Republic, and the fall of the Empire.-αmεσ (!) 15:48, 14 August 2007 (CDT) [edit] It's all your fault Your Matthew 1034 got my Matthew 1036 banned (After all, the name similarity meant we had to be the same). He was one of my most promising socks, grumble grumble. 171.159.64.10 15:21, 14 August 2007 (CDT) [edit] to: Ames Dear AmesG, I created a theory of evolution mockery page with many mocking statements on the theory of evolution. One involves the Skell issue. I put it at two locations at Conservapedia. Newton 18:25, 16 August 2007 (CDT) - Was that supposed to be funny? 'Cause it isn't. It still has your ridiculous claim of a lack of evidence for evolution. --transResident Transfanform! 18:27, 16 August 2007 (CDT) - Uhmm.....Conservative? Don't give up the day job, OK? Doggedpersistance 18:29, 16 August 2007 (CDT) - Is this supposed to be some kind of Neil Hamburger routine? ollïegrïnd 13:42, 17 August 2007 (CDT) The article, linked here for your viewing "pleasure," is yet another example of why conservatives fail to have anything to match the Daily Show. Although I admire the effort. Ken, have you decided to let drop the issues I raised about the HG Wells quote-mine?-αmεσ (!) 14:34, 17 August 2007 (CDT) [edit] Thanks for your input. I made some changes to the Conservapedia theory of evolution article and the Conservapedia Social Effects of the theory of evolution. I hope you liked my choice of pictures in regards to Darwin and Stalin. Needless to say, given my previous comments in regards to Darwin's materialism and Huxley's public agnosticism and given that Darwininism cannot be reasonably shoe horned into the first two chapters of Genesis, I disagree with some of the material of H.G. Wells. Newton 15:26, 18 August 2007 (CDT) - So you admit you've quote-mined Wells. Good job. We'll continue this discussion on your talk page. Feel free to review my latest essay response to your drivel.-αmεσ (!) 16:53, 18 August 2007 (CDT) Stalinpedia. I pee address. [edit] Hey Hey Ames, I was just on wikipedia reading your comments on the conservapedia talk page. I didn't know you edited wikipedia, and I was surprised to see you there, so I went by to say "hi". I was then very disturbed by this [9] on your talk page. Do you agree with this person that your ban was comparable to a "Stalinist purge"? Do you really think that the sysops at CP are "fascists"? And do you really believe that Andrew Schlafly and the others who work to make CP a quality reference are "Nazis"? Bohdan 21:17, 19 August 2007 (CDT) - I'm disturbed by the all-too-frequent invocation of Hitler to end, or intensify, or somehow justify, any position in debate. I think the Kings of CP do repress information, and dissent, in a way that is not conducive to education or the production of a "quality reference." I think people like SharonS will have a very nasty awakening sometime around age 18, and no thanks to their "educator" and poor choice of role model. However, and I say this in all honesty, I don't group you with them. You seem honestly interested in the free exchange of ideas, for which I admire you. And you seem to like us, which makes me like you. So I don't group you with the people whom I consider to be truly awful, like Andy & Ken. And I never think it's a legitimate or respectable debate tactic to say, "Oh, that's what Hitler would say."-αmεσ (!) 21:21, 19 August 2007 (CDT) - I do however believe, as I've written previously, that Andy is essentially a cult leader and, had he more of a following, a fascist. Certainly the children cannot be blamed, not can all the editors.--PalMD-Ars longa, vita brevis 21:28, 19 August 2007 (CDT) - Hmmm, not what I wished to hear. Ames, you are a fan of The Hitchhiker's Guide to the Galaxy, right? Bohdan - I do not believe that conservative christian = fascist. Fascist = fascist, and if they happen to be conservative and christian, well, there's others who are radical and communist, etc. --PalMD-Ars longa, vita brevis 21:59, 19 August 2007 (CDT) Bohdan, what did you want to hear from me?-αmεσ (!) 22:05, 19 August 2007 (CDT) - Really I wanted to hear that your banning from CP was not at all like a "Stalinist Purge". Stalin's purges are no laughing matter. Bohdan - You never answered if you have read HHGTTG. Bohdan - Oh, I forgot to mention both of those things. No, Boh, I wholeheartedly agree with you. Just like the Nazi epithet shouldn't be tossed around, genocide shouldn't be joked about. It's seriously sad business. Have you considered telling Ken that? You have my support :-). And I have never read HHGTTG... but I intend to! Why do you ask?-αmεσ (!) 00:29, 20 August 2007 (CDT) - I was hoping someone could explain parts of it to me. I just assumed you would have read it. Bohdan 00:31, 20 August 2007 (CDT) - 42. tmtoulouse annoy 00:36, 20 August 2007 (CDT) - I haven't read the last book, but there are a lot of H2G2 fans hereabouts. What were you wondering about? --Kels 18:47, 20 August 2007 (CDT) [edit] Random legal musings So how much of the voi dire is cold reading? tmtoulouse annoy 21:43, 19 August 2007 (CDT) - They're essentially two subsets of the same thing: reading what your audience wants to hear, and then telling them that :-). Good point... Texas litigators are apparently famous for voir dire skillz, but apparently the practice is pretty strictly regulated otherwise lately :-( -αmεσ (!) 22:08, 19 August 2007 (CDT) [edit] Newton Lets see where he is going with this first. tmtoulouse annoy 18:39, 20 August 2007 (CDT) - Stop using my exact words. Also I typed mine first, so JINX.-αmεσ (!) 18:41, 20 August 2007 (CDT) [edit] Question I noticed that you called it GDFL at least twice recently. But technically, GNU Free Documentation License would be GFDL. I also noticed that Wikipedia redirects GDFL to GFDL. Is GDFL used by the actual creators, or is it just that it rolls off most people's tongues easier? ThunderkatzHo! 19:33, 20 August 2007 (CDT) - Nope, I'm just a moron. Thanks :-). Don't tell any important firms please.-αmεσ (!) 19:39, 20 August 2007 (CDT) [edit] Answer The answer was I was wrong :-( -αmεσ (!) 21:08, 20 August 2007 (CDT) [edit] I made a mess and need your mad krazy sysop skillz Ames, can you please delete Essay:Bias in Science|this essay? It's been mainspaced here. Also, I screwed up the capitalization of that new article, so you may want to fix that also. Thanks in advance for cleaning up after me.--Bayes Factor 22:27, 20 August 2007 (CDT) - I think you solved it. Did you? Glad to help if not!-αmεσ (!) 06:40, 21 August 2007 (CDT) [edit] Threatening E-mails from Aschlafly Already received one about copyrights!-αmεσ (!) 06:40, 21 August 2007 (CDT) - ...seriously? What's his claim? Or is it a seekrit? --Sid 08:00, 21 August 2007 (CDT) - Will there be a long and potentially profitable lawsuit involved? --AKjeldsenGodspeed! 08:08, 21 August 2007 (CDT) - Do not publish the email here...that could be part of the "copyright" material. St. CЯacke® 08:10, 21 August 2007 (CDT) - Post it! Keep Salmon smoked 08:13, 21 August 2007 (CDT) - PLEASE! Keep Salmon smoked 08:13, 21 August 2007 (CDT) - Agreed. Locke Always Watching...... 15:31, 21 August 2007 (CDT) - See here humanbe in 15:37, 21 August 2007 (CDT) - The irony hurts. Locke Always Watching...... 15:40, 21 August 2007 (CDT) I'd recommend calling the helpful agents at the Cinncinnati FBI office? I believe they jump right on this kind of stuff. Doggedpersistance 16:00, 21 August 2007 (CDT) - I've added his crizazy e-mails, and our replies. I'll pull it if he asks me to, though. Sorry I couldn't add it earlier; interviews all day.-αmεσ (!) 18:20, 21 August 2007 (CDT) - Wait, it still looks the same (one from TK, two from Andy, one reply by trent). Anyway, isn't a DMCA-type copyright vio demand a public document by definition? Please keep the entire exchange in public view. humanbe in 19:19, 21 August 2007 (CDT) [edit] small request Can you write (even if stubbily) Intermediate scrutiny? I ask because it tops our redlink list with 14 links (probably from the discrimlaw template, of course). I suspect you intended to write it and got bizzy IRL. Thanks! The preceding unsigned comment was left by bohdan / talk User:AmesG/Abortion is now in your user space instead of the main space, just FYI. tmtoulouse annoy 22:42, 28 August 2007 (CDT) [edit] conservapedia Yes I am THE User:Richard (Andy Oliver). I came to update that crazy peeps are writing me and telling me I am people who I am not. Richard 22:02, 26 September 2007 (EDT) I see you are back at CP?? You are not allowed to make any edits over there till you at least give us the Intermediate scrutiny article! tmtoulouse annoy 15:51, 1 September 2007 (CDT) - only for aiding in andy class:-) but I promise I'll do that yes. And RW remains priority One. Just want to ensure the chldren learn real lawαmεσ (!) 16:22, 1 September 2007 (CDT) - Real law is given by God via his Sons Andy and JC. Godspeed.--PalMD-Ars longa, vita brevis 16:54, 1 September 2007 (CDT) - There is only ten real laws. tmtoulouse annoy 16:55, 1 September 2007 (CDT) You guys need to see this. It even disappears in the right places: the Second Amendment stays intact, but the Due Process clause *poof*!-αmεσ (!) 17:16, 1 September 2007 (CDT) - Your coming back? Can I get partial credit for this? After all, I told you to email Aschlafly. Bohdan - Wait, seeing as you are a twenty-something time blocked user, maybe I don't really want credit. Bohdan 18:33, 1 September 2007 (CDT) [edit] Yer "Castle" Is gone. CЯacke® 20:30, 1 September 2007 (CDT) - Ames you know I think you're great and all but this is looking like a "please sir may I have another" moment! I shudder at the thought of being back under the thumb of those sociopaths. tmtoulouse annoy 20:44, 1 September 2007 (CDT) - The goal is to try to ensure that legal classes are presented fairly. But if TK seizes the chance to treat me as a red headed stepchild, you're right, I'm gone.-αmεσ (!) 20:45, 1 September 2007 (CDT) - Well good luck mate. tmtoulouse annoy 20:52, 1 September 2007 (CDT) Thanks :-/. Would appreciate advice you have; do you think there's value to this goal?-αmεσ (!) 20:54, 1 September 2007 (CDT) I don't understand why you should want to give AS's courses legitimacy.A bit like supping with the devil - you don't want to be tarred with the same brush. (metaphor mixing!) Think: when you graduate or whatever, do you want "Assisted Andrew Schlafley" on your resumé? - Or him saying "A joint creation with supreme court judge Ames G."? Susan Jayne Garlicktalk 20:57, 1 September 2007 (CDT) - Hah, I don't plan on any of this going on my resume :-/ and it is a delicate line to tread between affirming the project, and trying to prevent active damage done to others' educations. I feel I'm falling on the side of the latter right now. That's the plan at least. The idea of kids walking into law school with an 1800s view of the Fourteenth Amendment sickens me, and if I can fix that I'd like to... but if I cross into the former, then I'll ptfo.-αmεσ (!) 21:05, 1 September 2007 (CDT) - It's how many kids? Their parents will have the responsibility for letting AS tell them his version of law. What makes you think that what you do will stay in once the AS brain gets to work on it. I admire your altruistic motive but doubt your ability to get any real results. Susan Jayne Garlicktalk 21:15, 1 September 2007 (CDT) Ugh, TK is a pernicious little twit. Just stay away till the classes start. tmtoulouse annoy 21:16, 1 September 2007 (CDT) - I agree with both Trent and Susan, TK is an ass and you're just spinning your wheels. The only benefit, and it's a pretty vague one, that I can see is that your desire to help just keeps their own personal delusion machines spinning at full load, hastening the inevitable meltdown and complete departure from reality. Which is good for lulz, bad for CP (which is good for everyone), but not so hot for you and does little for the kids. --Kels 21:22, 1 September 2007 (CDT) - Got to admit though, the antics on your userpage over there are wonderfully entertaining. So far, after razing your "castle" and protecting it, TK's unprotected it, Jallen and TK have edited it, and then TK locked it again, all without your input, and preventing you from having any in the future. The circus has, indeed, come to town. --Kels 23:16, 1 September 2007 (CDT) I've decided that everyone here is right. I'm staying away until the class thing actually starts, having forgotten what Life with TK is really like. Blech. I'll try to do some good when the class starts... but... after seeing TK in his rarest form again, I feel unclean.-αmεσ (!) 10:20, 2 September 2007 (CDT) - If you're back here then could you sort out 3.4 x 1094 redlinks to Intermediate scrutiny. I think (95% confidence level) they're mostly yours. Apart from this one of course. p.s. glad youre here Susan Jayne Garlicktalk 10:39, 2 September 2007 (CDT) Done!-αmεσ (!) 10:41, 2 September 2007 (CDT) - WTF! How did you do all that so fast? thanx! Susan Jayne Garlicktalk 10:53, 2 September 2007 (CDT) Wow--I never thought I'd see the day when "User:AmesG" was active on CP again. I think it's going to be cold in hell. Sterileblah, blah, blah 18:21, 2 September 2007 (CDT) [edit] Ames, Ames, Ames... Why must you do this to yourself? If you really must satisfy your masochistic needs, I'm sure there are many nice professionals in your area who can oblige. --Kels 21:35, 2 September 2007 (CDT) - I like reaping the whirlwind, what can I say?-αmεσ (!) 21:40, 2 September 2007 (CDT) I see your encore has ended and the curtain has again closed. Alas. Can any of us really say we're surprised though? Could Andy really tolerate you bringing an unmandated opinion into his classes? Still, you get the Timex award for takin' a lickin' and keepin' on tickin'. DickTurpis 12:27, 3 September 2007 (CDT) - This is so classic. You're unblocked, have a few altercations with Conservative and TK, nothing major as far as I can see - at which point Karajou bursts in, starts bitching about ancient history, gives you "a very last chance", then reblocks 10 hours later without any further edits. Just like in the good old days. :D --AKjeldsenGodspeed! 13:00, 3 September 2007 (CDT) It cause your from "the site that can not be named." God it must suck to be so insecure in your beliefs that you can not even acknowledge the existence of a counter idea. I have decided they are all closet atheist and find our arguments too convincing. tmtoulouse annoy 13:03, 3 September 2007 (CDT) - Oh, dear. And class hadn't even started yet. I wonder if they'll cover that freedom of speech thing? Sterileblah, blah, blah 19:53, 3 September 2007 (CDT) Thanks! Jayjay4ever 21:30, 3 September 2007 (CDT) - That's funny ... if you look at when Karadumbass left his threat and when he blocked Ames, you'll notice that there were no edits made by Ames in between. Paranoid much? Jrssr5 10:50, 4 September 2007 (CDT) [edit] I'm not sure But I thought we didn't do infinite blocks? Locke Always Watching...... 22:04, 6 September 2007 (CDT) - For pr0n and spam bots I thought we did?-αmεσ (!) 22:04, 6 September 2007 (CDT) - I'm not sure, you'd have to ask Trent or such. Locke Always Watching...... 22:07, 6 September 2007 (CDT) - Ok, I vote infinite until stated otherwise. Locke Always Watching...... 22:15, 6 September 2007 (CDT) - Concurring.-αmεσ (!) 22:17, 6 September 2007 (CDT) - I vote a few days, up to a month. The thing is, the bots tend not to come back anyway. Even hardcore vandals go away most of the time after one rash of stupidity. Let's worry about longer times if we see the actual need to reblock an IP occur. That's my vote. humanbe in 22:44, 6 September 2007 (CDT) - Should I unblock/reblock the ones I permablocked?-αmεσ (!) 22:47, 6 September 2007 (CDT) - Probably, yes. If we find ourselves reblocking IPs that come back and spam after, say a month block, we can obviously revisit the topic. Once I realized what a putz he was, I blocked last night's vandal for a month, and each IP he then used similarly. humanbe in 22:56, 6 September 2007 (CDT) [edit] Archive Copying what I wrote at talk:global flood: Someone more knowledgable than me needs to archive a lot of this [global flood] talk page (currently, it's over 111 kb). ThunderkatzHo! 13:17, 8 September 2007 (CDT) [edit] award Ooh, that's um, pritty.... [edit] RationalWiki E-mail Accounts So, Linus set one up for me. I know my account is amesg@rationalwiki.com But can someone tell me the following.... Incoming server: Outgoing Server: SSL?: HALP!-αmεσ (!) 00:08, 9 September 2007 (CDT) [edit] proxy What exactly is a proxy? Bohdan - Bohdan, it's like an internet condom. It hides your IP address :-/. And allows me to do things like that instead of working... shoot! Again, I congratulate you on maintaining yourself as a voice of sanity on CP. You and Iduan were the only reasonable people I interacted with aside from Order :-)-αmεσ (!) 21:56, 9 September 2007 (CDT) - Have you appealed your most recent block so you can take part in the class? I have to admit sockpuppets probably don't help your chances. Bohdan 22:00, 9 September 2007 (CDT) - Does this mean you gave your cat a last name? Bohdan 22:17, 9 September 2007 (CDT) - That scares me..... Locke Always Watching...... 22:21, 9 September 2007 (CDT) - P.S. Long time no see Mr. B. I tried to rejoin so I could help kids who were getting a bad education at Andy's hands. Then I realized there were only two kids, and just how unpleasant it was to be in contact with TK, Karajou, and RobS again, and how many better things I had to do. So I have not appealed the decision. And yes, the cat has a last name... but only because the character in the book does. -αmεσ (!) 22:24, 9 September 2007 (CDT) - For the record Bohdan, how do you deal with those characters? Karajou, I think, is certifiably unbalanced, and RobS paranoid. However you do it - possibly with skillful application of goatspeed - good show.-αmεσ (!) 22:38, 9 September 2007 (CDT) Oh man, she's adorable. She's been asleep this whole time, but I'm sure she would've enjoyed the fun. I'll post a picture later, we just adopted her. And yes, her - girlfriend chose the name, and was stuck on Richard Parker, regardless of gender :-P.-αmεσ (!) 22:44, 9 September 2007 (CDT) [edit] Creepy Dude - Hey Ames Good to see you finally admitted to being Phoenix. You should have come clean long ago when the email came out. You are still playing with fire - don't you understand he will stalk you and make your life miserable - he's psychotic. By the way, it was Andy's decision to let you back, your "friend" was 100 percent against it. And your stuff is still being posted in the "special-discussion-group" for the "braintrust" (LOL) as well as the new sysop-only wiki that they made to replace the sysop-only "hidden pages" at CP that weren't well hidden: -- 85.195.123.22 22:34, 11 September 2007 (MDT) Yes, that's disturbing. Messages like this, though, are more disturbing and remind me why I decided it was a good idea to stop talking to TK. Curiosity killed the Ames.-αmεσ (!) 22:52, 11 September 2007 (MDT) [edit] Boycott Credit where it's due Ames. This boycott is YOURS! Have a bikkie! DogP 13:16, 14 September 2007 (MDT) - Bows. But in fairness I'm not abiding by it; I'm still scouting at teh CP so you don't have to :-) -αmεσ (!) 17:12, 14 September 2007 (MDT) [edit] Dreadlinks Asking permission (or requesting you) to de-redlink User:AmesG/OldCP humanbe in 15:55, 15 September 2007 (EDT) - I'll do it now; just logged on for the day :-) -αmεσ (!) 15:55, 15 September 2007 (EDT) [edit] Thanks ...for following me around with a broom...im pretty sloppy with the cats.--PalMD-Berate Me 21:33, 15 September 2007 (EDT) - Although I'm sure you'd find that most liberals are sloppy, I pride myself on my cleanliness :-D-αmεσ (!) 21:35, 15 September 2007 (EDT) [edit] Sigs I put the following in my preferences {{SUBST:User:Tmtoulouse/sig}}, goto user:tmtoulouse/sig to see that. tmtoulouse annoy 23:19, 16 September 2007 (EDT) - But then it does this. Watch the horrors. Goto user:tmtoulouse/sig and edit it and see what I have done, you dont put that code in the one you put in your preferences but transclude it. tmtoulouse annoy 23:29, 16 September 2007 (EDT) Now I see. You're a genius.-αmεσ (soldier) 23:29, 16 September 2007 (EDT) - Yes I am. tmtoulouse annoy 23:31, 16 September 2007 (EDT) So does this mean you're still going to kill all proto-lawyers with your bot?-αmεσ (soldier) 23:32, 16 September 2007 (EDT) - I think Genghis Kant blocked him, much like someone else as long as he is safely sealed your safe....just don't slip up and unblock him and unleash him unto the world..........at least until your no longer proto. tmtoulouse annoy 23:35, 16 September 2007 (EDT) - Did I miss something? Locke Always Watching...... 00:08, 17 September 2007 (EDT) - Depends on your innate fear of proto-lawyer hunting wikibots. tmtoulouse annoy 00:10, 17 September 2007 (EDT) - Shit, sounds scary..... Locke Always Watching...... 00:14, 17 September 2007 (EDT) - Best to leave him to rest in peace. tmtoulouse annoy 00:15, 17 September 2007 (EDT) - What would happen should I set him free? Locke Always Watching...... 00:19, 17 September 2007 (EDT) - WikiHorror beyond measure. tmtoulouse annoy 00:21, 17 September 2007 (EDT) - Intriguing..... now I just need to wait until everyone else is asleep, and then I set it free..... Muahahahaha..... Locke Always Watching...... 00:23, 17 September 2007 (EDT) [edit] Rome Cool stuff, I guess, but can you at least edit out the redlinks before saving them here? Wow... humanbe in 19:26, 17 September 2007 (EDT) Wait, Ames is debunking Rome? --Kels 19:38, 17 September 2007 (EDT) I took the liberty of creating the three redlinked Rome articles as basically empty stubs which now await your atention.:--Remarcsd 00:11, 19 September 2007 (EDT) - Wouldn't we have been better off removing the links? They probably all come from the Romyish template thing. Stubs become junk "random articles", and I see no reason that we'll ever, well, what? Debunk ancient Rome??? humanbe in 00:42, 19 September 2007 (EDT) More like debunking the use of Roman history to justify imperialism, is the theory. Someday.-αmεσ (soldier) 12:17, 19 September 2007 (EDT) [edit] Pi Pledge Hey check out RationalWiki:Site support and since you like userboxen you should make a couple of user boxes for each pledge level so that people who want to advertise that they have "pledged" on the site can. Then add the links on to the site support page. 24.141.169.255 17:13, 18 September 2007 (EDT) - Will do buddy. Can I brag about my prior contributions?-αmεσ (soldier) 17:14, 18 September 2007 (EDT) - Sure. tmtoulouse annoy 17:18, 18 September 2007 (EDT) Template:user pipledge it is. It'll be prettier when I get home.-αmεσ (soldier) 17:19, 18 September 2007 (EDT) - NEVERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR-αmεσ (soldier) 17:33, 18 September 2007 (EDT) [edit] Question So, do you think this case has any chance legally? Locke Always Watching...... 00:37, 21 September 2007 (EDT) - Hah! The case has happened before.... in one case someone sued Satan... dismissal on "sovereign immunity" :-) and lack of personal jurisdiction. It's pretty hilarious though.-αmεσ (soldier) 00:38, 21 September 2007 (EDT) - Here's another link. Locke Always Watching...... 00:43, 21 September 2007 (EDT) <touches nose> NOT IT.-αmεσ (soldier) 00:53, 21 September 2007 (EDT) Andrew Schlafly for the defense, your honor!-αmεσ (soldier) 15:17, 21 September 2007 (EDT) [edit] CrackBoy I was talking to him! Zhakrin 00:08, 24 September 2007 (EDT) [edit] law don't fuck with my law articles, Mr. pre-law boyyyyy!!!!! hehehe. OK, at least you didn't delete and rewrite everything I wrote... humanbe in 02:10, 25 September 2007 (EDT) - I warned you, bootch!!!! Quit schooling me with your city slicker trickery!!!! humanbe in 02:20, 25 September 2007 (EDT) Sorry Human! I didn't mean to fuxx0r it!-αmεσ (soldier) 19:40, 25 September 2007 (EDT) Always watching.....Stubbot 14:19, 26 September 2007 (EDT) - IMPOSTOR!!!! That's my line. Locke Always Watching...... 00:56, 27 September 2007 (EDT) [edit] I enjoyed that Well...getting that little essay written over at CP was fun! Note that they haven't actually disputed any of my major points. They merely launched the ad-hominator at me. Good times!--Patthew 16:31, 27 September 2007 (EDT) [edit] I.R. Baboon Wow, so I'm not the only person who watched that. Funny, I always hated the main show, but the IRB bits were gold. --Kels 14:41, 28 September 2007 (EDT) - Oh, that was cracka, not me :-)-αmεσ (soldier) 14:50, 28 September 2007 (EDT) [edit] Thought you might enjoy this On CP's anti-gay page(s) they include a list of folks supposedly arrested for just praying in public and other blather. Anyway, if you look at the part here you'll notice a guy named David Ott. Turns out, he is fabricated out of whole cloth. I thought this was really weird. Anyway, food for thought. 64.122.82.126 15:26, 28 September 2007 (EDT) [edit] Bored? So many things to do, so little time! ----ИїģḥŤ¤Ṭŗáìṇ ♦Τάļќ ǃ 00:57, 30 September 2007 (EDT) - Im free!!! Im free!!!--PalMD-Oy, mein tukhas! 01:00, 30 September 2007 (EDT) - Thx gods almightys-αmεσ (soldier) 01:01, 30 September 2007 (EDT) - Im scared of aliens--they probe your rectum without even buying dinner.--PalMD-Oy, mein tukhas! 01:03, 30 September 2007 (EDT) - So do Doctors! ;-) ----ИїģḥŤ¤Ṭŗáìṇ ♦Τάļќ ǃ 04:58, 30 September 2007 (EDT) [edit] An Apology Sorry 'bout the F-bomb on the front page. I'm still in a little shock here. Won't happen again. PFoster 20:16, 30 September 2007 (EDT) - YOU WILL BE BANNED ZOMG. No, if a site can drop the n-bomb, you're justified in being that upset. I was too. Crikey! I still don't get what metapedia is exactly; racist-a-pedia? But you apologize to me as if I had authority. You should know better than that!-αmεσ (soldier) 20:23, 30 September 2007 (EDT) - I spent, uh, 3 minutes at metaracist - o - pedia. Well, people will be idiots. No voice for them allowed here. Is that narrow-minded? Anti-free speech? No, just not allowing hard core racists to use the server space we pay for? Dumb jackass apparently has "his own wiki". Engage him and anger/bore/revert him every where he turns up here. No waste of time blocking - undo the racist crap and endlessly discuss his crap on his talk page. humanbe in 02:55, 2 October 2007 (EDT) - I still say we should purchase a (perhaps used) bot to dig up links to meta and kill them--PalMD-Oy, mein tukhas! 10:40, 2 October 2007 (EDT) [edit] Spanish Thanks for the addition how much spanish can you speak?The AlienDon't tase me, Bro!!! 01:47, 2 October 2007 (EDT) [edit] RobSmith Uh oh, did he really call this correctly? -Smyth 15:50, 5 October 2007 (EDT) - Rob just switched to total overdrive and now rollbacks anything the AmesG account ever touched. --Sid 16:29, 5 October 2007 (EDT) - Wow, that's...well, I knew he was a total paranoid whackjob but this is pretty crazy. Doesn't he bother to actually read any of this stuff? Or maybe find out if it's real material before he destroys it? All he's managing to do is make CP stupider, and I didn't think that was possible! --Kels 16:31, 5 October 2007 (EDT) - His whitewash begins. 68.205.178.238 16:32, 5 October 2007 (EDT) - Cool. A little more of this and the whole site will be nothing but copypasta glossaries, loving dissertations on anal sex and love letters to Ann Coulter and Joe McCarthy's corpse. --Kels 16:34, 5 October 2007 (EDT) - Oh snap, what should I do with banwatch of MichaelS? 68.205.178.238 16:36, 5 October 2007 (EDT) - Funny thing --Kels 16:38, 5 October 2007 (EDT) - Say, was this MichaelS' IP? It got blocked right after I posted the above. --Kels 16:41, 5 October 2007 (EDT) - Actually, I think Ames outed himself over here. --Kels 16:50, 5 October 2007 (EDT) MichaelS was me, yes, and I don't relish the comparison to Metapedia. Unfortunate. I've told them to remove all of my content, since Rob started doing it, he might as well finish... the challenge is posted in any of the latest contributions here. I think it's fair.-αmεσ (soldier) 18:01, 5 October 2007 (EDT) - Also, sorry I blanked your commentary, Kels. I was at the doctors and didn't want Rob to block my IP before I could execute my plan.-αmεσ (soldier) 18:05, 5 October 2007 (EDT) [edit] Nazis I now this is gonna be tough for you, based on past comments. Please, let us just take them down in a "free speech" world? Hang in there... humanbe in 21:41, 5 October 2007 (EDT) - I'm all for free speech but kick meta ass, please. They're a ...different type.-αmεσ (soldier) 23:18, 5 October 2007 (EDT) - I hope I will have your back before you get deeply offended. See here, at least. I know you are sensitive to this nasty racist shit, all I ask is that you let us wrangle them to the ground, rather than blocking on sight. I'm sure you're up to it. Remember, you're not alone in this battle. And, I agree. CP is "funny" & wrong. MP is just sick & wrong. humanbe in 23:42, 5 October 2007 (EDT) Oh, okay :-). I'll put the banhammer to rest. The farther away from Rob I am, the better the world is.-αmεσ (soldier) 23:47, 5 October 2007 (EDT) [edit] Goat retentive Getting a little goat retentive over your contribs, huh? RobS 15:44, 8 October 2007 (EDT) - If anyone's gone anal it's newt... Susantalk to me - There is a serious obsession with teh buttsechs.162.82.215.199 16:37, 8 October 2007 (EDT) Rob, I have no idea what you're referring to. What the hell? Go back to trying to perfect your gay bomb. Hey, if it works, you may even make a few new "friends."-αmεσ (soldier) 18:43, 8 October 2007 (EDT) [edit] block time half-life It looks like there is a nice, exponential decay curve from user creation until block, with a half-life of 5.8 minutes. VirileSterileyawn! 15:47, 9 October 2007 (EDT) [edit] that thing i emailed you back per your request. Have at it.--PalMD-If it looks like a donut, eat it 23:18, 10 October 2007 (EDT) - I didn't get 'em yet!-αmεσ (soldier) 23:22, 10 October 2007 (EDT) - Crap, i emailed a while ago...ill resend?--PalMD-If it looks like a donut, eat it 23:27, 10 October 2007 (EDT) - I just resent...check again?--PalMD-If it looks like a donut, eat it 23:29, 10 October 2007 (EDT) Aaaaaaaand NYU mail wins again. Your 11:03 message just arrived. & well done buddy! -αmεσ (soldier) 23:31, 10 October 2007 (EDT) - Those poor little intertube gerbils. Run, gerbil, run!--PalMD-If it looks like a donut, eat it 23:33, 10 October 2007 (EDT) Exactly! I look forward to seeing that dude's reply. You've pwned.-αmεσ (soldier) 23:39, 10 October 2007 (EDT) - I sent you his idiotic response about hopkins, which is a place he apparently discovered (i bet he doesnt know who osler was). He keeps re-citing the same article, which quotes the article i sent you, which doesnt mention GBS. Fucking tool. May the Goat nibble on his testes--PalMD-If it looks like a donut, eat it 23:41, 10 October 2007 (EDT) I don't know who "John Hokins" is, but he seems to place great stake in him.-αmεσ (soldier) 23:42, 10 October 2007 (EDT) [edit] I hope you dont mind On 10/10/07, Ames wrote: Ken, since you're not a doctor, and neither am I, I've copied a real doctor to talk to you about this study. Dr. L, sorry to bug you. Could I ask your help taking Ken on regarding this issue? David Jensen wrote: > Dear Ames, > > You told me that the various symptoms are gay bowel syndrome are not > related. You clearly did not read the CP article. You have shown in > the past that you do not care about facts. > > Both Johns Hopkins and Medscape state: > > "There were multiple studies of the newly recognized "gay bowel > syndrome" in the late 1970s and early 1980s. However, subsequent > attention and study has been sparse, in part attributed to reduced > frequency thought to reflect changing practices by gay men in response > to the HIV < /HIV> epidemic. This study > clearly indicates that it is still an issue, since the cases were > studied in 2001-2002." > (see: /Gay_Bowel_Syndrome ) > > Here is the Wikipedia article on Johns Hopkins in case you are not > familar with them: > /Johns_Hopkins_University _School_of_Medicine > > Next, I improved the article based on your feedback as I now in a > stronger fashion show some of the maladies of gay bowel syndrome are > related plus I added some other material. Thank you for your input. > > Lastly, Yahoo ranks the CP gay bowel syndrome #1 and I am guessing the > other search engines may soon rank it high as well especially given > your helpful feedback and the conservative organization and press > which may soon link to the article. > > Sincerely, > > Conservative I don't expect Cons to accept anything I say, but I'll say it anyway. A few points: 1) On the point about google rank, an article on any real disease will not have such a high rank. Its high rank reflects the fact that no one else is really writing about it. Compare it to, for example, breast cancer, which CP also has a controversial article on, but not much google cred. 2)"You told me that the various symptoms are gay bowel syndrome are not related. You clearly did not read the CP article. You have shown in the past that you do not care about facts." Citing your own source is bad form. 3) The 2004 and 1995 study cited in the 2004 medscape review was interesting--and repetitive. Most importantly, the 2004 study regarding proctitits (attached for your perusal) MAKES NO MENTION OF "GAY BOWEL". None at all. That is an editorial comment on medscape. What the article does make clear is the spectrum of disorders in gay men at one SF clinic--important info, to be sure. It only emphasizes the fact that "Gay Bowel" is meaningless, as there are a myriad of disorders found in gay and straight patients, and that you have to test for and treat the correct condition. Does that answer the question? PAL BTW, Ames...we totally PWND!!!!111! him.--PalMD-If it looks like a donut, eat it 12:39, 12 October 2007 (EDT) - No dude, you did :-). I was way out of my depth, but yes, in the end, he was totally pwned by the joint efforts of Ames & Pal. Great show! He's e-mailed us back a few times, just bitching, but it's all just bitching... no argumentation. Wictory! (wikivictory)-αmεσ (soldier) 12:45, 12 October 2007 (EDT) Always watching.....Stubbot 22:44, 13 October 2007 (EDT) [edit] My userpage Thanks. I wasn't sure how to do that. I Eat Glue 11:06, 18 October 2007 (EDT) - No prob! I was worried that interfering with your page would make me sketchy, but I thought that's what you were trying to get at, so glad to help!-αmεσ (soldier) 11:24, 18 October 2007 (EDT) [edit] Ecclesia Quote Mine I'd love to, but I haven't gotten any reply. I don't think I'm going to get one. But I'll be happy to make mention of it in the article. --user:Egnome 1:29, 20 Octobery 2007 [edit] RW pic Yeah I forgot, thank you. I'll upload another one without the name. In Christ. Jayjay4ever 18:29, 21 October 2007 (EDT) [edit] Nio Naughtzee I gotta say, your spit-take there was a joy to behold. XD --Kels 19:09, 21 October 2007 (EDT) - That's exactly what it was! Like Jon Stewart... gluggluggl-WHA-spoooooooooooot.-αmεσ (soldier) 19:18, 21 October 2007 (EDT) [edit] Thanks Thanks!The AlienSick Freak!!! 02:23, 22 October 2007 (EDT) [edit] Private message Ames, I've sent you a pm via the forum.--Bobbing for apples 13:49, 22 October 2007 (EDT) [edit] AMES--I HAVE SENT YOU AN IMPORTANT EMAIL MASSAGE ABOUT A VERY IMPORTANT MATTER! PLEASE LET ME KNOW WHEN YOU GET IT!! There. See the diff, Bob? The Kenservative book on email style clearly says you need to work in the word "important" and be very verbose in the headline. BTW, sorry for just fuckin around with this, but I couldn't resist! :P -- --Иight¤Ṭrain ♦Τalk ǃ 19:27, 22 October 2007 (EDT) [edit] Incredibly and unnecessarily long subject header that will look funny on recent changes for a while and one that I am tempted to repeat in the post itself but won't this time, although I reserve the right to do so in the future I see hints that you may now be persona non grata at CW. In fact, it appears that at least one person was salivating over the prospect of you being banned so he could reply to you after the fact (awesome move, that one). Is this true? Say it ain't so!!! Tell me the dream is alive!! And if it's dead, well, congrats on your ever-increasing blacklist total.--Bayesupdate 00:50, 23 October 2007 (EDT) - There's no "W" in Conservapedia. And, "W" isn't even near "P"! What were you thinkin'??? human 01:32, 23 October 2007 (EDT) Human, he means CretinWiki, which is another barrel of monkeys (specially created, unevolved/ing ones, mind you). Thanks for showing me Bayes :-). I think it's very telling that Terry's only way out of my argument is to (1) point out that the entire first amendment jurisprudence might be overturned making him correct, or, (2) Jesus is comin' any day now, making it a moot point. Those are not exactly convincing counterarguments; one wonders why he waited until I was gone to enunciate them. Hmmmmm. Anyways, yes, Bayes, I did bite the dust over there, for making a snarky comment (see RationalWiki:NPOV). Alas. I hope you keep up the good fight there without me, though; for one, you ought to tear Terry a new one on that argument... -αmεσ (soldier) 01:42, 23 October 2007 (EDT) Human, is "M." there a deliberate reference to the honorific in the Hyperion sci-fi series?-αmεσ (soldier) 09:29, 23 October 2007 (EDT) - I gotta say, I'm disappointed in CW, because it seemed that their policy was to give non-creationists some degree of latitude on their talk pages. At least, I expected that people from here would last longer than at CP. Pie in the sky idealism on my part I guess, given that CP dudes are in charge there too. Human-san, I'm flattered you find me worthy of the monsieur title. And Ames, we may agree on some other stuff, but your taste in TV and books makes me want to throw up :-).--Bayesupdate 12:53, 23 October 2007 (EDT) <- sticks to ridiculous over-the-top drama instead of ridiculous over-the-top sci-fi Bayes, are you not a sci-fi fan!? Hyperion is kickass awesome! It's like as good as Ender's Game! The sequels, sure, not as hot, but... that means it's even more like Ender's Game, but not written by a crazy-conservative-homophobic Mormon (I use the first three as pejoratives, not the last one)... which makes it better than Ender's Game!!! And do you refer to my passion for Battlestar Galactica? I do apologize that I'm so divorced from reality that I didn't know that "m." means "monsieur." Ugh.-αmεσ (soldier) 13:24, 23 October 2007 (EDT) - Ender's game are writ for 12 year olds and are otherwise crap. There hasn't been 1 good TV SF in all history. Susantalk to me 13:35, 23 October 2007 (EDT) - Strong words Susan.--Bobbing for apples 13:48, 23 October 2007 (EDT) Harry Potter's also written for 12 years olds but it still roxxorz.-αmεσ (soldier) 13:49, 23 October 2007 (EDT) - The b******s all outsell me 10000x & r therefore to be despised. Susantalk to me 13:56, 23 October 2007 (EDT) Those who cannot comprehend the greatness of Hyperion are clearly too far removed from reality. Harry Potter? Maybe less so. --AKjeldsenGodspeed! 14:07, 23 October 2007 (EDT) - I actually DO like stuff like Ender's Game (sorry Susan!)...you have a point there. I am probably the last person on earth who has managed to not read any Harry Potter stuff yet (and why bother to start now, if I already know that the one guy is gay--OK, kidding). I think my main beef is with the sci-fi TV scene. As a kid I kinda liked the Star Trek Next Generation series, but I got disillusioned after about 47 rip-offs. Then everything went to hell with stuff like wp:Cleopatra 2525. Stargate never really did it for me either, but Richard Dean Anderson still r0xx the house because of MacGyver. He needs to regrow a mullet.--Bayesupdate 14:28, 23 October 2007 (EDT) Mm. read ender's game & realised when I was about to buy second one just how condescending it was - it assumes that you've the experience of a 12 y.o. It's baby food SF for comfort & reading without thinking. So I didn't buy 2nd (or any others). As they used to say about radio "The pictures are better" - you can't possibly compete with the mental pictures that a good book produces. I'd like to see William Gibson film/tv'd but they'd probably put some pretty boys / girls in & ruin 'em (or even worse that Sutherland guy!). Susanspeak your mind 15:07, 23 October 2007 (EDT) Wow, all that from one letter! When I use M. it's either pretensiousness, or, more likely, wanting to add a "title" and not knowing (or remembering) if someone is a boy or a girl... or both. Since "M." can stand for monsieur or madame or mademoiselle or monkey... hahahahahahahaha. I'm not even going to comment on the alleged "literature" under discussion other than to say "to each their own, and let them be happy". human 15:10, 23 October 2007 (EDT) - Ender's Game, mindless! Heresy! It's about difference, and struggling with uniqueness, and the role the extremely powerful has to play. But, yes, it caters to those who've had the experience of a 12yo boy, definitely, but I don't think the themes are generally that vapid... we might have our first disagreement :-(-αmεσ (soldier) 15:11, 23 October 2007 (EDT) (ec) OK! Live & let live -- someday I'll give you my ISBN numbers(s - not yet) & get your feedback. Susanspeak your mind 15:20, 23 October 2007 (EDT) - Yeah, I think Human's right... we should live & let live :-). But what're your books? Why didn't I know you're a writer? That's awesome!-αmεσ (soldier) 15:24, 23 October 2007 (EDT) Only 1 published so far & that's not paid for its print run! Second in fourth rewrite as we talk. Susanspeak your mind 15:32, 23 October 2007 (EDT) [edit] Getting rid of that really stupid overlong header that fills up RC with verbiage unnecessarily. SF - what else - not telling identification possible - anonymity to be presrved @ all costs. Susanspeak your mind 15:50, 23 October 2007 (EDT) - I agree, that is awesome! I can't imagine what it would take to write a novel. But I'd be interested in someday reading your book(s) too, Susan. Such talent here! There ought to be a depository for work by RWians. We could call it the Trashional Heap. 'Course, any submissions would need to undergo a peer review process that's up to the standards of M. Schlafly.--Bayesupdate 16:01, 23 October 2007 (EDT) - I agree with everything expressed immediately above. --AKjeldsenGodspeed! 16:04, 23 October 2007 (EDT) - Hahahahahahahaha, great ideas, both... human 16:05, 23 October 2007 (EDT) - 'Course, to live up to Schlafly's exacting standards, we'd need to put together a peer review board that's less corrupt than the Oxford Distinctions Committee. Won't be easy, especially since we're all deceitful liberals. --AKjeldsenGodspeed! 16:08, 23 October 2007 (EDT) My publisher needs to hear that (awsomeness) they think I'm a bit of a liability but my agent/editor's got faith - so far. Susanspeak your mind 16:12, 23 October 2007 (EDT) - I have little experience with publishers, but if they're anything like journal editors, I guess they can be pretty mean-spirited people. --AKjeldsenGodspeed! 16:25, 23 October 2007 (EDT) I have an excellent editor/agent who has worked (so far) for very little cash/hour - he thinks I'm the next hope of british SF if " You can get more commercial Miss -'" trouble is I don't know how to write - I just tell the story as the protagenists go through it. At present in 4th rewrite 500pp -> 400 -> 600 etc. etc Started this about 18 months ago for pennies. Not an income generator! I've had almost zero personal contact with publisher. Susanspeak your mind 17:05, 23 October 2007 (EDT) - Right, bought Hyperion. I'll let you know! (See also Talk:Singularity) Susanspeak your mind 08:42, 24 October 2007 (EDT) - I had no clue we had a real writer around. When you hit the big time, you have to let us read your stuff! I'll read almost any SciFi (now I have to read Hyperion). Good luck! With all the crappy SF out there, I hope they decide that yours is either good or at least better than most; publish, and let the reader decide!--PalMD-If it looks like a donut, eat it 18:42, 24 October 2007 (EDT) Hyperion is amazing :-). But I agree, I want to read Susan's material. I hope you guys like it... one problem is that it's a LITTLE oversexed.-αmεσ (soldier) 19:29, 24 October 2007 (EDT) [edit] The Great Purge I tried to continue the discussion at CW, but with exactly zero warnings, I've been hit with teh Bannination. Not only that, I've actually been purged from their record of users--if I try to log in, I get a message saying that my username doesn't exist! I guess the question of whether creationists resort to shady tactics is officially resolved. No big surprise, but still...geez. I just wonder how long it'll be before Mr. T declares "victory" because I "refuse" to respond. Oh well, the goat's better here anyway.--Bayesupdate 18:26, 24 October 2007 (EDT) - HAHAHAHA! Oh Bayes, you suffered my fate. You get an entry on WIGO for a valiant defense. And I do contend, Terry, if you're reading this, that I am more of an expert than you are in first amendment law. For one, I've been to law school. For two, I've read a book.-αmεσ (soldier) 19:29, 24 October 2007 (EDT) [edit] don't do it Ames, don't make me post our conversation. Bohdan 00:54, 26 October 2007 (EDT) - Don't do it Bohdan..... Locke Always Watching...... 00:59, 26 October 2007 (EDT) (By that I mean do it by all means.) Our conversation?-αmεσ (soldier) 01:01, 26 October 2007 (EDT) - User:Bohdan/AmesGandCats I think you just got trolled. Bohdan 01:03, 26 October 2007 (EDT) - Sorry Ames. If it offends you, delete it immediately. Bohdan 01:08, 26 October 2007 (EDT) - Hahahaha, that was brilliant. Locke Always Watching...... 01:09, 26 October 2007 (EDT) - I think Ames is offended by my implication that he has kicked his cat. I apologize if you are offended. I meant no harm. Bohdan 01:10, 26 October 2007 (EDT) - So, Bohdan, are you a cat person, or a dog person? Locke Always Watching...... 01:12, 26 October 2007 (EDT) - AmesG, I know you have not kicked your cats. Please forgive my implying that you have done so. Bohdan 01:16, 26 October 2007 (EDT) This is the funniest thing ever. Can I put it in my userspace if you don't want it in yours :-) ?-αmεσ (soldier) 01:20, 26 October 2007 (EDT) [edit] How did you find it? Spread the word! --H jimachong 22:26, 28 October 2007 (EDT) PS - you might want to consider archiving [edit] You On Facebook. NOW. --H jimachong 23:56, 28 October 2007 (EDT) - Shocking stuff. Replied. This is a fateful day.-αmεσ (soldier) 00:24, 29 October 2007 (EDT) - It goes mostly to the fact that RobS fiddles trolls.-αmεσ (soldier) 01:41, 30 October 2007 (EDT) [edit] Ames hitting his cat Yay! Don't ever leave again. We need you to wandalise and keep us honest.-αmεσ (soldier) 00:24, 29 October 2007 (EDT) How did I know that when you uploaded this it'd be for me?-αmεσ (soldier) 01:35, 30 October 2007 (EDT) - You must be psychic. there is no other explanation.Bohdan Ames, I didn't know you like Vladimir Putin. The picture you added isn't working though. Bohdan I'm not so much a Putin fan :-/. Although I shouldn't say that too loudly; I take my tea sans-polonium. If I recall you're not a fan of his :-)-αmεσ (soldier) 01:50, 30 October 2007 (EDT) It is a true honor to be thought of as a sock of our Fearless Leader. But unfortunately, no. I do, however, operate both Andy and Roger Schlafly. I must say, the work of creating their personalities is rather dull.-αmεσ (soldier) 02:06, 30 October 2007 (EDT) - Wow, you truly are a Black Hole. Locke Always Watching...... 03:35, 30 October 2007 (EDT) RobS is my sock. I use him to reveal the ultimate communist/jewish/atheist/FDA conspiracy without losing my cred at the meetings.--PalMD-If it looks like a donut, eat it 08:27, 30 October 2007 (EDT) - I must come clean, TK is my sock. Or is it the other way around? Locke Always Watching...... 13:02, 30 October 2007 (EDT) [edit] silly wandal Think it's some kind of bot - it comes around every day & drops these letters all over the place & then changes IP. SusanYou don't have to talk, but ... 18:35, 30 October 2007 (EDT) Oh & thanks for "sticking it in". SusanYou don't have to talk, but ... [edit] Rejoice! If God exists, he sure is just! — Unsigned, by: hojimachong / talk / contribs - THAT is totally awesome.-αmεσ (soldier) 18:56, 31 October 2007 (EDT) - hey ames got your email. go ahead and add me to YIM same name as the email. 85.195.123.25 19:27, 1 November 2007 (EDT) [edit] Pseudolaw It is time we develop a new term I think--pseudolaw. The analogies to pseudoscience are very strong. Here is an example: here the homepage for the "company I have more......what do you think? tmtoulouse annoy 10:51, 2 November 2007 (EDT) - This is amazing, it has all the elements of just about every conspiracy and pseudolaw argument all rolled into one. This is a letter that as actually sent to a judge. Check it out..........how would you handle such a client as this? tmtoulouse annoy 09:38, 8 November 2007 (EST) [edit] deletion Moved to my user page.The AlienSick Freak!!! 20:22, 2 November 2007 (EDT) [edit] Hello Hi AmesG, thanks for the welcome. I am one of the few people here who was never a Conservapedia member/user. Just looking at that site makes me break out in hives, and I don't even consider myself a "liberal" as such. I do, however, contribute to Wikipedia fairly frequently. Anyway, I will probably be making some sporadic contributions. I'm not sure what I will work on yet. --Wet Walnuts 02:13, 5 November 2007 (EST) [edit] Don't block me But if you do, don't do it like your a character in Animal Farm. — Unsigned, by: nwo / talk / contribs [edit] USSR Symbol This is very offensive. I am disturbed that you of all people would "proudly" display it. [10] It is banned in some countries. To millions of people who suffered horrors you can't imagine, this is the same as you displaying a swastika. Bohdan 22:12, 8 November 2007 (EST) - I guess in America it's been detoxified, but I had not thought about the experience of people in your part of the world, Bohdan, so I'll pull it from my profile.-αmεσ (soldier) 23:18, 8 November 2007 (EST) I don't think it's something that should be banned, but if it makes a user more comfortable, I'm happy to oblige. I whited the character out, just so I can keep it around in case I ever want to know how to make the hammer & sickle in wiki-code... but it doesn't show on the page anymore.-αmεσ (soldier) 23:33, 8 November 2007 (EST) - Am I missing something? To me it just showed a large question mark. Locke Always Watching...... 23:42, 8 November 2007 (EST) I invented the question mark.-αmεσ (soldier) 23:43, 8 November 2007 (EST) [edit] demotions thanks for letting me catdch stile4aly's volunteerism. You want 'crat so you can play the user rights game? I see no reason why not. Just, please, don't abuse checkuser, it creeps me out. human 22:56, 10 November 2007 (EST) - I promises and you can trust me because I'm not yet a lawyer!-αmεσ (soldier) 22:57, 10 November 2007 (EST) - ZOMG. My first act is to hand the entire site to NightTrain. How do I... errr... do that?-αmεσ (soldier) 22:58, 10 November 2007 (EST) - Wins! Sorry, been reading icanhascheezburger all day instead of working.-αmεσ (soldier) 23:00, 10 November 2007 (EST) - Congrats. *Plots ames' murder* Locke Always Watching...... 23:05, 10 November 2007 (EST) - That's it, I'm making you a bot too.-αmεσ (soldier) 23:05, 10 November 2007 (EST) [edit] Delusions of Grandeur I hereby DEMAND that you create a special usergroup for me (the "Benevolent Dictator and Supreme Tyrant" usergroup) and make me the only member. Or not. --Ζωροάστρης 23:03, 10 November 2007 (EST) Wow, I was really just tempted to make Bohdan a bot.-αmεσ (soldier) 23:04, 10 November 2007 (EST) [edit] Race and Intelligence Personally, I think that would be a wonderful place to place MLK's speech, since it has to do with both. --Kels 13:38, 11 November 2007 (EST) [edit] GofG on TK have you seen this before? It's new to me. --Ζωροάστρης 14:34, 11 November 2007 (EST) - Interesting. Is there any other way to view that? Scrolling to the bottom to scroll across while reading is murder. human 14:46, 11 November 2007 (EST) - I don't think so... I found it while Googling myself :D. I think I'll go Google you now, human (that'll be hard). --Ζωροάστρης 14:50, 11 November 2007 (EST) That's a fairly un-incriminating conversation, though, especially for TK!-αmεσ (soldier) 15:25, 11 November 2007 (EST) - Not incriminating, but certainly revealing. The passive-aggressive is strong in this one! --Kels 17:07, 11 November 2007 (EST) [edit] TK How do you spell TK's last name? --Ζωροάστρης 00:45, 13 November 2007 (EST) - Not gonna "out" his full name on-wiki more than it already is... but you might want to check your "My-Face" account.-αmεσ (soldier) 00:48, 13 November 2007 (EST) [edit] Renaming teh wandals for justice Awww, I wanna be able to do that... --transResident Transfanform! 11:24, 13 November 2007 (EST) - Can you rename SteriIe (not me, Sterile) to something else? VirileSterileyawn! 11:26, 13 November 2007 (EST) Done! I was gonna do it, but the subway came and cut off my reception.-αmεσ (soldier) 11:43, 13 November 2007 (EST) [edit] Variation on a meme As a fellow lolcat-lover and historian, you ought to take a look at this. --AKjeldsenGodspeed! 16:41, 14 November 2007 (EST) Always watching.....Stubbot 15:50, 15 November 2007 (EST) - Akj that was lolsome! Love it. Things like that give me hope yet.-αmεσ (soldier) 18:24, 15 November 2007 (EST) [edit] Trigger finger Thanks. No problem. Glad an admin was around or I could have been up all night. Hell, might be anyway. DickTurpis 01:16, 23 November 2007 (EST) - I mean, if there's something good on, right?-αmεσ (soldier) 01:17, 23 November 2007 (EST) - Well, do Conan reruns count as "good"? DickTurpis 01:19, 23 November 2007 (EST) - Good is definitely relative :-). DAMN WRITER'S STRIKE! CAVE, STUDIOS, YOU FREAKIN JERKS! I would say Battlestar Galactica (new) reruns > Conan.-αmεσ (soldier) 01:41, 23 November 2007 (EST) - Hmm. Haven't seen the show. I'm not all that into sci-fi, in general. Though I was getting into Firefly for a bit there. Yeah, damn strike. A friend of mine who works for Colbert was telling me at "work" he's just been playing games and watching movies. And I thought he had a good job before. DickTurpis 01:52, 23 November 2007 (EST) [edit] Bias Ames, you wouldn't like to move your Essay "Bias in Conservapedia" from "Essay" to Conservapedia (ie, de-essay it) would you? There's nothing worth the name in the current article. (I might steal it anyway!) Susan... miaow ... 14:55, 25 November 2007 (EST) - It was only a suggestion! (I haven't even got my whip with me!) Susan... miaow ... 18:02, 25 November 2007 (EST) Tee hee! Was just having fun... You were right about the move!-αmεσ (soldier) 21:20, 25 November 2007 (EST) [edit] ;) Lulz at User:RosaParksFan. Smite the fascist menace, comrade! -- מְתֻרְגְּמָן וִיקִי שְׁלֹום! [edit] Helios wuz here As long as I'm here, I thought I'd drop by to say hi. ɧєɭıסş-get sunburn! 01:01, 10 December 2007 (EST) [edit] Give User:HeartOfGold his powers, as you said you would. Yesterday you promised to give that user his sysop powers. [11] I realize you are a lawyer, but your not a liar also, are you? :) Bohdan 19:12, 12 December 2007 (EST) - The mob stepped in to discuss the matter. And HG hasn't come back and commented yet, from what I can tell. human 19:19, 12 December 2007 (EST) Yeah, I wasn't planning on giving him any powaz back until he came back and talked to us about it first. My hope was that I'd be able to talk to him last night and figure it out, but mob intervention means that, in the words of Spock, the good of the many outweighs the good of the one.-αmεσ (soldier) 21:54, 12 December 2007 (EST) I will not live long and prosper My middle name is not Foster I am not Silek son of Sam I will not eat Green Eggs and Ham -- Dr. Seuss Goes to Vulcan (excerpt) - Okay, that poem was cool. But listen Akj, you don't want to go up against me in Star Trek trivia. That may've been Surak, as quoted in Enterprise season 4, but it was Spock in Wrath of Kahn, Search for Spock, and Voyage Home, FIRST! Punk. Oh, and Bohdan, I already gave you Oversight, don't push your luck-αmεσ (soldier) 22:32, 12 December 2007 (EST) And legally speaking there's an agency issue: could he have reasonably relied upon my apparent agency to act unilaterally? Doubt it. I'll make sure it works out if he comes back. If he comes back :-/-αmεσ (soldier) 22:33, 12 December 2007 (EST) - That sounds like a fancy way of saying "I lied to HeartOfGold". Bohdan 22:35, 12 December 2007 (EST) The more appropriate answer is "I messed up." I didn't know that he'd been removed for misconduct, I thought he'd been removed when he went on sabbatical (like Airdish, who was recently re-crat'd, because he returned). So I didn't know the fax :-(-αmεσ (soldier) 22:38, 12 December 2007 (EST) - Correct. Now, back to the essential question here! It may be true that Spock said it first, but as there is no doubt that he quoted Surak, it should properly be attributed to him. --AKjeldsenGodspeed! 22:44, 12 December 2007 (EST) - What "misconduct"? Different opinions? Reluctancy to be a RW Kool-Aid drinker? Be fair, give him his powers back. Bohdan 22:49, 12 December 2007 (EST) When he comes back, we'll talk to him: I don't know what it was but his desysop message was "abuse." And AKj, that's HEARSAY!-αmεσ (soldier) 22:52, 12 December 2007 (EST) - Bohdan, you know that AmesG is in Law School. He strives to become a professional liar for hire! How can you hope to best him in this argument? Heart's "misconduct" was his idealogical differences with the PTB (Powers That Be) nothing more. He was driven off the same as they try with me, same as they did with Jazzman and others, whenever they don't like someone. Trying to argue with dishonest people is like spitting into the wind. --TK/MyTalk 23:01, 12 December 2007 (EST) Hey, Bohdan was oversight for at least 30 seconds last night, I'll have you know. And, I wasn't aware of the reasons for his desysopping, nor am I now. So... we'll see? Look, at the point that we're even considering having a sysop who disagrees with us, we're heads and shoulders above CP. Give it a rest. We don't know the facts, so we'll wait and see, unless someone can link to the diff(s) that bought his desysopping.-αmεσ (soldier) 23:04, 12 December 2007 (EST) - Uh-oh ames. Tmtoulouse, Colin R, Hojimachong, they were all liberal sysops. The only conservative sysop you have had was driven away for reasons you don't even know. And my hope is to simply complain enough that they just let him have his sysopship back. professional liar for hire ha ha ha! Ouch! Bohdan 23:07, 12 December 2007 (EST) You could have desysopped and destroyed the entire wiki. But you only had it for 20 seconds or so. See?-αmεσ (soldier) 23:11, 12 December 2007 (EST) So in conclusion, we'll see about HG. And I'll have you know that the cat is very happy right now, bohdan, she's asleep with the girlfriend, not being beaten or anything.-αmεσ (soldier) 23:15, 12 December 2007 (EST) [edit] Can you get me in at wikipedia? Can you get me in at wikipedia? Thanks. Heart♥GoldTeach me about your father Satan 00:09, 13 December 2007 (EST) - I barely ever use my account there :-/ -αmεσ (soldier) 00:13, 13 December 2007 (EST) [edit] Can I work on my Swarm Essay? It is insulting (but it makes you think, I hope). Heart♥GoldTeach me about your father Satan 00:16, 13 December 2007 (EST) - It certainly makes me think... about what is another story... but essay namespace is your playground.-αmεσ (soldier) 00:18, 13 December 2007 (EST) - Ah, nevermind. Heart♥GoldTeach me about your father Satan 00:35, 13 December 2007 (EST) [edit] what the hell Please try not to rename me when i am sockpuppteering for fun. It logs me out for some reason. --You know who i am - Of course I know who you are, that's why I did it... :-) -αmεσ (soldier) 00:21, 13 December 2007 (EST) - Cincinnati, Ohio. Heart♥GoldTeach me about your father Satan 00:34, 13 December 2007 (EST) ? Oh, I thought that user was Bohdan. Oops.-αmεσ (soldier) 00:37, 13 December 2007 (EST) - I am insulted. Neither one of those users was me. Bohdan 00:38, 13 December 2007 (EST) - Or me. human 00:38, 13 December 2007 (EST) - Human, I should really block you for taking away HG's sysop powers. Bohdan 00:39, 13 December 2007 (EST) - Yes, you really should. Who do you think gave them to him in the first place? human 00:42, 13 December 2007 (EST) - Don't mind human, he's on the rag. Heart♥GoldTeach me about your father Satan 00:42, 13 December 2007 (EST) - I blocked Ames to get him to take away the powers he gave me. Bohdan 00:48, 13 December 2007 (EST) - I forgot I'd sysopped you for lulz. Dammit.-αmεσ (soldier) 00:50, 13 December 2007 (EST) [edit] Is this a joke? How could you vote against HG? You were the one who said you would give him the powers in the first place! Bohdan 12:08, 13 December 2007 (EST) - That's the punchline!-αmεσ (soldier) 12:36, 13 December 2007 (EST) [edit] i WANNA BE UNBLOKCEDED pleaz I WANNA BE UNBLOKCEDED 13:06, 13 December 2007 (EST) [edit] sock I have tagged you for puppetry. You are not allowed to edit or remove the tag until the situation is cleared up. Thank you. Bohdan 19:43, 13 December 2007 (EST) - ?-αmεσ (soldier) 19:45, 13 December 2007 (EST) [edit] You are now restricted Due to the ongoing sockpupet investigation, you have been placed under editing restriction. You may not edit outside of your user space. Thank you. Bohdan 21:10, 13 December 2007 (EST) - You are in violation of your parole [12]. Your account will be blocked. Bohdan 22:00, 13 December 2007 (EST) - You should really block tmtoulouse. Make it infinite. And take away his powers. Thanks, Bohdan 22:04, 13 December 2007 (EST) - Where in the world of fuck are you getting these ideas? --Cheers, ♦ Ryan ♦ ǂ wuz here ǂ 01:41, 14 December 2007 (EST) - He makes them up. He is our pet vandal, check the histories, etc. human 02:12, 14 December 2007 (EST) - Typical slander. I do hold the record on this wiki for the most blocks though. Bohdan 11:40, 14 December 2007 (EST) - In my opinion, at this time I believe there has not been slander posted on this user talk page. (too many unneeded words!) --Cheers, ♦ Ryan ♦ ǂ wuz here ǂ 15:17, 14 December 2007 (EST) [edit] quote template Mind if I tidy up that quote template (which I suspect you haven't tried)? :-) Susanpurrrrr ... 02:33, 16 December 2007 (EST) {go to bed - it's late} Ahhh. It's already there:Template:Q & has been for some time. Susanpurrrrr ... 02:52, 16 December 2007 (EST) [edit] I don't look like Phyliss Schlafly That wasn't very nice about what you said about me. I do not look like Phyllis Schlafly. Trolls have feelings too you know :P - The Halifax Troll - Whereabouts in Halifax are you, anyhow? I spent a long time down that way, it's nice to see something familiar. --Kels 18:14, 16 December 2007 (EST) - I'm actually not in Halifax, the CP ppl just think I am ;) Dear troll, I just meant to imply that Phyllis looks like a dude. Not that you look like her aside from superficial male characteristics, I promise!-αmεσ (soldier) 18:16, 16 December 2007 (EST) - Its ok, I'm not thin-skinned like conservatives. I actually don't have a very prominent adam's apple though. hahaha, so how did you know that I, the halifax troll am a guy - Sexist assumptions of mine :-/ plus I think we've conversed before?-αmεσ (soldier) 18:18, 16 December 2007 (EST) - ;) No Ames, I don't believe we have --HalifaxTroll 18:28, 16 December 2007 (EST) - Ames, is Bohdan a sysop? --HalifaxTroll 18:41, 16 December 2007 (EST) - Bohdan thinks I'm Icewedge. Is he for real? --HalifaxTroll 18:46, 16 December 2007 (EST) [edit] block That last block crossed the line. I am going to recommend your de-sysopping. Bohdan 18:38, 16 December 2007 (EST) - 314 seconds!??!? Hmmm. Maybe a bit long. Srry :-( -αmεσ (soldier) 18:40, 16 December 2007 (EST) Bohdan is not a sysop, in response to an earlier question. He's just saberrattling :-) but I think I'll not give you oversight just yet...-αmεσ (soldier) 18:42, 16 December 2007 (EST) [edit] hey I blocked you and it said "AmesG has been banhammered". I don't think it worked though. Are you blocked? user:Bohdan 16:41, 19 December 2007 (EST) - Uh oh. No response. Did I just block you? Now I feel terrible. user:Bohdan 16:42, 19 December 2007 (EST) You did, but I desysoped you, so we're even :-(-αmεσ (soldier) 16:43, 19 December 2007 (EST) - How can I desysop someone the next time some fool gives me oversight? Not that I would desysop you or anything, just in case some unethical user takes over the wiki and needs to be removed... user:Bohdan 16:45, 19 December 2007 (EST) Good question. We shall see.-αmεσ (soldier) 16:47, 19 December 2007 (EST) [edit] Oh hai! Are you flammable? [edit] Asking? This post by Kels, and other posts, by other Admins, sanctioned as they are by the Cabal and the Admins here, is the reason, Ames. [13] If it wasn't sanctioned, righteous Admins like you and Jeeves, would have already dished out two week or six month blocks for doing so, and then reverted them to time-served like you did with me. It is quite simply an allowed continuation of recrimination and retribution, a official, unofficial policy of of marginalization. It is merely a device to make sure no actual or perceived transgression is ever forgotten, therefore making sure that user is forever in a "second class". --TK/MyTalk 18:21, 22 December 2007 (EST) [edit] be proud I just found out someone made a blunder and I am currently a sysop. Be happy, aside from blocking worthless vandal tmtoulouse I have done nothing else. No one is making any edits, and I could have caused some serious, and time consuming to revert, disruption. But I didn't. Be proud ames, be proud. And take away the sysopship please. user talk:Bohdan 02:43, 2 January 2008 (EST) [edit] Yeah! ! SusanPurrrrrrr 19:26, 15 January 2008 (EST) [edit] some advice Hey Ames, since you seem to be the user most involved with this TK block fiasco, I am going to say this to you. After reading over the TK block page and thinking about it, I have concluded that this entire incident is pathetic. Seriously. I don't see why you had to ban him at all. If he is such the instigator that you and the others claim he is, why not just ignore him? As far as I can tell, he hasn't ever created or vandalized an article. If he "starts trouble" (which it seems you and a few others did just as often as him) why not just ignore him? Or is Schlafly correct, liberals always have to have the last word? To quote susang, "be an infant if you must". Also, now that you are attempting to decide how to manage this wiki, a mob which I am part of, remember what all this offline policy stuff has gotten you. And unblock TK, the block was unjust. Best regards, user talk:Bohdan 18:43, 16 January 2008 (EST) - I admit that I completely fracked up the procedure. The methods I used were poorly planned and a joke of the rule of law, and they've have made me and the entire sysop group look like morons, and I take all the blame for that myself. Please, heap your aspersions one me. However, I will not apologize for the end pursued and achieved: TK is gone, never to return (he says), and in any event, we're free of him for a couple months. If I did a difficult, unpopular thing that'll turn up good, I don't apologize for the end pursued... much like Bush & the Iraq War (but hopefully with better results)... although I admit the pursuit could have been done much better. - Now, two final notes - first, my suggestions for rules were just that; suggestions. Second, what has all this offline policy stuff gotten me?-αmεσ (soldier) 19:05, 16 January 2008 (EST) - Vandalism is something that is easily taken care of. It is a minor annoyance but not harmful to the community as a whole. What TK has been doing has been harmful to the community - starting flame wars, starting arguments, making the place hostile for ip users, and making it uncomfortable for a person to contribute. Vandalism does not do those things. It is the community that said this type of behavior is unacceptable. It is also the nature of the wiki software that the community has to act. There is no way for an individual to shun a member of a wiki as can be done on usenet (kill files) or in email (filters). - As to the correctness of people go look at Conservapedia again and see how many times it is that conservatives have to have the last word. But this isn't a liberal/conservative issue (we are not all liberals here). People always want to have the last word. And yet, the last word isn't the issue either. Some behaviors are not acceptable in some communities. If you feel otherwise, try going into a church and start swearing and see if that community behaves any differently. You will be asked to leave and if you don't, they will call the police and have you forcefully removed. - TKs block is simply a matter of saying "the atmosphere that surrounds you is not acceptable in this community." - --Shagie 19:18, 16 January 2008 (EST) - Well said, Shagie. human 19:46, 16 January 2008 (EST) - Well said except that there is no admission that the flame wars, arguments, making the place hostile for ip users, and making it uncomfortable for a person to contribute did not always start with TK. Frankly it was Human and AmesG and others that instigated EASILY as much as TK instigated. 69.158.111.210 19:57, 16 January 2008 (EST) - Yeah, I MUST be TK. If that helps you ignore the truth then whatever makes you happy. 69.158.111.210 21:27, 16 January 2008 (EST) - Secret offline policy (or perhaps discussion would have been a better word) seems to be the stupidest part of this. This whole incident seems to be about something that happened in secret. How can the mob make a decision without seeing the evidence? TK had a clean slate when he came here. Yet many of you had something against him based on ongoing offwiki business. That should have stayed offwiki, but it didn't, it led to his block and undermined the mobocracy. And the IP above is actually somewhat correct, TK was often not the one guilty, yet he was always the one blocked. Locke 20:18, 16 January 2008 (EST) - Isn't that Bohdan? Honestly, I'm tired of defending myself today. Could someone else, please? Then I can devote my time to repairing my credibility, maybe.-αmεσ (soldier) 20:27, 16 January 2008 (EST) - Whats with all of the indents? This is Bohdan. Sorry, but my account was blocked. And you are a lawyer, you can't get tired of defending yourself. I still want to know what all this off-wiki stuff was. You realize that no one really reads this wiki, or even conservapedia for that matter? I strongly doubt anyone will care about what was said in the secret forums. Locke 20:30, 16 January 2008 (EST) - The short answer is, TK volunteered to help us get back at Conservapedia just after we started RationalWiki. We accepted. He quickly grew annoying, threatening, insultive, manipulative, poisonous to all he spoke with, and creepy. He blackmailed us into silence, with the threat that he would populate rationalwiki.info if we didn't keep his treachery secret, and later blackmailed us with other things. We eventually stopped complying, blew his NightTrain/E Wig cover (the height of his threatening & blackmail), he was banned from Conservapedia. He came back here, became even more of a douche, started turning people against each other by being a douche still in secret, but sweet on the surface, with no decrease in his creepy/evil behavior - threatening me, the Wiki, being creepy, and blackmailing us up until his last night unblocked, so we blocked him.-αmεσ (soldier) 20:43, 16 January 2008 (EST) Hell I'm in the secret forum (singular, by the way), and I don't care what's in it. --Kels 20:44, 16 January 2008 (EST) The difference is that Ames and Human are part of what makes RW what it is. Read - seriously read it. There will be a test on it next week. I know that I was made to feel uncomfortable at times - I am sure others also feel this way (I hope they now feel free to speak up). Look at the community as a whole without regard for who started it where (I am well aware that there is a significant amount of offwiki communication that happens) and see where the negativity surrounds. Admission or not TK was not helping the community grow nor become a better place and wasn't even neutral in its growth but actively worked to make it a place that was uncomfortable for as many people as possible. Telling the person to go away apparently has had little effect. Past "I'll be good" promises didn't either. Various forms of of trying to get TK to change didn't either. I honestly believe the behavior was not punished soon enough and allowed TK to think that this was acceptable and made it so that community dividing personal attacks were not frowned upon as strongly. I hope that TK's removal will spur people into determining what is acceptable and is not acceptable and foster discussion of the structure for how to deal with such disruptive people in the future. What this was not was secret. TK's attitude was never secret. The decision to block him was not. I doubt TK ever had a clean slate and if he did he tarnished it very quickly - yes, reputation carries over from one place to the next. One identity can never be distinct from the others they are linked to. His attacks against most anyone who interacted with him on here were not secret. He was a person the community did not want to be part of itself. The mob made its decision about the type of person that TK presented himself as and about how much TK hurt the community. And the wiki matters to the people who are here. That is all that is necessary. It is the hope for me that some parent who is considering enrolling their child in one of Andy's classes will search and find this place and see what beliefs their student will be exposed to and be able to make a more informed choice as to if this is right or not. One child less child that is exposed to Conservapedia being seen as absolute truth is all that matters to me. --Shagie 20:45, 16 January 2008 (EST) - Some people take their assholes too seriously.-αmεσ (soldier) 20:47, 16 January 2008 (EST) There's nothing here beyond just desserts and some hard-earned catharsis. Sleep easy, Ames ;) --Robledo 20:49, 16 January 2008 (EST) - Rob, you have no idea how much that helps.-αmεσ (soldier) It is possible that we are taking this too seriously, though there are other wikis that the criticism is even more appropriate for. --Shagie 20:50, 16 January 2008 (EST) - Hey, I wasn't singling you out. I think all wikis (including WP) are taken too seriously. Ames, when you say blackmail, what does this mean? That he would expose your socks on conservapedia? Like I said earlier, no one really cares. Locke 20:52, 16 January 2008 (EST) He told me that he'd call my law firm: until I realized what bullshit that was, I was scared. Among other things. Plus, with TK fabricating e-mails from KevinKConley (did anyone else get an e-mail from him?) about how he ruined people's lives with identity theft, etc., well... that's not the right atmosphere is it?-αmεσ (soldier) 20:53, 16 January 2008 (EST) - I had quite a scare during the initial FBI thinggie...it really sucked.162.82.215.199 21:00, 16 January 2008 (EST) - TK is the end of the culture of fear, and impoliteness. He's also the end of our... sordid past with Conservapedia. And he's the end of backroom dealings. All that in addition to being the end of a manipulative, threatening, blackmailing troll. Why aren't we celebrating?-αmεσ (soldier) 21:02, 16 January 2008 (EST) - I confess my guilt of poor timing and thank you too :-).-αmεσ (soldier) 21:05, 16 January 2008 (EST) - If he comes back after the block, will you treat him fairly? user talk:Bohdan 21:07, 16 January 2008 (EST) - Let's pray it doesn't come to that.-αmεσ (soldier) 21:08, 16 January 2008 (EST) - Per wikipedia: assume good faith. user talk:Bohdan 21:09, 16 January 2008 (EST) - Good faith is a presumption, but it's a rebuttable one. I long ago had my assumptions of him disproven. But I'll try if he comes back.-αmεσ (soldier) 21:15, 16 January 2008 (EST) - Thats good to hear. Will you let him come back to discuss this block? Limit him to just a single page, even if only a single statement in his defense. This is all I can say on the matter. Please reconsider this block. user talk:Bohdan 21:18, 16 January 2008 (EST) No.-αmεσ (soldier) 21:20, 16 January 2008 (EST) - You didn't even take the time to indent :( user talk:Bohdan 21:24, 16 January 2008 (EST) - At this point, discussion is futile. It probably was 4 months ago.--PalMD-Did that sound a little harsh? 21:25, 16 January 2008 (EST) - At least you indented. user talk:Bohdan 21:27, 16 January 2008 (EST) - If he is truly not coming back, as he said, the issue really is a moot point. Pinto's5150 Talk 21:29, 16 January 2008 (EST) [edit] FBI Let me get something off my chest, without directly pointing fingers, since I cannot prove precisely who the main player was. I edited over at CP quite substantively. I argued with idiots. It seemed fun and important, and maybe it was. Then I get an email at my office, and a phone call, that the FBI is notified about me, that my work/hospital,etc are being contacted, yada yada yada. Of course it was all bs, but that kind of threat sucks the energy out of you. I can't abide fascists, or those who get sucked into following their orders.--PalMD-Did that sound a little harsh? 21:12, 16 January 2008 (EST) - Honestly, that's harassment, plain and simple. I'd guarantee it was Conservapedia... obviously... although it probably was Karajou. Why don't we check the SDG?-αmεσ (soldier) 21:22, 16 January 2008 (EST) - Pal - are effin' SERIOUS?!?!?! Of course, I don't think the EFFBEEAYE is in the habit of e-mailing the targets of investigations to give them a heads up - but, man, that well and truly sucks. And pardon my ignorance, but what's an "SDG?" PFoster 21:25, 16 January 2008 (EST) - PFoster, see Conservapedia:Special Discussion Group... it's where the CP sysops threw mud at themselves and the rest of the world. TK opened it for all the world to see for a bit.-αmεσ (soldier) 21:26, 16 January 2008 (EST) - As I recall, the communications came from Koo Koo and TK. When I emailed Andy to call off the dogs, he disavowed any knowledge or approval.--PalMD-Did that sound a little harsh? 21:27, 16 January 2008 (EST) - Karajou initiated most of the bullshit in that regards, he e-mailed the president of my university and wiki stalked me around for a while telling me the Royal Canadian Mounted Police would be dragging me off any day and he would be there to spit on me when they did. TK did contact me at my lab and threatened all kinds of stuff, but it was, I think, more bark then bite. But still i am not going to get that "off wiki" and then pretend to get along with him "on wiki". tmtoulouse annoy 21:28, 16 January 2008 (EST) - Wow Pal, that really, really, really, sucks. Pinto's5150 Talk 21:29, 16 January 2008 (EST) - Honestly, that's actual illegal harassment.-αmεσ (soldier) 21:31, 16 January 2008 (EST) - That's what I told Andy. Anyway, after I realized it was BS, i started doing some fun writing.--PalMD-Did that sound a little harsh? 21:32, 16 January 2008 (EST) - I e-mailed Andy and told him to call them off and said otherwise the next call was to my lawyer. I saw months later in SDG that there was a big debate about whether I was serious and whether they would be in trouble. It was nice to see that. Morons. tmtoulouse annoy 21:33, 16 January 2008 (EST) - Just so you know, very few statutes of limitations are under a year. So if you decide to jump on it?-αmεσ (soldier) 21:37, 16 January 2008 (EST) - Maybe some day we can post the SDG with (or without) personal info expurgated. I'm starting to get pissed off again.--PalMD-Did that sound a little harsh? 22:28, 16 January 2008 (EST) Holy Crap. I know few details about off-site activity, and I was away from ze internetz when the SDG was apparently open for viewing, so I honestly had no idea things went quite that far. I'm amazed you guys stuck around as long as you did. Personally if the phone-your-boss-for-wikiediting-type stuff had happened to me I'd probably have decided that participating in what amounts to an online discussion group/fundie soapbox isn't worth having weird dudes trying to track me down in real life. Kudos to all of you sirs (and madams, if applicable), and I'm glad, for my own educational and entertainment purposes, that you are still around. Hope that kind of BS (even if it really is just pure BS) doesn't happen again.--Bayesupdate 19:40, 17 January 2008 (EST) [edit] Sockassint Hey ames - there's something weird in the wikicode on Elassint/Sockasint's talk page - why does the welcome template take up 400+ characters? PFoster - Apparently it's my sig. It dropped all my options instead of just the template! I'll fix it.-αmεσ (soldier) 21:18, 16 January 2008 (EST) [edit] Ames you rock Any problems that emerged were procedural and are being discussed elsewhere. Ames took the initiative to deal with an endemic problem that was poisoning the site for many of us. Cheers to you! You can not separate "off wiki" and "on wiki" in some circumstances. When a user like TK is contacting people in your real life and threatening to "fuck you over"...this is "off wiki" but why would I not respond "on wiki" to bull shit like this. I wanted TK gone since I first 404 blocked him 2 months into our site. He was not a positive addition to the community and made the place far less enjoyable to many of the people that really care about the site. More than once when I was preparing to get back involved after my break I would pull up recent changes and see a bunch of "TK bullshit" and decide fuck it I am doing something else. And many others did the same thing. The only reason this is create such friction is because we as a site have been very very tolerant of trolls so when "enough is enough" finally happens it looks like a bigger deal. If we had not gone out of our way to allow problem users many chances then TK could have been dumped along time ago. Bah, good riddance I say and Ames does not deserve to bare the brunt of all this. His only crime was taking the initiative that many of us failed to do. Any issues that arose were, as I said, procedural issues that goto the heart of RW as a community and therefore are not Ames' responsibility. They are for all of us who care to site down and talk about and work out as best we can. tmtoulouse annoy 21:20, 16 January 2008 (EST) My biggest criticism really was that it was a needlessly complicated method of simply blocking an obvious troll. We bent so far over backwards that we began to resemble a corkscrew, and even in the end the blocking was watered down a lot. I'm of the belief that TK benefitted by not completely having a clean slate and actively took advantage of it, and I'm glad we're finally able to put that bit of fiction to rest. --Kels 21:48, 16 January 2008 (EST) [edit] Block I meant to write "Doesn't appreciate art" but some fool put the apostrophe key next to the enter key. --Kels 19:15, 17 January 2008 (EST) - I had wondered what you meant when I saw that. I just chalked it up to you being you :) -- Radioactive Misanthrope 19:42, 17 January 2008 (EST) [edit] Article on front page And I think discussion/promotion etc. of article should stay at the best of RW pages. Once we're done hashing things out at cover story. human 10:25, 18 January 2008 (EST) - Human I love the sandbox! That looks fantastic! I would still suggest a different order; Featured Article, About RationalWiki, then Featured Content, but if you'd rather not I understand-αmεσ (soldier) 11:45, 18 January 2008 (EST) - Thanks! I know, it's weird adding something and having it lie "off screen". How about About RW/FA/FC? That seems logical to me. And the FC header could change to "More Featured Articles" or "Other Featured Content" or something. And, oops, we should try to get this discussion all into one place again! I just wanted to alert you to the sandbox. human 12:13, 18 January 2008 (EST) When you're around again, we are "voting" at RationalWiki talk:Random_coverstory on using the sandbox version and template (template:cover) we set up. human 12:33, 29 January 2008 (EST) [edit] Creepy stalking There's creepy stalking, and there's plain ol' curious. I'm curious... This you? 66.90.73.125 19:10, 18 January 2008 (EST) - No comment, especially as to how funny lookin I may or may not have been, back in the day :-D.-αmεσ (soldier) 19:39, 18 January 2008 (EST) - We all looked goofy when we were just kids of that age, Ames! I'm kinda sorry I posted it now cos I was just wanting to poke your ribs and chuckle, not make you feel bad n'all 66.90.73.125 19:43, 18 January 2008 (EST) - Oh no, hardly! I lol'd! See the smiley face (:-D)? My girlfriend pulls up that picture when she wants to tease me! :-)-αmεσ (soldier) - ...They had the internet back then? -- Radioactive Misanthrope 03:40, 20 January 2008 (EST) [edit] SSchultz I take it this is your sock right? user talk:Bohdan 22:36, 18 January 2008 (EST) - I haven't had a sock on CP since 19-dickety-2! Honest Injun. Well, deceitful Injun. But I do like the cut of schultz's jib. Do a checkuser of him, if it comes up New York then it MUST BE ME, since no one else lives here, right?</snark>-αmεσ (soldier) 22:52, 18 January 2008 (EST) - I have no checkuser capabilities, and I am confused as to why you still use canadian drug slang. And now racism This is disturbing. user talk:Bohdan 22:54, 18 January 2008 (EST) - Yah, and if it comes up Oregon, it has to be me, because everyone here is just a sock of me. :-) -- Radioactive Misanthrope 03:51, 20 January 2008 (EST) [edit] Kittehs Hey Ames, I want your cat. But mine are still cuter, sorry to say. --Linus(plot evil tech) 20:56, 19 January 2008 (EST) - Isn't she adorable!!!! Her name's Richard Parker :-). yes, we're aware of the confusion, but we picked the name ere we picked the cat...-αmεσ (soldier) 01:45, 20 January 2008 (EST) - My cat watchs all of yours'! -- Radioactive Misanthrope 03:33, 20 January 2008 (EST) --Lolryan 06:52, 20 January 2008 (EST) I've got a cat (speyed vicious tortoishell/white female called Domino). We've got a cat (intact male called "the stray ginger cat who appeared & started stealing Domino's food). Domino dislikes Tsgcwaassdf intensly. Tsgcwaassdf likes food. Domino sleeps on our bed. Tsgcwaassdf sleeps anywhere. SusanPurrrrrrr 09:41, 20 January 2008 (EST) - Between my roommate and I, we have four cats, one of which is owned by roomie, the other three have shifting allegiances and have been left by past relationships. One female gray tab who lives almost solely on roomie's desk and hates all the others. One strange shy-but-bold female tortiseshell who's got a thing for junk food, one female black & white "magpie" kitty who's a suck for attention with a type-A personality and gets commonly mistaken for male, even by the vet, and one huge gray male fluffball who grew up thinking he was a ferret. Oh, and an indeterminate number of ferrets (right now it's 8). --Kels 10:04, 20 January 2008 (EST) My cat likes physics. So there. --Linus(plot evil tech) 20:09, 20 January 2008 (EST) My cat does not like to be disturbed while reading his scientific texts. DogP 23:27, 20 January 2008 (EST) Not a kitteh, a dog. --Cheers, ♦ Ryan ♦ ♦ ǂ wuz here ǂ 00:05, 21 January 2008 (EST) Is this where teh cat party is? Is there food? PFoster 21:10, 24 January 2008 (EST)(soldier) 21:40, 24 January 2008 (EST) [edit] I gave you a well-deserved block, but you weren't here for it Want me to block you again? -- Radioactive Misanthrope 15:02, 20 January 2008 (EST) [edit] Exorcism Is this what you wanted for According to...? Sterilexx 11:15, 23 January 2008 (EST) - OMG yes! Shall you post it or shall I?-αmεσ (soldier) 11:17, 23 January 2008 (EST) [edit] look at this Someone has been talking trash about my favorite lawyer. Locke 20:43, 3 February 2008 (EST) - We all know that lawyers are scum sucking trolls. Unless they work for the PD! Or sue giant companies on behalf of regular people, who get incomprehesible $50 payouts, while the lawyers get 1/3. I still love ya, AmesG, and lawyers only suck when they ain't your lawyer! human 21:18, 3 February 2008 (EST) - I'm confused by the backwards letters... are both Human and Namuh the same person? Are they both talking trash about me, or is it only one of them? As for the incomprehensible $50 payouts from class actions, I can explain - most class actions are driven by scumbags and only litigate to up the class settlement, not the individual payouts. Of course, there are a few good ones, one of them being my former civil procedure professor. But still, the device of the "class" works against individual payouts in the high-dollar range; since classes tend to be opt-out, almost everyone and their sister is a party to the class, so estimation of the individual's loss is always a shot in the dark (albeit a mathematically guided one), meaning that some individual class members get absurdly high settlements, but most get absurdly low. And the class counsel always gets the most. Unless he's a prince of a guy, like my civpro professor. I think the class, overall, succeeds mostly at getting a big money judgment against the tortfeasor and therefore defraying and preventing future abuses, while it's overall not as good at getting make-whole damages for the plaintiffs. However, let's not discount the huge value of the class in preventing future abuses by ratcheting up huge combined damages against the company.-αmεσ (soldier) 22:49, 3 February 2008 (EST) - Silly. I'm my own sock. :-) -- ni ebnamuħ 22:56, 3 February 2008 (EST) - I forget who runs NamuH, but it's not me. I have been the "beneficiary" of two class actions - one over UPS insurance (entitled me to get a $50 coupon to pay my bill, but since I have it auto-debited, they couldn't tell me how to do it!) and one over Epson's predatory printer cartridge practice, where if any cartridge is low, you can't print at all (even in B&W, with a color cart empty). That one, I believe was some lame discount on buying more of their stuff - a very typical settlement, from what I have heard, in these "consumer" type class actions - only the lawyers get any actual money. human 15:55, 4 February 2008 (EST) - Those are the wimpiest class actions I've ever heard! I haven't benefited from any, but my girlfriend's dad got $1500 from the Holocaust Swiss Bank litigation. And yes, the lawyers get the most, but again, I think their real utility is as an accountability check on the company (which loses ass-tons) rather than as make-whole relief. Also, keep in mind that, suing on your own, you'd never even get that... since single plaintiffs are picked off like Dick Cheney's friends in a duck hunt by corporate litigators.-αmεσ (soldier) 16:15, 4 February 2008 (EST) - See, AmesG? All lawyers really do work for Jews. -- ni ebnamuħ 17:09, 4 February 2008 (EST) - Over here in Eurocommie-Land, we have a whole bunch of government insitutions to keep watch over the evöl corporations and kick them where it hurts if they try to mess with the consumers. You should really try that, you know. --AKjeldsenGodspeed! 07:20, 6 February 2008 (EST) - I'd be totally fine with that, Akj :-). Honestly, most class action lawyers think of themselves as doing that exact thing; my professor referred to himself as a "legal privateer," doing the government's work of regulation for it, in return for a "letter of marque," namely, the legal authority to sue as a class (conferred by the Federal Rules of Civil Procedure). Good times.-αmεσ (soldier) 10:14, 6 February 2008 (EST) - I'm hurt, Human, I really am. -- ni ebnamuħ 17:07, 4 February 2008 (EST) [edit] Rationalwiki When are are you going to let us non-RW 1.0 people see what was on RW 1.0? I want to know if I was mocked. Oscar 15:06, 7 February 2008 (EST) - The server was wiped. I think only TK kept the seekrits.162.82.215.199 15:11, 7 February 2008 (EST) - Why does everyone log out when I ask a question? But anyway, was I mocked? Oscar 15:15, 7 February 2008 (EST) - That wasn't me! Anyways, yeah it was wiped. Doesn't Karajou think he has a copy? I'm sure he's turned it over to the "FBI" at some point. Ask him. But in short, you weren't mocked, and it's not as exciting as everyone seems to think it was. The SDG, now... that was exciting.-αmεσ (soldier) 15:21, 7 February 2008 (EST) I saved my talk page from RW 1.0 - it's here. And, if you weren't mocked by name, surely you were in spirit! human 15:35, 7 February 2008 (EST) - I am not sure uhh Oscar was an active member of CP at the time RW 1.0 was made. We do have a database copy of it backed-up just in case we ever have to you know defend ourselves against the evil Empire. 130.113.218.226 15:40, 7 February 2008 (EST) I'm sure the FBI has a copy. Sterilexx 15:47, 7 February 2008 (EST) - And never forget: "I did engage in a little spat with Bohdan last night, that TK intruded on briefly, but we kissed and made up before drinking heavily and having messy buttsex. human 12:53, 13 May 2007 (CDT)" human 15:47, 7 February 2008 (EST) - Please, lets concentrate on Tmtoulouse' lunacy, not yours. Oscar 15:49, 7 February 2008 (EST) - Most of my mockery was not personally directed at anyone, although some probably was. I wrote a web of (IMHO) humorous articles about wacko religious ideas, etc. Then when we went live for 2.0, I switched to productive articles. Now I I just pleasure myself incessantlydo nothing.--PalMD-Did that sound a little harsh? 17:01, 7 February 2008 (EST) - But Human's lunacy is so much more entertaining. :-( --AKjeldsenGodspeed! 17:30, 7 February 2008 (EST) [edit] question Ames, as a lawyer and someone who seems to support freedom and human rights, I thought I would ask you a question. Do you think a creationist should be excluded from holding public office? Oscar 18:16, 7 February 2008 (EST) Bohdan, let's be clear here - I'm not suggesting a Creationist can't hold public office. I'm saying they shouldn't be able to hold public positions where their beliefs conflict with their duties. A Creationist, I'm quite sure, could run a public Roads Division, or DMV, or Air Traffic Control or whatnot quite satisfactorily. (Actually, I'm not even sure about that now that I've written it). But yes, that's not a problem. DogP 18:20, 7 February 2008 (EST) - Please, its Oscar. Excluding someone from holding public office based on a private belief such as this one is a pretty serious claim, is it not? And as president, how exactly would it conflict with there duties? Oscar 18:23, 7 February 2008 (EST) Bohdan, let's discuss this where we were discussing it, on the Huckabee Talk page. Let's let Ames get back to you with his answer and not clutter up this thread. DogP 18:26, 7 February 2008 (EST) - O-S-C-A-R. Gee, stop being such a name-conservative. Oscar 18:27, 7 February 2008 (EST) - I'm kinda with DP on this one, Yuri...User:PalMD So Bohdan/Oscar, I think it's without debate that the United States can't ban someone from public office by the mere fact of their religion... or disqualify them from the same. Also, I think it's similarly beyond debate that the fact of someone's lack of religion doesn't disqualify them either... however, that someone running for office is a creationist says a lot about them. It proves a deficit of logic, the tendency to let emotion and blind faith trump reason, and, frankly, it proves that the candidate is gullible and irrationally committed to incorrect positions. So... I don't think a creationist is qualified for office, but it's my vote, and not the law, that determines that. Is this debate going somewhere else?-αmεσ (soldier) 23:44, 7 February 2008 (EST) - kinda sorta, in a typical goatlike way: Debate:Religious beliefs and public office human 00:32, 8 February 2008 (EST) [edit] ? It was supposed to be "DoggedamesG. But this is good too. DoggedamesP 20:17, 8 February 2008 (EST) [edit] Talk to the dead much, Ames? I found an article on Wikipedia that strikes me as surreal: Judicial shamanism. I know it's a legitimate subject, but still... the images of lawyers communing with the dead and making sacrifices to the spirits won't leave my head. Can I have you reassurance that you won't be burning incense or consuming small children in the courtroom? -- Radioactive Misanthrope 03:17, 12 February 2008 (EST) [edit] Looking Good for Jesus I was following up the Looking Good for Jesus cosmetics item on the BBC and visited the website of the manufacturers, BlueQ . I thought you might be distressed by this: Genghis Marauding 05:32, 13 February 2008 (EST) [edit] you bastid No new WIGOs!!!! feel free to troll and save, but do not add to WIGO until next Freya Day! Beotch. human 22:55, 15 February 2008 (EST) [edit] cover story Hey Ames, the "procedure", if you don't mind, is to: 1. Put {{cover}} at teh top of the article you are nominating 2. Start a new talk section called "cover story" and put Please do not archive this section at the top of it. 3. State why you are nominating the article. Then prod people to go discuss the nominees that are automatically in category:cover story nominees. Thanks! human 12:09, 16 February 2008 (EST) [edit] oh please... I do not need petty "user rights". My powers are REAL, not useless. DoggedamesP 00:47, 21 February 2008 (EST) [edit] Bored? Are you bored or something? Bohdan2 00:10, 22 February 2008 (EST) - I'm reading about adverse possession. What do you think? Is this actually Bohdan? I forget.-αmεσ (soldier) 00:12, 22 February 2008 (EST) Would you like to debate about something? Bohdan2 00:13, 22 February 2008 (EST) - We could debate about whether we should debate about something. I say NO!0αmεσ (soldier) 00:16, 22 February 2008 (EST) - Would you please explain your position. Bohdan2 00:17, 22 February 2008 (EST) - See, there's this passage in II Peter that says we shouldn't.-αmεσ (soldier) 00:17, 22 February 2008 (EST) - Nice try. But you happen to be an atheist. Bohdan2 00:20, 22 February 2008 (EST) - We could 'definitely' debate about whether or nor not we should debate about something. Or not. human 00:20, 22 February 2008 (EST) - Ah, now we have a debate! I'm actually an agnostic spiritualist. Humanist? But not an atheist! Touche!!!!!! We could also debate about how awesome Bohdan is. I content that he is "very."-αmεσ (soldier) 00:22, 22 February 2008 (EST) - Human was not invited to the debate. You are so to an atheist. Bohdan2 00:23, 22 February 2008 (EST) Only when the choice involves killing babies. God I hate them. Almost as much as I hate cats.-αmεσ (soldier) 00:25, 22 February 2008 (EST) - We are all well aware of the terrible things you do to cats. How you live with yourself, I'll never understand... Bohdan2 00:27, 22 February 2008 (EST) On a matter unrelated to the debate, lets try to fill up the recent changes page with just your talk page. Then get a screen shot. Bohdan2 00:28, 22 February 2008 (EST) - I'm committed to this goal. Also, on a related note, I was petting my cat, and it's so dry here that I accidentally static-shocked her, just by touching her fur! I felt awful and then burst into raucous evil laughter. Then I pet her on the head for a while.-αmεσ (soldier) 00:30, 22 February 2008 (EST) - [edit conflict]So, would you be angry if I decided to improve my user page just as you reach edit 49? - Icewedge 00:32, 22 February 2008 (EST) - Are you saying you electrocuted your cat? Bohdan2 00:31, 22 February 2008 (EST) Oh, a debate? Sounds fun. Pinto's5150 Talk 00:34, 22 February 2008 (EST) Shows over everyone. Human wrecked the attempt. Bohdan3 00:35, 22 February 2008 (EST) - We could photoshop over it? That wasn't very nice Human...-αmεσ (soldier) 00:36, 22 February 2008 (EST) Back to the topic at hand. Next time you electrocute one of you poor cats, you will leave me no choice but to report you to the Humane society. Bohdan2 00:40, 22 February 2008 (EST) - But I only electrocuted her by trying to pet her. Should the Humane Society discourage petting one's cat?!-00:42, 22 February 2008 (EST) Always watching.....Stubbot 21:56, 24 February 2008 (EST) [edit] "board member" Congratulations! human 22:10, 26 February 2008 (EST) - OMG thanks! I'm really excited. I was scared most all of today. YAY! Thanks for the congrats!-αmεσ (soldier) 22:29, 26 February 2008 (EST) - Congratulations Ames. But what exactly were you scared of? DoggedamesP 23:09, 26 February 2008 (EST) - Not being elected :-) and thanks!!! -αmεσ (soldier) 23:15, 26 February 2008 (EST) - I thought you were scared that the other editors would beat you up. I am relieved. DoggedamesP 23:28, 26 February 2008 (EST) - What? "Board member"? Is this a play on words with the section above this one, or did I miss some catastrophic, democratically based event? Do we even have a board? I thought nonprofits needed money before you could do that. -- Radioactive Misanthrope 23:30, 26 February 2008 (EST) - It's IRL :-). And Bohdan, I'd be afraid you'd be beat me up.-αmεσ (soldier) 23:39, 26 February 2008 (EST) - Oh. So we don't have money to form a board like real nonprofits do? Dang. -- Radioactive Misanthrope 23:49, 26 February 2008 (EST) [edit] DoggedAmesP to TMTamesP DogP thanks you! DogP 19:45, 27 February 2008 (EST) - Hahahah. Some day I'll just rename him as Tmtoulouse and see what happens :-) -αmεσ (soldier) 19:49, 27 February 2008 (EST) Why thank Ames? It was my idea. Bohdan2 19:52, 27 February 2008 (EST) - Careful I will just remove EVERYONES user rights and then we will see where we are. tmtoulouse annoy 19:53, 27 February 2008 (EST) [edit] debate time What do you say? Are you in? TmtamesP 00:49, 28 February 2008 (EST) - Tragedy strikes. I was about to go to bed & read :-( rain check?-αmεσ (soldier) 00:53, 28 February 2008 (EST) - Wait. You mean you go to bed (sleep) first and then read? That makes no sense. I can only assume you are lying. You are just afraid of my wikilawyering skills. Fine. I will debate with someone else. But it won't be the same :( TmtamesP 00:55, 28 February 2008 (EST) [edit] Starcraft Fun game, eh? Pinto's5150 Talk 01:01, 28 February 2008 (EST) - I just learned that there's a bonus mission if you beat Zerg Mission 9 (Brood War) with at least 5m to spare. Damn! 10 years and I had no idea!-αmεσ (soldier) 01:03, 28 February 2008 (EST) - I really wish I could remember where my disk is. Pinto's5150 Talk 17:25, 28 February 2008 (EST) [edit] Debate Night! Get ready Ames, its debate night tonight. How about around 11 eastern? We can start up our own user debate subpage, it will be so fun. TmtamesP 15:41, 28 February 2008 (EST) - Oh noes, hide teh kittehs!!! human 15:49, 28 February 2008 (EST) - What debate? Have you guys been keeping secrets from me? Liberal deceit, I say! -- Radioactive Misanthrope 16:46, 28 February 2008 (EST) - I think others should participate to, so you don't slaughter me like last time.-αmεσ (soldier) 16:50, 28 February 2008 (EST) - Is that a yes? At 11 eastern? TmtamesP 16:51, 28 February 2008 (EST) - On or about?-αmεσ (soldier) 16:54, 28 February 2008 (EST) - *Ahem* Still no one has told me what's going on... -- Radioactive Misanthrope 16:55, 28 February 2008 (EST) - Count me in! human 16:56, 28 February 2008 (EST) - None of you are invited. TmtamesP 16:58, 28 February 2008 (EST) - We can debate right now about whether to invite them. I say that if we don't invite them, I'll push my cat off the bed by accident again. And it'll be all your fault.-αmεσ (soldier) 17:00, 28 February 2008 (EST) - 11 PM eastern is 5 AM central European. Why are you trying to exclude us? Is it because we're Euro-commies? :-( --AKjeldsenGodspeed! 17:04, 28 February 2008 (EST) - It's 8 PM where I am. My time zone is better than yours! : ) -- Radioactive Misanthrope 17:10, 28 February 2008 (EST) - Because you're mean. TmtamesP 17:05, 28 February 2008 (EST) Bohdan where do you live? Aren't you Ukrainian or something? Wo't that be like 3 am or something?-αmεσ (soldier) 17:06, 28 February 2008 (EST) - Stunning. I could be in Canada. TmtamesP 17:07, 28 February 2008 (EST) - We're not mean, we're just... financially sensible. --AKjeldsenGodspeed! 17:09, 28 February 2008 (EST) - Nope. 100% mean. TmtamesP 17:10, 28 February 2008 (EST) - Oh. I see. :-( --AKjeldsenGodspeed! 17:14, 28 February 2008 (EST) <---Shall we bring food and beverages? Who will be hosting? human 17:17, 28 February 2008 (EST) - You will. You have a house, don't you? : ) -- Radioactive Misanthrope 17:22, 28 February 2008 (EST) - I'll bring the gloves and KY!!-- -PalMD --Trust me; I'm a doctor 17:20, 28 February 2008 (EST) - neither one of you are invited. TmtamesP 17:21, 28 February 2008 (EST) - Bohdan, I'll be there, whether you like it or not. Pinto's5150 Talk 17:24, 28 February 2008 (EST) - You were never invited to this site, Bohdan. You just sort of force your abominable self upon us. It's only fair that we get to barge in on your affairs every now and then. -- Radioactive Misanthrope 17:26, 28 February 2008 (EST) - Wow, you're a rather inflammatory fellow, aren't you? Pinto's5150 Talk 17:28, 28 February 2008 (EST) I say we get AmesG to archive this mess of a talk page and we play in the clean space. human 17:25, 28 February 2008 (EST) That's it, no debate! Thanks Ames, for not RSVPing. And RA, how do you know I wasn't invited? TmtamesP 17:29, 28 February 2008 (EST) - Coward. If I do remember correctly, you were invited, but then again, you were here before I was. Pinto's5150 Talk 17:33, 28 February 2008 (EST) [edit] Long live le Debate!!! That's it, the debate is on! Or, at least, the pre-debate wrangling over time, place, participants and attitude. human 17:35, 28 February 2008 (EST) That's it! Is Human welcome to the cancelled pre-debate debate? Opinions? TmtamesP 17:38, 28 February 2008 (EST) - I don't think so, 'cuz I'm a mean Euro-commie. --AKjeldsenGodspeed! 17:39, 28 February 2008 (EST) I think the debate is on, and everyone should be invited. If we don't do that we'll be just like CP!-αmεσ (soldier) 17:49, 28 February 2008 (EST) - You fool! That's Bohdan's line! -- Radioactive Misanthrope 17:54, 28 February 2008 (EST) [edit] Next Issue Does Bohdan even have the right to call off the debate? Discuss. Pinto's5150 Talk 18:03, 28 February 2008 (EST) [edit] Next Tissue Does that bean guy even have the right to question Bohdan? Discuss. human 18:08, 28 February 2008 (EST) [edit] Text Tissue Does Human even have the right to question That Bean Guy? Discuss. Pinto's5150 Talk 18:12, 28 February 2008 (EST) [edit] Text Fissure Cake? Yes/no/lie? Discuss. --AKjeldsenGodspeed! 18:14, 28 February 2008 (EST) - The cake is a lie! The cake is a lie! The cake is a lie! The cake is a lie! Damn that GLaDOS. Pinto's5150 Talk 18:18, 28 February 2008 (EST) [edit] Mixed Pressure What does 'discuss' mean? Discuss. --AKjeldsenGodspeed! 18:38, 28 February 2008 (EST) [edit] Mixed Pleasure What duz 'maen' discuss? Cheezburger. human 19:15, 28 February 2008 (EST) [edit] Jinxed Treasure Will it blend? Ssucsid. --AKjeldsenGodspeed! 19:26, 28 February 2008 (EST) - Perhaps. TmtamesP 19:26, 28 February 2008 (EST) - Nah, it'll blend. It always blends. --AKjeldsenGodspeed! 19:28, 28 February 2008 (EST) - If you say that, then I have to disagree with you. It won't blend. It never blends. TmtamesP 19:30, 28 February 2008 (EST) - Tom agrees with me. Trus me, it will blend. --AKjeldsenGodspeed! 19:35, 28 February 2008 (EST) [edit] Sphinx' Pleasure Will Ames love us even more than he already does when he comes back to find his talk page filled with random crap our erudite discussion topics? Blend. --AKjeldsenGodspeed! 20:07, 28 February 2008 (EST) - Ames already hates you and I. TmtamesP 20:08, 28 February 2008 (EST) [edit] Human Take a wiki-break. For a few months TmtamesP 19:17, 28 February 2008 (EST) - Gee, I thought you meant you blocked me into the middle of next summer! Now shut up, I'm putting 15 years of snowfall records into a spreadsheet to graph. human 19:24, 28 February 2008 (EST) -- -PalMD --Trust me; I'm a doctor 19:57, 28 February 2008 (EST) [edit] Wherein I declare my hate for you all Deal with it. Maybe debate at 12 though?-αmεσ (soldier) 22:27, 28 February 2008 (EST) - The debate is on in one twenty minutes. TmtamesP 22:41, 28 February 2008 (EST) - I win!-- -PalMD --Trust me; I'm a doctor 23:12, 28 February 2008 (EST) - This isn't even the debate page, you numbskull. TmtamesP 23:13, 28 February 2008 (EST) - Awesome, I eat now, I come debate soon! Midnight, with pistols, and acumen. human 23:15, 28 February 2008 (EST) - You said "numbskull"! Cool!-- -PalMD --Trust me; I'm a doctor 23:20, 28 February 2008 (EST) - I used the ad hom template. TmtamesP 23:23, 28 February 2008 (EST) - I nicely fed now, baker tato & ham and swiss omelet (YUM). Let the discussions rolllll!!!! human 00:00, 29 February 2008 (EST) [edit] DeBaTe ToPiC Should any wiki run on the MediaWiki software honor the open editing policy of Wikipedia? Alternate topic: If farts have lumps, are they truly still just farts? Discuss (disgust) human 23:58, 28 February 2008 (EST) - First topic: Not necessarily. Some people may just like the look and ease of use of Mediawiki, and use it for a private website. Only if they explicitly claim to be a wiki should they allow open editing. - Second topic: -- Radioactive Misanthrope 00:05, 29 February 2008 (EST) - Oh oh. I forgot.-αmεσ (soldier) 00:19, 29 February 2008 (EST) - I was here at 11 eastern. I created the debate page. You didn't show. You lied again. I don't like you anymore. TmtamesP 00:20, 29 February 2008 (EST) - No!!!! I edited above to say 12 eastern instead!-αmεσ (soldier) 00:21, 29 February 2008 (EST) - Oh. Okay. Then nevermind. But I am still taking the victory. Perfect 2-0. TmtamesP 00:23, 29 February 2008 (EST) - Yes, a perfect run. Ames: 2, Bohdan: 0. -- Radioactive Misanthrope 00:25, 29 February 2008 (EST) 2-0-1 draw :-) -αmεσ (soldier) 00:23, 29 February 2008 (EST) - This impersonation of you was so good. It was very believable. TmtamesP 00:24, 29 February 2008 (EST) But my counter of it was exactly 1,337 characters. See? I think i win at life.-αmεσ (soldier) 00:25, 29 February 2008 (EST) - I was here at 11 EST, nothing was happening, tmtamesgradiodocpalnamuhpretzel, you LIE! human 00:26, 29 February 2008 (EST) - At 11:03 eastern I created the debate page. YOU LIE! TmtamesP 00:27, 29 February 2008 (EST) - You were off stuffing your face with omelettes. TmtamesP 00:28, 29 February 2008 (EST) - Any you were stuffing your face with crap. In one end, out the other. -- Radioactive Misanthrope 00:30, 29 February 2008 (EST) - I admit it. at 11 I was playing starcraft. Sorry.-αmεσ (soldier) 00:29, 29 February 2008 (EST) Lets try Monday at 11 eastern. Does that work for you? TmtamesP 00:34, 29 February 2008 (EST) Stop edit conflicting with me. CЯacke® 00:35, 29 February 2008 (EST) - So where is this alleged "debate page"????? Heh????? human 00:35, 29 February 2008 (EST) - User:AmesG/debate 2-28. -- Radioactive Misanthrope 00:37, 29 February 2008 (EST) Well, then, obviously, human 00:43, 29 February 2008 (EST) [edit] Debate Aw, Ames, I am not disappointed. I am just a little... disappointed. But we'll debate next week sometime. Until then, TmtamesP 00:51, 29 February 2008 (EST) - Coward. You're just like ASchlafly, postponing the election of sysops. -- ni ebnamuħ 00:52, 29 February 2008 (EST) To Bohdan - you bet buddy :-) -αmεσ (soldier) 00:53, 29 February 2008 (EST) [edit] Happy Birthday! What are you, twelve or thirteen? :) TmtamesP 01:40, 1 March 2008 (EST) Or was this just another one of your many lies? :( TmtamesP 01:41, 1 March 2008 (EST) - It is true! Thanks Bohdan buddy! I'm 24, meaning very old-αmεσ (soldier) 01:42, 1 March 2008 (EST) - I'm still skeptical. After all, you have a reputation for abusing my trust. I seem to remember something about a debate? What happened with that? TmtamesP 01:53, 1 March 2008 (EST) - I let you down because I forgot what time it was :-( :-( :-( :-( off to sleep now tho :0)-αmεσ (soldier) 01:58, 1 March 2008 (EST) - Well, half my age, I must be dead by now. Congratulations, and sweet of nadhoB to remember - and better yet, it is "David's" day (check your recent changes/watchlist) human 01:48, 1 March 2008 (EST) - Happy birthday! And you're not old. Yet. ;-) --AKjeldsenGodspeed! 08:35, 1 March 2008 (EST) [edit] Cratness Can I have my crat powers back? Pinto's5150 Talk 23:41, 2 March 2008 (EST) - Thank you, I'm not rightly sure why they were gone. Pinto's5150 Talk 23:44, 2 March 2008 (EST) Human took them away, and despite Pinto's requets he would not return them. Ames has shown total disregard for Human's authority. What will happen next? TmtamesP 23:55, 2 March 2008 (EST) - Say what? Pinto's5150 Talk 23:56, 2 March 2008 (EST) [edit] Belated birthday gift Enjoy. TmtamesP 00:04, 3 March 2008 (EST) - Hahahahahhahahahhahahahahahahhaahahahahaha I love it! My girlfriend hated that game. But technically, by being level 72, I was a winner?-αmεσ (soldier) 00:52, 3 March 2008 (EST) Sorry, I'm flat broke and can't get you anything. I spent it all on concert tickets for my brother's birthday. And ice cream for myself. Yah... If it's any consolation, the ice cream was really good. Well, at least the chocolate chip cookie dough, but the "cheesecake diva" was incredibly bad. -- Radioactive Misanthrope 14:21, 3 March 2008 (EST) [edit] Request for friend Timppeli forgot his password, and asked me to ask you if you could delete his account so he can start over. Please? -- Radioactive Misanthrope 19:48, 6 March 2008 (EST) - Maybe we should "rename" the old account as (say) "Timmpeli_old" or something? Then I presume the account could be recreated? (But I'm not sure). RA, why don't we do a test of this? I can do that to one of your surplus sockpuppets and you can check to see if you can recreate the account? human 19:58, 6 March 2008 (EST) - >_< I just asked you on your talk page without realizing you had already responded here. And yah, sure. How about renaming NamuH to Namuh? -- Radioactive Misanthrope 20:00, 6 March 2008 (EST) - OK, I'll do it in a few seconds. human 20:03, 6 March 2008 (EST) - Done. Do you want to try re-registering it before we do anything with the redirects? human 20:04, 6 March 2008 (EST) - Nevermind! I just registered as "Bohdan". The original! :D --Bohdan 20:07, 6 March 2008 (EST) - Yup. Now put those redirects back and lose the password ;) Anyway, what does timmpeli want his "old" name moved to? human 20:10, 6 March 2008 (EST) - Timppeli2, he says. Btw, it's spelled with two 'p's and only one 'm'. Just making sure : ) -- Radioactive Misanthrope 20:12, 6 March 2008 (EST) Er, again, I can "reset" his password to anything just e-mail me in private so no one else gets in. tmtoulouse annoy 20:13, 6 March 2008 (EST) - I'll ask him. -- Radioactive Misanthrope 20:14, 6 March 2008 (EST) - He says he's "trying to find [your] email from somewhere". Would you mind supplying it for him (via me)? -- Radioactive Misanthrope 20:22, 6 March 2008 (EST) - ttoulouse@gmail.com tmtoulouse annoy 20:24, 6 March 2008 (EST) It works! Thanks all. Timppeli 21:20, 6 March 2008 (EST) [edit] Display of Ignorance Who's Ms. O'Leary? Susanpurrrrr 15:47, 8 March 2008 (EST) - Obscure and vitrolic pseudoscience blogger. Nuff said. UchihaKATON! 15:50, 8 March 2008 (EST) - Hmm... Illuminating. Susanpurrrrr 15:53, 8 March 2008 (EST) - I believe she burned down Chicago. That would make her a terrorist. DickTurpis 15:57, 8 March 2008 (EST) THAT was fun. I think I did a good job of being respectful, but Karajou has such a hard on for me...-αmεσ (soldier) 16:00, 8 March 2008 (EST) [edit] are you ready? For the TK welcome home party? TmtamesP 16:10, 10 March 2008 (EDT) - I wondered why that shape in my Foe-Glass was getting bigger.-αmεσ (soldier) 16:12, 10 March 2008 (EDT) Am I Ralph Nader?— Unsigned, by: TmtamesP / talk / contribs - No, I just like that pic. And you are sort of a third party type of guy.-αmεσ (soldier) 16:20, 10 March 2008 (EDT) - Don't we all like a few Nader pics once in a while? But hey, where is our guest of honor? Since you were involved in the block, would you send the "welcome back" email? TmtamesP 16:22, 10 March 2008 (EDT) - I don't think I could code an appropriate virus in time :-/ -αmεσ (soldier) 16:23, 10 March 2008 (EDT) - I will ignore that, and wait patiently for his return and rw's subsequent episode of headless chicken mode. Perhaps this time we can make it throught it? TmtamesP 16:24, 10 March 2008 (EDT) - I think we made it through last time alright. Everybody won!-αmεσ (soldier) 16:30, 10 March 2008 (EDT) - As I said before, I was actually under the impression that TK had decided to leave and never come back? --AKjeldsenGodspeed! 16:37, 10 March 2008 (EDT) But we actually like you, Bohdan.-αmεσ (soldier) 16:41, 10 March 2008 (EDT) - Don't forget about the clean slate rule. TmtamesP 16:42, 10 March 2008 (EDT) - What about the clean slate rule? --AKjeldsenGodspeed! 16:45, 10 March 2008 (EDT) - Anders, please. Think. TmtamesP 16:47, 10 March 2008 (EDT) - "Andreas". Also, I spend all day thinking at work. After hours, I prefer to avoid it whenever I can. :nods: --AKjeldsenGodspeed! 16:52, 10 March 2008 (EDT) Andreas? I think not. Its time for another debate. Anders v. Andreas [edit] What is AKjeldsen's first name? [edit] Anders [edit] Andreas *Strong support. AKjeldsenGodspeed! 17:02, 10 March 2008 (EDT) But... it's true. I can prove it. I have papers and... stuff. :-( - Comment - nonsense. The mob and the mob alone will determine your name. TmtamesP 17:03, 10 March 2008 (EDT) - Strong oppose - obviously lieberal deceit. human 18:10, 10 March 2008 (EDT) [edit] Ames [edit] Peter [edit] Arathorn [edit] Andy [edit] Bohdan - Exercising my powers as bureaucrat, in the hopes that this may make us "as bad as CP," I find that AKJ's first name is Bohdan.-αmεσ (soldier) 20:31, 10 March 2008 (EDT) - Strongly disapprove -- Bohdan 21:24, 10 March 2008 (EDT) [edit] food or pet? Has your shrimp mauled your betta splendens yet? human 21:41, 10 March 2008 (EDT) - They both died :-( -αmεσ (soldier) 21:44, 10 March 2008 (EDT) - Natural causes, I promise :-) But the betta was the one that tried to kill itt! How'd you know about that?-αmεσ (soldier) 21:45, 10 March 2008 (EDT) [edit] I'm sending you an important email regarding some of what we were discussing ASAP. You should get it in a few minutes. I'm sending you an important email regarding some of what we were discussing ASAP. You should get it in a few minutes. human 22:12, 10 March 2008 (EDT) [edit] I have sent the aforementioned email. Please check your email soon and read what I wrote. I have sent the aforementioned email. Please check your email soon and read what I wrote. human 22:15, 10 March 2008 (EDT) [edit] Request Will you send the email to TK telling him his block is over? Please? TmtamesP 14:53, 11 March 2008 (EDT) - nope.-αmεσ (soldier) 15:16, 11 March 2008 (EDT) I think you're confused about what tolerance means. Where there's objective cause shown to disregard the benefit of the doubt accorded the person, the presumption that he's a nice guy drops out. For example, one need not tolerate a felon who hasn't served his time. Just so, one need not tolerate an insufferably recidivist douchebag. -αmεσ (soldier) 15:25, 11 March 2008 (EDT) - If TK said that, he would be blocked. TmtamesP 15:30, 11 March 2008 (EDT) - Yes he would. --AKjeldsenGodspeed! 15:34, 11 March 2008 (EDT) [edit] Surprise debate time You ready? TmtamesP 22:36, 11 March 2008 (EDT) - "Uh-oh! Here we go again!" UchihaKATON! 22:39, 11 March 2008 (EDT) Should DogP get dinner? TmtamesP 22:44, 11 March 2008 (EDT) I only have my iPhone available right now which means I may not be able to debate well. I nominate human as my second-αmεσ (soldier) 23:00, 11 March 2008 (EDT) I will not attend, as I am going out to have a life after my nice dinner. Debate well, Liberal Scum! DogP 23:32, 11 March 2008 (EDT) - Strong support: DogP should get dinner. Food is good. I ate food. It was good. I will live another day to participate in yet another SURPRISE DEBATE. human 01:34, 12 March 2008 (EDT) I have returned to zhe debate, but am a bish too drunk for deh debatink, offisher. G'night. DogP 03:11, 12 March 2008 (EDT) - Strong delete - Ames has obviously used extensive original research in his law studies. --מְתֻרְגְּמָן שְׁלֹום [edit] Another debate Tonight. 9 eastern. You had better show up. TmtamesP 16:54, 12 March 2008 (EDT) - Wait...don't just show up, look around for a sec, and declare yourself the Viktor.-- -PalMD --Trust me; I'm a doctor 17:10, 12 March 2008 (EDT) - Depending on the wimminz, I may not be available!-αmεσ (soldier) 17:14, 12 March 2008 (EDT) - We could have a debate, "Should Ames have a girlfriend?"-αmεσ (soldier) 17:15, 12 March 2008 (EDT) - As long as it's not my wife...-- -PalMD --Trust me; I'm a doctor 17:16, 12 March 2008 (EDT) I heard a rumor that Ames and Spitzer are chums. TmtamesP 17:17, 12 March 2008 (EDT) - We're both liberals and in New York. Coincidence?-αmεσ (soldier) 17:19, 12 March 2008 (EDT) [edit] Good news! I just remembered that I can email people through the wiki. TK has been notified of his expired block! TmtamesP 18:56, 12 March 2008 (EDT) - I am RationalWiki's karajou! I destroy all things that I don't like! RAAAAAAAAAAAWR!-αmεσ (soldier) 19:02, 12 March 2008 (EDT) - He'll be thrilled, I'm sure. --AKjeldsenGodspeed! 19:03, 12 March 2008 (EDT) - Go play with your wooden shoes, Anders. TmtamesP 19:05, 12 March 2008 (EDT) - That would be the Dutch. Please get your Euro-commies straight. --AKjeldsenGodspeed! 19:06, 12 March 2008 (EDT) [edit] Debate time! Are the Dutch and the Danes the same? [edit] Yes - Strong Support - only someone with a serious WP:COI would disagree. TmtamesP 19:15, 12 March 2008 (EDT) [edit] No - Of course not. The very thought itself is practically unnatural. --AKjeldsenGodspeed! 19:12, 12 March 2008 (EDT) - WP:IDONTLIKEIT. --מְתֻרְגְּמָן שְׁלֹום - WP:VAGUEWAVE. --AKjeldsenGodspeed! 19:26, 12 March 2008 (EDT) - WP:IGNOREALLARGUMENTS. --מְתֻרְגְּמָן שְׁלֹום - Agreed. The Danes are famous for their engineering and dike building.-- -PalMD --Trust me; I'm a doctor 19:14, 12 March 2008 (EDT) - But... ok, actually, we do have dikes. But they're very different from the Dutch dikes! --AKjeldsenGodspeed! 19:27, 12 March 2008 (EDT) [edit] A bit - Kind of. But Danes are way cooler. See, e.g., Beowulf, but not the movie. Please, God, not the movie.-αmεσ (soldier) 19:14, 12 March 2008 (EDT) [edit] Discussion They both were wooden shoes, thus they are the same. Simple. TmtamesP 19:16, 12 March 2008 (EDT) - I must protest! Neither I, nor anyone I know, has ever been a wooden shoe. --AKjeldsenGodspeed! 19:18, 12 March 2008 (EDT) - AKjeldsen, you are simply revealing your own liberal ignorance. This type of deceit will not be tolerated. Godspeed. [edit] I'll be back at nine when the real debate begins. Please be sure to establish a substantive topic so we can all Learn Together. I'll be back at nine (EST) when the real debate begins. Please be sure to establish a substantive topic so we can all Learn Together. human 19:43, 12 March 2008 (EDT) - You aren't invited. TmtamesP 19:46, 12 March 2008 (EDT) - Thanks! I'll be there!-- -PalMD --Trust me; I'm a doctor 19:48, 12 March 2008 (EDT) - You are only invited if Ames choosed to go out with Spitzer rather than debate. TmtamesP 19:49, 12 March 2008 (EDT) - Are you calling my girlfriend Elliott Spitzer?! Hot! Anyways, I think I will have to miss, can I make Human my second?-αmεσ (soldier) 19:55, 12 March 2008 (EDT) - Why is it all the interesting debates happen way after my bedtime? :-/ --AKjeldsenGodspeed! 20:05, 12 March 2008 (EDT) - Why is it that all the interesting debates happen when I'm supposed to be doing schoolwork? -- Radioactive Misanthrope 08:00, 13 March 2008 (EDT) [edit] What happened to the much-heralded debate for the champion crown of uber-debater that was supposed to be happening hereabouts round about now? What happened to the much-heralded debate for the champion crown of uber-debater that was supposed to be happening hereabouts round about now? human 21:33, 12 March 2008 (EDT) - Ames is out, Kjeldsen is gone, PalMD is missing, and Interpreter is only here in spirit. The debate can't happen. TmtamesP 22:06, 12 March 2008 (EDT) - Of course it can -- you and I are both at least partially here, Secret Squirrel is nibbling on stale acorns nearby, and that Glaucopis guy would surely have 3 or 4 depreciated cents to toss into the mix. So I certainly would argue for the proposition that the debate can happen. human 22:14, 12 March 2008 (EDT) - It can't. TmtamesP 22:21, 12 March 2008 (EDT) - Well, it won't, if you continue to refuse to argue and merely attempt one or two worded gainsaying of the opposing view's presentation. I am going to get some more eloquent editors to come join the fun! human 22:27, 12 March 2008 (EDT) - Hello. Dark Matter Glaucopis 22:31, 12 March 2008 (EDT) - Muwahahaha-- -PalMD --Trust me; I'm a doctor 22:34, 12 March 2008 (EDT) Pwned! ...or?.... shit!!! human 22:57, 12 March 2008 (EDT) - You need a new topic. Dark Matter Glaucopis 22:59, 12 March 2008 (EDT) - To quote my third favorite video game, "I'm ready to render a verdict in this matter."-αmεσ (soldier) 23:01, 12 March 2008 (EDT) - What video game is that? -- Radioactive Misanthrope 23:03, 12 March 2008 (EDT) - Bearded Judge from Phoenix Wright. I'm delighted that there are so many RW fans of that game, btw, and apparently one Conservapedia lib'rul fan too. Anyways, yeah. Ahead of PW are probably Starcraft, Civilization IV, and Knights of the Old Republic. Oh crap, I can't count!-αmεσ (soldier) 23:05, 12 March 2008 (EDT) - Mine? Pokemon, Fire Emblem, and Zelda. What's with that look? Yes, I am older than twelve, thank you very much. -- Radioactive Misanthrope 23:08, 12 March 2008 (EDT) Silence! The spirit of Wikinterpreter says that... I win the debate! I am now 3-0 against you. See you next time ames. TmtamesP 23:12, 12 March 2008 (EDT) - I debate the results of this debate. I say Human won it, as my second, meaning I won it.-αmεσ (soldier) 23:12, 12 March 2008 (EDT) - My sock was Human's second. Does that mean I won, too? (It boggles the mind...) -- Radioactive Misanthrope 23:13, 12 March 2008 (EDT) OBJECTION!-αmεσ (soldier) 23:15, 12 March 2008 (EDT) Good day. What's teh topic eh? Secret Squirrel 07:55, 13 March 2008 (EDT) [edit] Consolation prize Since I schooled you in the debate, here is something to brighten your day. TmtamesP 23:24, 12 March 2008 (EDT) Since you're evidently too lazy to put it in your signature, I put it in mine. TmtamesP 23:43, 12 March 2008 (EDT) [edit] question What did you study in college? TmtamesP 14:56, 13 March 2008 (EDT) - The ladiez. Hahaha. Just kidding. Ancient history, then political science.-αmεσ (soldier) 15:10, 13 March 2008 (EDT) Both. I doubled it up.-αmεσ (soldier) 15:12, 13 March 2008 (EDT) Rice. See my luserpage-αmεσ (soldier) 15:14, 13 March 2008 (EDT) - I avoid luserpages. Call it a phobia. TmtamesP 15:16, 13 March 2008 (EDT) [edit] D d [edit] E e [edit] B b [edit] A a [edit] T t [edit] E e Speak to Me! (haha, buttsecks?) [edit] TIME! Are you ready? TmtamesP 23:24, 13 March 2008 (EDT) - No. --Gulik 00:00, 14 March 2008 (EDT) - I am. It's on! human 01:26, 14 March 2008 (EDT) - Hello all. So I was actually flying. See, I was supposed to have landed in City 1 by now, but wound up in City 2. Why, you ask? Two words: fuck Airtran. Some more words: your two-hour delays are bad, and made about 100 people today miss their connections. Human, would you be my second again, even though Bohdan isn't man enough to debate you?-αmεσ (soldier) 01:37, 14 March 2008 (EDT) - Sure, no problem. Although all it usually takes to derail teh nadhoB is a simple non sequitur, followed by an ad hoc jab with an ad hominem truth. Hope you make it home (or wherever your destination is). human 01:43, 14 March 2008 (EDT) City #2 is where fambly lives, so life has a pretty good silver lining :-) but thanks for your concern! I'd be concerned for Airtran. Heads're gonna roll.-αmεσ (soldier) 01:47, 14 March 2008 (EDT) [edit] ha ha! Even you believe you're just like what you claim cp is sometimes. TmtamesP 11:59, 14 March 2008 (EDT) - I hadn't paid attention to the according to page in a while, but I do think it's vitally important that we mean what we say, yeah. Which is one reason I like having you around... you keep us honest in our internal dealings, if sometimes you go too far.-αmεσ (soldier) 12:03, 14 March 2008 (EDT) [edit] Thanks But we could still do with some more help. I'm beginning to get tired and cranky with the discussion. MarcusCicero 13:38, 14 March 2008 (EDT) [edit] debates Ames, I have secured a wiki for non-stop debating. Please tell me what time you are available to debate. Until then, TmtamesP 19:49, 15 March 2008 (EDT) - You are, however, not permitted to wear clogs or play with Lego while on the site. Just remember that. --מְתֻרְגְּמָן שְׁלֹום - What? I have to play with Lego when I edit wikis! TmtamesP 19:59, 15 March 2008 (EDT) - Remember NDPOV, Bohdan. --מְתֻרְגְּמָן שְׁלֹום - You're right. I will gladly give it up for such a noble cause. TmtamesP 20:02, 15 March 2008 (EDT) - I think everyone should be playing with Lego all the time. The more, the better! --AKjeldsenGodspeed! 20:05, 15 March 2008 (EDT) - That figures... TmtamesP 20:06, 15 March 2008 (EDT) - Well, we all have to do ours for the balance of trade. --AKjeldsenGodspeed! 20:31, 15 March 2008 (EDT) Its tuesday, debate night. TmtamesP 12:54, 18 March 2008 (EDT) - I'll debate if you go over to the other place & call Ed Poor out on his craziness.-αmεσ (soldier) 12:56, 18 March 2008 (EDT) - Really? Now I must earn debates? Are you talking about the liberal code words page? TmtamesP 13:01, 18 March 2008 (EDT) - Just general, "articles sourced to blog posts" pages.-αmεσ (soldier) 13:03, 18 March 2008 (EDT) - Whoa. You did. I guess we have to debate now!-αmεσ (soldier) 13:35, 18 March 2008 (EDT) Well? Where are you? Don't make me write a liberal honesty article... TmtamesP 22:23, 18 March 2008 (EDT) apologies but I'm currently occupied with throwing up. Some bad Indian food. Pray for mojo. Sysop rights to the first person to place that quote.αmεσ (soldier) 00:03, 19 March 2008 (EDT) - As much as it pains me to say this, I don't believe you. You're probably out with Spitz right now... TmtamesP 00:09, 19 March 2008 (EDT) - Bohdan, did you just pass up the op for sysopness?????? Pinto's5150 Talk 00:12, 19 March 2008 (EDT) - B17, you might want to go put a security fence around your beloved RWWW. Teh wandals edit it more than anyone else; teh logo, she iz gonn, captin. human 00:20, 19 March 2008 (EDT) - And where, may I ask, were you whilst the wiki was being vandalized? I made you a sysop for a reason. TmtamesP 00:53, 19 March 2008 (EDT) - Bohdan dearest, I was telling the truth! And I just sat up for the first time in 12 hours or so. It's really exciting. I had to share it.-αmεσ (soldier) 16:33, 19 March 2008 (EDT) [edit] Susan They think I drove away Susan. Thats why their pissed. MarcusCicero 07:01, 25 March 2008 (EDT) [edit] me ames, can you block me for 5 minutes, i dont want myself getting too angry here --RyanB 11:00, 25 March 2008 (EDT) [edit] Image:LochShiel04.png Ames, do you have a Flickr account? - Reply to apparently Susan. I'm sorry for the comment by StrangeIP above. I've Commented it out for douchiness. I don't :-(. But I guess I could get one! Alternately, could you e-mail me a high-res one? I'm ames.xxxxxxx@gmail.com... I promise to use it only as a desktop and not commercially :-) - Hope you're back on the site soon.-αmεσ (soldier) 23:26, 25 March 2008 (EDT) [edit] Community Standards I put some suggestions on RationalWiki talk:Community Standards to help progress the conversation in a new direction. I view it as a community wide discussion, not arbitration for a specific case. Please comment there. Sterilexx 17:49, 25 March 2008 (EDT) [edit] I need help Yesterday, TK was blocked for no reason by PalMD. PalMD would not explain why. Would you look into this abuse of admin powers? There was no reason for the block, and no reason given in the block log. Please see my complaint oh his talk and the admin abuse page. tia, TmtamesP 18:20, 26 March 2008 (EDT) - TK's expressed a desire to leave and never come back, so I think the harm is minimal. We'll hear when we get back :-/ -αmεσ (soldier) 22:01, 26 March 2008 (EDT) No. Yesterday we were having a conversation. PalMD blocked him for no reason. He was unblocked. He was again blocked with no reason then unblocked. Then he was blocked again. No reason was ever given. Is this the sort of site you run? TmtamesP 22:54, 26 March 2008 (EDT) - Honestly, I hadn't paid that much attention to the debates/wars surrounding MarcusCicero. I leapt in a couple times to defend who I had imagined to be the underdog, but found my assumptions wanting, and so tried to slowly, slowly, carefully back out :-). So I actually didn't notice TK's blockage until someone brought it up on TK's little CP Discussion Group Google thing. So I don't think I'm that competent a reviewer. Also, I'm biased.-αmεσ (soldier) 23:07, 26 March 2008 (EDT) You are also a liar. You promised me a debate, and you have not followed through. TmtamesP 23:09, 26 March 2008 (EDT) - I'm learning about close corporations and pornographic art. One sounds dirty, the other is! C'mon, no contest. Sorry :-( -αmεσ (soldier) 23:19, 26 March 2008 (EDT) - Have you finally lost your mind? I ask you about debates, and you tell me this? TmtamesP 23:42, 26 March 2008 (EDT) - I have started, or added amicus briefs to, some debates at the Great Debate Wiki, but I am getting no nibbles, not even a simple "that's not cricket, old chap"! Slacker. human 00:11, 27 March 2008 (EDT) [edit] Say what? Details, man! ;) --Robledo 00:28, 28 March 2008 (EDT) - I conquerconcur (assuming Robbley is talking about the Assfly debate at Princeton). DickTurpis 00:32, 28 March 2008 (EDT) - He is indeed. --Robledo 00:35, 28 March 2008 (EDT) - The best source for the details from an attendant to the imbroglio is at human 00:49, 28 March 2008 (EDT) [edit] block When you blocked TK, you blocked his email. Earlier you said you didn't know how to do that. Were you (gasp) lying to me again? TmtamesP 18:39, 29 March 2008 (EDT) - Or maybe he just looked it up when you (Was that you? I'm working from memory and gut feeling here... *checks* Ah yeah, looks like my memory was right.) brought it up before...</drive-by-guess> --Sid 18:45, 29 March 2008 (EDT) Sid got it right. I hadn't seen that option before but jumped at re chance.-αmεσ (soldier) 19:09, 29 March 2008 (EDT) - Sid, ames lies to me everyday. I always assume he is lying. Besides, he is a lawyer. TmtamesP 20:27, 29 March 2008 (EDT) - May I create a CP sock and quote you for a new cp:Lawyer values? ;) --Sid 21:02, 29 March 2008 (EDT) [edit] A game to play with laywer friends Assuming lawyers have friends give nomic a look some time. --Shagie 22:16, 30 March 2008 (EDT) - That looks super fun. I'm partial to Mafia though... always awesome, but I will try, thanks!-αmεσ (soldier) 00:41, 31 March 2008 (EDT) - P.S. - anything that compares itself (seemingly plausibly) to Calvinball is alright by me.-αmεσ (soldier) 00:42, 31 March 2008 (EDT) [edit] Unblock Will you unblock my real account (human blocked me for no reason), and then rename it to "Wikinterpretererer"? Thanks in advance, Bohdan2 00:56, 31 March 2008 (EDT) - I just learned that this "PMOTF" isn't stated policy, but an advisable policy, but I think that it's a policy which we would be wise to adopt. Accordingly, I didn't unblock you, Bohdan, even though I would've liked to have. Sorry :-(.-αmεσ (soldier) 16:07, 31 March 2008 (EDT) - I could not disagree with you more. This site has no rules on blocking, so who can undo an unjust block? At the begining, it was fun to get little blocks. I even requested them. But now, it is getting old and it is sometimes very inconvenient. Perhaps not for the users who are sysops and able to unblock themselves, but for everyone else it is. You, as a high ranking and respected user, need to take a stand against this. Do it for me. I no longer want to be blocked for anything. I rarely ever vandalize the site anymore, so why am I always blocked? And besides even if I did vandalize, read the quote I put on my userpage (it appears some of the newer sysops don't remember this). Put an end to this senseless blocking. Again, it is not hard for you to get blocked for 2 hours, you will just unblock. But I cannot. When I am in a conversation with a user, and an uninvolved user decides (for no reason) to give me "another timeout" for ___ hours, this is very inconvenient. Thanks, TmtamesP 22:10, 31 March 2008 (EDT) - Bohdan, besides what may have been an unjustified block today on you, what other editors are getting inconvenienced by blocks? Have any editors even been blocked lately besides that troll we all got sick of last May or so?— Unsigned, by: Human / talk / contribs - You're right. Not many other editors are blocked unfairly (and if they are, they just unblock themselves). I am usually the one who is targeted. I suppose I am the only non kool-aid drinker left, perhaps thats why? - Look earlier. I was blocked by a user I have never heard of or interacted with. Why? Because I added Tmtoulouse as a problem at the "constitutional convention page? Is that a good enough reason? TmtamesP 23:14, 31 March 2008 (EDT) - Yes, that was a good reason. You added a senseless attack on a particular editor at a policy discussion page. No other users get blocked, sysop or not, if you take the trouble to actually research instead of just whine. If you are "turning over a new leaf", you'll also have to give up random hand grenades on pages people are trying to take seriously. Save them for sillier discussions, like the rest of us try to do. The very fact that the blocker had never interacted with you attests to the "fairness" of the block. It wasn't personal, silly, or fun. It was for disruptive behaviour. human 01:12, 1 April 2008 (EDT) - Senseless attack? Please, your whole wiki is based on senseless attacks. The fact that he never interacted with me and just blocked out of the blue attests to the fact that your block system is flawed, and you need to start training your sysops what is blockable and what isn't. I am not whining, the only users who get blocked and are unable to unblock themselves are me and TK. My behavior was not disruptive at all, if someone is so disturbed by it, why not just ignore it? I have no reason to give up random hand grenades, as Tmtoulouse assured me safe passage on this wiki no matter what. He specifically said that I would not be blocked. Perhaps Aschlafly is right about liberal deceit? TmtamesP 01:19, 1 April 2008 (EDT) - Safe passage? Only as the "resident vandal". And, as resident vandal, you are also game for fun blocks. Or was that only fun last summer? Which way do you want it? Serious editor, no silly blocks, and you comport yourself accordingly, or resident vandal, subject to hilarious short-term blocks just "because", but you get away with any silliness with no lasting repercussions? You can't have it both ways, Mr. SomebodyElsesNames. It's up to you, but you seem to be driven to take the advantages of the "resident vandal" along with the respect of a normal editor. At this point, one is surely tempted to follow you around posting "ignore the troll, he is our resident vandal" and link to the comment Trent made early last summer. human 01:03, 3 April 2008 (EDT) - Bravo, Human. I said the same thing myself some months ago, so obviously I agree with the sentiment. --Kels 21:43, 4 April 2008 (EDT) - You did not say the same thing. Liberal honesty... TmtamesP 22:54, 4 April 2008 (EDT) - Quiet, troll. --Kels 22:59, 4 April 2008 (EDT) - Please point out where you said, verbatim, what Human said. TmtamesP 23:01, 4 April 2008 (EDT) - Please point out where I'm supposed to care about your opinion. Unless, of course, you want to give up being "resident vandal" and thus your supposed immunity. --Kels 23:04, 4 April 2008 (EDT) - Get bent. I blocked you because, as stated above, it was a stupid senseless attack on Tmtoulouse on a page dedicated to a serious discussion. And get over it, the block was for one lousy hour. Time that was apparently not spent thinking about what you did. Addendum: While you point to this as why you got blocked, it was actually this. Had you left it alone after RA's revert, I would've never thought twice about it. --Edgerunner76...and a hotplate! 07:29, 2 April 2008 (EDT) - I'll stop blocking you senselessly, and if someone tries to do it in fun I'll undo it. Sorry :-/-αmεσ (soldier) 22:38, 31 March 2008 (EDT) - I think the heart of the matter is that if Bohdan wants to redefine his status here, that's fine with everyone - then we'll treat him like any other editor. Of course, that works both ways. No senseless blocks vs. no vandalism and no trolling. --AKjeldsenGodspeed! 11:14, 5 April 2008 (EDT) - Did the original "Resident Vandal" concept include trolling in the first place? Wandalism can be pretty light-hearted (and was cute for about a week), but trolling is a bit less of a jolly jape. --Kels 11:23, 5 April 2008 (EDT) [edit] Voting on the above matter [edit] Yes [edit] No - Pinto's5150 Talk - In accordance with RW:PMOTF, only the original sysop can reverse the blocker. Taking contrary action is divisive and impolite. Genghis Marauding - Coincidentally, I unblocked TtamesP earlier today, partly after realizing that no one else would due to the above-referenced policy. How about renaming it to "WikiTwerp"? human 14:42, 31 March 2008 (EDT) [edit] For YouSusanG 17:38, 1 April 2008 (EDT) - Susan, this is a true gift of love, and some fine, fine photoshoppin :-). Dickie P will appreciate it!-αmεσ (soldier) 23:52, 1 April 2008 (EDT) [edit] I sent a very important e-mail to the ASPCA I sent a very important e-mail to the ASPCA. They told me that, due to both the sheer number and brutality of the complaints they receive on you, they no longer handled investigations involving AmesG, instead they said I needed to go to the animal cruelty division of SMERSH. I fired off an email to them, and they assured me that swift retribution would be dealt. TmtamesP 23:51, 1 April 2008 (EDT) - In my defense, I do supply kitty with numerous pictures of her, photoshopped and captioned hilariously, thanks in part to SusanG-αmεσ (soldier) 23:52, 1 April 2008 (EDT) - what sort of sick person are you? TmtamesP 23:55, 1 April 2008 (EDT) - Fer chissakes he's in school to become a lawyer!!! HELLO? CЯacke® 00:02, 2 April 2008 (EDT) - No, no, no. Lawyers hurt people, Cracker, not cats. Not even lawyers are so heartless. Insurance salemen, now they would hurt a cat. -- Radioactive Misanthrope 01:13, 3 April 2008 (EDT) [edit] side by side template I made a new one and put it here for now. I think, and hope, that it would be a lot easier for people to work with, especially those who are table format-challenged. I would like to replace the template itself with it, but thought since you made the original I'd at least get feedback from you before over-writing your fine work. Any comments here, at its talk page, or at talk main (where I made a small blurb for it), would be appreciated! Thanks, human 13:47, 2 April 2008 (EDT) [edit] d d [edit] e e [edit] b b [edit] a a [edit] t t [edit] e e [edit] (space) [edit] t t [edit] i i [edit] m m [edit] e e [edit] ! ! [edit] from, --TmtamesP 23:49, 2 April 2008 (EDT) [edit] TmtamesP . [edit] The lord of all universes Think Elassint had a mood swing... again --Ryan 21:38, 4 April 2008 (EDT) [edit] Debate If Ames does not respond, I will accept anyone... SHahB 01:00, 8 April 2008 (EDT) - Look Amos, you promised me a debate. I ask you: how long? SHahB 16:42, 8 April 2008 (EDT) Debate here please. You were already unblocked and that didn't turn out well. SHahB 16:45, 8 April 2008 (EDT) - Just because Karajou's primal instincts were aroused when he discovered there was something in his cave. As he seems to be getting dumber by the minute, there's no telling how he'd react now.-αmεσ (soldier) 16:48, 8 April 2008 (EDT) Ames. Never. Ever. Put. The words. 'Karajou'. And. 'Aroused'. In. The. Same. Sentence. Gottit? In other news, I've been a little ill lately, and as such have watched the entire first season of Battlestar Galactica (almost) back to back. It is, as you say, excellent - although I'm not sure yet that I see a similarity between Baltar and Terry.--מְתֻרְגְּמָן שְׁלֹום [edit] Debate (closing argument) Ladies and gentlemen of this supposed jury, Ames would certainly want you to believe that his client wrote "Stinky Britches" ten years ago. And he makes. SHahB 22:56, 8 April 2008 (EDT) - OLD! PHAIL! --AKjeldsenGodspeed! 14:22, 9 April 2008 (EDT) [edit] Possible? Hey homes, any chance that a bureaucrat or someone could reset/change the password on the User:Fox account so that I can reclaim it? I don't especially mind the V. vulpes, but I'd prefer not to be a "sock" of myself if you see what I mean :D If it can be done, then the new password could be emailed to my gmail address and I could reclaim my identity. V. vulpes 15:46, 11 April 2008 (EDT) - I wish I could, but I don't know how to. I think you might have to talk to fearless leader.-αmεσ (soldier) 15:54, 11 April 2008 (EDT) - Nema problema, I will ask on his page :) ty anyway Fox 15:59, 11 April 2008 (EDT) - One way I or another 'crat could do it would be to rename the Fox account, to something of your choice. Then, you could reregister as Fox (renaming leaves the old name "untaken", strangely enough). Let me know if you want to do that. Although, since Tmt is around maybe for a bit, asking him to do it might work. human 22:18, 11 April 2008 (EDT) - I thought of that but discounted it because I assumed he'd want his old contribs acessible, too... but that's a good option if TMT can't help.-αmεσ (soldier) 22:21, 11 April 2008 (EDT) - As chance would have it, I just remembered that I had enabled the email, and so was able to get a temporary password :) And now have reclaimed the account. As the V.vulpes is already redirected to the Fox user spaces, I think that pretty much means there are no other loose ends to tie up. Fox 12:01, 12 April 2008 (EDT) [edit] Might it be debate time? Eh? Public, please join too!-αmεσ (soldier) 22:18, 15 April 2008 (EDT) - You can archive, but you can't hide the truth. (<- he nods in agreement) SHahB 22:19, 15 April 2008 (EDT) But it works so well for Karajou! As anyone can plainly see by looking at his page now, no-one has ever disagreed with him! Otherwise it'd be there or archived, right?-αmεσ (soldier) 22:21, 15 April 2008 (EDT) - You can't seem to stop talking about Karajou. (<- once again, he nods in agreement)SHahB 22:22, 15 April 2008 (EDT) - I admit it. I'm so into him. And other seamen.-αmεσ (soldier) 22:23, 15 April 2008 (EDT) - Does this mean your -supposed- "girlfriend" (I doubt her existence given your editing a wiki) is a sailor? SHahB 22:26, 15 April 2008 (EDT) - KooKoo? And Se(a)men, anyway you can get it? Oooh, the mussels! human 22:28, 15 April 2008 (EDT) - Those are terrible puns, Human. And she exists! I swear!-αmεσ (soldier) 22:32, 15 April 2008 (EDT) - Yeah, sure. And she edits the wiki with you, right? SHahB 22:36, 15 April 2008 (EDT) - Right next to his kitty-kat and the Newton's balls! Mmm, yummy! human 22:43, 15 April 2008 (EDT) - I don't think anyone I know is as amused by CP/RW as I am, it's true.-αmεσ (soldier) 22:54, 15 April 2008 (EDT) Actually, several of my law school friends were quite proud of my destroying CP efforts, although it has yet to bear fruit. But some are quite amused, so that's good.-αmεσ (soldier) 23:06, 15 April 2008 (EDT) - Haha, you said "bear fruit". Don't piss off Stephen! human 23:07, 15 April 2008 (EDT) [edit] CHECKUSER?!?!?! I thought we disabled that....PFoster 20:37, 16 April 2008 (EDT) - We did, but it still shows as a group. I'll make you a bureaucrat temp so you can see; it's not a group that you can switch users into or out of anymore, but the software still thinks it's there.- - REDIRECT User:CivisAmericanusSum/AmesGsig 20:40, 16 April 2008 (EDT) - No need to do such a thing - I'll take your word for it, historian to historian. PFoster 20:47, 16 April 2008 (EDT) - Thanks! Yeah, trent tried to figure out how to nuke the group, but we can't. Instead, I'm a member of a group with no special page attached. Sigh.-CivisAmericanusSum 20:49, 16 April 2008 (EDT) [edit] No more Mr Nice Caius! Expect more puns incoming.— Unsigned, by: Interpreted / talk / contribs - I can't believe they used that on BSG. But it was awesome! And the name was inspired more by Marius than by Baltar, I promise....-caius (tailor) 16:01, 17 April 2008 (EDT) [edit] Dr Dino OK so where do I sucker these creationists for $17.95? I can't seem to find the link. (Doh, I searched for free coaster!) Genghis Marauding 18:44, 17 April 2008 (EDT) - it doesn't really cost them 17.95, of course. You get a free DVD with free shipping, though. And you can opt-in to their snail mail newsletter (I did), I figure that costs them cash, too. I already got confirmation that mine shipped! Spread this link far and wide, the offer's good through April 30. human 19:44, 17 April 2008 (EDT) - But they lose the opportunity cost of $17.95!-caius (tailor) 20:09, 17 April 2008 (EDT) - Only by giving it to people who would have bought it anyway - and for those folks, it is, after all, part one of a series of eight. Opportunity cost... you know, the most harm we could do to the social conservative movement would be to kill CP, because then Andy would make things harder for them by re-surfacing. Did his mommy buy him his blog to get him out from underfoot? human 21:06, 17 April 2008 (EDT) - The link still doesn't work for me. Maybe because my IP is non-USA. Genghis Marauding 03:52, 18 April 2008 (EDT) - No, even through a US-based proxy I can't find it. Genghis Marauding 04:38, 18 April 2008 (EDT) - The general consensus is that they shut it down. I read it on a science blog, so I can imagine they got swamped with materialist IPs requesting copies, and zillions of people whose names and addresses didn't jibe with their sekrit "one of us" lists... human 12:15, 18 April 2008 (EDT) [edit] debate? Are you available? I have a serious topic if you are. SHahB 23:29, 17 April 2008 (EDT) You should stop posting Conservatives name. he clearly does not want it posted, so why are you doing it? SHahB 23:57, 17 April 2008 (EDT) Hmmmm. You have a point. I can't concoct an argument that doesn't sound like one TK would make for using his real name. KDBuffalo, though, I should expect, is fine.-caius (tailor) 23:59, 17 April 2008 (EDT)Retracted - I thought of an argument. - But wait. On the other hand, he active trades on that name (Ken DeMeyer) in internet circles, and his denial that he's one and the same is magnificently transparent. Doesn't his usage of the name in internet circles, for similar activities, drop his legitimate expecation of privacy?-caius (tailor) 00:00, 18 April 2008 (EDT) - Well, in a way. Whenever someone posts it themselves, then they can't expect privacy. But it seems clear he does not want you to be posting it. Can't you do stop out of the goodness of your heart? SHahB 00:07, 18 April 2008 (EDT) - First I'd like to distinguish between privacy between websites, and privacy between one website and the outside world. I think it violates a canon of internet debate - at least at this level - to use someone's positions against them in the real world. I'm not sure the same thing is true for between websites. - I've actually done a lot out of the kindness of my heart for Ken... I wrote an essay about him that was particularly mean-spirited, and upon his request, I deleted it. He has yet to do the same regarding his KDBuffalo account. But, I think the issue is material to his dishonesty and level of argument at CP, if he's ashamed of his past attempts. But, upon request from him, I probably would.-caius (tailor) 00:12, 18 April 2008 (EDT) I didn't think it was too mean spirited at first. But he convinced me and I took it down. If you want to talk real mean spirited... have you read cp:homosexuality?-caius (tailor) 00:17, 18 April 2008 (EDT) - Don't try to change the subject, Amos. SHahB 00:26, 18 April 2008 (EDT) - And now you misspell my name! Do I have to change my name back now?-caius (tailor) 00:26, 18 April 2008 (EDT) I'm not that bright. I wouldn't retain me.-caius (tailor) 00:35, 18 April 2008 (EDT) - Speaking of real names... oh, nevermind, Bohdan 127 apologized for that. Back to business, serious, boyz. human 00:44, 18 April 2008 (EDT) [edit] sub pages Aren't they all at Luser:Caiaphus/ by now? You might want to take out the trash if you really want to slowly fog the trail of that wanna-be lawyer guy you used to play on here. human 23:45, 18 April 2008 (EDT) [edit] Edgerunner76 I figured that I'd put this here instead of the debate page. I'm from Pittsburgh, Pa. Except for when I went to college outside Eire, Pa. I haven't moved around much. --Edgerunner76...and a hotplate! 14:14, 23 April 2008 (EDT) [edit] Apology Sorry for saying you are long-winded, arrogant, and self righteous. It wasn't fair, I know you're still in school. To make it up, I will advertise your blog on my user page. SHahB 18:17, 23 April 2008 (EDT) Am I allowed to comment on your blog? Every day? I will promise, no trolling. I only troll here... SHahB 02:51, 24 April 2008 (EDT) - Definitely!-caius (tailor) 09:37, 24 April 2008 (EDT) - Wait. Ames has a blog? Since when? -- Radioactive Misanthrope 12:56, 24 April 2008 (EDT) [edit] Scratch Based on Fox's obscnee reading of what the cat is doing, I can't tell if you're being obscene or not... but I like it! I love my qitty :-) -caius (tailor) 18:14, 24 April 2008 (EDT) Never crossed my mind. ContribsTalk 18:21, 24 April 2008 (EDT) [edit] Arterial blockage I think that was I, wiseass ;) If you ever need it, ask & I'll give you the password. If I remember it. human 21:22, 24 April 2008 (EDT) - Whoa. I legitimately have no idea what you're talking about.-caius (tailor) 00:02, 25 April 2008 (EDT) YES! Were you the creator of the new Ames account? I figured it was my pet troll!-caius (tailor) 01:47, 26 April 2008 (EDT) [edit] Just curious Are you Is AmesG still of the same opinion about Ed Poor: Honestly, I think he's the most sane of them all there; while that's not saying a huge amount, I don't think he's the one to worry about.-αmεσ (spy) 10:07, 14 January 2008 (EST) I may have had similar feelings at those times, but the last few weeks have convinced me of the opposite. (Editor at) CP:no intelligence allowed 08:56, 1 May 2008 (EDT) - I had no opinion on the guy but after my little bit of googling, I now think he's a fifth column working everywhere trying to get people to think he's a reasonable guy while pushing his Moony agenda. ContribsTalk 09:19, 1 May 2008 (EDT) - Yeah, Editor & Susan, I have changed my opinion ever since the great crazy-going of Aught-Eight.-caius (tailor) 10:32, 1 May 2008 (EDT) [edit] ah! so you are the insidious caius! Rubico 20:43, 1 May 2008 (EDT) [edit] shame Your edit summary here was totally devoid of class, and also slanderous. I always thought you were better than that. SHahB 01:18, 9 May 2008 (EDT) - Copycat - I has one. But I'm disappointed in him/her too.-caius (tailor) 01:20, 9 May 2008 (EDT) No, I like provoking Ed Poor. SCW was me. But the people who keep reverting back teh comments are not.-caius (tailor) 01:25, 9 May 2008 (EDT) - I've seen you provoke Karajou. SHahB 01:28, 9 May 2008 (EDT) - Yes, and I've posted ridiculously often about it, and about his tendency to now overshoot and assume everyone is me. I suspect someone picked up on the lulz n ran. The timing was quite poor for me though.-caius (tailor) 01:29, 9 May 2008 (EDT) - Please Ames, just admit you sock often. You are far more recognizable then you seem to think. SHahB - The last two I had lived only long enough to plug my blog & die. I'd love to hear what makes me recognizable though - as you yourself point out, the people you're accusing of "being me" actually act quite differently.-caius (tailor) 01:36, 9 May 2008 (EDT) - No, no you have little things that give you away. "RCooper"? Please, try to mix it up a bit. SHahB 01:41, 9 May 2008 (EDT) - Sock identification on CP is nothing but paranoid guesswork, Shabohdan my hairy friend. I have been blocked for being AmesG on several ocassions, and I'm fairly certain I'm not.— Unsigned, by: 85.25.151.22 / talk / contribs 01:43, 9 May 2008 (EDT) LOL! Yeah, sorry about that 85 :-/. Check this and do a find for "AmesG" - it's ridiculous.-caius (tailor) 01:50, 9 May 2008 (EDT) - Idea - I think he thinks all Tor users are me. I do use Tor - but I learned the trick from other people at this site. That's a particularly shitty assumption of him to make.-caius (tailor) 01:51, 9 May 2008 (EDT) - (Edit conflict) Oh, don't worry about it, it was kinda flattering :) But making the sysops believe that they can identify hidden enemies in innocent accounts is the surest way we can starve CP of sincere editors. It seems like whenever I get blocked over there, Karajou selects three random bystanders and assumes they're also me. Progress! - And, yeah, I think he thinks only one person could possibly use Tor, and I have frequently found that Tor also temporarily gives me IPs that are used by other people on the wiki, so that is a serious error for him to make.— Unsigned, by: 85.25.151.22 / talk / contribs 01:56, 9 May 2008 (EDT) [edit] Harvey Thanks for putting me in touch with your gay lawyer friend in NJ. He's agreed to serve the crvio class action directly to the man himself and do all the paperwork as pro bono. Together KTDiputsho and FrancisG have got well over a hundred examples and almost thirty have now signed up so far. The evidence from the talk pages where they have ignored warnings should be quite damaging. However, Harvey says that even if the court only gives token damages his standing in legal circles should be severely undermined. The only disappointment is that it won't happen until a few days after NotBK. GenghisRationalWiki GOLD member 03:16, 9 May 2008 (EDT) - So someone finally managed to build a (legal) case against ASchlafly? That's good to hear. Question: Are you sure we aren't violating some sort of privacy law by discussing the details of a legal case on a public forum like this? -- Radioactive Misanthrope 11:49, 9 May 2008 (EDT) - I'm not sure about the wisdom of info leaks - and all I did was suggest the guy to go to if they wanted to go to someone - but this is inspiring news indeed. But, a little good news from the troops can't be that harmful :-)-caius (tailor) 11:52, 9 May 2008 (EDT) - Trent is gonna setup the user group "Ides" soon, that will help a lot I think. human 13:06, 9 May 2008 (EDT) - Ides means...? NightFlareSpeak, mortal 13:13, 9 May 2008 (EDT) - Got it. Wow, I had no idea that things were comign together this fast. NightFlare, you'll be blown away.-caius (tailor) 14:04, 9 May 2008 (EDT) - I'm metaphorically peeing myself. NightFlareSpeak, mortal 14:08, 9 May 2008 (EDT) Good man. Next Friday will be legen... Wait for it... Dary.-caius (tailor) 14:11, 9 May 2008 (EDT) [edit] Op Merry Days Caius, some bad news and some good news. Today's testing went splendidly - especially the rights toggle. The problem is only accounts with rights can be manipulated. So if your sock never had rights in the first place then they can't be changed. However, any accounts that did have rights, even if blocked will be promoted. So if you really want to use your AmesG account for that pwning you'll have to get whoever ran Samwell or Mex Max to unblock you. They will have to unprotect the required page. We reckon you'll have about four hours to play with before the system has to be reloaded. None of the original sysops, bureaucrats or even controlling admin will have any rights whatsoever while those with edit, block or upload will have full sysop rights (HJ even gets to be a bc!). I only wish we had real pyrotechnics to go along with it all. GenghisRationalWiki GOLD member 17:22, 11 May 2008 (EDT) - Shoot! But since TMT used to be a sysop, he'd be a sysop again, right? And since my Phoenix account used to have edit, that could still work?-caius (tailor) 17:35, 11 May 2008 (EDT) - I knew PhoenixWright was you! Stop naming your socks after videogame characters. Like Arcturus Mengsk— Unsigned, by: 15.15.15.15 / talk / contribs 17:46, 11 May 2008 (EDT) - No, anyone who was a sysop cannot be made one again. So Fox and TK would not be reinstated. It would have to be someone who only had edit,block or upload rights. GenghisRationalWiki GOLD member 17:52, 11 May 2008 (EDT) - Sorry 85, PhoenixWright wasn't, but "Phoenix" - one word - was. So Genghis, would Phoenix (who only had Edit I think) get sysopry?-caius (tailor) 17:53, 11 May 2008 (EDT) - Yes. Have to go now I've had a long day and by head is spinning. GenghisRationalWiki GOLD member 17:56, 11 May 2008 (EDT) My favorite part about this plan is that they can't do a goddamn thing about it. Genghis. Good job.-caius (tailor) 17:57, 11 May 2008 (EDT) - Wait - did you set the transwiki from ED to CP up? I can't see it, and if it's not working, then they might be able to reverse it. I mean, only Ed has the know-how, but it's still a risk that said plan could backfire terribly against all of the seven participating wikis. --מְתֻרְגְּמָן שְׁלֹום Just out of curiosity - will the "Ides" be receiving all of the attention it deserves, so that we may all partake in its lulz? In other words... will I actually know when it's happening? Will others be able to follow the succession of events? Or will this be a silent and deadly strike, with only shadowy high-fives passed about afterwards before moving on? UchihaKATON! 21:47, 13 May 2008 (EDT) - Once the wheels are set in motion, there won't be anywhere on the planet - nay, in our solar system - nay, the entire galaxy - where you won't be able to see the gears grinding. However, it is rumored that the best seats are in the inner Oort Cloud. Things might be too bright and too loud to really appreciate from our earth-bound vantage. However, the dvd set of the process will be carefully filtered. human 22:06, 13 May 2008 (EDT) Thanks for the response human - I await with anticipation! UchihaKATON! 22:24, 13 May 2008 (EDT) "...said plan could backfire terribly against all of the seven participating wikis." Is that a good idea to write, or is an indication of scale (such as that) just fine to disclose? UchihaKATON! 22:27, 13 May 2008 (EDT) - I think that was hyperbole and worrywartism if our toys got loose before they were fine-tuned to obey us 100%. What's more likely is that six of the seven wikis will be all that remains of human civilisation when the dust settles. Wait, was that more hyperbole? Stay tuned ;) human 23:02, 13 May 2008 (EDT) [edit] Questions I have some questions that need answering, Caius. -- Radioactive Misanthrope 03:42, 12 May 2008 (EDT) [edit] Deep as a puddle I think you said it a while back, but it bears repeating. Yes, their faith really is that shallow. I'm a freakin' nonpracticing pagan, and even I can conceive of a richer Christianity than that. --Kels 23:04, 12 May 2008 (EDT) - Kels - YES! I absolutely agree! That argument never seems to sink in with them. I wrote an editorial like that for the Rice editorial pages, and it was the ONLY ONE which I got significant hate mail!-caius (tailor) 23:39, 12 May 2008 (EDT) - What is the "Rice" you're talking about? -- Radioactive Misanthrope 13:22, 13 May 2008 (EDT) Hey, you know what they say: Harvard is the Rice of the northeast.-caius (tailor) 20:32, 13 May 2008 (EDT) - Nay, Caius: I'm in college. And I'd rather not go back to Texas—two years of my childhood spent with fire ants was enough for me, thank you very much. -- Radioactive Misanthrope 11:48, 14 May 2008 (EDT) - Why did I think you were in high school? I'm... not that bright.-caius (tailor) 12:08, 14 May 2008 (EDT) [edit] Ides Well hello Caius, how do the coming ides find you? Cassius 20:17, 13 May 2008 (EDT) - Surprisingly well :-). our edits in that namespace aren't showing up in recent changes, are they?caius (tailor) 20:23, 13 May 2008 (EDT) [edit] Question Would a raid coinciding with Ides be a good thing or a bad thing. UchihaKATON! 16:25, 15 May 2008 (EDT) - Just don't forget your Kevlar? human 16:27, 15 May 2008 (EDT) [edit] Working? Don't be a stranger. ContribsTalk 22:10, 22 May 2008 (EDT) - I promise I won't be! Unnamed Law Firm is keeping me busy, and the journal, I actually have work on it all of a sudden. Le sigh. But I'll be back soon, I love you all too much to stay away for more than it takes me to get caught up with life :-) -caius (tailor) 23:46, 22 May 2008 (EDT) [edit] Debate? Its been a loooong time Ames. Debate? SHahB 00:04, 28 May 2008 (EDT) - I know I am not welcome here, so, yes, I'm in! ħuman 00:54, 28 May 2008 (EDT) - You're correct, you are not welcome. So indeed, lets begin. SHahB 01:11, 28 May 2008 (EDT) - What's the topic? "Danish poker players - are they just sexy, or are they smart as well?" ħuman 01:13, 28 May 2008 (EDT) - I was thinking: Welsh footballers - are they all as ugly as Ryan Giggs? SHahB 01:20, 28 May 2008 (EDT) - Hmmm, what's your fetish with "futballers"? Most of us Walish peoples are teh pretty and have teh pretty voices. ħuman 01:26, 28 May 2008 (EDT) - Futballers? What on earth is that? Use English, not Welshish. SHahB 01:28, 28 May 2008 (EDT) - Sorry, typo, I meant "futbol". Screech we Dainisch, not the Islander slanguages? ħuman 01:44, 28 May 2008 (EDT) - You are a football fan, right? I thought all humpback whales were? SHahB 02:02, 28 May 2008 (EDT) - Can we debate something worthwhile, please? Jellyfish!However, there no need to fear. 02:22, 28 May 2008 (EDT) [edit] debate Ames, you have repeatedly ignored my calls for debate. Is there something (or someone) else I should know about? SHahB 21:06, 28 May 2008 (EDT) - Hee hee. I'm sick, actually, and sleepy. Watching Enterprise and socking at CP seem to be theo nly things I'm capable of.-caius (tailor) 21:15, 28 May 2008 (EDT) - Tought it out. SHahB 21:17, 28 May 2008 (EDT) - Enterprise? You watch Enterprise? As in "watch it and enjoy doing so"? --AKjeldsenCum dissensie 05:21, 29 May 2008 (EDT) I do! Seasons 3 and 4 are quality! Seasons 1 and 2 are, of course, unwatchable crap, though.-caius (tailor) 09:36, 29 May 2008 (EDT) [edit] Self promotion? :) ContribsTalk 18:44, 1 June 2008 (EDT) - Apparently Shangrila Habib and her Buttresses is asking you a question about the validity of her actions over at the CP block log.[14] You can use my red telephone if you need to, it's Swedish. ħuman 21:30, 14 June 2008 (EDT) - After reading this diff, I am certain that's Ames. SHahB"I don't hate Tmtoulouse - I pity the fool." 21:49, 14 June 2008 (EDT) - Funny, that read more like Andy, to me. Oh well, you know them both better than I do. ħuman 21:57, 14 June 2008 (EDT) [edit] Quotes I appreciate the thought, but I saved everything on all of my essays, userpage, and user talk page. So no worries :) --Tom Moorefiat justitia ruat coelum 21:11, 18 June 2008 (EDT) - Glad to have you here full time buddy. You lasted longer than any of us could've guessed. I suspect you won their respect, if not their minds. Very good job. Well done.-caius (tailor) 21:49, 18 June 2008 (EDT) [edit] image Ames, can I have your permission to use this Ames image in an Ames userbox? I uploaded it last night and was instantly blocked for two days. Bohdan2 21:25, 26 June 2008 (EDT) - Depends upon the box, but so far I suppose :-).-caius (tailor) 00:47, 27 June 2008 (EDT) - The box would say "AmesG". Like the Kjeldsen box (his had a picture of wooden shoes). Bohdan2 00:50, 27 June 2008 (EDT) - Caius - I deleted the image, (did I block?) Anyway, if it is of you and you approve then it's your call. GenghisRationalWiki GOLD member 16:30, 3 July 2008 (EDT) [edit] Honesty Ames, in order for this relationship to work you need to be honest with me. What sort of discussion went on in the secret forum? It was conversations about site policy, wasn't it? Bohdan2 00:39, 30 June 2008 (EDT) - Actually, no: when a conversation developed into site policy discussion, it was stopped and the thread moved, or conversation discontinued and begun again here. The forum's almost dead lately; it was 99% just about keeping things from TK.-caius (tailor) 00:56, 30 June 2008 (EDT) - And Bohdan. 75.161.36.101 01:02, 30 June 2008 (EDT) Give me access, Ames. Give it to me. Now. Give it. Now! Now! Now! Bohdan2 01:09, 30 June 2008 (EDT) - I'm not sure that Ames even can give you access - I can't remember if he's a forum benevolent dictatoradmin. I, on the other hand, could. But I don't think I will. Sorry. :-( --AKjeldsenPotential fundamentalist! 08:30, 30 June 2008 (EDT) - It's not worth accessing anyways, Bohdan. The secret forum is like the Special Discussion Group, only without the backstabbing, paranoia, and general intrigue, and with more goat jokes. Radioactive Misanthrope 15:39, 3 July 2008 (EDT) - "...only without the backstabbing, paranoia, and general intrigue..." - so in other words, it's nothing like the SDG at all. --AKjeldsenCum dissensie 15:56, 3 July 2008 (EDT) - But they're exactly alike! They're both closed-to-the-public secretz! Radioactive Misanthrope 04:10, 4 July 2008 (EDT) [edit] radio Meh, Schlafly was on the radio also. You're really not that special. Say, is that really how you pronounce your last name? I always thought it was pronounced Jones. Bohdan2 22:14, 9 July 2008 (EDT) - Yes, but Schlafly entire purpose when doing so was to pimp Conservapedia, not to sound intelligent. In fact, he's also appeared on TV, but only under the networks' policy of "equal time for nutjobs". Radioactive Misanthrope 11:29, 10 July 2008 (EDT) - Hey, is "bŌ-dăn" really how you pronounce your name, Bohdan? I always thought it was pronounced "bastard". Radioactive Misanthrope 11:29, 10 July 2008 (EDT) - LOL! Bohdan's a harmless friend... I prefer my name pronounced "mon capitan."-caius (tailor) 00:16, 11 July 2008 (EDT) - What about "KJeldsen"? Bohdan2 22:00, 11 July 2008 (EDT) - How about "JEldsen"? ħuman 23:40, 11 July 2008 (EDT) - I actually go by "Ed Poor." That's right. You ought have guessed by now! MWAHHAAH. After all, by Karalogic(c), we're both in Manhattan, and probably both use RoadRunner, so...-caius (tailor) 11:40, 12 July 2008 (EDT) - What's "RoadRunner"? Radioactive Misanthrope 16:34, 12 July 2008 (EDT) - A cable ISP brand name. ħuman 19:42, 12 July 2008 (EDT) - 'Kay, I understand now. Thanks. Radioactive Misanthrope 17:26, 13 July 2008 (EDT) [edit] Unblock Still no word from ASchlafly. Have you sent an email? Bohdan2 22:00, 11 July 2008 (EDT) [edit] kitteh So that's your game? Starve the cat to death? That's low. Very low. I am ashamed of you. Bohdan2 22:09, 15 July 2008 (EDT) [edit] I already read that ^_^ Am I overusing that smilie? Marginally Less Chaos!Audacity! 17:09, 31 July 2008 (EDT) [edit] Remember Change the links in your blog as well. If you haven't already, I mean... ~ Gloom(is never asleep) 12:48, 3 August 2008 (EDT) - Ah, I also redirected the old site, so internal links should bounce correctly after ping-ponging off Wordpress.com :-)-caius (tailor) 19:54, 3 August 2008 (EDT) [edit] PUMA You might want to define it along the way, it took me several clicks to get to "Party Unity My Ass" at riverdaughter's blog... Wait, I can edit this wiki! Thanks for reminding me. ħuman 04:25, 14 August 2008 (EDT) [edit] Sme Entertaining Sme (see your block comment) is all very well, but I hope you'll help out when I'm cleaning Jinx's crayon graffiti off the wiki :P Jellyfish!However, there no need to fear. 22:34, 27 August 2008 (EDT) [edit] Invitation There have been quite a number of ames blocks by Karajou and HenryS in the last couple of days, and I was part of it in many of them. I hope you don't mind. The invitation is valid though, if you happen to come to this part of the world. It extends to Karajou and Toffeeman and all RWans too. Harimau 09:33, 1 September 2008 (EDT) - Thanks man! I had missed that, that's hilarious! I haven't had a sock on CP since the Great Debate, but apparently every drunk has-been Holmes needs his Moriarty, and, even when I don't know it, I guess I am that Moriarty. Good show bothering Karajou :).-caius (tailor) 11:49, 1 September 2008 (EDT) [edit] Tabula Rasa Hi!-caius (tailor) 11:54, 1 September 2008 (EDT) - Hi. What do you want? - Hurry up. I'm a busy fish. Jellyfish!However, there no need to fear. 11:55, 1 September 2008 (EDT) - Hi, I'm selling these nice leather jackets... --AKjeldsenCum dissensie 11:56, 1 September 2008 (EDT) - I thought it was "fine leather jackets". You're expelled from the obscure injoke community. Jellyfish!However, there no need to fear. 12:00, 1 September 2008 (EDT) - Grand. Then I'll have more time for my meetings at the community of people with faulty memories. If I could just remember when they were, that is... --AKjeldsenCum dissensie 12:02, 1 September 2008 (EDT) [edit] Congratulations... You're part of the Democratic Attack Machine™. Sterilesnore! 17:30, 3 September 2008 (EDT) - I intend to use my newfound status to destroy common decency in America. YES WE CAN.-caius (tailor) 17:51, 3 September 2008 (EDT) - Once more into the breach, people. Harry, England and St. George, and all that. Keep up the good work. --AKjeldsenCum dissensie 17:55, 3 September 2008 (EDT) [edit] Tip re: Sarah Palin You might find this week's Sinfest comics of some interest. --AKjeldsenCum dissensie 15:17, 7 September 2008 (EDT) [edit] Thomas Friedman on McCain ... ... is a good read. Sterilesnore! 17:40, 9 September 2008 (EDT) [edit] Add! Feel free! Hell, subtract/edit if you don't think something is funny. Tell your friends. I plan to add it to the Fun name space once it's up to snuff. -- YossieSpring in Fialta 05:39, 24 September 2008 (EDT) [edit] Blog You and you shameless self promotion of your own blog. Why dont you get job. Ace McWickedcast ye the first stone 20:28, 26 September 2008 (EDT) - He does. He works in a law firm in New York City. Radioactive Misanthrope 21:14, 26 September 2008 (EDT) - You're cluelezz. Ace McWickedcast ye the first stone 22:45, 26 September 2008 (EDT) Not yet :). Just a 3L now :). Will be working for them soon! For now skool is teh job. But I love my self promos :).-caius (tailor) 17:44, 27 September 2008 (EDT)
http://rationalwiki.org/wiki/User_talk:Caius/masterarchive
CC-MAIN-2015-40
refinedweb
47,424
74.39
TrivialDBTrivialDB TrivialDB is a lightweight key/value json storage with persistence. Conceptually, it's just a thin lodash wrapper around plain javascript objects; with the added bonus of doing versioned asynchronous writes on changes. Its on disk format is simply "json on disk"; basically the json version of the plain object, saved to a file on disk. This makes making hand edits not just possible, but simple. Use CaseUse Case TrivialDB is intended for simple storage needs. It's in-process, small, and very, very fast. It takes almost nothing to get up and running with it, and it gives you an impressive amount of power, thanks to lodash chaining. I've found its a great fit for any personal project that needs to persist data. If you find yourself wanting to work with raw json files, it's a rather large improvement on writing your own loading/saving/querying logic. The one caveat to keep in mind is this: every database your work with is stored in memory. Since TrivialDB is in-process, you might run into the memory limits of node; before v12, on a 64 bit machine, this is 1.76GB by default. (You can increase this via --max_old_space_size=<size>.) In practice, however, this isn't actually that much of a limitation. Generally, you're working with a large amount of your data in memory anyway; your data sets can get relatively large before you even need to worry about this. In fact, the very popular nosql database Redis is in-memory. In their FAQ, they have this to say: In the past the Redis developers experimented with Virtual Memory and other systems in order to allow larger than RAM datasets, but after all we are very happy if we can do one thing well: data served from memory, disk used for storage. So for now there are no plans to create an on disk backend for Redis. Most of what Redis is, after all, is a direct result of its current design. In practice, I use TrivialDB to power a wiki that has thousands of printed pages worth of text, and the node process uses around 200mb, with the json being around 1mb on disk. For things like a blog, or user database, or session storage, or a preference system, TrivialDB will work for a long time before you need to move to something out of process. The one caveat to keep in mind is this: every database you work with is stored in memory. Since TrivialDB is in-process, you might run into the memory limits of node; (on versions before 0.12 there's a 1.4GB - 1.7GB limit). However, this isn't actually that much of a limitation. Generally, you're working with a large amount of your data in memory anyway; your data sets can get relatively large before you even need to worry about this. In-Browser DatabaseIn-Browser Database One of the new and exciting use cases is that TrivialDB is now usable inside a browser! By default it will read/write JSON over REST, but you can easily change this to use IndexedDB or LocalStorage. You can even use a bundler like Browserify or Webpack to include the JSON directly, and have zero load time. This helps when developing static, "server-less" sites; you can have a development version that generates the JSON locally, commit it to git, and then have your static site generation simply include the new JSON files and push them out. Your client-side code can still work with TrivialDB as if it was a normal application. (For more information, please see the "Reading and Writing in a Browser" section.) Lodash ShoutoutLodash Shoutout This entire project is made possible by the lodash project. If it wasn't for their hard work and the effort they put into building an amazing API, TrivialDB would not exist. InstallationInstallation Simply install with npm: $ npm install --save trivialdb TrivialDB APITrivialDB API There are two concepts to remember with TrivialDB: namespaces and databases. A 'namespace' is, as it implies, just an isolated environment with a name. Inside a namespace, all database names must be unique. So, if you want to have to independent 'foobar' databases, you will need to have them in different namespaces. Databases, on the other hand, are the heart and soul of TrivialDB. As the name implies, they hold all your data. Database objects are the interesting ones, with the main API you will be working with in TrivialDB. Creating a namespaceCreating a namespace ns(name, options)- creates or retrieves a TDBNamespaceobject. - alias: 'namespace' const trivialdb = ;// Create a namespaceconst ns1 = triviadb;// Create a namespace with some optionsconst ns2 = triviadb;// Create a database inside that namespaceconst db = ns1; Once you've created your namespace object, you can create or retrieve database instances from it, just like you can the main TrivialDB module. OptionsOptions The options supported by the ns call are: basePath: "..." // The base path for all other paths to be relative to. (Defaults to the application's base directory.)dbPath: "..." // The path, relative to `basePath` to the root database folder. (Defaults to 'db'.) If you call ns passing in the name of an existing namespace, any options passed will be ignored. Creating a databaseCreating a database db(name, options)- creates or retrieves a database instance. - alias: 'database' const trivialdb = ;// Open or create a databaseconst db = trivialdb;// Open or create a database, with optionsconst db2 = trivialdb; By default, when a new database is created, it will look for a file named 'some_db.json' inside the database folder. (By default this is '<application>/db'. You can control this path by setting the basePath or dbPath options of the namespace, or alternatively, the dbPath or rootPath options of the database.) You can request the same database multiple times, and get back the same instance (though any options passed on subsequent calls will be ignored). This allows you to request the database by name in different places in your code, and not worry about the two database instance fighting with each other. OptionsOptions The options supported by the db call are: writeToDisk: true || false // Whether or not to persist the database to disk. (Default: `true`)loadFromDisk: true || false // Whether or not to read the database in from disk on load. (Default: `true`)rootPath: "..." // The path to a folder that will contain the persisted database json files. (Default: './')dbPath: "..." // The path, relative to the namespace's `basePath` to the root database folder. (Defaults to 'db'.)writeDelay: ... // A number in milliseconds to wait between writes to the disk. (Default: 0)prettyPrint: true || false // Whether or not the json on disk should be pretty printed. (Default: `true`)pk: "..." // The field in the object to use as the primary key. (Default: `undefined`){...} // The function to use to generate unique ids. If you call db passing in the name of an existing namespace, any options passed will be ignored. Namespace APINamespace API Namespaces have exactly one function, db, which works exactly like the TrivialDB function for creating a database. (see above.) Database APIDatabase API TrivialDB database objects have two APIs, one synchronous, the other asynchronous (Promise based). The synchronous API is significantly faster, but it does not trigger syncing to disk, and should be considered a 'dirty' form of reading and writing. In the future, TrivialDB may get the ability to support multiple processes sharing the same file, and at that time, the synchronous API will be a truly dirty API, with the values often being out of date. (See the more in depth discussion in each relevant section below.) PropertiesProperties The database object has the following properties: name- The name given to the database. (Also the filename, minus extension.) count- The number of keys in the database. path- The full path to the backing file, assuming it writes to disk. rootPath- The full path to the folder for the database (aka pathminus the filename). loading- A promise that is resolved once the initial data is loaded. Database OptionsDatabase Options There are some options that deserve further details. Custom ID GenerationCustom ID Generation If you want to generate your own ids, and not use the ids TrivialDB generates by default, you can specify your own function in the database options. By specifying idFunc, TrivialDB will use this function to generate all ids, when needed. The idFunc function is passed the object, so you can generate ids based on the object's content, if you wish. (An example of this would be generating a slug from an article's name.) {return articlename;} // end slugify// Declare a new database, using the slugify function above.const db = trivialdb;// Now, we save an objectdb; Be careful; it is up to you to ensure your generated ids are unique. Additionally, if your generation function blows up, TrivialDB may return some nonsensical errors. (This may improve in the future.) readFunc and writeFunc You can override the built in underlying read and/or write functions. By default these will read/write from the disk (in node) or GET/ POST to the specified path in the browser. You can, however, override them with any Promise returning function. readFunc(path)- This function is passed the absolute path of the file as path. The rootDirwill be /on browser, or the root directory of the running node process. This function must return a Promise. The promise's return value is ignored. writeFunc(path, jsonStr)- This function is passed the absolute path of the file as path, and the json string representation of the database as jsonStr. The rootDirwill be /on browser, or the root directory of the running node process. This function must return a Promise. The promise's return value is ignored. As long as loadFromDisk (or writeToDisk) is not set to false, TrivialDB will attempt to load a database when you first call .db(). Sometimes, you need to wait for the datbase to be loaded before doing operations. This is why we provide a loading promise on the db object. Waiting for the database to be done is very simple: // This could declare a new DB, or it could be pulling an existing one from the cache.const db = trivialdb;// This will execute once the db is loaded. If it is already loaded, we resolve instantly.dbloading; It's worth mentioning that the loading promise is always available, even if disk operations will not be performed. This means you can always wait on the loading promise, without knowing details about how the database is configured. loaded event If you don't want to use the loading promise, there is also a loaded event that is always fired off once the database has finished loading. This event does still fire if there's no disk operations to do. // This could declare a new DB, or it could be pulling an existing one from the cache.const db = trivialdb;// This will execute once the db is loaded. If it is already loaded, **this will never fire.**db; Note: Due to the nature of events, if the database has already loaded, listening for the loaded event will never trigger. There is no way to know, other than to call db.loading.isPending(), at which point you should probably just use the promise directly. Reading and Writing in a BrowserReading and Writing in a Browser By default, in node, TrivialDB will attempt to read and write using the fs library. The path will be relative to the project's absolute path. However, in a browser, we can't use fs. So, instead, we use the fetch api to make REST calls. The path is relative to /, and will look something like /db/namespace/some_db.json. For loading the database, it will make a GET request, and for writing, it will make a POST request. If you need to do something different, like using PUT or maybe transmitting data over websockets, simply override the readFunc and/or writeFunc options in the configuration. Key/Value APIKey/Value API The synchronous API follows a scheme of get, set, del. Primarily, these functions work with the internal memory store directly, meaning that in the case of set or del, thier changes will not be persisted until something else triggers a write to disk. If you have set writeToDisk to false, then you can use these APIs without any concern at all. The asynchronous API follows a scheme of load, save, remove. These functions are always considered safe; they will not resolve their promises until after the changes have been successfully saved to disk. (They will, however, modify the data immediately, so dirty reads/writes may occur while the safe read/write is pending, and it will get the updated value.) It should be noted that currently, get and load are only differentiated by the fact that load returns a promise. In the future, load may be modified to sync from disk, allowing for multiple processes to write to the same json file. This is important to keep in mind, as get is a very popular function, if you are in a multiprocess scenario in the future, it may return stale values. As such, it should be considered a dirty read. Retrieving ValuesRetrieving Values - Synchronous get(key, defaultVal)- Returns the value stored under keyor undefined. - Asynchronous load(key)- Returns a promise resolved to the value or throws DocumentNotFoundError. // Get an object synchronouslyconst val = db;// Get an object synchronously, with a default valueconst val2 = db;// Get an object asynchronouslydb;// Get an object asynchronously, with a default valuedb;// Get an object asynchronously that doesn't existdb; TrivialDB only supports direct retrieval by a single string identifier. If a value for that key is not found, undefined will be returned for get (This mirrors the direct use of objects in JavaScript); additionally, we allow you to pass in a default value, which will be returned if the key is not found. This is not supported on load, however, as load is intended to return you exactly what is in the database at this moment. If you attempt to use load to get a document that does not exist, it will throw a DocumentNotFoundError object. This allows you to do traditional promise error handling, as opposed to using if(result === undefiend). Storing ValuesStoring Values - Synchronous set(value)- Returns a generated key. set(key, value)- Returns key. - Asynchronous save(value)- Returns a promise resolved with a generated key. save(key, value)- Returns a promise resolved with key. // Store a valueconst id = db;// Store a value with a specific keydb;// Overwrite the previous valuedb;// Asynchronously store a valuedb; All values in TrivialDB are stored under a key. They may be objects, or primitive types. If you do not pass in a key, TrivialDB will generate one for you. (The autogenerated keys are base62 encoded uuids, basically the same algorithm use by url shorteners.) In the event you do not pass a key, your will need to look at the return value to know how to retrieve your objects. If you specify a key, it is up to you to ensure it's unique. TrivialDB will silently overwrite any previous value. TrivialDb supports the pk option for setting a primary key. Keys are always added if your value is an object, but with the pk options, you can control what field it is stored under. (By default, it's id.) Removing ValuesRemoving Values - Synchronous del(predicate)- Returns a list of removed values. - Asynchronous remove(predicate)- Returns a promise resolved with a list of removed values. Removing values works off a lodash predicate, must like filter. This allows for removing multiple documents at the same time. However, if you only wish to remove one, you will need to pass in an object that selects your primary key, for example: { id: 'my_key' }. Deleting the databaseDeleting the database clear()- Returns a promise resolved once the database is considered 'settled'. In addition to removing an individual key, you can clear the entire database. This always syncs to disk. Query APIQuery API Instead of exposing a large, complex Query API, TrivialDB exposes lodash chain objects, allowing you to perform lodash queries to filter and manipulate your data in any way you want. As this uses lazy evaluation, it's fast and efficient even on large datasets. Note: TrivialDB currently uses explicit chaining, meaning that you must always use .run()/ .value(). Please check the docs to understand the full implications of this. Basic FilteringBasic Filtering filter(predicate)- Returns the values that match the predicate. // Simple object filterconst vals = db;// Function filterconst vals2 = db; TrivialDB has a simple filter function for when you just want a lodash filter. It works as you would expect, filtering all items in the database by the predicate you passed in. Advanced QueriesAdvanced Queries query()- Returns a lodash chain object, wrapped around all values in the database. // Query for all admins, sorting by created dateconst items = db;// Find the most recently created userconst latestUser = db; This exposes a lodash chain object, which allows you to run whatever lodash queries you want. It clones the database's values, so feel free to make any modifications you desire; you will not affect the data in the database. Note: As you can see from our example, we execute the query with .run(). This alias was removed in Lodash 4. We jump through a few hoops to extend the prototype of the individual chain object to add this back in there; this should not leak into the global lodash module. Why did we do this? Because I like the semantics of .run(), dammit. ReloadReload reload()- Returns a promise resolved once the database has been reloaded from disk. If you need to reload your database for any reason (such as hand-edited JSON files), you can reload the database from disk with the reload() function. This is the same function that is used to load from disk initially. This function resets the loaded event once complete. Note: This will throw an exception on any database with loadFromDisk: false. Note: This will completely throw away all values from in memory. If saving is not settled, changes may be lost. Direct AccessDirect Access sync()- Returns a promise resolved once the database is considered 'settled'. You can directly access the key/value store with the values property on the database instance. This is exposed explicitly to allow you as much freedom to work with your data as you might want. However, TrivialDB can't detect any changes you make directly, so you will need to call the sync function to get your changes to persist to disk. // Add a new key manuallydbvalues'foobar' = test: "something" ;// Sync that new key to diskdb; The sync function returns a promise that is resolved once the database has 'settled', as in, there are no more scheduled writes. Because of this behavior, you should consider whether or not you want to wait on its promise. Under high load, (or with a high writeDelay) it's possible for a sync promise's resolution to be considerably delayed. // Add a new key manuallydbvalues'foobar' = test: "something" ;// Sync that new key to diskdb; Also, you should feel free to iterate over the values object if you need to do any advanced filtering. All the same caveats of working with a plain javascript object apply. Just remember to call sync if you've made any modifications. StatusStatus With the release of v2.0.0, v1.x is no longer supported. Additionally, there were large, breaking API changes. TrivialDB is stable and production ready (for the intended use case). I will provide support for v2.x for the foreseeable future. I will even attempt to help with v1.x if you're using it in a production product, but I can't make any promises. If you are using this in a production product, please get in touch. Not only would I love to know, but if you need direct support, I'd be more than willing to discuss it. UpdatesUpdates Since the code base is small enough, it's relatively immune to the most common forms of 'code rot'. I make improvements when they're needed, or if someone files an issue. Just because I haven't touched it in a year or two doesn't mean it's dead; if you're concerned, feel free to file an issue and ask if it's still being supported. ContributingContributing While I only work on TrivialDB in my spare time (what little there is), I use it for several of my projects. I'm more than happy to accept merge requests, and/or any issues filed. If you want to fork it and improve part of the API, I'm ok with that too, however I ask you open an issue to discuss your proposed changes first. And, since it's MIT licensed, you can of course take the code and use it in your own projects. DonationsDonations I accept donations for my work. While this is not my primary means of income, by any stretch, I would not mind a few bucks if you find the software useful.
https://preview.npmjs.com/package/trivialdb
CC-MAIN-2021-39
refinedweb
3,519
63.49
Hybrid View How to deal with stores in another namespace How to deal with stores in another namespace Hello all, In our environment we're building an application that makes use of generic parts that can also be used in other apps. This varies from components to stores. These generic parts have been put in a separate namespace and are configured in the loader part for debugging and sencha.cfg for building using Sencha CMD. The loader part: Code: //<debug> Ext.Loader.setPath( { 'zwik': '../shared/src', 'Ext': '../touch/src', 'Cm': 'app' }); // </debug> Code: app.name=Cm app.framework=touch app.shared = ${app.dir}/../shared/ app.classpath=${app.dir}/app.js,${app.dir}/app,${app.shared} When I investigate the production app.js generated by Sencha CMD I can find the shared/generic store in there. So why is the application looking for it somewhere else as well? . My question is, how should we deal with this? Is this even possible? I can get rid of the 404's by removing the stores from the store configuration in app.js but then the store events stop working. If I then put the stores in the requires section of the class that makes use of the store the events don't work. Other shared/generic items in other namespaces, such as components, work fine and don't cause any problems at all. Also when we're coding the build works fine. It's only the build part that seems to go wrong. We're using ST2.1 with Sencha CMD 3.0.0.250. Thanks! - Join Date - Mar 2007 - Location - Gainesville, FL - 37,948 - Vote Rating - 951 Where are you requiring requiring the store in the app.js. I've also tried requiring in the class where we actually need the store but that didn't seem to help either - dcordesGuest Same problem here!
http://www.sencha.com/forum/showthread.php?250291-How-to-deal-with-stores-in-another-namespace&mode=hybrid
CC-MAIN-2015-14
refinedweb
312
75.3
I have a bigcartel site selling my products however some products I just want displayed as 'portfolio' pieces without a price (and possibly without 'sold out' or 'coming soon' etc). Is there a way to hide the price for those products? Could I categorize the products and make every product in a certain category have a different code? I'm using the 'Luna' theme. Any help would be great. Instead of having a ton of conditional statements to check against product names, you may just want to have your portfolio products added to a "Portfolio" category and only hide the price for products in that category. Add this to the top of Customize Design > Advanced > Product: {% for category in product.categories %} {% if category.name == 'Portfolio' %} {% assign hide_price = 1 %} {% endif %} {% endfor %} Next, change the line that displays the price to this: {% if hide_price != 1 %}<h3>{{ product.default_price | money_with_sign }}</h3>{% endif %} You could also use the same conditional statement above to hide the product status - like sold out, coming soon, etc.
https://codedump.io/share/1NAOvSGbnjZJ/1/how-can-i-hide-the-price-of-a-product-in-bigcartel
CC-MAIN-2016-50
refinedweb
169
64.71
Facebook Cookbooks SuiteFacebook Cookbooks Suite This repo contains attribute-driven-API cookbooks maintained by Facebook. It's a large chunk of what we refer to as our "core cookbooks." It's worth reading our Philosophy.md doc before reading this. It covers how we use Chef and is important context before reading this. It is important to note that these cookbooks are built using a very specific model that's very different from most other cookbooks in the community. Specifically: - It assumes an environment in which you want to delegate. The cookbooks are designed to be organized in a "least specific to most specific" order in the run-list. The run-list starts with the "core cookbooks" that setup APIs and enforce a base standard, which can be adjusted by the service owners using cookbooks later in the run-list. - It assumes a "run from main" type environment. At Facebook we use Grocery Delivery to sync the main branch of our source control repo with all of our Chef servers. Grocery Delivery is not necessary to use these cookbooks, but since they were built with this model in mind, the versions never change (relatedly: we do not use environments). - It assumes you have a testing toolset that allows anyone modifying later cookbooks to ensure that their use of the API worked as expected on a live node before committing. For this, we use Taste Tester. Cookbooks in this repo all being with fb_ to denote that not only do they use the Facebook Cookbook Model, but that they are maintained in this repo. Local cookbooks or cookbooks in other repositories that implement this model should not use this prefix, but should reference this document in their docs. APIsAP. For example, if the service we are configuring has a key-value pair configuration file, we will provide a simple hash where keys and values will be directly put into the necessary configuration file. There are two reasons we use attribute-driven APIs: Cascading configuration Since our cookbooks are ordered least specific (core team that owns Chef) to most specific (the team that owns this machine or service) it means that the team who cares about this specific instance can always override anything. This enables stacking that is not possible in many other models. For example, you can have a run-list that looks like: - Core cookbooks (the ones in this repo) - Site/Company cookbooks (site-specific settings) - Region cookbooks (overrides for a given region/cluster) - Application Category cookbooks (webserver, mail server, etc.) - Specific Application cookbook ("internal app1 server") So let's say that you want a specific amount of shared memory by default, but in some region you know you have different size machines, so you shrink it, but web servers need a further different setting, and then finally some specific internal webserver needs an even more specific setting... this all just works. Further, a cookbook can see the value that was set before it modifies things, so the 'webserver' cookbook could look to see what the value was (small or large) before modifying it and adjust it accordingly (so it could be relative to the size of memory that the 'region' cookbook set). Using resources for this does not allow this "cascading", it instead creates "fighting". If you use the cron resource to setup an hourly job, and then someone else creates a cron for that same job but only twice a day, then during each Chef run the cron job gets modified to hourly, then re-modified to twice a day. Allows for what we refer to as "idempotent systems" instead of "idempotent settings." In other words, if you only manage a specific item in a larger config, and then you stop managing it, it should either revert to a less-specific setting (see #1) or be removed, as necessary. For example let's say you want to set a cron job. If you use the internal cron resource, and then delete the recipe code that adds that cronjob, that cron isn't removed from your production environment - it's on all existing nodes, but not on any new nodes. For this reason we use templates to take over a whole configuration wherever possible. All cron jobs in our fb_cronAPI are written to /etc/cron.d/fb_crontab. If you delete the lines adding a cronjob, since they are just entries in a hash, when the template is generated on the next Chef run, those crons go away. Alternatively, consider a sysctl set by the "site" cookbook, then overwritten by a later cookbook. When that later code is removed, the entry in the hash falls back to being set again by the next-most-specific value (i.e. the "site" cookbook in this case). Run-listsRun-lists How you formulate your run-lists is up to your site, as long as you follow the basic rule that core cookbooks come first and you order least-specific to most-specific. At Facebook, all of our run-lists are: recipe[fb_init], recipe[$SERVICE] Where fb_init is similar to the sample provided in this repo, but with extra "core cookbooks." We generally think of this way: fb_init should make you a "Facebook server" and the rest should make you a whatever-kind-of-server-you-are. Getting startedGetting started Grab a copy of the repo, rename fb_init_sample to fb_init, and follow the instructions in its README.md (coordinating guidance is in comments in the default recipe). Other GuidelinesOther Guidelines Modules and classes in cookbooksModules and classes in cookbooks It is often useful to factor out logic into a library - especially logic that doesn't create resources. Doing so makes this logic easier to unit test and makes the recipe or resource cleaner. Our standard is that all cookbooks use the top-level container of module FB, and then create a class for their cookbook under that. For example, fb_fstab creates a class Fstab inside of the module FB. We will refer to this as the cookbook class from here. We require all cookbooks use this model for consistency. Since we don't put anything other than other classes inside the top-level object, it's clear that a module is the right choice. While there is no reason that a cookbook class can't be one designed to be instantiated, more often than not it is simply a collection of class methods and constants (i.e. static data and methods that can then be called both from this cookbook and others). Below the cookbook class, the author is free to make whatever class or methods they desire. When building a complicated Custom Resource, the recommended pattern is to factor out the majority of the logic into a module, inside of the cookbook class, that can be included in the action_class. This allows the logic to be easily unit tested using standard rspec. It is preferred for this module to be in its own library file, and for its name to end in Provider, ala FB::Thing::ThingProvider. When more than 1 or 2 methods from this module are called from the custom resource itself, it is highly recommended you include it in a Helper class for clarity, ala: action_class do class ThingHelper include FB::Thing::ThingProvider end end In this way, it is clear where methods come from. Extending the node vs self-contained classesExtending the node vs self-contained classes You may have noticed that some of our cookbooks will extend the node object, while others have self-contained classes that sometimes require the node be passed as a parameter to some methods. In general, the only time when extending the node is acceptable is when you are simply making a convenience function around using the node object. So, for example, instead of making people do node['platform_family'] = 'debian', there's a node.debian?. This is simply syntactic sugar on top of data entirely in the node. In all other cases, one should simply have the node be an argument passed on, so as to not pollute the node namespace. For example, a method that looks at the node attributes, but also does a variety of other logic, should be in a cookbook class and take the node as an argument (per standard programming paradigms about clear dependencies). Methods in recipesMethods in recipes Sometimes it is convenient to put a method directly in a recipe. It is strongly preferred to put these methods in the cookbook class, however there are some cases where methods directly in recipes make sense. The primary example is a small method which creates a resource based on some input to make a set of loops more readable. Methods in templatesMethods in templates Methods should not be put into templates. In general, as little logic as possible should be in templates. In general the easiest way to do this is to put the complex logic into methods in your cookbook class and call them from the templates. Err on the side of failErr on the side of fail Chef is an ordered system and thus is designed to fail a run if a resource cannot be converged. The reason for this is that if one step in an ordered list cannot be completed, it's likely not safe to do at least some of the following steps. For example, if you were not able to write the correct configuration for a service, then starting it may open up a security vulnerability. Likewise, the Facebook cookbooks will err on the side of failing if something seems wrong. This is both in line with the Chef philosophy we just outlined, but also because this model assumes that code is being tested on real systems before being released using something like taste-tester and that monitoring is in place to know if your machines are successfully running Chef. Here are some examples of this philosophy in practice: - If a cookbook is included on a platform it does not support, we fail. It might seem like returning in this case is reasonable but there is a good indication the run-list isn't as-expected, so it's a great idea to bail out before this machine is mis-configured. - If a configuration was passed in that we don't support, rather than ignore it we fail. Validation of inputs and whyrun_safe_ruby_blocks Many cookbooks rely on the service underneath and the testing of the user to be the primary validator of inputs. Is the software we just configured, behaving as expected? However, sometimes it's useful to do our own validation because there are certain configurations we don't want to support, because the software may accepted dangerous configurations we want to catch, or because the user could pass us a combination of configurations that is conflicting or impossible to implement. In this model, however, this must be done at runtime. If your implementation is done primarily inside of an internally-called resource, then this validation can also be done there. However, if your implementation is primarily a recipe and templates, doing the validation in templates is obviously not desirable. This is where whyrun_safe_ruby_blocks come in. Using an ordinary ruby_block would suffice to have ruby code run at runtime to validate the attributes, however that means that the error would not be caught in whyrun mode. Since this validation does not change the system, it is safe to execute in whyrun mode, and that's why we use whyrun_safe_ruby_blocks: they are run in whyrun mode. It is worth noting that this is also where you can take input that perhaps was in a structure convenient for users and build out a different data structure that's more convenient to use in your template. Implementing runtime-safe APIsImplementing runtime-safe APIs This model intentionally draws the complexity of Chef into the "core cookbooks" (those implementing APIs) so that the user experience of maintaining systems is simple and (usually) requires little more than writing to the node object. However, the trade-off for that simplicity is that implementing the API properly can be quite tricky. How to do this is a large enough topic that it gets its own document. However, some style guidance is also useful. This section assumes you have read the aforementioned document. The three main ways that runtime-safety is achieved are lazy, templates, and custom resources. When should you use which? The template case is fairly straight forward - if you have a template, read the node object from the within the template source instead of using variables on the template resource, and all data read is inherently runtime safe since templates run at runtime. But what about lazy vs custom resources? For example, in a recipe you might do: package 'thingy packages' do package_name lazy { pkgs = 'thingy' if node['fb_thingy']['want_devel'] pkgs << 'thingy-devel' end pkgs } action :upgrade end Where as inside of a custom resource you could instead do: pkgs = 'thingy' if node['fb_thingy']['want_devel'] pkgs << 'thingy-devel' end package pkgs do action :upgrade end Which one is better? There's not an exact answer, both work, so it's a style consideration. In general, there are two times when we suggest a custom resource: The first is when you need to loop over the node in order to even know what resources to create. Since this isn't possible to (well, technically it's possible with some ugliness, but by and large not using the standard DSL), this must go into a custom resource. Example might be: # This MUST be inside of a custom resource! node['fb_thingy']['instances'].each do |name, config| template "/etc/thingy/#{instance}.conf" do owner 'root' group 'root' mode '644' variables({:config => config}) end end The second is when you're using lazy on the majority of the resources in your recipe. If your recipe has 15 resources and you've had to pepper all of them with lazy, it's a bit cleaner to make a custom resource that you call in your recipe. It's important here to reiterate: we're not referring to using a Custom Resource as an API, but simply making an internal custom resource, called only by your own recipe, as a way to simplify runtime safety. Outside of these two cases, you should default to implementations inside of recipes. This is for a few reasons. The first reason is that dropping entire implementations in custom resources leads to confusion and sets a bad precedent for how runtime-safety works. For example, consider the custom resource code we saw earlier where you assemble the package list in "naked" ruby: pkgs = 'thingy' if node['fb_thingy']['want_devel'] pkgs << 'thingy-devel' end This code works fine in a resource, but serves as a bad reference for others - since this absolutely won't work in a recipe (even though it'll run). The second reason is that quite often implementations need both compile-time and runtime code, and by blindly dropping the implementation into a custom resource, you can often miss this and create bugs like this: # only safe because we're in a custom resource packages = FB::Thingy.determine_packages(node) package packages do action :upgrade end if node['fb_thingy']['want_cron'] node.default['fb_cron']['jobs']['thingy_runner'] = { 'time' => '* * * * *', 'command' => '/usr/bin/thingy --quiet', } end service 'thingy' do action [:enable, :start] end Note here that while this code all seems reasonable in a custom resource ( if statements are runtime safe when inside of a custom resource), that cronjob will never get picked up, because you're using an API at runtime, but APIs must be called at compile time and consumed at runtime. In reality, this needs to be in the recipe in order to work, and should look like this, in a recipe: package 'thingy packages' do package_name lazy { FB::Thingy.determine_packages(node) } action :upgrade end node.default['fb_cron']['jobs']['thingy_runner'] = { 'only_if' => proc { node['fb_thingy']['want_cron'] }, 'time' => '* * * * *', 'command' => '/usr/bin/thingy --quiet', } service 'thingy' do action [:enable, :start] end In general, always start your implementation as a recipe and then escalate to Custom Resources where necessary. Debugging kitchen runsDebugging kitchen runs You can set up kitchen using the same commands as in .github/workflows/ci.yml, but once Chef runs you won't have access to connect, so modify fb_sudo/attributes/default.rb and uncomment the kitchen block. Then you can do bundle exec kitchen login <INSTANCE> after a failed run, and sudo will be passwordless so you can debug. LicenseLicense See the LICENSE file in this directory
https://githubhelp.com/facebook/chef-cookbooks
CC-MAIN-2022-40
refinedweb
2,756
57.2
(This blog post was written jointly by Phil Webb and Dave Syer). We are pleased to announce the first milestone release of a new project called Spring Boot. 'java -jar' or more traditional WAR deployments. We also provide a command line tool that runs 'spring scripts'. The diagram below shows Spring Boot as a point of focus on the larger Spring ecosystem. It presents a small surface area for users to approach and extract value from the rest of Spring: The primary goals of Spring Boot are: - To provide a radically faster and widely accessible 'getting and there is absolutely no requirement for XML configuration. Spring Scripts Spring Boot ships with a small command line application that can be used to run 'spring scripts'. Spring scripts are written in Groovy, which means that you have a familiar Java-like syntax, without so much boilerplate code. We are able to deduce a lot of information simply by looking at the way you have written your script. For example, here is a simple web application: @Controller class ThisWillActuallyRun { @RequestMapping("/") @ResponseBody String home() { return "Hello World!" } } When you run this application using 'spring run webapp.groovy' a number things are happening: - Your script is enhanced with common 'import'statements to save you typing them - We recognize the @ResponseBodyannotation and download appropriate Spring JARs - We automatically create the Spring @Configurationthat you would otherwise need to write - We start up an embedded servlet container and handle incoming requests on port 8080 The command line tool recognizes a number of different types of Spring Applications, including Web, Batch and Integration. There are a number of samples available in the GitHub repository. Spring Boot with Java You don't need use the command line tool or write Groovy code to get the benefits of Spring Boot. We also have first class Java support. For example, here is the same application written in Java: import org.springframework.boot.*; import org.springframework.boot.autoconfigure.*; import org.springframework.stereotype.*; import org.springframework.web.bind.annotation.*; @Controller @EnableAutoConfiguration public class SampleController { @RequestMapping("/") @ResponseBody String home() { return "Hello World!"; } public static void main(String[] args) throws Exception { SpringApplication.run(SampleController.class, args); } } Other than import statements, the main difference between this example and the earlier Groovy script is the main() method that calls SpringApplication and the @EnableAutoConfiguration annotation. Obviously with Java you also need a build system to compile and package your code. We provide a number of convenient 'starter' POMs that you can use with Maven, Gradle or Ant+Ivy to quickly grab appropriate dependencies. For example, the application above would need just a single dependency to the spring-boot-starter-web module. We also provide Maven and Gradle plugins that allow you to package a fully self contained 'fat jar' that can be started from the command line: $ java -jar myproject.jar . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: v0.0 Production Ready Spring Boot also includes helpful features that you often need when you push an application into production. We can automatically provide web endpoints that you can use to monitor application health, provide basic metrics or use to analyze production issues (such as thread deadlocks). We also provide a new @ConfigurationProperties annotation that you can use to externalize your application configuration (complete with support for JSR-303 @Valid annotations). Taking it for a spin Spring Boot 0.5.0.M1 is available now in the Spring Milestone Repository. If you want to try out any of the examples in this blog head over to the GitHub project page where you find detailed instructions. We are actively looking for early feedback so please feel free to raise issues or fork the repository and submit pull requests.! Back
http://spring.io/blog/2013/08/06/spring-boot-simplifying-spring-for-everyone
CC-MAIN-2013-48
refinedweb
648
52.19
Welcome to a feature matching tutorial with OpenCV and Python. Feature matching is going to be a slightly more impressive version of template matching, where a perfect, or very close to perfect, match is required. We start with the image that we're hoping to find, and then we can search for this image within another image. The beauty here is that the image does not need to be the same lighting, angle, rotation...etc. The features just need to match up. To start, we need some sample images. Our "template," or image we're going to try to match: Then our image to search for this template in: Here, our template image is a bit smaller in the template than in the image we're going to search. It is also a different rotation, and has some different shadows. Now we're going to use a form of "brute force" matching. We're going to find all features in both images. Then we match these features. We then can draw out as many as we want. Careful though. If you draw say 500 matches, you're going to have a lot of false positives. Draw the first few only. import numpy as np import cv2 import matplotlib.pyplot as plt img1 = cv2.imread('opencv-feature-matching-template.jpg',0) img2 = cv2.imread('opencv-feature-matching-image.jpg',0) So far we've imported the modules we're going to use, and defined our two images, the template (img1) and the image we're going to search for the template in (img2). orb = cv2.ORB_create() This is the detector we're going to use for the features. kp1, des1 = orb.detectAndCompute(img1,None) kp2, des2 = orb.detectAndCompute(img2,None) Here, we find the key points and their descriptors with the orb detector. bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True) This is our BFMatcher object. matches = bf.match(des1,des2) matches = sorted(matches, key = lambda x:x.distance) Here we create matches of the descriptors, then we sort them based on their distances. img3 = cv2.drawMatches(img1,kp1,img2,kp2,matches[:10],None, flags=2) plt.imshow(img3) plt.show() Here, we've drawn the first 10 matches. The output:
https://pythonprogramming.net/feature-matching-homography-python-opencv-tutorial/
CC-MAIN-2021-39
refinedweb
369
68.16
I have written the following code When I run and blow into a tube attached to the top connector on the device I get Code: Select all import spidev import time spi = spidev.SpiDev() # create spi object spi.open(0, 0) # open spi port 0, device (CS) 1 spi.mode = 0b11 # 1,1 - 3 bytes read; 0,0 - 4 bytes read try: while True: resp = spi.readbytes(3) # read three bytes print resp time.sleep(0.1) # sleep for 0.1 secs # end while except KeyboardInterrupt : spi.close() Any ideas why the alternate 3 bytes are 255,255,255 I am guessing that the MCP3551 is not ready to deliver the next reading but don't see how I can check from python. The MCP3551 that the devices uses to communicate via SPI is documented here ... 21950b.pdf Code: Select all [1, 72, 82] [255, 255, 255] [1, 72, 14] [255, 255, 255] [1, 72, 81] [255, 255, 255] [1, 72, 91] [255, 255, 255] [1, 72, 85] [255, 255, 255] [1, 72, 127]
https://lb.raspberrypi.org/forums/viewtopic.php?p=1061282
CC-MAIN-2020-16
refinedweb
174
80.92
You can imagine this project as a standalone monitoring device that could expose information to other mobile devices (i.e. smartphones) in the absence of a WiFi Internet connection, while hosting a backup of this information. As of this project, the WiFi web server is always on, while you can easily trigger the server by putting a pushbutton that brings it up if pressed, making the application less power-hungry. Temperature, humidity, pressure and light data are going to be displayed on a simple webpage, while two buttons will allow to control the behaviour of the two relays on the Proto Carrier. Most important, all the data is stored on the SD, in a .CSV file (comma separated values). This is very handy if you want a solid backup device that can be collected / or replaced as needed.Software This project heavily relies on the AP_SimpleWebServer example of the WiFi NINA Library written by Tom Igoe: File>Examples>WifiNINA>AP_SimpleWebServer.ino I strongly advice you to run that example in order to test a simpler sketch. Before we start we need to know that the SSID and Password names are to be longer than eight letters, don't use short names if you don't want to run into strange behaviours. Another very important rule of thumb is to be sure the WiFiNINA Library is up-to-date (1.4.0 as we speak). While the code checks for the firmware version on line 46. String fv = WiFi.firmwareVersion(); if (fv < "1.0.0") { Serial.println("Please upgrade the firmware"); } You should follow the instructions of firmware updater (Tools>Wifi101 WifiNINA Firmware Updater) in order to be 100% sure everything is up to date and working fine on the module.If you are ok in testing the AP_SimpleWebServer.ino code, you should be able to light on and off the on-board LED. Remember the network the MKR WiFi 1010 is offering has no connection to the interweb, so you'll may enable non-connected navigation on some mobile devices.We are ready to #copypasta the code. Before, let's review it in order to check if everything is in order. Libraries to import: #include <SPI.h> #include <SD.h> #include <WiFiNINA.h> #include <Arduino_MKRENV.h> #define POLL_RATE 2*1000 The variable POLL_RATE is defining the update time of the SD data. Every Log is printed in the Serial Port for you to check. In the setup() function, the communication with the WiFi module, the Environmental Shield and the SD card is checked, and the server is run on port 80, and we are notfied on the Serial Port throughout printWiFiStatus(); function. // start the web server on port 80 server.begin();// you're connected now, so print out the status printWiFiStatus(); Like in the previous example, everytime a client connects, its browser in injected with html data from the client.println() function. Also, this can be seen in the Serial Log. The only exception in this version of the code is the body part, generated in the readENV() function, returning a string with the data. String body = readENV(); // the content of the HTTP response follows the header: client.print(body); The data is then saved on the SD throughout the void writeLog() function. You can control the board using the web UI. As a bonus track, an Arduino logo is hosted on the SD and imported directly in the page, using base64 standards. You can use multiple sites to create a img.txt file. Check it out!
https://create.arduino.cc/projecthub/officine-innesto/expose-your-iot-bundle-kit-info-trough-a-wifi-web-server-1db49c
CC-MAIN-2020-40
refinedweb
587
65.22
. 2003 DNS is also commonly deployed as a non-Active Directory, or standard, Domain Name System solution, for the purposes of hosting the Internet presence of an organization, for example. DNS Architecture Microsoft Windows 2000 and Windows Server 2003 operating systems are 1034, 1035, 1886, 1996, 1995, 2136, 2308, and 2052. previous, who. How the DNS Domain Namespace Is Organized DNS and Internet Domains) could them. As mentioned above, a DNS server can host multiple zones. A DNS server. Note - A secondary or stub zone cannot be hosted on a DNS server that hosts a primary zone for the same domain name. Zone Transfer.),. For more information about forwarders, see “Forwarding” later in this document.. The following figure shows an example of both types of queries. DNS Query Types As shown in the graphic above, a number of queries were used to determine the IP address for. The query sequence is described below: - interative query from whitehouse.gov server (’s IP address) - Answer to the original recursive query from local DNS server to Resolver (’s IP address) Time to Live for Resource Records.<< DNS Protocol The DNS protocol consists of DNS different types of DNS messages that are processed according to the information in their message fields. This section discusses the different types of DNS messages and the different. DNS Update Message Format which). Connection-specific Names As shown in the following figure, a multihomed server computer named “host-a” can be named according to both its primary and connection-specific DNS domain names. Connection-specific DNS Names >>IMAGE. XP and Windows Server 2003. Once.. that. Note - If you disable recursion on the DNS server, you will not be able to use forwarders on the same server. For more information about forwarders, see “Forwarding” later in this document. Round Robin:: If the IP address of the requesting client has no local network match with any of the RRs in the answer list, then the list is not prioritized. Complex example: Local subnet prioritizing In Windows Server 2003,:. The SOA and NS resource records occupy a special role in zone configuration. They are required records for any zone and are typically the first resource records listed in files. The SOA resource record done between servers authoritative for the zone. The SOA resource record contains the following information: SOA Resource Record Fields The following is an example of a default SOA resource record: In the example SOA record shown above,.. or popular: Mail exchanger (MX) resource records. Note that the use of the at sign (@) in the records indicates that the mailer DNS domain name is the same as the name of origin (example.microsoft.com) for the zone. Pointer (PTR) resource records..). Difference Between Zones and Domains . Why Zone Replication and Zone Transfers Are Needed 2003, the DNS service supports incremental zone transfer, a revised DNS zone transfer process for intermediate changes. Domain Delegation: - A need to delegate management of part of your DNS namespace to another location or department within your organization. - A need to divide one large zone into smaller zones for distributing traffic loads among multiple servers - A need to extend the namespace by adding numerous subdomains at once, such as to accommodate the opening of a new branch or site. necessary: -. Example: Delegating a subdomain to a new zone As shown in the following figure, when a new zone for a subdomain (example.microsoft.com) is created, delegation from the parent zone (microsoft.com) is needed. Delegating a Subdomain . These RRs include: - An NS RR to effect the delegation. This RR is used to advertise that the server named ns1.na.example.microsoft.com is an authoritative server for the delegated subdomain. - An A RR (also known as a glue record) is needed to resolve the name of the server specified in the NS RR to its IP address. The process of resolving the host name in this RR to the delegated DNS server in the NS RR is sometimes referred to as glue chasing. Note -: - When the refresh interval expires for the zone - When a secondary server is notified of zone changes by its master server - When the DNS Server service is started at a secondary server for the zone - When the DNS console is used at a secondary server for the zone to manually initiate a transfer from its master server. Zone transfer process. - The master (source) server responds and fully transfers the zone to the secondary (destination) server. The zone is delivered to the destination server requesting the transfer with its version established by use of a Serial number field in the properties for the start of authority RR. The SOA RR also contains a stated refresh interval in seconds (by default, 900 seconds or 15 minutes) to indicate when the destination server should next request to renew the zone with the source server. - When the refresh interval expires, an SOA query is used by the destination server to request renewal of the zone from the source server. - The source server answers the query for its SOA record. This response contains the serial number for the zone in its current state at the source server. The destination server checks the serial number of the SOA record in the response and determines how to renew the zone.: - The local zone at a DNS server acting as a master server, a source for the zone to other servers, is updated. When the zone is updated at the master or source server, the serial number field in the SOA RR is also updated, indicating a new local version of the zone. - The master server sends a DNS notify message to other servers that are part of its configured notify list. - All secondary servers that receive the notify message can then respond by initiating a zone transfer request back to the notifying master server.: - Are you using DNS on the Internet or on a private network? - Is the server used as a root server?. Note - If you are operating internal root servers, do not use root hints. Instead, delete the Cache.dns file entirely for any of your root servers. EDNS0 the “DNS Resource Records Reference” later in this document. For more information about related RFCs, see “Related Information” at the end of this document. Server support for DNSSEC. Client support for DNSSEC Windows XP DNS clients.: - Containers–objects that can contain other container and leaf objects. - Leafs–objects representing a specific resource within the Active Directory service tree. ‘host: DNS Client Service Resolver The following figure shows an overview of the complete DNS query process. Overview of DNS Query Process is selected from a global list..) - RRs. If you disable recursion on the DNS server, you will not be able to use forwarders on the same server. By default, DNS servers use several default timings when performing a recursive query and contacting other DNS servers. These defaults include: -. and to look up a computer name based on its address. A reverse lookup takes the form of a question, such as “Can you tell me the DNS name of the computer that uses the IP address 192.168.1.20?” DNS was not originally designed to support this type of query. One problem for supporting the reverse query process is the difference in how the DNS namespace organizes and indexes names and how IP addresses are assigned. If the only Keep in mind that if the queried reverse name is not answerable from the DNS server, normal DNS resolution (either recursion or iteration) can be used to locate a DNS server that is authoritative for the reverse lookup zone and that contains the queried name. In this sense, the name resolution process. Directing Name Queries Using Forwarders The following figure illustrates how external name queries are directed using forwarders. External Name Queries Directed Using Forwarders .. Intranet Name Resolution. Internet Name Resolution. - update process described above (seven., is connected to both the Internet and the corporate intranet. Client1 is connected to the intranet by adapter A, a DHCP adapter with the IP address 172.16.8.7. Client1 is also connected to the Internet by adapter B, a remote access adapter with the IP address.. ACLs are for DNS administration access control only, and do not influence DNS query resolution. By default, dynamic update security for DNS servers and clients. client’s. Note - and Scavenging Before the aging and scavenging features of to the aging and-a for DNS) for use.
http://technet.microsoft.com/en-us/library/cc772774(d=printer).aspx
CC-MAIN-2014-15
refinedweb
1,412
63.9
accumulate Computes the sum of all the elements in a specified range including some initial value by computing successive partial sums or computes the result of successive partial results similarly obtained from using a specified binary operation other than the sum. Parameters - _First An input iterator addressing the first element in the range to be summed or combined according to a specified binary operation. An input iterator addressing the last element in the range to be summed or combined according to a specified binary operation that is one position beyond the final element actually included in the iterated accumulation. - _Val An initial value to which each element is in turn added or combined with according to a specified binary operation. - _Binary_op The binary operation that is to be applied to the each element in the specified range and the result of its previous applications. The sum of _Val and all the elements in the specified range for the first template function, or, for the second template function, the result of applying the binary operation specified, instead of the sum operation, to (PartialResult, *Iter), where PartialResult is the result of previous applications of the operation and Iter is an iterator pointing to an element in the range. The initial value insures that there will be a well-defined result when the range is empty, in which case _Val is returned. The binary operation does not need to be associative or commutative. The result is initialized to the initial value _Val and then result = _Binary_op (result, *Iter) is calculated iteratively through the range, where Iter is an iterator pointing to successive element in the range. The range must be valid and the complexity is linear with the size of the range. The return type of the binary operator must be convertible to Type to ensure closure during the iteration. // numeric_accum.cpp // compile with: /EHsc #include <vector> #include <numeric> #include <functional> #include <iostream> int main( ) { using namespace std; vector <int> v1, v2(20); vector <int>::iterator iter1, iter2; int i; for (i = 1; i < 21; i++) { v1.push_back(i); } cout << "The original vector v1 is:\n ( " ; for (iter1 = v1.begin(); iter1 != v1.end(); iter1++) cout << *iter1 << " "; cout << ")." << endl; // The first member function for the accumulated sum int total; total = accumulate(v1.begin(), v1.end(), 0); cout << "The sum of the integers from 1 to 20 is: " << total << "." << endl; // Constructing a vector of partial sums int j = 0, partotal; for (iter1 = v1.begin(); iter1 != v1.end(); iter1++) { partotal = accumulate(v1.begin(), iter1 + 1, 0); v2[j] = partotal; j++; } cout << "The vector of partial sums is:\n ( " ; for (iter2 = v2.begin(); iter2 != v2.end(); iter2++) cout << *iter2 << " "; cout << ")." << endl << endl; // The second member function for the accumulated product vector <int> v3, v4(10); vector <int>::iterator iter3, iter4; int s; for (s = 1; s < 11; s++) { v3.push_back(s); } cout << "The original vector v3 is:\n ( " ; for (iter3 = v3.begin(); iter3 != v3.end(); iter3++) cout << *iter3 << " "; cout << ")." << endl; int ptotal; ptotal = accumulate(v3.begin(), v3.end(), 1, multiplies<int>()); cout << "The product of the integers from 1 to 10 is: " << ptotal << "." << endl; // Constructing a vector of partial products int k = 0, ppartotal; for (iter3 = v3.begin(); iter3 != v3.end(); iter3++) { ppartotal = accumulate(v3.begin(), iter3 + 1, 1, multiplies<int>()); v4[k] = ppartotal; k++; } cout << "The vector of partial products is:\n ( " ; for (iter4 = v4.begin(); iter4 != v4.end(); iter4++) cout << *iter4 << " "; cout << ")." << endl; } Output The original vector v1 is: ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ). The sum of the integers from 1 to 20 is: 210. The vector of partial sums is: ( 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 ). The original vector v3 is: ( 1 2 3 4 5 6 7 8 9 10 ). The product of the integers from 1 to 10 is: 3628800. The vector of partial products is: ( 1 2 6 24 120 720 5040 40320 362880 3628800 ). Referenceaccumulate, copy, and vector::push_back Standard Template Library
https://msdn.microsoft.com/en-us/library/aawk6wsh(v=vs.80).aspx
CC-MAIN-2016-50
refinedweb
681
53.41
- Start a new web analytics project with python using PyCharm IDE - Install Pandas - Load the csvfile. In this project I will use the data from Google Analytic to analysis the ranking of my website on the Google SERP, I have downloaded the first copy of the analytic data in the form of Now, we will use Pandas to load the csv data, from the top (10 positions) to the end. import pandas as pd analytic = pd.read_csv('analytic.csv') print(analytic.tail(10)) As you can see, my website is doing terrible at the moment, none of the keywords are actually rank well. But again I just want to point it out, I just want to use Pandas to do some analysis on my site data, I don’t think this site will do well even after the analysis! For the last 10 years, my websites seldom do well on both Google or Bing. Will I ever receive ‘LOVE’ from Google or Bing? Work hard #blender @BlenderArtists pic.twitter.com/yosXWd3t3X— TechLikin (@ChooWhei) July 1, 2019 Stay tuned! We will create a full applicable application using this Pandas module!
https://kibiwebgeek.com/starting-a-web-analytics-project-with-pandas/
CC-MAIN-2021-04
refinedweb
189
70.23
First published by IBM at. When working with Web services, it is all too often assumed that anything that can be done in a programming language can be done in XML. There are many cases where that is not true. This tip addresses one of those cases: the distinction between an array which is null, and an array which has no elements. An XML array Most programming languages, like the Java language, have the concept of an array: a sequential collection of like elements. XML also has a sequential collection of like elements: an XML schema element with a maxOccurs attribute whose value is greater than 1. So it stands to reason that the Java language's sequential collection of like elements would map nicely to XML's sequential collection of like elements. Listing 1 defines a complexType which contains such an XML schema 'array'. maxOccurs complexType <complexType name="bean"> <sequence> <element name="name" type="xsd:string"/> <element name="array" minOccurs="0" maxOccurs="unbounded" nillable="true" type="xsd:int"/> </sequence> </complexType> The problem This XML "array" is not strictly an array. It is an element with an occurrence constraint, which means that the element is defined to occur a specific number of times, in this case 0 or more times. This does sound a lot like an array, and for most intents and purposes, it is. But the mapping isn't perfect. You should be aware of the shortcomings so they don't catch you by surprise. Following the JAX-RPC mapping rules, the complexType in Listing 1 would become the Java bean in Listing 2 (actually, the bean would have getters and setters, but we'll keep it simple for this discussion). public class Bean { public java.lang.String name; public java.lang.Integer[] array; } (Note that Bean's array variable is an array of java.lang.Integer, not an array of int. The array element from the XML schema is nillable. A Java int cannot be null. A java.lang.Integer can be null. So we use java.lang.Integer in this mapping.) Bean java.lang.Integer int Table 1 shows a number of examples of mapping an instance of the Java Bean to an instance of the corresponding XML. The first row is the Java representation; the second row is the corresponding XML representation. One obvious thing to note about Table 1—and it's the topic of this tip—is that an empty instance of a Java array and a null instance of a Java array map to the same XML instance. This is not good if you're depending on a distinction between the two. One easy trap to fall into here is to guess that a null array inside a bean is really represented by the XML in the second column. But as we hope we've shown in the table, that really represents an array with a single element whose value is null, not a null array. Is there a way around this issue? Of course! The thing to be aware of is that an array in most programming languages is really made up of two things: there are the contents of the array and there is the array itself—a wrapper, if you like, around the contents. An XML "array" is only a list of the elements. There is no wrapper. So the solution is simple: create a wrapper for the array, as shown in Listing 3. <complexType name="arrayWrapper"> <sequence> <element name="el" nillable="true" maxOccurs= "unbounded" minOccurs="0" type="xsd:int"/> </sequence> </complexType> <complexType name="bean"> <sequence> <element name="name" type="xsd:string"/> <element name="array" nillable="true" type="tns:arrayWrapper"/> </sequence> </complexType> Table 2 is the array example table for this XML schema. As you can see, the empty instance and the null instance of the arrayWrapper complexType are distinct from each other. arrayWrapper This solution isn't a cure-all. First of all, it's rather more complex than a simple minOccurs/maxOccurs representation of an array. Secondly, instead of a simple bean containing an array, this XML schema really looks like a bean containing a bean containing an array; and that's likely what you'll end up with if you map this XML schema into Java programming with your favorite JAX-RPC WSDL-to-Java tool. Until standards bodies recognize and map this wrapped array pattern appropriately, this solution is something you should apply only if you really must distinguish a null array from an empty array. minOccurs Summary XML "arrays" are not truly arrays in a programming language sense. XML does not distinguish between a null array and an empty array. There is an XML schema pattern that you can follow to get the equivalent distinction, but this pattern is not well recognized by standards bodies and should only be used when absolutely necessary. Resources
http://www.devx.com/ibm/Article/20265
crawl-001
refinedweb
810
53.71
visual basic homework In this assigment, you will practice on creating a C++ file and displaying some data. Question a) You will create 5 variables and 5 constants holding data that you will display. uestion b) Using a 7-by-5 grid of stars "*" you will create and display your full name initials. Submit the .cpp file you wrote. #include <iostream> using namespace std; int main() { // char l; // variable declaration short int graduation_Year = 2016; // variable declaration const string first_Name = " Beatrice "; const string last_Name = " Walter. "; string home = "Aberdeen (Harford County)"; const string hs_Name = "Aberdeen High"; const string elem_Name = " Aberdeen Elementary.....Sike naa, it was called Halls Cross Roads aka Halls x"; string preferred_Sport = " basketball, but I love football " ; //double // add some data of type double //aint // add some data of type int // Now display the information; there will be 10 cout worth 1 point each cout << "My name is " << first_Name << " " << last_Name << endl; cout << "\n I am a sophomore majoring in Electrical and Computer Engineering "<< endl; cout<< "\n I am from: " << home << endl; cout << "\n My high school name is: " << hs_Name << endl; cout<< "\n My elementary school name is: " << elem_Name << endl; cout << "\n I will graduate from Morgan State University in " << graduation_Year << endl; cout << "\n I like "<< preferred_Sport << endl; // // Print the initials of your firstname then lastname in a 7 x 5 grid: 10 points // Example to print the letter B: cout << "****" << endl; cout << "* *" << endl; cout << "* *" << endl; cout << "****" << endl; cout << "* *" << endl; cout << "* *" << endl; cout << "****" <<" " << "*"<< endl; system("pause"); return
https://www.studypool.com/questions/237255/visual-basic-homework
CC-MAIN-2017-17
refinedweb
246
53.28
Debugging Thread Applications In this chapter, we will learn how to debug thread applications. We will also learn the importance of debugging. What is Debugging? In computer programming, debugging is the process of finding and removing the bugs, errors and abnormalities from computer program. This process starts as soon as the code is written and continues in successive stages as code is combined with other units of programming to form a software product. Debugging is part of the software testing process and is an integral part of the entire software development life cycle. Python Debugger The Python debugger or the pdb is part of the Python standard library. It is a good fallback tool for tracking down hard-to-find bugs and allows us to fix faulty code quickly and reliably. Followings are the two most important tasks of the pdp debugger − - It allows us to check the values of variables at runtime. - We can step through the code and set breakpoints also. We can work with pdb in the following two ways − - Through the command-line; this is also called postmortem debugging. - By interactively running pdb. Working with pdb For working with the Python debugger, we need to use the following code at the location where we want to break into the debugger − import pdb; pdb.set_trace() Consider the following commands to work with pdb through command-line. - h(help) - d(down) - u(up) - b(break) - cl(clear) - l(list)) - n(next)) - c(continue) - s(step) - r(return)) - b(break) Following is a demo of the h(help) command of the Python debugger − import pdb pdb.set_trace() --Call-- >d:\programdata\lib\site-packages\ipython\core\displayhook.py(247)__call__() -> def __call__(self, result = None): Example While working with Python debugger, we can set the breakpoint anywhere in the script by using the following lines − import pdb; pdb.set_trace() After setting the breakpoint, we can run the script normally. The script will execute until a certain point; until where a line has been set. Consider the following example where we will run the script by using the above-mentioned lines at various places in the script − import pdb; a = "aaa" pdb.set_trace() b = "bbb" c = "ccc" final = a + b + c print (final) When the above script is run, it will execute the program till a = “aaa”, we can check this in the following output. Output >--Return-- > <ipython-input-7-8a7d1b5cc854>(3)<module>()->None -> pdb.set_trace() (Pdb) p a 'aaa' (Pdb) p b *** NameError: name 'b' is not defined (Pdb) p c *** NameError: name 'c' is not defined After using the command ‘p(print)’ in pdb, this script is only printing ‘aaa’. This is followed by an error because we have set the breakpoint till a = “aaa”. Similarly, we can run the script by changing the breakpoints and see the difference in the output − >import pdb a = "aaa" b = "bbb" c = "ccc" pdb.set_trace() final = a + b + c print (final) Output >--Return-- > <ipython-input-9-a59ef5caf723>(5)<module>()->None -> pdb.set_trace() (Pdb) p a 'aaa' (Pdb) p b 'bbb' (Pdb) p c 'ccc' (Pdb) p final *** NameError: name 'final' is not defined (Pdb) exit In the following script, we are setting the breakpoint in the last line of the program − import pdb a = "aaa" b = "bbb" c = "ccc" final = a + b + c pdb.set_trace() print (final) The output is as follows − >--Return-- > <ipython-input-11-8019b029997d>(6)<module>()->None -> pdb.set_trace() (Pdb) p a 'aaa' (Pdb) p b 'bbb' (Pdb) p c 'ccc' (Pdb) p final 'aaabbbccc' (Pdb)
https://scanftree.com/tutorial/python/concurrency-with-python/debugging-thread-applications/
CC-MAIN-2022-40
refinedweb
587
61.36
Contents - What is D? - Why D? - Major Features of D - Sample D Program D is a general purpose systems and applications programming language. It is a high level language,, indeed. Who needs another programming language? The software industry is continuously evolving at a breakneck pace. New ideas appear, and older ideas are either validated or discarded. What programmers need and want out of a programming language changes. Available memory and computing power have increased by orders of magnitude, as well as the scale of programs being developed. Compilers are no longer terribly constrained by available computing resources, and so are able to do much more for the programmer. Much more powerful language features have become practical. These features can be difficult to retrofit into existing languages, and when there are enough of these, a new language is justified. Everything in designing a language is a tradeoff. Keeping some principles in mind will help to make the right decisions.. This section lists some of the more interesting features of D in various categories.. See the Classes page for more information. Classes can be crafted that work with existing operators to extend the type system to support new types. An example would be creating a bignumber class and then overloading the +, -, * and / operators to enable using ordinary algebraic syntax with them. See the Operator Overloading page for more information. Functional programming has a lot to offer in terms of encapsulation, concurrent programming, memory safety, and composition. D's support for functional style programming include: Source files have a one-to-one correspondence with modules. See the Module page for more information. Functions and classes are defined once. There is no need for declarations when they are forward referenced. A module can be imported, and all its public declarations become available to the importer. Example: class ABC { int func() { return 7; } static int z = 7; } int q; All members are defined in the class or struct, not separately. class Foo { int foo(Bar c) { return c.bar; } } class Bar { int bar() { return 3; } } Whether a D function is inlined or not is determined by the optimizer settings. D templates offer a clean way to support generic programming while offering the power of partial specialization. Template classes and template functions are available, along with variadic template arguments and tuples. See the Templates page for more information. Associative arrays are arrays with an arbitrary data type as the index rather than being limited to an integer index. In essence, associated arrays are hash tables. Associative arrays make it easy to build fast, efficient, bug-free symbol tables. See the Associative Arrays page for more information. other languages. they have some serious shortcomings: D has the expected support for ordinary functions including global functions, overloaded functions, inlining of functions, member functions, virtual functions, function pointers, etc. In addition: Functions can be nested within other functions. This is highly useful for code factoring, locality, and function closure techniques. Anonymous functions can be embedded directly into an expression. Nested functions and class member functions can be referenced with closures (also called delegates), making generic programming much easier and type safe.". C arrays have several faults that can be corrected:. See the Arrays page for more information. String manipulation needs direct support in the language. Modern languages handle string concatenation, copying, etc., and so does D. Strings are a direct consequence of improved array handling. D uses the concept of a range in lieu of iterators or generators found in other languages. A range is any type that provides a common interface to a sequence of values. The purpose of a range is to allow for a simpler way to write code that works on arbitrary data, thereby making it reusable. The most basic type of range is called an input range, which provides three methods. struct MyRange { auto front() { // return the next value in the sequence } void popFront() { // move the front of the sequence to the next value } bool empty() { // true if the range has no more values to return } } To understand the power of this simple interface, let's run through an example. Say we wanted to write a program that took all of the employees in a company, took out the ones younger than 40, and grouped the remaining into an array of arrays by their organization. struct Employee { uint id; uint organization_id; string name; uint age; } struct Employees { Employee[] data; this(Employee[] employees) { data = employees; } Employee front() { return data[0]; } void popFront() { data = data[1 .. $]; } bool empty() { return data.length == 0; } } Here the data is coming from a constructor as a simple example, but it could come from any source, like a CSV or a database. Please note that this code should not be used in actual code, because in D, the basic dynamic array also acts as a range, so any algorithm that accepts ranges also accepts arrays. However, static arrays are not considered ranges, as the operation popFront is based on mutating the length of the range, which is impossible with static arrays. To get a range out of a static array, create a slice containing all of its elements, like so: int[4] array = [1, 2, 3, 4]; // not a range array[]; // valid range Now that the range is defined, we can populate it and write the filtering code. void main() { import std.algorithm.iteration : filter, chunkBy; Employees employees = Employees([ Employee(1, 1, "George", 50), Employee(2, 3, "John", 65), Employee(3, 2, "David", 40), Employee(4, 1, "Eli", 40), Employee(5, 2, "Hal", 35) ]); auto older_employees = employees .filter!(a => a.age > 40) // lambdas in D use the => syntax .chunkBy!((a,b) => a.organization_id == b.organization_id); } All of the algorithms in std.algorithm work with ranges to avoid the problem of rewriting common functionality for every project. std.algorithm implements sorts, filters, maps, reductions, and more. Because our Employees struct conforms to the input range definition, it can also be used in foreach loops, which automatically detects if the value passed is an input range. foreach(employee; employees) { writeln(employee); } which is equivalent to for(; !employees.empty; employees.popFront()) { writeln(employees.front); } The input range is just the most basic form of range, there are also Each of these ranges represents a distinct way of accessing the underlying data. Or, in the case of the output range, a way to send data to another source. To learn more about each type of range, see the range primitives page in the standard library documentation. Each of these types of ranges give you access to different algorithms in the standard library. For example, a filter can be run on an input range, but not a sort, which requires a random access range with the slice operator overload defined. The requirements for each function can be seen in the function signature in the documentation in the template constraints. See the template page and the range primitives link above for more details on template constraints. As stated before, dynamic arrays and associative arrays in D act as ranges. Specifically, they are random access ranges, so any of the functions in std.algorithm work with these basic types. The following example uses input ranges and an output range to take data from stdin, take only the unique lines, sort them, and then print the result to stdout. // Sort lines import std.stdio; import std.array; import std.algorithm; void main() { stdin .byLine(KeepTerminator.yes) .uniq .map!(a => a.idup) .array .sort .copy(stdout.lockingTextWriter()); For more examples of range based code, see the Ranges chapter in Ali Çehreli's book "Programming In D". Also, see the article Component programming with ranges by H. S. Teoh. D memory allocation is fully garbage collected. With garbage collection, programming gets much simpler. Garbage collection eliminates the need for tedious, error prone memory allocation tracking code. This not only means much faster development time and lower maintenance costs, but the resulting program frequently runs faster. For a fuller discussion of this, see garbage collection. Despite D being a garbage collected language, the new and delete operations can be overridden for particular classes so that a custom allocator can be used. RAII is a modern software development technique to manage resource allocation and deallocation. D supports RAII in a controlled, predictable manner that is independent of the garbage collection cycle. D supports simple C style structs, both for compatibility with C data structures and because they're useful when the full power of classes is overkill.. See the Inline Assembler page for more information. A modern language should do all it can to help the programmer flush out bugs in the code. Help can come in many forms; from making it easy to use more robust techniques, to compiler flagging of obviously incorrect code, to runtime checking. Contract Programming (invented by Dr. Bertrand Meyer) is a technique to aid in ensuring the correctness of programs. D's version of Contracts includes function preconditions, function postconditions, class invariants, and assert contracts. See Contracts for D's implementation. library and application code bases out there for download on the web. How much of it comes with *any* verification tests at all, let alone unit testing?. See the Unit Tests page for more information.. The superior try-catch-finally model is used rather than just try-catch. There's no need to create dummy objects just to have the destructor implement the finally semantics.. D retains C operators and their precedence rules, order of evaluation rules, and promotion rules. This avoids subtle bugs that might arise from being so used to the way C does things that one has a great deal of trouble finding bugs due to different semantics. Not only does D have data types that correspond to C types, it provides direct access to C functions. There is no need to write wrapper functions, parameter swizzlers, nor code to copy aggregate members one by one. Making it possible to interface to any C API or existing C library code. This support includes structs, unions, enums, pointers, and all C99 types. D includes the capability to set the alignment of struct members to ensure compatibility with externally imposed data formats. D's exception handling mechanism will connect to the way the underlying operating system handles exceptions in an application. D produces code in standard object file format, enabling the use of standard assemblers, linkers, debuggers, profilers, exe compressors, and other analyzers, as well as linking to code written in other languages. D provides built-in support for generation of multiple versions of a program from the same text. It replaces the C preprocessor #if/#endif technique.. /* Sieve of Eratosthenes prime numbers */ import std.stdio; void main() { size_t count; bool[8191] flags; writeln("10 iterations"); // using iter as a throwaway variable foreach (iter; 1 .. 11) { count = 0; flags[] = 1; foreach (index, flag; flags) { if (flag) { size_t prime = index + index + 3; size_t k = index + prime; while (k < flags.length) { flags[k] = 0; k += prime; } count += 1; } } } writefln("%d primes", count); } NB: The expectation may be that array index x represents the number x, with i + i + 3 seeming odd at first glance. However, if one were to consider each index, it would mean that the first element would represent 0 + 0 + 3 = 3; the second element would represent 1 + 1 + 3 = 5; the third element would represent 2 + 2 + 3 = 7; and so on. So the numbers represented by the array actually go from 3 to (8190 + 8190 + 3), or 16383.
http://dlang.org/overview.html
CC-MAIN-2016-40
refinedweb
1,916
55.74
Provided by: frr_6.0.2-2build2_amd64 NAME ldpd - an LDP routing engine for use with FRRouting. SYNOPSIS ldpd [-h] [-v] ldpd [-d|-t|-dt] [-C] [-f config-file] [-i pid-file] [-z zclient-path] [-u user] [-g group] [-A vty-addr] [-P vty-port] [-M module[:options]] [-N pathspace] [--vty_socket vty-path] [--moduledir module-path] DESCRIPTION ldpd is a routing component that works with the FRRouting routing engine. OPTIONS OPTIONS available for the ldp./<daemon> "logical routers" on a system, particularly with Linux network namespaces. Groups of daemons running with distinct pathspace values will be completely unaware of each other and not interact in any way. This option does not do any system setup (like network namespaces.) reasons of backwards compatibility, the default is to listen on all interfaces. -P, --vty_port vty-port Override the daemon's default TCP VTY port (each daemon has a different default value upwards of 2600, listed below.) Specifying default /usr/lib/frr/modules. (This path is not affected by the -N option.) The list of loaded modules can be inspected at runtime with the show modules VTY command. FILES /usr/lib/frr/ldpd The default location of the ldpd binary. /etc/frr/ldpd.conf The default location of the ldpd config file. $(PWD)/ldpd.log If the ldpd process is configured to output logs to a file, then you will find this file in the directory where you started ldpd. WARNING This man page is intended to be a quick reference for command line options. The definitive document is the info file frr 6.0 zebra(8), vtysh(1), ripd(8), ripngd(8), ospfd(8), ospf6d(8), bgpd(8), isisd(8), babeld(8), nhrpd(8), pimd(8), pbrd(8), ldpd(8), eigrpd(8), staticd(8), mtracebis(8) BUGS FRR eats bugs for breakfast. If you have food for the maintainers, please email <‐ dev@lists.frrouting.org>. 2019, FRR
http://manpages.ubuntu.com/manpages/eoan/man8/ldpd.8.html
CC-MAIN-2019-47
refinedweb
314
57.16
In-Depth. I don't know about you, but I'm amazed at what you can do with the multimedia in today's mobile devices. I grew up playing "Pong" and remember when games had to fit into big boxes with green screens and ASCII art. About 10 years ago, I had to create an interpreter for the graphics processor in the IBM AS/400 systems (iSeries now) to generate graphics in a screen-scraping application. How did we survive those days? Now, mobile devices allow you to take pictures, record audio and video, and send it all to friends and relatives in minutes. You're seeing this happen all over the world, even in uprisings, as people compete to get their stories out. Many people are confused by what multimedia actually is (including me), but for our purposes, I'll look at how .NET developers can use the Xamarin Mono for Android plug-in with Visual Studio 2010 to create Android applications that use pictures and video. If you're new to Mono for Android, check out my tutorial, "Introduction to MonoDroid". While Mono for Android has definitely grown and matured since then, many of the basics are still applicable. However, the Mono garbage collector (GC) is not quite as advanced as the GC in the Microsoft .NET Framework. Sometimes, you'll need to help the GC along by calling GC.Collect at an appropriate part of your application. There are a large number of Android devices in the marketplace. What works on one may not work properly on another. The code in this article was tested and validated against Mono for Android 4.0.x. Testing was done on two devices: an HTC EVO 4G running Android 2.3 (code-named "Gingerbread"), and a Motorola Xoom tablet running Android 4.0.3 (code-named "Ice Cream Sandwich"). I've found that if an app will work on my HTC EVO 4G and my Motorola Xoom, it typically works across many devices. Asking for Permissions Mobile applications shouldn't just allow complete access to the hardware and other software in a device. With Android, developers must request access to various features on the device, such as the camera. To ask for access, you must include an AndroidManifest.xml file in your application. Mono for Android includes a default AndroidManifest.xml file based on the various attributes of the activities. It's not something you see in the file system, but if you unzip the output .apk file, you'll find an AndroidManifest.xml file. Unfortunately, the resulting file is in binary, so it's rather hard to read, but it's there. To set permissions and use other features of Android (basically, all of the cool stuff), you must create an explicit AndroidManifest.xml file for your Mono for Android project. This is done by going to the properties of the project, selecting the Android Manifest tab and then creating the AndroidManfest.xml file, as shown in Figure 1. Once this is done, an AndroidManifest.xml file is created in the Properties folder of the project. This is shown in Figure 2. Now that you have an AndroidManifest.xml file, you can edit it in one of two ways. Mono for Android has an editor for setting the permissions. You can add various permissions to use features in the phone, specify the minimum supported version of Android, identify what features are required in the device for the application and stipulate other items. For example, an application that's writing images to the device's file system will probably need android.permission.WRITE_EXTERNAL_STORAGE. An application that records audio will need android.permission.RECORD_AUDIO. If the application needs to embed GPS data into images, then it will require either adroid.permission.ACCESS_FINE_LOCATION or adroid.permission.ACCESS_COARSE_LOCATION. Listing 1 shows the XML code for the AndroidManifest file. The application requests the Camera, Internet and Record_Audio permissions so it can use these features in the device. Once you have permissions, you need to document the features you'll need to have on the device. In Figure 3, the file documents that the application will use the camera. Displaying Images Pictures allow people to process a story much better than just text alone. Android has the ability to display pictures as well as create them with a camera. Displaying images is fairly simple in Android, but there's one situation in which you need to be careful. You can get pictures in Android in three ways. First, images can be built into an application. The advantage of this method is that the image is basically guaranteed to be available. It's fairly simple programmatically because you can reference the image with the code Resource.Drawable.PictureName, so that you can access it via IntelliSense. An example call is: iv.SetImageResource(Resource.Drawable.AndroidLocalImage); Note that the resource is created for you in the Android.Designer.cs file. There's also a limit on local images stored as resources. This scenario is good for standard images that are necessary in your application. There's no need to go outside the device, so you won't be required to use a network, which is often spotty at best. Second, images can be on the device, but not built into the application. In this scenario, you don't have IntelliSense access to the images. To load an image off the device, you call an ImageView SetImageURI method and pass in a local Android.Net.Uri path to the file. Third, images can be pulled from a location outside the device, typically over the Internet. Mobile networks are not as reliable as wired networks. Add in that Android will close applications that have locked the UI thread for too long, and you can have problems if you attempt to access this on the UI thread. Think about displaying a Twitter search in a ListView. Instead of displaying one picture from outside the device, now you have to display up to 20 images. A better strategy is to load an image asynchronously on a background thread. An example call to start loading the image off of a network resource is shown in Listing 2. In Listing 2, the button's Click event starts a ThreadPool that will load images from a remote resource. Once the thread is started, the image is downloaded into a bitmap object in the local device's memory, and then loaded in the application. Note that you have to use RunOnUIThread to perform the loading on the UI control because it's running on a background thread. Using Native Camera Functionality The APIs in Android allow developers to integrate with cameras in different ways. The question is whether you want to use the existing functionality in your Android phone or build custom functionality. Most applications can use the existing camera application. Creating an Intent is an easy and quick way to enable taking pictures from within your app. Once the Camera Intent is fired, the native camera application loads and a user can "point and shoot"; then program control is returned to your application. Here's how to use a Camera Intent to take pictures in your application: The code to handle this processing is shown in Listing 3. Out of this Listing 3 code, you should see the sequence of pictures shown in Figure 4. Figure 4 (A) is the image shown in the Camera Activity before the picture is actually taken. Figure 4 (B) is the same image after it has been selected in a Camera Intent and is waiting for the user to select. The Camera Activity is asking if the user is "Done," which sends execution back to your application. There's also an option to return to the Camera Activity and take a different picture. Figure 4 (C) shows the original application displaying the returned image. Note that when a program interfaces with the built-in Activities, they have the built-in security permissions. Taking Your Own Pictures Depending on the built-in Activities, and communicating with Intents, is the way to go for more than 90 percent of applications. Other apps can implement their own functionality to integrate with the camera. The Mono for Android framework provides access to the Android Camera APIs via the Android.Hardware.Camera class. The Camera class is used to set image capture values, perform preview operations, take pictures and retrieve frames for encoding video. The Camera class will interface with the Android Camera service, which manages communications with the camera hardware. Follow this general sequence to take pictures in your app using a custom Camera: The following interfaces can be implemented from the Camera class: Associated with the Camera class, and its methods and interfaces, is the SurfaceView. The SurfaceView is used to provide a drawing surface for previewing and displaying content. It exposes a SurfaceHolder object via the Holder property. The SurfaceHolder provides an ISurfaceHolder interface. This interface has three methods: SurfaceCreated, SurfaceChanged and SurfaceDestroyed. These methods are asynchronous and used to perform any operations needed, such as displaying an image, video or cleanup. Now, take a look at the code. In this class definition, you inherit from an Activity and then implement the interfaces: public class SimpleCameraActivity : Activity, Android.Hardware.Camera.IAutoFocusCallback, Android.Hardware.Camera.IPictureCallback, Android.Hardware.Camera.IPreviewCallback, Android.Hardware.Camera.IShutterCallback, ISurfaceHolderCallback Next, set up the SurfaceView, its holder and the callback associated with it: SurfaceView surface = (SurfaceView)FindViewById(Resource.Id.Surface); var holder = surface.Holder; holder.AddCallback(this); holder.SetType(Android.Views.SurfaceType.PushBuffers); holder.SetFixedSize(300, 200); Once the holder is created, the code in Listing 4 will run when it's called from the SurfaceCreated event. This code will run the moment that the holder is created. One thing to notice within the Listing 4 code is that you can test the device to verify it has a feature. In this case, I'm using the PackageManager to test if the camera has the ability to perform auto-focus. If so, then I allow auto-focus to occur. The sequence to take the pictures is shown next. Here, you get the camera's parameters, set the PictureFormat property to Jpeg, and then tell the camera to take the picture: Android.Hardware.Camera.Parameters p = camera.GetParameters(); p.PictureFormat = (int)Format.Jpeg; camera.SetParameters(p); camera.TakePicture(this,this,this); If you step through the code in debug mode in Visual Studio, notice that taking the picture is an asynchronous operation. There's no return for the TakePicture method. Instead, you process the picture in the OnPictureTaken method. The final piece of code is the callback for the OnPictureTaken method, shown in Listing 5. This code will write the content to the local SD card and then set various parameters in the JPG output file. Now that the picture is taken, let's look at the screen output of the code. You can display the image with Windows Photo Viewer. Be careful when your device is attached to your Windows system for application development, because the default configuration maps the phone's SD card to a drive letter in Windows. The SD card is no longer available to your device, so it can't save the image. I work around this problem by just setting the device to charge by default when it connects to my development system. I don't know about you, but I find that it's a lot of work to take the pictures on your own. Given the open nature of Android and the various devices that are on the market, I prefer to make use of as much built-in code as possible to make my life easier. Playing Video If pictures are worth a thousand words, videos are priceless. In Mono for Android, you have the ability to play video as well as record video. Mono for Android allows for video to be played easily. As you create video for mobile devices, remember that video will most likely be played over a wireless network. Rarely is video distributed on a device with an application. Therefore, you need to do two things. First, create video content that's as small as possible. This will speed delivery and create the least amount of problems during the download process. Second, you need to make sure you perform as many operations as possible asynchronously within your application. You'll need to watch this when you're preparing the media player. Follow this sequence of actions to play video in this example: Recording Video Now that you've seen how to play a video stream, let's look at how to record a video stream. Just like taking a picture, there are two ways to record a video stream. You can record the video using the built-in Camera Activity, or you can interface with the camera directly. Personally, I find that interfacing with the camera seems to have a number of issues across devices, so I'll show you how to interact with the Camera Activity. Using the Camera Activity to record video is similar to taking pictures. You don't need to handle all of the painful issues regarding video recording because the Camera Activity handles them for you. Follow these steps to record the video: The video and other files are available in the code download for this article. You can pull the video out and play it on your local system. Taking pictures, and recording and playing video, is the basis for a lot of the excitement around mobile devices. After all, why carry a camcorder and a phone when the phone will do the job of both and is smaller and lighter? Smartphones, and Android, are a great way to record multimedia and share it with the world quickly and easily. I hope you'll start developing applications to take advantage of these great features in Mono for Android. Printable Format > More TechLibrary I agree to this site's Privacy Policy. > More Webcasts
https://visualstudiomagazine.com/articles/2012/05/01/plug-in-to-mono.aspx
CC-MAIN-2018-09
refinedweb
2,344
56.05
launch a .stl file Hi Ros Users: I have a .stl file and I just would like to launch in a gazebo empty world with a .launch. How con I do that? Thanks a lot ! Hi Ros Users: I have a .stl file and I just would like to launch in a gazebo empty world with a .launch. How con I do that? Thanks a lot ! answered 2015-10-19 08:47:15 -0500 You. Thanks a lot @Stefan Kohlbrecher ! I have fixed it! But now I have another problem... please have a look at... because maybe you can help me. Thanks a lot again Open the file in SolidWorks and export to URDF using this plug-in. This URDF file can be read in Gazebo. You can find the details and procedure in following links Solidworks teacher blog, Design for gazebo, Willow Garage. Please start posting anonymously - your entry will be published after you log in or create a new account. Asked: 2015-10-19 06:13:17 -0500 Seen: 447 times Last updated: Oct 19 '15 Using diff drive to drive a new robot Gazebo simulations not repeatable Unable to find ros-indigo-gazebo7-ros-pkgs What means 'ground truth' Wheel slippery, wrong direction and not straight how to use "rosparam load" to set specified namespace parameter? Battery Usage Simulation in Gazebo rosparam load all yaml-files in folder Gazebo world from heightmap in Electric/Fuerte problem loading walls model in gazebo 1.0
https://answers.ros.org/question/219390/launch-a-stl-file/
CC-MAIN-2019-39
refinedweb
246
85.18
Applications get data from lots of different sources. The most common is to get data from a database or a web service. Typically, we encapsulate calls to a database in a Repository object and we create some sort of IRepository interface as an abstraction to decouple between layers and enable easier unit testing by leveraging faking and mocking. This works great for database interaction. However, when consuming a RESTful web service, this is is not always the best approach. The WCF Web APIs that are available on CodePlex (current drop is Preview 3) provide a variety of features to make building HTTP REST services more robust. When you download the latest bits, you’ll also find a new HttpClient which has been updated for .NET 4.0 as compared to the one that shipped for 3.5 in the original REST Starter Kit. The HttpClient currently provides the best API for consuming REST services on the .NET platform and the WCF Web APIs provide a number of extension methods which extend HttpClient and make it even easier to use. Let’s say you have a client application that is consuming an HTTP service – this could be Silverlight, WPF, or any UI technology but for my example I’ll use an MVC application: 1: using System; 2: using System.Net.Http; 3: using System.Web.Mvc; 4: using FakeChannelExample.Models; 5: using Microsoft.Runtime.Serialization; 6: 7: namespace FakeChannelExample.Controllers 8: { 9: public class HomeController : Controller 10: { 11: private readonly HttpClient httpClient; 12: 13: public HomeController(HttpClient httpClient) 14: { 15: this.httpClient = httpClient; 16: } 17: 18: public ActionResult Index() 19: { 20: var response = httpClient.Get("Person(1)"); 21: var person = response.Content.ReadAsDataContract<Person>(); 22: 23: this.ViewBag.Message = person.FirstName + " " + person.LastName; 24: 25: return View(); 26: } 27: } 28: } On line #20 of the code above you can see I’m performing an HTTP GET request to a Person resource exposed by an HTTP service. On line #21, I use the ReadAsDataContract() extension method provided by the WCF Web APIs to serialize to a Person object. In this example, the HttpClient is being passed into the constructor by MVC’s dependency resolver – in this case, I’m using StructureMap as an IoC and my StructureMap initialization code looks like this: 1: using StructureMap; 3: 4: namespace FakeChannelExample 5: { 6: public static class IoC 7: { 8: public static IContainer Initialize() 9: { 10: ObjectFactory.Initialize(x => 11: { 12: x.For<HttpClient>().Use(() => new HttpClient("")); 13: }); 14: return ObjectFactory.Container; 15: } 16: } 17: } My controller code currently depends on a concrete instance of the HttpClient. Now I *could* create some sort of interface and wrap the HttpClient in this interface and use that object inside my controller instead – however, there are a few why reasons that is not desirable: For one thing, the API provided by the HttpClient provides nice features for dealing with HTTP services. I don’t really *want* these to look like C# RPC method calls – when HTTP services have REST features, I may want to inspect HTTP response headers and hypermedia contained within the message so that I can make intelligent decisions as to what to do next in my workflow (although I don’t happen to be doing these things in my example above) – this type of workflow is common in hypermedia REST scenarios. If I just encapsulate HttpClient behind some IRepository interface and make it look like a C# RPC method call, it will become difficult to take advantage of these types of things. Second, it could get pretty mind-numbing to have to create interfaces all over the place just to wrap the HttpClient. Then you’re probably going to have to hard-code HTTP knowledge into your code to formulate requests rather than just “following the links” that the hypermedia in a message might provide. Third, at first glance it might appear that we need to create an interface to facilitate unit testing, but actually it’s unnecessary. Even though the code above is dependent on a concrete type, it’s actually very easy to fake the data in a unit test. The HttpClient provides a Channel property (of type HttpMessageChannel) which allows you to create a fake message channel which can be leveraged in unit testing. In this case, what I want is to be able to write a unit test that just returns fake data. I also want this to be as re-usable as possible for my unit testing. I want to be able to write a unit test that looks like this: 1: [TestClass] 2: public class HomeControllerTest 3: { 4: [TestMethod] 5: public void Index() 6: { 7: // Arrange 8: var httpClient = new HttpClient(""); 9: httpClient.Channel = new FakeHttpChannel<Person>(new Person { FirstName = "Joe", LastName = "Blow" }); 10: 11: HomeController controller = new HomeController(httpClient); 13: // Act 14: ViewResult result = controller.Index() as ViewResult; 15: 16: // Assert 17: Assert.AreEqual("Joe Blow", result.ViewBag.Message); 18: } 19: } Notice on line #9, I’m setting the Channel property of the HttpClient to be a fake channel. I’m also specifying the fake object that I want to be in the response on my “fake” Http request. I don’t need to rely on any mocking frameworks to do this. All I need is my FakeHttpChannel. The code to do this is not complex: 2: using System.IO; 3: using System.Net.Http; 4: using System.Runtime.Serialization; 5: using System.Threading; 6: using FakeChannelExample.Models; 7: 8: namespace FakeChannelExample.Tests 9: { 10: public class FakeHttpChannel<T> : HttpClientChannel 11: { 12: private T responseObject; 13: 14: public FakeHttpChannel(T responseObject) 15: { 16: this.responseObject = responseObject; 17: } 18: 19: protected override HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken) 20: { 21: return new HttpResponseMessage() 22: { 23: RequestMessage = request, 24: Content = new StreamContent(this.GetContentStream()) 25: }; 27: 28: private Stream GetContentStream() 29: { 30: var serializer = new DataContractSerializer(typeof(T)); 31: Stream stream = new MemoryStream(); 32: serializer.WriteObject(stream, this.responseObject); 33: stream.Position = 0; 34: return stream; 35: } 36: } 37: } The HttpClientChannel provides a Send() method which you can override to return any HttpResponseMessage that you want. You can see I’m using the DataContractSerializer to serialize the object and write it to a stream. That’s all you need to do. In the example above, the only thing I’ve chosen to do is to provide a way to return different response objects. But there are many more features you could add to your own re-usable FakeHttpChannel. For example, you might want to provide the ability to add HTTP headers to the message. You might want to use a different serializer other than the DataContractSerializer. You might want to provide custom hypermedia in the response as well as just an object or set HTTP response codes. This list goes on. This is the just one example of the really cool features being added to the next version of WCF to enable various HTTP scenarios. The code sample for this post can be downloaded here.
http://gamecontest.geekswithblogs.net/michelotti/archive/2011/02.aspx
CC-MAIN-2019-43
refinedweb
1,165
54.52
Odoo Help This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers. how to retrieve values to RML Report ? I would like to take product's internal reference in purchase.requisition to make an output as Product Code in Purchase Requisition Report. I also want to make a method to get a total number of quantity , do i have to write in report.py or inherit purchase.requisition.py ? how can i write the code both RML and PY ? Thanks in advance .. Hi, For the method, first of all, you must write your method in report.py (by "report" y mean the name of the file that contains the Python code...) like this: class my_class(report_sxw.rml_parse): def __init__(self, cr, uid, name, context=None): super(my_class, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'method': self._your_method, }) def _your_method(self): return 'whatever' And then call it on your report like this: [[ method() ]] For retrieving any value just use [[ (object).(field) ]] bearing in mind that (object) must be the 'string' assigned to the loop [[ repeatIn(object,string) ]] into the same RML. Don't forget to check already done reports as sale_order one into addons/sale/report/ EDIT: Be sure to place your [[ method() ]] call into the tags <para></para> so that it appears've applied but the output in the report does not appear are there any other suggestions? thanks
https://www.odoo.com/forum/help-1/question/how-to-retrieve-values-to-rml-report-71542
CC-MAIN-2016-50
refinedweb
254
67.15
A small (376B) lazy function scheduler for a butter smooth main thread Workshy is a throttle utility that rate limit, queue, and distribute function executions over time to prevent the main thread from becoming unresponsive. Unlike a standard throttle function, and to ensure non-blocking rendering and responsive UIs, workshy break up functions into smaller chunks executed over time if necessary. This module is available in three formats: dist/workshy.mjs dist/workshy.js dist/workshy.min.js $ npm install --save workshy The script can also be directly included from unpkg.com: <script src=""></script> import workshy from 'workshy'; // dummy function doing heavy work const greet = () => 'hello world'; // queue and call function workshy(greet)(); // => 'hello world' // tasks are only called once, but // multiple calls increases priority const a = workshy(x => console.log(`A: ${x}`)); const b = workshy(x => console.log(`B: ${x}`)); b(1); a(1); a(2); // => A: 2 // => B: 1 // manually define priority const func = workshy(greet, {priority: 2}); // force it to be called immediately const func = workshy(greet, {force: true}); // workshy distribute the work over time to // make sure the main thread runs butter smooth for (let i = 0; i < 5000; i++) { workshy(greet)(); // => this won't block UI } Returns: function Type: function Accepts any function a returns a function (a function that wraps your original function). Call returned function to queue task. The returned function will execute your function with the latest arguments provided to it as soon as possible based on queue length and prioroty. Important: Task are only called once. Calling the same task multiple times increases its priority. Type: Number Default: 0 Tasks are sorted by priority. Functions with high priority are called first. Important: Priority also increase if a task is called multiple times. workshy(() => console.log('Hello World'), {force: false, priority: 2}); //=> 'Hello World' Type: Boolean Default: false workshy(() => console.log('Hello World'), {force: false, priority: 2}); //=> 'Hello World' This is inspired by the talk The Virtue of Laziness: Leveraging Incrementality for Faster Web UI MIT © Terkel Gjervig
https://openbase.com/js/workshy
CC-MAIN-2022-27
refinedweb
337
51.89
Been developing an application which uses both Silverlight and Unity side-by-side in the web browser. However, we've found that when Unity is performing a lot of work (either due to complex scenes, underpowered hardware, etc) it was negatively impacting the performance of Silverlight to the point of no longer being usable. We tried having Unity "idle" when not being directly interacted with by the user by dropping its frame rate using Application.targetFrameRate. Initially, it works great and the Silverlight performance shoots back up through the roof. However, the performance degrades to the point where Silverlight starts running at the same framerate as Unity. It also seems to affect the browser overall (closing the window, interacting with it can become delayed). Application.targetFrameRate I've profiled the processing of Silverlight, and considering the browser slowdown, I think the main browser process might not be triggering the main Silverlight runtime's loop. Once the loop executes, the code processes as quickly as ever, but the browser/runtime just waits and waits until Unity runs its update for its next frame. As soon as we set the Application.targetFrameRate back up to 60fps, everything works fine again (albeit with the degraded performance we were trying to solve in the first place) I put together a sample test that demonstrates this. Simply on the left-hand side in Silverlight, a smiley face follows the mouse cursor and on the right-hand side Unity displays a spinning cube. If you click the "Drop Frame Rate to 2 FPS" button in Unity, then continually move your mouse around in Silverlight, after about 10 seconds or so, you'll notice that the smiley face starts pausing instead of smoothly following your mouse. The performance continues to degrade until the smiley face updates are synchronized with Unity's frame rate (and even worse sometimes if it skips a frame). Click the "Increase Frame Rate to 60 FPS" will fix the performance, and clicking the 2 FPS button after will go through the same process of slowly degrading performance. You can access the test here: The only Silverlight code is: public MainPage() { InitializeComponent(); MouseMove += MainPage_MouseMove; } private void MainPage_MouseMove(object sender, MouseEventArgs e) { var position = e.GetPosition(this); this.image1.Margin = new Thickness(position.X - image1.Width / 2, position.Y - image1.Height / 2, 0, 0); } And on Unity's side, the only pertinent code is: public class ChangeFrameRate : MonoBehaviour { private void Start() { QualitySettings.vSyncCount = 0; Application.runInBackground = true; } private void OnGUI() { if (GUI.Button(new Rect(0, 0, 250, 20), "Drop Frame Rate to 2 FPS")) Application.targetFrameRate = 2; if (GUI.Button(new Rect(0, 30, 250, 20), "Increase Frame Rate to 60 FPS")) Application.targetFrameRate = 60; } } So far we've tested and duplicated the slowdown on Windows XP and Windows 7 running on IE 8/9, Firefox 13/14, and Google Chrome 17/20. We've also found that the time needed to exhibit the slowdown can vary from operating system and browser though we have found that generally, Chrome takes the longest to slowdown and IE degrades the fastest. This is created with Unity Pro 3.5.2f2. Any thoughts or insights on this, or possible solutions would be greatly appreciated! Thank you! EDIT: By the way, CPU usage during the tests never rose above 2% so this isn't an issue with one of them hogging the CPU, just thread waiting I guess. FYI doesn't happen on my Mac running Chrome. @whydoidoit thanks for the mac test; good to. [iOS] Frame rate drops when ASSISTIVE TOUCH is on 0 Answers Animation of terrain causes drastic performance drop (fps) 0 Answers Webplayer deliberately caping the framerate? 2 Answers Slowdown with armv7 on iPhone4 and armv6 on iPhone4S 0 Answers Performance Differences in Standalone player versus Web Browser? 2 Answers
http://answers.unity3d.com/questions/287655/low-applicationtargetframerate-slows-silverlightbr.html
CC-MAIN-2016-30
refinedweb
636
52.7
Hello dear Kali forum friends I'm running a program in Kali linux, python and I keep getting errors like below. I couldn't solve it. I tried installing Kali linux from scratch and it didn't work. Can you help me? Thanks... ERROR CODE Traceback (most recent call last): File "/usr/local/bin", line 5, in <module> from import run_as_command File "/usr/local/lib/python3.9/dist-packages/ ", line 14, in <module> from . import run File "/usr/local/lib/python3.9/dist-packages/run.py", line 4, in <module> from . import datelock, feed, get, output, verbose, storage File "/usr/local/lib/python3.9/dist-packages/get.py", line 6, in <module> import aiohttp File "/usr/lib/python3/dist-packages/aio line 6, in <module> from .client import ( File "/usr/lib/python3/dist-packages/aio line 35, in <module> from . import hdrs, payload File "/usr/lib/python3/dist-packages/aio line 7, in <module> from . import ( File "/usr/lib/python3/dist-packages/aio line 15, in <module> from .helpers import NO_EXTENSIONS, BaseTimerContext File "/usr/lib/python3/dist-packages/aio line 667, in <module> class CeilTimeout(async_timeout.timeout): TypeError: function() argument 'code' must be code, not str
https://forums.kali.org/showthread.php?68243-Help&s=b4d9956dc7badc0989db8d652803f75c&p=117724
CC-MAIN-2022-21
refinedweb
196
53.37
If you have your BeagleBone Black or Raspberry Pi running a process and you would like it to send updates to your phone, you can easily accomplish that using a new API and service from Pushover. This morning I was considering different methods for getting messages from my BeagleBone Black sent to my iPhone. At first I considered setting it up to send emails, but that is a little bit of work and isn’t extremely reliable. I also considered setting it up to send tweets, but that involves creating a separate twitter account and dealing with OAuth to interface with Twitter. As it happened I ended up stumbling across Pushover while I was looking at possible channels in IFTTT. I spent a few minutes looking around the Pushover website and looked over their API and what do you know, this is the perfect service for pushing updates to your phone. So how can we do that? Step 1: Download Pushover and Create Account You first need to install the device side application on your phone. This is the only part of the process that you are charged for. At the time of writing, the app cost me a cool $4.99, I generally don’t like paying more than $1.99 for an app but this one seemed worth it. After you download the app, open it up and create an account. This will assign you a unique user token that you will need to use to communicate with the Pushover server. I recommend copying this key into a text file so you can easily use it later. Step 2: Create Your Pushover Application After you have an account with Pushover you will need to create an application so you can receive an application token. This process is free and you are allowed to send up to 7,500 messages a month. Once you have created an application you will see an application key, I also recommend copying this into a text file because you will need it later. Step 3: Set It Up On Your System Since the Pushover API is composed of simple HTTP transfers it is a simple matter to interact with their service from many different environments. For this example I have chosen to use Python because it is so simple to use and highly portable. For more examples on how to interact with Pushover visit the FAQ page on their website. I have adapted the Python example from the FAQ page to be more descriptive and dynamic, take a look: import httplib, urllib # Application specific variables application_token = "YOUR APPLICATION TOKEN" user_token = "YOUR USER TOKEN" # Message specific variables title = "A Simple Test" message = "Saying hello from BeagleBone Black" url = "" # To remove any of these fields you will need to remove them # from the conn.request() below # Start your connection with the Pushover API server conn = httplib.HTTPSConnection("api.pushover.net:443") # Send a POST request in urlencoded json conn.request("POST", "/1/messages.json", urllib.urlencode({ "token": application_token, "user": user_token, "title": title, "message": message, "url": url, }), { "Content-type": "application/x-www-form-urlencoded" }) # Listen for any error messages or other responses conn.getresponse() Try copying this code onto your BeagleBone Black or Raspberry Pi and running it using Python, remember to change the variables for your user and application keys. I have included some images below of this working on my own BeagleBone Black and iPhone 5. Networked BeagleBone Black. As you can see it is just connected to a power source that I made from a modified mini-usb cable and a LAN connection. Just a few seconds after running the script through Python on my BeagleBone Black I received the following push message to my phone. And that’s it for this introduction to Pushover, if you would like to learn more check out their API Reference and the Pushover FAQ page. If you have questions or suggestions for me, post them in the comments below. If you liked this article be sure to subscribe.
http://www.michaelhleonard.com/send-push-messages-from-beaglebone-black-or-raspberry-pi-to-iphone-or-android/
CC-MAIN-2014-15
refinedweb
672
60.04
For a while I've had people ask me how I did my photoblog and because I wrote it from scratch it's not really useful (and it's definitely "Me-ware": unusable to just about anyone but me). I always direct people towards Flickr but it doesn't have the photoblog experience quite like mine and other photoblogs. This weekend I've been writing a tool called Flickr-Fu that grabs the RSS feed from Flickr and attempts to simulate the photoblog experience allowing a user to navigate forward and backward one photograph at a time. The RSS xml structure is extended by Yahoo with it's own namespace: - all such tags are given a "media" prefix to distinguish them from the structure of RSS 2.0. Using XPaths with .NET is pretty straight forward until you run into the namespace issue, at which point there is a class XmlNamespaceManager that you will need to tame in order to get the job done. But before this point I was hitting my head against a wall: I could see the media:content tag that I needed to get the image URL but I could see no namespace associated with it! It doesn't follow as well-formed XML to have namespaces without some namespace URI but sure enough, Firefox was hiding the namespace URI. I pasted to IE and was able to get a proper reference to use with the XmlNamespaceManager. What a strange thing to display XML in a stylesheet but leave off the namespace references in the root element! Just to prove I'm not hallucinating, here's a screen cap: Once the namespace issue was cleared up for me, the code was quite simple: 21 XmlNamespaceManager spaceManager = new XmlNamespaceManager(doc.NameTable); 22 spaceManager.AddNamespace("media", ""); 23 linkToBig = xnItem.SelectSingleNode("media:content/@url", spaceManager).InnerText; Flickr-Fu is a work in progress but you can have a look here. } 1 comment: I spent way more time than I should have tonight trying to find a reason why Firefox does that to no avail. Anyway, if don't want to have to fire up IE, you can see the namespace declarations by using the view-source keyword in front of your URL in Firefox like so: view-source: AJ
http://metadeveloper.blogspot.com/2006/10/firefox-hiding-namespaces-arg.html
CC-MAIN-2018-22
refinedweb
380
57.5
have a pydev project named 'kuma' with a vendor/kuma.pth file like so: packages packages/pytz packages/coverage ... src src/django-cronjobs src/django-cache-machine I tried adding vendor/ to the project PYTHONPATH, but it doesn't add the directories from the .pth file? E.g., from caching.base import cache gives 'Unresolved import: cache' even though src/django-cache-machine/caching/base.py defines it I've got 59 lib's in my kuma.pth file - I'd rather not have to add each of them to the PyDev - PYTHONPATH. So how can I add .pth files and/or their contents to PyDev - PYTHONPATH? Thanks, -L The following forum message was posted by pduffy at: Hi Fabio, As you say, it appears that it was a permissions problem: there were some files among the ones in the pydev dropin which were only readable by the owner (in this case, root.) I fixed it by changing to the dropins directory and changing everything below it to be world-readable and world-executable - after this, pydev was visible for non-root users. (Note that this was only a test to prove the point - I'll now reinstall pydev and try changing the permissions on specific files.) A few points. Under our Red Hat systems, we have no option but to install software as root, and eclipse works fine if installed in this way. Also, as far as I could see, there's nothing currently in the pydev installation instructions about having to change file permissions, and/or installing as a particular user. (Probably also worth noting that our Red Hat boxes can't see the internet, so we have to install eclipse and add-ons using .zip files. Maybe if pydev is installed via the online repositories, this problem doesn't occur.) Thanks for getting back to me on this. When I've identified which files need to have their permissions changed, I'll post another update. Regards, Peter The following forum message was posted by fabioz at: I think the problem is that you didn't set the proper permissions so that your user can use the files you created as root. Cheers, Fabio The following forum message was posted by pduffy at: I'm trying to install pydev 1.6.5 under eclipse galileo running on linux (RH5.3). I downloaded the .zip file, logged into the linux box as root, changed to the dropins directory under the eclipse installation, unzipped the .zip file and restarted eclipse. I then verified that under window -> preferences, I could see the pydev entry. I then logged off root and logged in as a non-root user. I started eclipse, and again navigated to window -> preferences. No sign of pydev. (Seems to be the same for any non-root user.) Thanks in advance for any ideas, suggestions, etc. I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details
https://sourceforge.net/p/pydev/mailman/pydev-users/?viewmonth=201102&viewday=18
CC-MAIN-2017-34
refinedweb
520
65.62
What's a Plugin? A Thoth plugin is really just a Ruby module that lives in the Thoth::Plugin namespace. Plugins can either be distributed as RubyGems or you can just drop them into a /plugin directory under your Thoth home directory. When you call a method like Thoth::Plugin::Foo.bar from a view (or even from another plugin), Thoth first looks for a file named thoth_foo.rb in the /plugin directory. If it doesn't find the file, then it looks for a gem named thoth_foo. Once found, the plugin will be loaded automatically. It couldn't be any easier. Writing a Plugin Let's write a simple plugin that grabs the last five status updates from someone's Twitter feed and returns them in an array. Create a file in your /plugin directory named thoth_twitter.rb and open it in your favorite text editor. Here's the plugin code in its entirety (yes, this is really all of it): require 'json' require 'open-uri' module Thoth; module Plugin module Twitter def self.recent_tweets(user) url = "{user}.json?count=5" JSON.parse(open(url).read).collect {|item| item['text']} end end end; end Calling a Plugin It'd be nice to have your recent tweets displayed just above the first blog post on your blog's index page, don't you think? Let's make that happen. If you've read the CreatingCustomThemes guide, you probably already have some idea of what to do now, but I'll reiterate just to make sure. First, create a new directory under your Thoth home directory to hold your custom views, then copy the default view/index.rhtml file into it, since that's the file you'll want to modify. If you're not sure where the default views are, run thoth --help to find out. mkdir -p ~/mysite/custom/view cp /path/to/default/view/index.rhtml ~/mysite/custom/view/ Now open ~/mysite/custom/view/index.rhtml in your text editor. It should look something like this: <% @posts.all do |post| %> <%= render_template('post/compact', :post => post) %> <% end %> <%= render_template(:pager, :prev_text => '« Newer stuff', :next_text => 'Older stuff »') %> That loop up at the top is what displays the blog posts. Add your new Twitter feed just above it, like so: <div id="twitter"> <ul> <% Thoth::Plugin::Twitter.recent_tweets('yourname').each do |tweet| %> <li><%= tweet %></li> <% end %> </ul> </div> <% @posts.all do |post| %> <%= render_template('post/compact', :post => post) %> <% end %> <%= render_template(:pager, :prev_text => '« Newer stuff', :next_text => 'Older stuff »') %> Save the file, restart Thoth, browse to your site, and you should see a lovely Twitter feed staring back at you. Well, maybe not lovely since we haven't added any styles for it, but at least it works. How easy was that? The Sky's the Limit This is obviously a very basic example just to get you started; there's virtually no limit to what you can do with plugins. Your plugins have the full power of Ruby at their disposal. And since Ruby allows you to modify other classes at runtime, you can even override pieces of Thoth's core functionality if you want to. Be creative! And be sure to let us know about the awesome plugins you create.
http://code.google.com/p/thoth-blog/wiki/CreatingPlugins
crawl-001
refinedweb
537
65.83
There are lots of techniques for controlling an existing Windows application from code, but why not go one better and write a class that represents the app within your program? It can be done! As long as you prepared to use a few non-obvious techniques then running an existing application under the control of a .NET “wrapper” program is fairly easy. Our project .NET MP3 demonstrates how to run command line .EXE program using the Process class, but it is possible to go further and wrap standard Windows applications. As a simple example we create a wrapper for NotePad, but the technique works just a well with any Windows application. The example is a good illustration of not just using the process class, SendKeys and Shell but also how to pass on events and deal with cross-threading problems. You can start any application using the Process class but VB programmers have the Shell command that is easier to use. However there is nothing stopping C# programmers using classes that were intended to be used in VB .NET. If you start a new Windows project and add a new class called NotePad then to use the Shell object all we need to do is add a reference (Project,Add Reference) to Microsoft.VisualBasic and add: using Microsoft.VisualBasic; The object that we want to make use of is Interaction. You should look this up in the documentation because it has lots of useful methods. The one of immediate value is Shell, which starts an application running and returns a process handle to it. The location of the application that we want to run could be specified in a number of ways, even as a parameter in the constructor, but in this case a constant is simpler: private const string location = "NotePad.exe"; It seems reasonable to create the instance of the application in the constructor: public NotePad(){ Int32 ProcessHandle = Interaction.Shell( location, AppWinStyle.NormalFocus, false, 0);} Now if you return to the main form, add a button and the following code: private void button1_Click( object sender, EventArgs e){ NotePad NP = new NotePad();} Running the program and clicking on the button results in an instance of NotePad starting. To really keep control of NotePad we need to associate it with a Process object. Given we have a process handle, this is easy: NPad = Process.GetProcessById(ProcessHandle); To make this work we need to add a private variable: private Process NPad; and using System.Diagnostics; Notice that now we can access the process handle as NPad.Id and we have lots of facilities for managing the process. The simplest way of sending data to the running application is to use the SendKeys static class that we get from the System.Window.Forms name space. This is best packaged as a new method of the NotePad class. public void Input(string Text){ if (NPad.Responding) { Interaction.AppActivate(NPad.Id); Thread.Sleep(10); SendKeys.SendWait(Text); }} The Process object is used to check that the application has a responsive user interface. Then the Interaction object is used to make the application active. Notice that (contrary to the documentation) this is the managed way to activate an application even if it has been borrowed from VB .NET. Finally the SendWait method is use to send the text. The use of the Thread object to pause the program is necessary because some applications miss keystrokes if you send them too fast. If you find that this is happening simply increase the delay. It would be nice to avoid putting the tread to sleep and it would be nice to interlock the two applications together but in practice the method works well enough. To make all this work we need to add: using System.Windows.Forms;using System.Threading; If you now add: NP.Input("Hello World"); to the Button's event handler you will see the message appear when the NotePad is created. You can, of course send any commands to the application that have keyboard shortcuts – see the documentation on SendKeys to discover how to send control codes etc.
http://i-programmer.info/projects/38-windows/2032-wrapping-an-external-app-in-a-class.html
CC-MAIN-2013-20
refinedweb
685
62.88
On Oct 12, 2009, at 22:28 , Uwe Hollerbach wrote: > parsePrefixOf n str = > string (take n str) >> opts (drop n str) >> return str > where opts [] = return () > opts (c:cs) = optional (char c >> opts cs) Seems to me this will succeed as soon as it possibly can... > myTest = myPrefixOf 1 "banana" > <|> myPrefixOf 1 "chocolate" > <|> TPCP.try (myPrefixOf 2 "frito") > <|> myPrefixOf 3 "fromage" ...so the "frito" branch gets committed as soon as "fr" is read/parsed (myTest returns)... > % ./opry fro > "test" (line 1, column 3): > unexpected "o" > expecting "i", white space or end of input ...which is why this is looking for "white space or end of input". My fix would be to have myPrefixOf require the prefix be terminated in whatever way is appropriate (end of input, white space, operator?) instead of simply accepting as soon as it gets a prefix match regardless of what follows. -- :
http://www.haskell.org/pipermail/haskell-cafe/2009-October/067733.html
CC-MAIN-2013-48
refinedweb
145
70.53
I have look at this question: In Django, how do I select 100 random records from the database? And attempted to make use of Content.objects.all().order_by('?')[:30], but this can produce some duplicate products. Just how could I choose 30 unique random values from database? For those who have a workable quantity of records within the database (ie not 1000's), this works, and despite the fact that it hits the db two times it'll most likely considerably more effective than order_by('?'). import random content_pks = Content.objects.values_list('pk', flat=True) selected_pks = random.sample(content_pks, 30) content_objects = Content.objects.filter(pk__in=selected_pks)
http://codeblow.com/questions/how-you-can-choose-30-unique-random-values-from-database-mysql-with/
CC-MAIN-2017-39
refinedweb
105
51.75
Understanding. If, for any of these reasons, you can benefit from delegating zones, it might make sense to restructure your namespace by adding additional zones. When you are deciding how to structure zones, use a plan that reflects the structure of your organization.. When a standard primary zone is first created, all the resource record information is stored as a text file on a single DNS server. This server acts as the primary master for the zone. Zone information can be replicated to other DNS servers to improve fault tolerance and server performance. When you are structuring your zones, there are several good reasons to use additional DNS servers for zone replication: - Added DNS servers provide zone redundancy, which makes it possible for, wide area network (WAN) link can be useful in managing and reducing network traffic. - Additional secondary servers can be used to reduce loads on a primary server for a zone. Example: Delegating a subdomain to a new zone As shown in the following illustration, when a new zone for a subdomain (example.microsoft.com) is created, delegation from the parent zone (microsoft.com) is needed. . These resource records include the following: - A name server (NS) resource record to effect the delegation. This resource record advertises that the server named ns1.na.example.microsoft.com is an authoritative server for the delegated subdomain. - A host (A or AAAA) resource record (also known as a glue record) is necessary to resolve the name of the server that is specified in the NS resource record to its IP address. The process of resolving the host name in this resource record to the delegated DNS server in the name server (NS) resource record is sometimes referred to as glue chasing.
http://technet.microsoft.com/en-us/library/cc771640.aspx
CC-MAIN-2014-42
refinedweb
289
52.39
Python generators are a powerful, but misunderstood tool. They’re often treated as too difficult a concept for beginning programmers to learn — creating the illusion that beginners should hold off on learning generators until they are ready. I think this assessment is unfair, and that you can use generators sooner than you think. In this tutorial, we’ll cover: - The basic terminology needed to understand generators - What a generator is - How to create your own generators - How to use a generator and generator methods - When to use a generator To get the most out of this tutorial, you should be familiar with the following concepts: - Basic Python data structures - What a list is - What a dictionary is - Functions - What a function is - How to create and use functions - List Comprehensions - What a list comprehension is - How to create a simple list comprehension Iteration and iterables Iteration is the repetition of some kind of process over and over again. Python’s for loop gives us an easy way to iterate over various objects. Often, you’ll iterate over a list, but we can also iterate over other Python objects such as strings and dictionaries. # Iterating over a list ez_list = [1, 2, 3] for i in ez_list: print(i) >>> 1 >>> 2 >>> 3 # Iterating over a string>> "e" ... >>> "r" >>> "s" # Iterating over a dictionary ez_dict = {1 : "First, 2 : "Second"} for key, value in ez_dict.items(): print(k, v) >>> 1 "First" >>> 2 "Second" In each of the above examples, the for loop iterates over the sequence we give it. The code above used a list, string, and dictionary, but you can iterate over tuples and sets as well. In each loop above, we ez_list is replicated in the order that its items are printed out. We refer to any object that can support iteration as an iterable. What defines an iterable? Iterables support something called the Iterator Protocol. The technical definition for the Iterator Protocol is out of the scope of this article, but it can be thought of as a set of requirements to be used for a for loop. That is to say: lists, strings and dictionaries all follow the Iterator Protocol, therefore we can use them in for loops. Conversely, objects that do not follow the protocol cannot be used in a for loop. One example of an object that does not follow the protocol is an integer. If we try to give an integer to a for loop, Python will throw an error. number = 12345 for n in number: print(n) >>> TypeError: 'int' object is not iterable An integer is just a singular number, not a sequence. You may argue that the “first” number in number is 1, but it is not the same as the first item in a sequence. It doesn’t make sense to ask “What’s after 1?” from number since Python only understands integers as a single entities. Therefore, one of the requirements to be an iterable is to be able to describe to the for loop what the next item to perform the operation on is. For example, lists tell the for loop that the next item to iterate on is in the index+1 from the current one (1 comes after 0). Consequently, an iterable must also signal to a for loop when to stop iterating. This signal usually comes when we arrive at the end of a sequence (i.e. the end of a list or string). We will explore the specific functions that make something iterable later in this article, the important thing to know is that iterables describe how a for loop should traverse its contents. Generators are iterables themselves. As you’ll see later, for loops are one of the main ways we use a generator, so they must be able to support iteration. We’ll delve into how we can create our own generators in the next secton. Key takeaways: basic terms to know Iteration is the idea of repeating some process over a sequence of items. In Python, iteration is usually related to the forloop. An iterable is an object that supports iteration. To be an iterable, it must describe to a forloop two things: - What item comes next in the iteration. - When should the loop stop iteration. Generators are iterables. To truly explore generators, we’ll use the Brewer’s Friend Beer Recipes data set from Kaggle. You can find the data set here, if you’d like to follow along on your own computer. The data contains important beer characteristics from brewers around the world, including style of beer, alcohol by volume (ABV), and amount of beer produced. For the purposes of this article, let’s say that we are interested in brewing our own beer. Perhaps we want to sell our beer, so we would like to see what others have done to inform our brewing choices and produce more popular beer styles. Author’s Note: The “Name” column in the original data set contains some messy values that interfere with our analysis. You can find a cleaned version that will serve our purposes here. If you’ve never encountered a generator before, the most common real-life example of a generator is a backup generator, which creates — generates — electricity for your house or office. Conceptually, Python generators generate values one at a time from a given sequence, instead of giving the entirety of the sequence at once. This one-at-a-time fashion of generators is what makes them so compatible with for loops. If this sounds confusing, don’t worry too much. As we explain how to create generators, it will become more clear. There are two ways to create a generator. They differ in their syntax, but the end result is still a generator. We’ll teach these concepts by covering their syntax and comparing them to a similar, but non-generator equivalent. - A generator function versus a regular function - A generator expression versus a list comprehension The generator function A generator function is just like a regular function but with a key difference: the yield keyword replaces return. # Regular function def function_a(): return "a" # Generator function def generator_a(): yield "a" The two functions above perform exactly same action (returning/yielding the same string). However, if you try to inspect the generator function, it won’t match what the regular function shows. function_a() >>> "a" generator_a() >>> <generator object a at 0x000001565469DA98> Calling a regular function tells Python to go back to where the function is located in our code, perform the code within the block, and return the result. In order to get the generator function to yield its values, you need to pass it into the next() function. next() is a special function that asks, “What’s the next item in the iteration?” In fact, next() is the precise function that is called when you run a for loop! Lists, dictionaries, strings, and the like all implement next(), so this is why you can incorporate them into loops in the first place. # Asking the generator what the next item is next(a()) >>> "a" # Do not do this next(a) Notice that we have to pass in generator function with the parentheses since the function itself is the generator. Providing only the function name will throw an error since you’re trying to give next() a function name. As expected, the generator function will yield “a” once we invoke the next() function. This example is not fully representative of what a generator is useful for. Remember that generators produce a stream of values, so yielding a single value doesn’t really qualify as a stream. To do this, we can actually put in multiple yield statements into a generator function. These yield statements form the sequence that the generator will output. We’ll create a generator and bind it to a varible mg. Then, if we keep passing mg into next(), we’ll get to the next yield. If we keep going past, we’ll be given a StopIteration error to tell us that the generator has no more values to give. The StopIteration error is actually how a for loop knows when to stop iterating. def multi_generate(): yield "a" yield "b" yield "c" mg = multi_generate() next(mg) >>> "a" next(mg) >>> "b" next(mg) >>> "c" next(mg) >>> StopIteration: Assigning multi_generate to mg is a crucial step in using a generator function. Binding a generator to mg allows us to create a single instance of a generator we can refer back to. We can continue passing mg into next() and get those other yield statements. Observe what happens if we just keep trying to pass in multi_generate itself. next(multi_generate()) >>> "a" next(multi_generate()) >>> "a" It’s easy to think of generators as a machine that waits for one command and one command only: next(). Once you call next() on the generator, it will dispense the next value in the sequence it is holding. Otherwise, you can’t do much else with a generator. The image below represents our generator as a simple machine. We continue to get the result of the first yield statement. The reason behind this is subtle. When we pass the generator function itself into next(), Python assumes you are passing a new instance of multi_generate into it, so it will always give you the first yield result. By binding the generator to a variable, Python knows you are trying to act on the same thing when you pass it into We’ve noted that as we keep passing in mg into next, we get the other yield results. This is possible only if the generator somehow remembers what it last did. This memory is what distinguishes generator functions from regular functions! Once you use a function, it’s a one-and-done deal. Once you return the value from the function. A generator will keep yielding values until its out. This brings us to another important property of generators. Once we’ve finished iterating through them, we can’t use them anymore. Once we got through all three yield values in mg, it can’t provide anything to us anymore. We’d have to store another instance of the multi_generate generator to begin asking next() statements of it again. Our data still hasn’t been read in yet, so let’s do that with a generator function. The data is called recipeData.csv, and its contained in a CSV file. We’ll use the open() function to enable us to read it, and we’ll start using next() function to read what the first few lines of the CSV are. # Creating a generator that will generate the data row by row def beerDataGenerator(): file = "recipeData.csv" for row in open(file, encoding="ISO-8859-1"): yield row We’ll slowly dissect the above code: - We’ve designated dataGeneratoras our generator function that will dispense our CSV file row by row. The function includes the name of the file in file, and this enables us to use the open()function to be able to read it. - While we’ve discussed that Python objects like lists and dictionaries can be iterated over, we can also iterate over files that we open()as well. - The encodingtells Python what kinds of characters it should expect to see; ISO-8859-1 specifically refers to Latin-1. - The forloop will start with the first row in the CSV file, yieldthat row, and then save its current place in reading the file until the generator function is called again. If you’re following along with the data on your own computer, you’ll need to replace file with the exact path on your computer to where the file is located. This will enable Python to find it when you want to open() it. # Remember to store an instance of the generator so we can refer back to it beer = beerDataGenerator() next(beer) >>> 'BeerID,Name,URL,Style,StyleID,Size(L),OG,FG,ABV,IBU,Color,BoilSize,BoilTime,BoilGravity,Efficiency,MashThickness,SugarScale,BrewMethod,PitchRate,PrimaryTemp,PrimingMethod,PrimingAmount,UserIdn' next(beer) >>> '1,Vanilla Cream Ale,/homebrew/recipe/view/1633/vanilla-cream-ale,Cream Ale,45,21.77,1.055,1.013,5.48,17.65,4.83,28.39,75,1.038,70,N/A,Specific Gravity,All Grain,N/A,17.78,corn sugar,4.5 oz,116n' Once we’ve created a beerDataGenerator in beer, we can start passing it into next() to look at the data itself. As the CSV file suggests, the columns are separated by commas. Furthermore, each row ends with an n, which indicates a line break. We found that the first item in recipeData.csv to is a list of column names and the first row to describe a delicious Vanilla Cream Ale. A self-imposed restriction You may be asking, “We can store the data in a list comprehension! Why jump through an extra hoop and use a generator?” As a programmer, you may encounger Big Data. This is a somewhat nebulous term, and so we won’t delve into the various Big Data definitions here. Suffice to say that any Big Data file is too big to assign to a variable. Our data file doesn’t qualify as Big Data, but we can still learn a lot by imposing a restriction on ourselves to recreate this conundrum. We’ll assume for now that our beer data is so large in size that we are incapable of storing all of the data in a list of lists. With the normal route of reading in data blocked off, we are forced to reconsider our options. This is where generators come in. We’ll explain later precisely why generators work here, but until then we can rest assured that our generator function will enable us to read the data in the first place, albeit not all at once. Along with generator functions, we can also create generators using generator expressions. The generator expression Early, we compared our generator function to a regular function since they have many similar aspects. For generation expressions, we’ll use list comprehensions. lc_example = [n**2 for n in [1, 2, 3, 4, 5]] genex_example = (n**2 for n in [1, 2, 3, 4, 5]) lc_example is our list comprehension, while genex_example is our generator expression that performs almost the same task. Take note that the only difference between the two is that the generator expression is surrounded by parentheses, rather than brackets. If we either of these iterators in a for loop, they will produce the same result and will be indistinguishable. However, if we try to inspect these variables in our interpreter, they produce different results. lc_example >>> [1, 4, 9, 16, 25] genex_example >>> <generator object <genexpr> at 0x00000156547B4FC0> This result is similar to what we saw when we tried to look at a regular function and a generator function. Python also recognizes that genex_example is a generator in generator expression form (<genexpr>). As lc_example is a list, we can perform all of the operations that they support: indexing, slicing, mutation, etc. We cannot do this with the generator expression. Generators are specialized as an easy to produce an output one-at-a-time, so they do not support these operations. However, like list comprehensions we can implement logic within generator expressions to form a filter if we needed it. genex_example2 = (n**2 for n in [1, 2, 3, 4, 5] if n >= 3) next(genex_example2) >>> 9 Effectively, there is no difference in how we will use a generator function or generator expression. Once we have our generator expression, we can call next() on it to start getting the values it will produce. Once we go through all of the values that the generator expression can produce, we cannot use it anymore. This contrasts against a list comprehension, which we can reuse as much as we want. next(genex_example) >>> 1 # Repeat until we reach the end... next(genex_example) >>> 25 next(genex_example) >>> StopIteration: The idea that we can only use generators once is tied to the idea of their consumption. Recall that when we iterate over some iterator, we perform some operation on each of the values within. We then move on with our analysis using these processed values, meaning that typically we may not need the original iterator. Generators fit perfectly into this need, allowing us to form an iterator that we can use once and then not have to worry about it taking up space after we use it (in a for loop, for example). We talked about next() as the way to get the values from the generators, but its often better to use generators in for loops. Using next() forces us to have to deal with the StopIteration ourselves, but the for loop uses this to know when to stop! # Using a for loop to consume a generator is better than using next() for ge in genex_example: print(ge) >>> 1 >>> 4 >>> 9 >>> 16 >>> 25 One distinction that generator expressions have over functions is their succinctness. Generator functions take up multiple lines, whereas we can fit generator expressions in one line. Multiple lines are not bad in and of itself, but it opens up functions to greater complexity that may introduce bugs later on. We’ll rewrite our generator function as a one-line expression that read in our beer data. This conciseness that will come in handy later in the article. beer_data = "recipeData.csv" # This one line perfoms the same action as beerDataGenerator()! lines = (line for line in open(beer_data, encoding="ISO-8859-1")) Key takeaways: generators and you - Generators produce values one-at-a-time as opposed to giving them all at once. - There are two ways to create generators: generator functions and generator expressions. - Generator functions yield, regular functions return. - Generator expressions need (), list comprehensions use []. - You can only use a generator once. - There are two ways to get values from generators: the next()function and a forloop. The forloop is often the preferred method. - We can use generators to read files and give us one line at a time. Earlier, we discussed imposing a restriction on ourselves that forced us to use a generator to read our data instead of reading it into a list of lists. We cited the problem of Big Data and an our inability to store it all in one variable. While calling it a Big Data problem is still correct, you may also call it a memory problem. Let’s say that you have an older laptop with about 4GB of RAM, random access memory. The true size of our beer data set is only about 3MB, but suppose that we asked everyone around the globe to give us their recipes, resulting in a data set around 3GB. If we were to read the entirety of our data set into a variable, it would take up a bit more than 3GB of RAM! This would leave us with little room for other operations, much less other variables of similar size. Storing our data in a list of lists would take up so much memory that any analyses we do would take excruciatingly long to do. Laziness and generators We know now that generators produce a single value from a defined sequence, but only when we ask next() or within a for loop. We call this lazy evaluation. Generators are lazy because they only give us a value when we ask for it. The flipside here is that only that single value takes up memory. The ultimate result is that generators are incredibly memory efficient, which makes it a perfect candidate for reading and using Big Data files. Once we ask for the next value of a generator, the old value is discarded. Once we go through the entire generator, it is also discarded from memory as well. Generators feeding generators We currently haven’t learned anything from the beer data. All we’ve done so far is to take the original CSV file and create a generator that will yield each line in the CSV, one at a time in the form of a string. Unless we’d like to do some crazy string manipulation, we’ll need to think of a way to get our data into a readable, useable form. Below is a representation of what our code currently does: a simple read from file and output of a single line from the file. Generators come to the rescue again here! So far in the article, we’ve been passing in other structures, specifically iterators, to the generators to indicate what sequence we’d like to generate from. However, generators are iterators themselves too — why don’t we create another generator that takes the output another generator? Our lines generator outputs the line in its entirety, so we’ll make a second generator that does some formatting for us. beer_data = "recipeData.csv" lines = (line for line in open(beer_data, encoding="ISO-8859-1")) lists = (l.split(",") for l in lines) The end result of our generators is a stream of lists, each containing the data within a row of the CSV. If we iterate through lists, we’ll be able to easily access the data elements within and perform the analyses we need! We’ve effectively made a pipeline for our data set, starting from the raw data set and sending it through 2 generators to get it into a familiar form. Remember that generators aren’t lists themselves, they merely generate a single element of a sequence and only take up the amount that element needs. By piping generators together, we’ve created a quick, easy-to-read way for us to read data that would be inaccessible through normal means. There’s some real power to this approach, and its significance can’t be understated. We didn’t need to create any temporary lists to hold intermediate values as we processed them. With the additional generator in the pipeline, our code might look like this: In this pipeline, each generator is put in charge of a single operation that will eventually be applied to all rows of the data set. Although having each list is good, there’s still some small issues that need to be addressed before we can do any meaningul analyses. First, we’d like to take the column names since they aren’t data and then turn them into a dictionary that would make any further code easier to read. Note: if you’re running this code on your own machine, you must remember that you can only use generators once. If you use the generator in a for loop to view the output, you’ll need to run the data and the whole pipeline again. Thankfully, the generators run fast here. beer_data = "recipeData.csv" lines = (line for line in open(beer_data, encoding="ISO-8859-1")) lists = (l.split(",") for l in lines) # Take the column names out of the generator and store them, leaving only data columns = next(lists) # Take these columns and use them to create an informative dictionary beerdicts = (dict(zip(columns, data)) for data in lists) The beerdicts does some simple formatting, which gives our pipeline even more power! This is a great place to start inquiring our data about our future beer brewing choices. Now that we have our generator pipeline in place, we can start consuming the data produced by the generators and create some insights. We usually consume generators using for loops, so we’ll use one to figure out what the most popular type of homebrewed beer is. beer_counts = {} for bd in beerdicts: if bd["Style"] not in beer_counts: beer_counts[bd["Style"]] = 1 else: beer_counts[bd["Style"]] += 1 most_popular = 0 most_popular_type = None for beer, count in beer_counts.items(): if count > most_popular: most_popular = count most_popular_type = beer most_popular_type >>> "American IPA" This operation is ubiquitous in data wrangling and processing, and you’ve probably seen it before. The only new thing here is that instead of referring back to a list of lists containing our data, we rely on dictionaries that are produced by our generators. With generators, we are able to make the same inquires we’d want from any Big Data set as we would a regular-sized one. We now know that American IPAs are the most popular homebrewed beer in the data set, and we know how many entries they have in the data. We can try figuring out how strong our beer should be. This data is contained in the “ABV” (Alcohol By Volume) key. Since we are working with dictionaries as the output of our generator stream, why don’t we add another generator to hone in on the exact values we want to output. abv = (float(bd["ABV"]) for bd in beerdicts if bd["Style"] == "American IPA") # Get the average ABV for an American IPA sum(abv)/most_popular >>> 6.44429396984925 This last generator forms the last of our pipeline, as visualized below: We should take special note of our use of sum() with the abv generator. It is not immediately intuitive that sum() will sum up all of the ABV values that it receives. You may think of sum() as reducing the whole output of the generator into one value. By dividing this sum by the number of American IPA entires there are, we got the average. Our data suggests that your average American IPA is about 6.4% alcohol by volume! Our last generator abv takes the dictionaries that are output by beerdicts and outputs the ABV key, but only if the beer is an American IPA. Filters on our generator expression form a powerful tool in our pipeline. If we think of each successive generator as a modular component, we can then swap out generators for others that may have a more desirable functionality. If we wanted to change what kind of beer we wanted to investigate or look at another beer characteristic, the only thing we need to change is the generator operation. The picture below expresses the different parts of the generator pipeline approach. It consists of some raw data you want to process, the pipeline that does the actual processing, and the final consumption of the output of this pipeline. Following this pattern will enable you to reenact what we’ve done with the beer data. If you’re used to the workflow of using a list of lists and leveraging all the list methods to do your analyses, this new approach to data wrangling might be strange. However, the data pipeline is a powerful concept that can be immediately incorporated into your code and you should try it. Infinite generation Let’s say that it’s been a few years since you first made that analysis on the beer data set. You used the insights from your analyses to create a successful American IPA, and you only have generators to thank. You produce thousands of bottles of your beer each day, and you need a way to analyze the quality of each batch. You go back to your old laptop to fire up the Python interpreter. You begin to write up a function to calculate and check the various qualities of your beer batches as you make them, but then you stop. You don’t know how much beer you’re going to make in advance. Analyzing the batches by day could offer discrete points for us to look at, but what if we want continuous data? Regular functions would not work here! They expect some arguments and will always return a discrete object. You can’t conceivably give a regular function a stream of data and return an continuous stream of values. But you can with generators! Generators are well suited to this type of task. We’ve discussed how generators will yield values one-at-a-time until it’s told to stop. If we never give a generator a stopping signal, it will happily generate these values ad infinitum. Take the example below. function alwaysBeer(): while True: yield "Beer" The while loop will always be true, so the generator function will always be yielding beer. We haven’t done anything wrong, this is completely valid code (although not one you’d actually want to implement)! How would this “infinite” stream of beer fit into our timeline? In our original look at the beer data set, the CSV was originally a set amount of lines. If you could automate your brewing process to output this data to a similar CSV and continuously update it, all you need to do to run your analyses would be to run the data through the generators again! You could conceivably create a generator in your pipeline to catch any batches that don’t meet your expectations and flag them in real time! Unfortunately, we don’t have said data, but this thought experiment should offer another compelling use case for the Python generator. With generators, you could even tackle infinity (in some cases). Key takeaways: motivation and uses behind generators - Generators are memory efficient since they only require memory for the one value they yield. - Generators are lazy: they only yield values when explicitly asked. - You can feed the output of a generator to the input of another generator to form data pipelines. - Data pipelines can be modularized and customized to your needs. - Generators are useful for generating values ad infinitum. Generators don’t have to be complicated topics, they have a place in any Python programmer’s repertoire if given the time to be understood. Even in Big Data situations where simpler methods fall short, generator-based analyses still stand tall. There’s a lot about generators that we didn’t discuss here, but it should still give you a good foundation to start using them in your own analytic life.
http://smartsoftware247.com/python-generators-tutorial/
CC-MAIN-2019-22
refinedweb
4,979
61.26
Failed to build test_old_trusty_regression_testsuite on Trusty ARM64 Bug Description The test_old_ Error message: cc -Wall -Wstrict-prototypes openat.c -lapparmor -o openat cc -Wall -Wstrict-prototypes pipe.c -lapparmor -o pipe cc -Wall -Wstrict-prototypes ptrace.c -lapparmor -o ptrace ptrace.c: In function ‘do_parent’: ptrace.c:40:14: error: storage size of ‘regs’ isn’t known struct user regs; ^ ptrace.c:92:14: error: ‘PTRACE_GETREGS’ undeclared (first use in this function) if (ptrace( ^ ptrace.c:92:14: note: each undeclared identifier is reported only once for each function it appears in ptrace.c:40:14: warning: unused variable ‘regs’ [-Wunused-variable] struct user regs; ^ make: *** [ptrace] Error 1 complete output: http:// Hello, yes these two packages are installed on the system $ dpkg -l | grep -e libc6-dev -e linux-libc-dev ii libc6-dev:arm64 2.19-0ubuntu6.13 arm64 Embedded GNU C Library: Development Libraries and Header Files ii linux-libc- Thanks - It must be something specific to the arm64 environment that's a little off in regards to the header files that need to be included. Sam, Tyler, is this still something that needs to be chased down? very old bug, with no action on it, marking bug as incomplete and will close in 5 days if no update. Hi Po-Hsu, I spent some time looking into this, and it looks like when the old apparmor tests got split out for trusty, one of the patches that needed to be applied to the regression test suite got dropped ('tests- There is another possible fix that may need to be applied, so please re-open if you end up running this test on arm64 again and it fails. Thanks. Hi Steve, the error message chagned from: ptrace.c:92:14: error: ‘PTRACE_GETREGS’ undeclared (first use in this function) To: readdir. Looks like we need more patches for that. Thanks. Ah, the old apparmor version tests were also missing the test fix for the getdents syscall not being supported on arm64, only getdents64. This has been fixed in https:/ Po-Hsu, I think that's all the fixups that are specific to arm64. If you could re-run the kernel tests for arm64/trusty, that would be great to confirm. Thanks! Thanks for the fix Steve, the ubuntu-qrt-apparmor is now marked as passed for Trusty ARM64. I will close this bug. The ptrace.c file contains both of these includes: #include <sys/ptrace.h> ... #include <sys/user.h> Those header files should provide the definitions that are missing in your build failure. Can you ensure that you have linux-libc-dev and libc6-dev installed?
https://bugs.launchpad.net/qa-regression-testing/+bug/1699987/+index
CC-MAIN-2019-35
refinedweb
439
71.95
Content-type: text/html #include <stdlib.h> int mbtowc(wchar_t *restrict pwc, const char *restrict s, size_t n); If s is not a null pointer, mbtowc()() stores the wide-character code in the object pointed to by pwc. A call with s as a null pointer causes this function to return 0. The behavior of this function is affected by the LC_CTYPE category of the current locale. At most n bytes of the array pointed to by s will be examined. If s is a null pointer, mbtowc() returns 0. If s is not a null pointer, mbtowc() returns 0 (if s points to the null byte), the number of bytes that constitute the converted character (if the next n or fewer bytes form a valid character), or . The mbtowc() function can be used safely in multithreaded applications, as long as setlocale(3C) is not being called to change the locale. See attributes(5) for descriptions of the following attributes: mblen(3C), mbstowcs(3C), setlocale(3C), wcstombs(3C), wctomb(3C), attributes(5), standards(5)
http://backdrift.org/man/SunOS-5.10/man3c/mbtowc.3c.html
CC-MAIN-2016-44
refinedweb
174
61.87
, then get more input from the user and do something with that, and keep going this way until the user has had enough. Or, put another way, loops are like the instructions on your shampoo: Lather. Rinse. Repeat. The most basic of all looping statements in Java is while. The while statement creates a type of loop that's called a while loop, which is simply a loop that executes continuously as long as some conditional expression evaluates to true. while loops are useful in all sorts of programming situations, so you use while loops a lot. (I tell you about other kinds of loops later in this chapter.) The basic format of the while statement is like this: while (expression) statement The while statement begins by evaluating the expression. If the expression is true, statement is executed. Then the expression is evaluated again, and the whole process repeats. If the expression is false, then statement is not executed, and the while loop ends. Note that the statement part of the while loop can either be a single statement or a block of statements contained in a pair of braces. Loops that have just one statement aren't very useful, so nearly all the while loops you code use a block of statements. (Well, okay, sometimes loops with a single statement are useful. It isn't unheard of. Just not all that common.) Here's a simple program that uses a while loop to print the even numbers from 2 through 20 on the console: public class EvenCounter { public static void main(String[] args) { int number = 2; while (number <= 20) { System.out.print(number + " "); number += 2; } System.out.println(); } } If you run this program,. Figure 5-1 shows a flowchart for this program. This flowchart can help you visualize the basic decision-making process of a loop. Figure 5-1: The flowchart for a while loop. In many programs, you need to set up a loop that has some kind of escape clause. Java's escape clause is the break statement. When a break statement is executed in a while loop, the loop ends immediately. Any remaining statements in the loop are ignored, and the next statement executed is the statement that follows the loop. For example, suppose you're afraid of the number 12. (I'm not a doctor and I don't play one on TV, but I think the scientific name for this condition would be duodecaphobia.) You could modify the counting program shown in the previous section so that when it gets to the number 12, it panics and aborts the loop: public class Duodecaphobia { public static void main(String[] args) { int number = 2; while (number <= 20) { if (number == 12) break; System.out.print(number + " "); number += 2; } System.out.println(); } } When you run this program, the following line is displayed on the console: 2 4 6 8 10 Whew! That was close. Almost got to 12 there. One common form of loop is called an infinite loop. That's a loop that goes on forever. You can create infinite loops many ways in Java (not all of them intentional), but the easiest is to just specify true for the while expression. Here's an example: public class CountForever { public static void main(String[] args) { int number = 2; while (true) { System.out.print(number + " "); number += 2; } } } If you run this program, your console window quickly fills up with numbers and just keeps going. That's great if you really like even numbers, but eventually you'll tire of this and want it to stop. You can stop an infinite loop three ways: The last one is probably the one you want to go with here. Here the loop looks like it might go on forever, but the break statement panics out of the loop when it hits 12. It turns out that infinite loops are also useful when you want to let the user be in charge of when to stop the loop. For example, suppose you don't know what numbers a user is afraid of, so you want to count numbers until the user says to stop. Here's a program that does that: import java.util.Scanner; public class NumberPhobia { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int number = 2; String input; while (true) { System.out.println(number + " "); System.out.print ("Do you want to keep counting?" + " (Y or N)"); input = sc.next(); if (input.equalsIgnoreCase("N")) break; number += 2; } System.out.println(" Whew! That was close. "); } } Here's some typical console output from this program, for a user who has octophobia: 2 Do you want to keep counting? (Y or N) y 4 Do you want to keep counting? (Y or N) y 6 Do you want to keep counting? (Y or N) n Whew! That was close. Another way to write a loop that a user can opt out of is to test the input string in the while condition. The only trick here is that you must first initialize the input string to the value that continues the loop. Otherwise the loop doesn't execute at all! Here's a variation of the NumberPhobia program that uses this technique: import java.util.Scanner; public class NumberPhobia2 { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int number = 2; String input = "Y"; while (input.equalsIgnoreCase("Y")) { System.out.println(number + " "); System.out.print ("Do you want to keep counting?" + " (Y or N)"); input = sc.next(); number += 2; } System.out.println(" Whew! That was close."); } } This program works almost the same as the previous version, but with a subtle difference. In the first version, if the user says N after the program displays 6, the value of the number variable after the loop is 6. That's because the break statement bails out of the loop before adding 2 to number. But in this version, the value of number is 8. The break statement is rather harsh: It completely bails out of the loop. Sometimes that's what you need-but just as often, you don't really need to quit the loop; you just need to skip a particular iteration of the loop. For example, the Duodecaphobia program presented earlier in this chapter stops the loop when it gets to 12. What if you just want to skip the number 12, so you go straight from 10 to 14? To do that, you can use the break statement's kinder, gentler relative, the continue statement. The continue statement sends control right back to the top of the loop, where the expression is immediately evaluated again. If the expression is still true, the loop's statement or block is executed again. Here's a version of the Duodecaphobia program that uses a continue statement to skip the number 12 rather than stop counting altogether when it reaches 12: public class Duodecaphobia2 { public static void main(String[] args) { int number = 0; while (number < 20) { number += 2; if (number == 12) continue; System.out.print(number + " "); } System.out.println(); } } Run this program, and you get the following output in the console window: 2 4 6 8 10 14 16 18 20 Notice that I had to make several changes to this program to get it to work with a continue statement instead of a break statement. If I had just replaced the word break with continue, the program wouldn't have worked. That's because the statement that added 2 to the number came after the break statement in the original version. As a result, if you just replace the break statement with a continue statement, you end up with an infinite loop when you reach 12 because the statement that adds 2 to number never gets executed. To make this program work with a continue statement, I rearranged the statements in the loop body so that the statement that adds 2 to number comes before the continue statement. That way, the only statement skipped by the continue statement is the one that prints number to the console. Unfortunately, this change affected other statements in the program as well. Because 2 is added to number before number is printed, I had to change the initial value of number from 2 to 0, and I had to change the while expression from number <= 20 to number < 20. A do-while loop (sometimes just called a do loop) is similar to a while loop, but with a critical difference: In a do-while loop, the condition that stops the loop isn't tested until after the statements in the loop have executed. The basic form of a do-while loop is this: do statement while (expression); Note that the while keyword and the expression aren't coded until after the body of the loop. As with a while loop, the body for a do-while loop can be a single statement or a block of statements enclosed in braces. Also, notice that the expression is followed by a semicolon. do-while is the only looping statement that ends with a semicolon. Here's a version of the EvenCounter program that uses a do-while loop instead of a while loop: public class EvenCounter2 { public static void main(String[] args) { int number = 2; do { System.out.print(number + " "); number += 2; } while (number <= 20); System.out.println(); } } Look at the flowchart in Figure 5-2 to see what I mean. You can see that execution starts at the top of the loop and flows through to the decision test after the loop's body has been executed once. Then, if the decision test is true, control flies back up to the top of the loop. Otherwise it spills out the bottom of the flowchart. Figure 5-2: The flowchart for a do-while loop. Here are a few other things to be aware of concerning do-while loops: do-while loops are especially useful for validating input by the user. For example, suppose you're writing a program that plays a betting game, and you want to get the amount of the user's bet from the console. The user can bet any dollar amount he wants (whole dollars only, though), but can't bet more than he has in the bank, and he can't bet a negative amount or zero. Here's a program that uses a do-while loop to get this input from the user: import java.util.Scanner; public class GetABet {(); } while ((bet <= 0) || (bet > bank)); System.out.println("Your money's good here."); } } Here the expression used by the do-while loop validates the data entered by the user, which means it checks the data against some set of criteria to make sure the data is acceptable. (Actually, you can avoid this problem by using either a do loop or a while loop and the hasNextDouble method of the Scanner class that I describe in Book II, Chapter 2.) If you want to display an error message when the user enters incorrect input, you have to use an if statement inside the loop, and this if statement must duplicate the expression that validates the input data. Thus the expression that does the validation has to appear twice. For example: import java.util.Scanner; public class GetABet2 {(); if ((bet <= 0) || (bet > bank)) System.out.println ("What, are you crazy?"); } while ((bet <= 0) || (bet > bank)); System.out.println("Your money's good here."); } } Here the if statement displays the message “What, are you crazy?” if the user tries to enter an inappropriate bet. In this example, I use a boolean variable named validBet to indicate whether the user has entered a valid bet. After the user enters a bet, this variable is set to true before the if statement tests the validation criteria. Then, if the if statement finds that the bet is not valid, validBet is set to false. In addition to while and do-while loops, Java offers one more kind of loop: the for loop. You may have noticed that many of the loops presented so far in this minibook have involved counting. It turns out that counting loops are quite common in computer programs, so the people who design computer programming languages (they're called "computer programming language designers") long ago concocted a special kind of looping mechanism that's designed just for counting. The basic principle behind a for loop is that the loop itself maintains a counter variable-that is, a variable whose value is increased each time the body of the loop is executed. For example, if you want a loop that counts from 1 to 10, you'd use a counter variable that starts with a value of 1 and is increased by 1 each time through the loop. Then you'd use a test to end the loop when the counter variable reaches 10. The for loop lets you set this up all in one convenient statement. I would now like to inform you of the formal format for the for loop, so you know how to form it from now on. The for loop follows this basic format: for (initialization-expression; test-expression; count- expression) statement ; The three expressions in the parentheses following the keyword for control how the for loop works. The following paragraphs explain what these three expressions do: Figure 5-3 shows a flowchart to help you visualize how a for loop works. Figure 5-3: The flowchart for a for loop. Here's a simple for loop that displays the numbers 1 to 10 on the console: public class CountToTen { public static void main(String[] args) { for (int i = 1; i <= 10; i++) System.out.println(i); } } Run this program and here's what you see on the console: 1 2 3 4 5 6 7 8 9 10 This for loop has the following pieces: If you declare the counter variable in the initialization statement, the scope of the counter variable is limited to the for statement itself. Thus you can use the variable in the other expressions that appear within the parentheses and in the body of the loop, but you can't use it outside of the loop. For example, this code causes a compiler error: public class CountToTenError { public static void main(String[] args) { for (int i = 1; i <=10; i++) System.out.println(i); System.out.println("The final value of i is " + i); } } That's because the last statement in the main method refers to the variable i, which has gone out of scope because it was declared within the for loop. However, you don't have to declare the counter variable in the for statement itself. Thus the following program works: public class CountToTenErrorFixed { public static void main(String[] args) { int i; for (i = 1; i <=10; i++) System.out.println(i); System.out.println("The final value of i is " + i); } } Note that because the i variable is declared before the for statement, the initialization expression doesn't name the variable's data type. When you run this program, the following appears in the console window: 1 2 3 4 5 6 7 8 9 10 The final value of i is 11 Earlier in this chapter, you saw a program that counts even numbers up to 20. You can do that with a for loop too. All you have to do is adjust the count expression. For example, here's a version of the CountEven program that uses a for loop: public class ForEvenCounter { public static void main(String[] args) { for (int number = 2; number <= 20; number += 2) System.out.print(number + " "); System.out.println(); } } Run this program, and sure enough, the console window displays the following: 2 4 6 8 10 12 14 16 18 20 No rule says for loops can only count forward. To count backwards, you simply have to adjust the three for loop expressions. As usual, the initialization expression specifies the starting value for the counter variable. The test expression uses a greater-than test instead of a less-than test. And the count expression subtracts from the counter variable rather than adding to it. For example: public class CountDown { public static void main(String[] args) { for (int count = 10; count >= 1; count--) { System.out.println(count); } } } Run this program, and you see this result in the console window: 10 9 8 7 6 5 4 3 2 1 When you run it, here's the output that's displayed: We are go for launch in T minus 10... 9... Ignition sequence start! 7... 6... 5... 4... 3... 2... 1... 0... All engines running! Liftoff! We have a liftoff! Can't you just hear the voice of Paul Haney, the famous "Voice of Mission Control" for NASA in the 1960s? If you can't, you're not nearly as nerdy as I am. Some programmers get a kick out of writing code that is as terse as possible. I think Seinfeld did an episode about that … Jerry had a girlfriend who was a "terse-coder." He had to dump her because he couldn't understand her code. Anyway, terse-coders sometimes like to play with for statements in an effort to do away with the body of a for loop altogether. To do that, they take advantage of the fact that you can code any expression you want in the count expression part of a for statement, including method calls. For example, here's a program that prints the numbers 1 to 10 on the console using a for statement that has no body: public class TerseCoder { public static void main(String[] args) { for (int i = 1; i <=10; System.out.println(i++)); } } Here the count expression is a call to System.out.println. The parameter to the println method cleverly uses the increment operator so the variable is both printed and incremented in the same expression. An obscure aspect of for loops is that the initialization and count expressions can actually be a list of expressions separated by commas. This can sometimes be useful if you need to keep track of two counter variables at the same time. For example, here's a program that counts from 1 to 10 and 10 to 1 at the same time, using two counter variables: public class CountBothWays { public static void main(String[] args) { int a, b; for (a = 1, b = 10; a <= 10; a++, b--) System.out.println(a + " " + b); } } If you run this program, here's what you see in the console window: 1 10 2 9 3 8 4 7 5 6 6 5 7 4 8 3 9 2 10 1 Keep in mind these rules when you use more than one expression for the initialization and counter expressions: This program actually looks more complicated than it is. The count expression is a list of two expressions. First is a call to System.out.println that uses the ternary ?: operator to determine what to print. The ?: operator first evaluates the count variable to see if it equals 8. If so, the string “Ignition sequence start!” is sent to the println method. Otherwise, count + “… ” is sent. The second expression simply increments the count variable. I think you'll agree that coding the for statement like this example is way out of line. It's better to keep the expressions simple and do the real work in the loop's body. Yet another oddity about for loops is that all three of the expressions are optional. If you omit one or more of the expressions, you just code the semicolon as a placeholder so the compiler knows what's going on. Omitting the test expression or the iteration expression is not common, but omitting the initialization expression is common. For example, the variable you're incrementing in the for loop may already be declared and initialized before you get to the loop. In that case, you can omit the initialization expression, as in this example: Scanner sc = new Scanner(System.in); System.out.print("Where should I start? "); int a = sc.nextInt(); for (; a >= 0; a--) System.out.println(a); This for loop simply counts down from whatever number the user enters to zero. You can also omit all three of the expressions if you want to, as in this example: for(;;) System.out.println("Oops"); This program also results in an infinite loop. There's little reason to do this because while(true) has the same effect and is more obvious. You can use a break in a for loop just as you can in a while or do-while loop. For example, here I revisit the Duodecaphobia program from earlier in the chapter, this time with a for loop: public class ForDuodecaphobia { public static void main(String[] args) { for (int number = 2; number <=20; number += 2) { if (number == 12) break; System.out.print(number + " "); } System.out.println(); } } As before, this version counts by 2s until it gets to 20. But when it hits 12, it panics and aborts the loop, so it never actually gets to 14, 16, 18, or 20. So the console output loops like this: 2 4 6 8 10 And here's a version that uses a continue statement to simply skip 12 rather than abort the loop: public class ForDuodecaphobia2 { public static void main(String[] args) { for (int number = 2; number <=20; number += 2) { if (number == 12) continue; System.out.print(number + " "); } System.out.println(); } } The console output from this version looks like this: 2 4 6 8 10 14 16 18 20 Loops can contain loops. The technical term for this is loop-de-loop. Just kidding. Actually, the technical term is nested loop. A nested loop is simply a loop that is completely contained inside another loop. The loop that's inside is called the inner loop, and the loop that's outside is called the outer loop. To demonstrate the basics of nesting, here's a simple little program that uses a pair of nested for loops: public class NestedLoop { public static void main(String[] args) { for(int x = 1; x < 10; x++) { for (int y = 1; y < 10; y++) System.out.print(x + "-" + y + " "); System.out.println(); } } } This program consists of two for loops. The outer loop uses x as its counter variable, and the inner loop uses y. For each execution of the outer loop, the inner loop executes 10 times and prints a line that shows the value of x and y for each pass through the inner loop. When the inner loop finishes, a call to System.out.println with no parameters starts a new line. Then the outer loop cycles so the next line is printed. When you run this program, the console displays this text: Listing 5-1 shows a more complicated but realistic example of nesting. This program implements a simple guessing game in which the computer picks a number between 1 and 10 and you have to guess the number. After you guess, the computer tells you if you're right or wrong, and then asks whether you want to play again. If you enter Y or y, the game starts over. The nesting comes into play because the entire game is written in a while loop that repeats as long as you say you want to play another game. Then-within that loop-each time the game asks for input from the user, it uses a do-while loop to validate the user's entry. Thus, when the game asks the user to guess a number between 1 and 10, it keeps looping until the number entered by the user is in that range. And when the game asks the user whether he or she wants to play again, it loops until the user enters Y, y, N, or n. Here's a sample of the console output displayed by this program: Let's play a guessing game! I'm thinking of a number between 1 and 10. What do you think it is? 5 You're wrong! The number was 8 Play again? (Y or N)y I'm thinking of a number between 1 and 10. What do you think it is? 32 I said, between 1 and 10. Try again: 5 You're wrong! The number was 6 Play again? (Y or N)maybe Play again? (Y or N)ok Play again? (Y or N)y I'm thinking of a number between 1 and 10. What do you think it is? 5 You're right! Play again? (Y or N)n Thank you for playing. Listing 5-1: The Guessing Game import java.util.Scanner; public class GuessingGame { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { boolean keepPlaying = true; → 10 System.out.println("Let's play a gussing game!"); while (keepPlaying) → 13 { boolean validInput; → 15 int number, guess; String answer; // Pick a random number number = (int)(Math.random() * 10) + 1; → 20 // Get the guess System.out.println(" I'm thing of number " + "between 1 and 10."); System.out.print("What do you think it is? "); do → 26 { guess = sc.nextInt(); validInput = true; if ((guess < 1) || (guess > 10)) { System.out.print ("I said, between 1 and 10. " + "Try again: "); validInput = false; } } while (!validInput); → 36 // Check the guess if (guess == number) → 39 System.out.println("You're right!"); else System.out.println("You're wrong! " + "The number was " + number); // Play again? do → 46 { System.out.print(" Play again? (Y or N)"); answer = sc.next(); validInput = true; if (answer.equalsIgnoreCase("Y")) ; else if (answer.equalsIgnoreCase("N")) keepPlaying = false; else validInput = false; } while (!validInput); → 57 } → 58 System.out.println(" Thank you for playing!"); → 59 } } The following paragraphs describe some of the key lines
https://flylib.com/books/en/2.706.1/going_around_in_circles_or_using_loops_.html
CC-MAIN-2018-09
refinedweb
4,309
72.26
I have two gameobjects in a scene. My base object and a target object. I want the base object to rotate along it's Y axis to face or look at, the target object. How do I constrain the rotation of the base object to just the Y axis? I have tried a slew of different ways to do this, with no luck. targetPoint = targetObject.transform.position; Quaternion targetRotation = Quaternion.LookRotation (targetPoint-transform.position ,Vector3.up); transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0); I've also tried just using Transform.LookAt(targetPoint) with no luck either. How can I constrain to just one axis (the Y-axis)? I don't care that the two objects are facing in the same direction, but what I'm trying to do is have the base object look at the target object with a fixed rotation axis. Thanks! Answer by wicked208 · Apr 26, 2011 at 05:40 PM Answer by Jesse Anders · Mar 28, 2011 at 11:31 PM This is a 'frequently asked question' :) (It comes up quite frequently on the forums.) There's more than one solution, but here's a common one (C#, untested): var targetPosition = targetTransform.position; targetPosition.y = transform.position.y; transform.LookAt(targetPosition); This is not working for me. It is causing the object to rotate on both the X and Y axis. The item is rotating from a flat position and ending up in a near vertical position. The above example assumes y is up, so if another axis is up in your case, you'll need to adjust accordingly. Otherwise, the method posted above should work (provided I got the example right). If it's not working, perhaps you could update your post with your current code, and then post a comment here indicating that the post has been updated. In my scene, Y is up. I have two game objects, one called base, one called target. base is in front of target. Both are facing the same direction. I want base to turn around (only on the Y axis) and face the target object. Using the above code provided, the base object rotates on both the X and Y axis. The code is attached to the base object and is 3 lines long. Code is as follows: Vector3 targetPosition = target.transform.position; targetPosition.y= transform.position.y; transform.LookAt(targetPosition); Thanks. Unless I'm missing something really obvious, the method described (and your code that's based on it) should work. Is there anything else affecting the transform of the object in question? Are there any game object parent-child relationships involved? If it's still not working, perhaps you could edit your post to include the entire script, and then add a comment here indicating that your original post has been changed. lets say you did a (* -1) on the Y axis value.. it would make the flip so the Up would be Down.. right? Answer by marcelobr · Jan 20, 2013 at 03:22 AM that works in my object but someone can create an "Quaternion.Slerp" for rotation the my object? Vector3 targetPosition = target.transform.position; targetPosition.y= transform.position.y; transform.LookAt(targetPosition); i need an quaternion.slerp help me? You should post this as a new question, not as an answer! Answer by Justin Warner · Mar 28, 2011 at 10:41 PM function Rotate (xAngle : float, yAngle : float, zAngle : float, relativeTo : Space = Space.Self) : void var y = //Whatever you want the y to be, being the targets y, just put this in the update function (Without the var). function Update(){ y = //Same thing here; transform.Rotate(0, y, 0, Space.World); } Something like this should work... Put it on the actual object... Hope it helps =). I am looking for something to rotate (and stop) at the Target object as described above. This just rotates the item on Y only and does not stop the rotation once the item is facing the target. Then take out the y = ... in the function Update() and put it in the function Start()... Should work then. Answer by mrekuc · Jul 17, 2013 at 07:09 PM In C# this works assuming you have the object tagged as "Player" or change it to what yours is. using UnityEngine; using System.Collections; public class GUIObject : MonoBehaviour { private GameObject target; private Vector3 targetPoint; private Quaternion targetRotation; void Start () { target = GameObject.FindWithTag("Player"); } void Update() { targetPoint = new Vector3(target.transform.position.x, transform.position.y, target.transform.position.z) - transform.position; targetRotation = Quaternion.LookRotation (-targetPoint, Vector3.up); transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0f); } } I used this to rotate an NGUI label to always point at the player while only rotating in the Y. Attach it to what ever object you want to "look at" the player To mrekuc That doesn't function in any way, shape, or. How can i rotate an object using LookAt with only 1 axis? 0 Answers Delayed LookAt, but only on one axis 1 Answer How to make the front, left, right, or the back of a gameobject look at a target? 1 Answer Using a transform.Lookat to set a rotation for a Vector3.lerp. 2 Answers Creating a Window - Camera movement 0 Answers
http://answers.unity3d.com/questions/54973/rotate-an-object-to-look-at-another-object-on-one.html
CC-MAIN-2016-07
refinedweb
879
58.99
I decided to make a small program that found prime numbers, and after an hour or so of tweaking i came up with something that was about 30 times faster than my first attempt, however I still have a couple of questions: 1. Is there an alternative to goto 2. How else can I optomise it further/any further improvements? 3. It only really needs to test if it is divisible by prime numbers, not every number, is there a way of doing this without taking up too much memory, and if so what shall i use, and will it even be quicker? Thanks for any help: Code: Code:#include <iostream> using namespace std; // varaiables int num=0; int i; int j; int main() { for (j=1; j <=9999; ++++j) { for (i=3; i <((j+1)/2); ++++i) { if (j%i==0) goto moo; } cout << j <<endl; moo:; } cin >> num; }
http://cboard.cprogramming.com/cplusplus-programming/90867-basic-prime-numbers.html
CC-MAIN-2015-32
refinedweb
150
68.23
ORMesque - Lightweight To-The-Point ORM version 1.110422 my $db = ORMesque->new('dbi:mysql:foo', 'root'); my $ta = $db->table_a ->page(1, 25) ->read({ column => 'value' }); my $tb = $db->table_b ->page(1, 25) ->read({ column => 'value' }); return $ta->join($tb); # returns an aggregated arrayref of hashefs ORMesque is a lightweight ORM supporting any database listed under ORMesque::SchemaLoader making it a great alternative when you don't have the time, need or desire to learn/utilize DBIx::Class or the like. ORMesque is an object relational mapper that provides a database connection to the database of your choice and automatically creates objects and accessors for that database and its tables and columns. ORMesque uses SQL::Abstract querying syntax. More usage examples... my $db = ORMesque->new($dsn); my $user = $db->users; # Grab the first record, not neccessary if operating on only one record $user->read; # SQL::Abstract where clause passed to the "read" method $user->read({ 'column' => 'query' }); $user->first; $user->last; # How many records in collection $user->count for (0..$user->count) { print $user->column; $user->column('new stuff'); $user->update($user->current, $user->id); $user->next; } # The database objects main accessors are CRUD (create, read, update, and delete) $user->create; $user->read; $user->update; $user->delete; # Also, need direct access to the resultset? $user->collection; # returns an array of hashrefs $user->current; # return a hashref of the current row in the collection Occassionally you may want to create application Models using ORMesque and venture beyond the standard CRUD methods, creating classes for each table and extending its methods. The following is an example of how this should be done using ORMesque. package MyApp::Model; use base 'ORMesque'; # create your base Model - lib/MyApp/Model.pm package MyApp::Model::Cd; use base 'MyApp::Model'; # create your table specific Model - lib/MyApp/Model/Cd.pm # note the model should be named after the table, the naming is as follows: # Schema Table Classes are CamelCased for convention, all class names are # titlecased, and have dashed and underscores removed. # e.g. table 'user_workplace' would generate a class named 'UserWorkspace' # with no special characters. If package name is one of the auto-generated # classes, all relevant methods and settings will be set automatically. sub write_cd { $self = shift; ... $self->create({ ... }); return $self; } ... 1; The namespace() method returns the classname being used in the auto-generated database table classes. my $a = ORMesque->new(...); my $b = ThisApp->new(...); $a->namespace; # ORMesque $b->namespace; # ThisApp Once the reset() method analyzes the specified database, the schema is cached to for speed and performance. Occassionally you may want to re-read the database schema. my $db = ORMesque->new(...); $db->reset; The next() method instructs the database object to continue to the next row if it exists. my $table = ORMesque->new(...)->table; while ($table->next) { ... } The first() method instructs the database object to continue to return the first row in the resultset. my $table = ORMesque->new(...)->table; $table->first; The last() method instructs the database object to continue to return the last row in the resultset. my $table = ORMesque->new(...)->table; $table->last; The collection() method return the raw resultset object. my $table = ORMesque->new(...)->table; $table->collection; The current() method return the raw row resultset object of the position in the resultset collection. my $table = ORMesque->new(...)->table; $table->current; The clear() method empties all resultset containers. This method should be used when your ready to perform another operation (start over) without initializing a new object. my $table = ORMesque->new(...)->table; $table->clear; The key() method finds the database objects primary key if its defined. my $table = ORMesque->new(...)->table; $table->key; The select() method defines specific columns to be used in the generated SQL query. This useful for database tables that have lots of columns where only a few are actually needed. my $table = ORMesque->new(...)->table $table->select('foo', 'bar')->read(); The return() method queries the database for the last created object(s). It is important to note that while return() can be used in most cases like the last_insert_id() to fetch the recently last created entry, function, you should not use it that way unless you know exactly what this method does and what your database will return. my $new = ORMesque->new(...)->table; $new->create(...); $new->return(); $new->column ..or.. my $rec = $new->current; # current row The count() method returns the number of items in the resultset of the object it's called on. Note! If you make changes to the database, you will need to call read() before calling count() to get an accurate count as count() operates on the current collection. my $db = ORMesque->new(...)->table; my $count = $db->read->count; Note! The count() method DOES NOT query the database, it merely counts the number of items in the existing resultset produced by read(). Alternatively, to perform a type-of SQL COUNT() query you can use the count($where) syntax: my $db = ORMesque->new(...)->table; my $count = $db->count({ id => 12345}); # notice there is no read() command Caveat 1: The create method will remove the primary key if the column is marked as auto-incremented ... The create method creates a new entry in the datastore. takes 1 arg: hashref (SQL::Abstract fields parameter) ORMesque->new(...)->table->create({ 'column_a' => 'value_a', }); # create a copy of an existing record my $user = ORMesque->new(...)->users; $user->read; $user->full_name_column('Copy of ' . $user->full_name); $user->user_name_column('foobarbaz'); $user->create($user->current); # get newly created record $user->return; print $user->id; # new record id print $user->full_name; The read method fetches records from the datastore. Takes 2 arg. arg 1: hashref (SQL::Abstract where parameter) or scalar arg 2: arrayref (SQL::Abstract order parameter) - optional ORMesque->new(...)->table->read({ 'column_a' => 'value_a', }); .. or read by primary key .. ORMesque->new(...)->table->read(1); .. or read and limit the resultset .. ORMesque->new(...)->table->read({ 'column_a' => 'value_a' }, ['orderby_column_a'], $limit, $offset); .. or return a paged resultset .. ORMesque->new(...)->table->page(1, 25)->read; The update method alters an existing record in the datastore. Takes 2 arg. arg 1: hashref (SQL::Abstract fields parameter) arg 2: arrayref (SQL::Abstract where parameter) or scalar - optional ORMesque->new(...)->table->update({ 'column_a' => 'value_a', },{ 'where_column_a' => '...' }); or ORMesque->new(...)->table->update({ 'column_a' => 'value_a', }, 1); The delete method is prohibited from deleting an entire database table and thus requires a where clause. If you intentionally desire to empty the entire database then you may use the delete_all method. ORMesque->new(...)->table->delete({ 'column_a' => 'value_a', }); or ORMesque->new(...)->table->delete(1); The delete_all method is use to intentionally empty the entire database table. ORMesque->new(...)->table->delete_all; If you have used ORMesque with a project of any sophistication you will have undoubtedly noticed that the is no mechanism for specifying joins and this is intentional. ORMesque is an ORM, and object relational mapper and that is its purpose, it is not a SQL substitute. Joins are neccessary in SQL as they are the only means of gathering related data. Such is not the case with Perl code, however, even in code the need to join related datasets exists and that is the need we address. The join method "Does Not Execute Any SQL", in-fact the join method is meant to be called after the desired resultsets have be gathered. The join method is merely an aggregator of result sets. my ($cd, $artist) = (ORMesque->new(...)->cd, ORMesque->new(...)->artist); $artist->read({ id => $aid }); $cd->read({ artist => $aid }); Always use the larger dataset to initiate the join, in the following example, the list we want is "the list of cds" and we want to include the artist information with every "cd" entry so we use the persist option. my $resultset = $cd->join($artist, { persist => 1 }); The join configuration option "persist" when set true will instruct the aggregator to include the first entry of the associated table with each entry in the primary list which is the list (collection) within the object that initiated the join. Every table object may be passed an options join configuration object as follows: my $resultset = $cd->join($artist, { persist => 1 }); .. which is the same as .. my $resultset = $cd->join({ }, $artist, { persist => 1 }); .. more complexity .. my $resultset = $track->join($cd, { persist => 1 }, $artist, { persist => 1 }); By default, a joined resultset is returned as an arrayref of hashrefs with all table columns as keys which are in $table_$columnName format. This is not always ideal and so the "columns" join configuration option allows you to specify exactly which columns to include as well as supply an alias if desired. The following is an example of that: my $resultset = $track->join({ columns => { track_name => 'track', } }, $cd, { persist => 1 columns => { cd_name => 'cd', } }, $artist, { persist => 1, columns => { artist_name => 'artist' } }); The page method creates a paged resultset and instructs the read() method to only return the resultset of the desired page. my $page = 1; # page of data to be returned my $rows = 100; # number of rows to return ORMesque->new(...)->table->page($page, $rows)->read; The pager method provides access to the Data::Page object used in pagination. Please see L<Data::Page> for more details... $pager = ORMesque->new(...)->table->pager; $pager->first_page; $pager->last_page; ORMesque provides columns accessors to the current record in the resultset object which is accessible via current() by default, collection() returns an arrayref of hashrefs based on the last read() call. Alternatively you may use the following methods to further transform and manipulate the returned resultset. Returns a list of column names. In scalar context, returns an array reference. Column names are lower cased if lc_columns was true when the query was executed. Binds the columns returned from the query to variable(s) ORMesque->new(...)->table->read(1)->into(my ($foo, $bar)); Fetches a single row and returns a list of values. In scalar context, returns only the last value. my @values = ORMesque->new(...)->table->read(1)->list; Fetches a single row and returns an array reference. my $row = ORMesque->new(...)->table->read(1)->array; print $row->[0]; Fetches a single row and returns a hash reference. Keys are lower cased if lc_columns was true when the query was executed. my $row = ORMesque->new(...)->table->read(1)->hash; print $row->{id}; Fetches all remaining rows and returns a flattened list. In scalar context, returns an array reference. my @records = ORMesque->new(...)->table->read(1)->flat; print $records[0]; Fetches all remaining rows and returns a list of array references. In scalar context, returns an array reference. my $rows = ORMesque->new(...)->table->read(1)->arrays; print $rows->[0]; Fetches all remaining rows and returns a list of hash references. In scalar context, returns an array reference. Keys are lower cased if lc_columns was true when the query was executed. my $rows = ORMesque->new(...)->table->read(1)->hashes; print $rows->[0]->{id}; Constructs a hash of hash references keyed by the values in the chosen column. In scalar context, returns a hash reference. In list context, returns interleaved keys and values. my $customer = ORMesque->new(...)->table->read->map_hashes('id'); # $customers = { $id => { name => $name, location => $location } } Constructs a hash of array references keyed by the values in the chosen column. In scalar context, returns a hash reference. In list context, returns interleaved keys and values. my $customer = ORMesque->new(...)->table->read->map_arrays(0); # $customers = { $id => [ $name, $location ] } Returns the number of rows affected by the last row affecting command, or -1 if the number of rows is not known or not available. For SELECT statements, it is generally not possible to know how many rows are returned. MySQL does provide this information. See DBI for a detailed explanation. my $changes = ORMesque->new(...)->table->insert(ORMesque->new(...)->table->current)->rows; ORMesque has as its sub-classes DBIx::Simple and SQL::Abstract as its querying language, it also provides access to SQL::Interp for good measure. For an in-depth look at what you can do with these utilities, please check out DBIx::Simple::Examples. The error function is used to access the $DBI::errstr variable. The query function provides a simplified interface to DBI, Perl's powerful database interfacing module. This function provides auto-escaping/interpolation as well as resultset abstraction. $db->query('DELETE FROM foo WHERE id = ?', $id); $db->query('SELECT 1 + 1')->into(my $two); $db->query('SELECT 3, 2 + 2')->into(my ($three, $four)); $db->query( 'SELECT name, email FROM people WHERE email = ? LIMIT 1', $mail )->into(my ($name, $email)); # One big flattened list (primarily for single column queries) my @names = $db->query('SELECT name FROM people WHERE id > 5')->flat; # Rows as array references for my $row ($db->query('SELECT name, email FROM people')->arrays) { print "Name: $row->[0], Email: $row->[1]\n"; } The iquery function is used to interpolate Perl variables into SQL statements, it converts a list of intermixed SQL fragments and variable references into a conventional SQL string and list of bind values suitable for passing onto DBI my $result = $db->iquery('INSERT INTO table', \%item); my $result = $db->iquery('UPDATE table SET', \%item, 'WHERE y <> ', \2); my $result = $db->iquery('DELETE FROM table WHERE y = ', \2); # These two select syntax produce the same result my $result = $db->iquery('SELECT * FROM table WHERE x = ', \$s, 'AND y IN', \@v); my $result = $db->iquery('SELECT * FROM table WHERE', {x => $s, y => \@v}); my $first_record = $result->hash; for ($result->hashes) { ... } Access to the underlying DBIx::Simple object. Access to the underlying DBI object. Determine whether a database connection exists. Returns true or false. Al Newkirk <awncorp@cpan.org> This software is copyright (c) 2010 by awncorp. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
http://search.cpan.org/~awncorp/ORMesque-1.110422/lib/ORMesque.pm
CC-MAIN-2014-23
refinedweb
2,270
57.16
Hello, Only caffemodel exists as an example model in 04_video_dec_trt How do I use the pytorch model (.pt)? Can you show me as an example? Thank you. Hello, Only caffemodel exists as an example model in 04_video_dec_trt How do I use the pytorch model (.pt)? Can you show me as an example? Thank you. Hi, The backend inference engine is TensorRT. TensorRT doesn’t support .pt, please convert it into onnx file format first. After that, just replace the caffe parser with the onnx parser and it should work. Thanks. Hello, I thought that the pytorch model can be used immediately using tensorRT as follows. The caffee model looks like this I have .prototxt, .caffemodel. In the case of pytorch What are the extensions for deployfile and modelfile? Can you show me an example? ./video_dec_trt 2 …/…/data/Video/sample_outdoor_car_1080p_10fps.h264 …/…/data/Video/sample_outdoor_car_1080p_10fps.h264 H264 –trt-deployfile …/…/data/Model/resnet10/resnet10.prototxt –trt-modelfile …/…/data/Model/resnet10/resnet10.caffemodel –trt-mode 0 Thank you. Hello, A21864 TRTorch A PyTorch TorchScript Compiler Targeting NVIDIA GPUs Using TensorRT_1601770370484001NQu2 (1).zip (998.6 KB) Do you have any comments? I know there are torch2trt and trttorch (introduced on GTC2020, attach file). I know that trttorch has not been released yet, when will it be released? Are there any plans to provide a way to directly write the pytorch model in the 04_video_dec_trt sample? torch2trt URL: Thank you. I changed nvcaffeparser1 to nvonnxparser and compiled it It doesn’t seem to recognize the nvonnxparser namespace. What am I supposed to do? Thank you. Hi, Please check the below file as sample: /usr/src/tensorrt/samples/common/sampleEngines.cpp case ModelFormat::kONNX: { using namespace nvonnxparser; parser.onnxParser.reset(createParser(network, sample::gLogger.getTRTLogger())); Thanks.
https://forums.developer.nvidia.com/t/04-video-dec-trt-how-to-use-the-pytorch-model-pt-in-the-sample/159444
CC-MAIN-2020-50
refinedweb
289
53.07
I am not very good with regex and it continues to confuse me every time it comes up so instead of writing a possibly incorrect regex string, I want to split a string a different way. Let's say I have a string "hello, my name is Joseph! Haha, hello!" and I want to split it whenever I encounter a non-alphanumeric character. So then, in this case, I would obtain: "hello" "my" "name" "is" "Joseph" "Haha" "hello" Is there a way to do this without a regex string? As in: split whenever character != alphanumeric? (Yes, I do realize it is probably not a smart thing to do to not correct my regex deficiency!) Personally, I think it is appropriate to use simple and straightforward regexes for such simple tasks. Compare an itertools and re solutions: import itertools, re s = "hello, my name is Joseph! Haha, hello!" print(["".join(x) for _, x in itertools.groupby(s, key=str.isalnum)][0::2]) print(re.findall(r"\w+", s)) See an online Python demo here. As for me, I'd vote for the regex here. The \w+ matches one or more word characters (letters, digits, underscores) and the re.findall returns all the non-overlapping occurrences. The itertools groupby groups the substring chunks according to the key which is set to alphanumeric ( str.alnum) and all the even tokens (the non-word chunks in this concrete case) are removed from the final result with [0::2]. If a string starts with a non-word char, this won't work, a regex solution is safer and easier.
https://codedump.io/share/J8mvYUM19v2k/1/splitting-in-python-with-everything-but-particular-set-of-cases
CC-MAIN-2017-09
refinedweb
265
72.97
Up to [cvs.NetBSD.org] / src / lib / libc / gen Request diff between arbitrary revisions Default branch: MAIN Revision 1.10.6.1 / (download) - annotate - [select for diffs], Tue Oct 30 18:58:46 2012 UTC (2 years, 4 months ago) by yamt Branch: yamt-pagecache CVS Tags: yamt-pagecache-tag8 Changes since 1.10: +3 -3 lines Diff to previous 1.10 (colored) next main 1.11 (colored) sync with head Revision 1.11 / (download) - annotate - [select for diffs], Sun Jun 24 15:26:03 2012 UTC (2 years, 9.10: +3 -3 lines Diff to previous 1.10 (colored) fix old style definitions; XXX: gcc should have picked them up but it did not. Revision 1.10 / (download) - annotate - [select for diffs], Mon Dec 14 01:04:46 2009 UTC (5 years,.9: +4 -2 lines Diff to previous 1.9 (colored) Make sure the kernel doesn't pass back 0 for pagesize. Revision 1.9.46.1 / (download) - annotate - [select for diffs], Sat Sep 5 03:11:43 2009 UTC (5 years, 6 months ago) by matt Branch: matt-nb5-mips64 CVS Tags: matt-nb5-mips64-u2-k2-k4-k7-k8-k Changes since 1.9: +4 -2 lines Diff to previous 1.9 (colored) next main 1.10 (colored) Add a DIAGASSERT for the returned pagesize being non-zero. Revision 1.9 / (download) - annotate - [select for diffs], Thu Aug 7 16:42:50 2003 UTC 1-k1-k: matt-nb5-mips64 Changes since 1.8: +3 -7 lines Diff to previous 1.8 (colored) Move UCB-licensed code from 4-clause to 3-clause licence. Patches provided by Joel Baker in PR 22280, verified by myself. Revision 1.8 / (download) - annotate - [select for diffs], Sat Jan 22 22:19:11 2000 UTC .7: +3 -3 lines Diff to previous 1.7 (colored) Delint. Remove trailing ; from uses of __weak_alias(). The macro inserts this if needed. Revision 1.7 / (download) - annotate - [select for diffs], Mon Jul 21 14:07:11 1997 UTC (17 years, 8:12:30 1997 UTC (17 years, 8 months ago) by christos Branch: MAIN Changes since 1.5: +4 -2 lines Diff to previous 1.5 (colored) Add missing unistd.h include Fix RCSID's Revision 1.5.4.1 / (download) - annotate - [select for diffs], Thu Sep 19 20:03:00 1996 UTC (18 years, 6 months ago) by jtc Branch: ivory_soap2 Changes since 1.5: +7 -2 lines Diff to previous 1.5 (colored) next main 1.6 (colored) snapshot namespace cleanup: gen Revision 1.5 / (download) - annotate - [select for diffs], Sat Feb 25 08:51:21: +6 -0 lines Diff to previous 1.4 (colored) clean up Id's on files previously imported... Revision 1.4 / (download) - annotate - [select for diffs], Mon Sep 19 23:46:29 1994 UTC (20 years, 6 months ago) by mycroft Branch: MAIN CVS Tags: ivory_soap Changes since 1.3: +5 -4 lines Diff to previous 1.3 (colored) Fix oversight in last change. Revision 1.3 / (download) - annotate - [select for diffs], Sun Sep 18 04:32:35 1994 UTC (20 years, 6 months ago) by mycroft Branch: MAIN Changes since 1.2: +9 -9 lines Diff to previous 1.2 (colored) Stylistic changes. Revision 1.2 / (download) - annotate - [select for diffs], Thu Sep 15 10:49:53 1994 UTC (20 years, 6 months ago) by pk Branch: MAIN Changes since 1.1: +4 -1 lines Diff to previous 1.1 (colored) Cache pagesize. Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Sat May 7 02:53:04 1994 UTC (20 years, 10 months ago) by cgd Branch: CSRG) various sysctl-related libc functions Revision 1.1 / (download) - annotate - [select for diffs], Sat May 7 02:53:03 1994 UTC (20.
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/gen/getpagesize.c
CC-MAIN-2015-14
refinedweb
628
76.82
Technical Articles Getting Started with the SAP Cloud Platform SDK for iOS – Part 3 – Logging Previous (Registration) Home Next (Online OData) The SDK provides a separate log file for an application which can be periodically uploaded to the SAP Cloud Platform Mobile Services server. The root logger has a log level that can be set in the application or can be remotely set using the SAP Cloud Platform mobile services cockpit. The SDK components themselves have loggers whose log level can be individually set. Child loggers can inherit the log level from their parent. The following are some additional sources of documentation on Logging. API Logging Reference API Log Upload Reference Logging Logging with Native iOS Mobile Interactive Tutorial The following examples attempt to demonstrate the functionality of the Logger. Initiating a Logger and Setting its Log Level Setting the Log Level in the Cockpit Using the Logger to Log Uploading the Log Viewing the Uploaded Log Initiating a Logger and Setting its Log Level - Add the following import to the top of ViewController. import SAPCommon - Near the top of the ViewController class, in the declaration section, add a reference to the rootLogger and create a logger for the ViewController class. let rootLogger = Logger.root let logger = Logger.shared(named: "ViewController") - In the viewDidLoad method change the log level of the rootLogger to debug by adding the below line after super.viewDidLoad(). rootLogger.logLevel = LogLevel.debug - Add a breakpoint in the just added line by double clicking on the line number. Add a second breakpoint on the following line in the onboardOrRestore method. print("Successfully restored") When the first breakpoint hits, examine the Logger Hierarchy using the dumpHierarchy method. Notice that the ViewController logger is a child of the root logger and that it inherits its parents log level as it has not been explicitly set. po rootLogger.dumpHierarchy() - In the debugger, expand the rootLogger and notice that it has two handlers added to it (ConsoleLogHandler and OSLog). Also note that a handler can have a formatter. These can be helpful if you wish to further customize where the logs are written to or the format of the log. - Using the debugger, step over the line that sets the log level to DEBUG. Notice this time the log level of all the child loggers has changed since the root log level was set. - Using the debugger, continue to the next breakpoint in the onboardOrRestore method. Notice the log hierarchy now contains additional loggers that were added as part of the registration. Setting the Log Level in Cockpit Add the following line to the buttonPressed method and use it to see the effect of changing the log level in the management cockpit as shown below. print("Log level of app is now at \(self.rootLogger.logLevel!)") The log level of the application can be remotely set at the application level. It can also be set for an individual registration. Using the Logger to Log In the following section, the ViewController logger will be used to log a few lines when the Button is pressed. - In the Mobile Services Management cockpit, set the log level to be warn. - In the buttonPressed method add the following methods after the existing print method. logger.debug("Button pressed \(numberOfPresses) times") logger.warn("Button pressed \(numberOfPresses) times") Run the app and press the button. Notice that since the log level of the app is warn, the line logged at the debug level is not logged. Also notice the extra information that the formatter adds such as the date, time, log level, class and method name. Uploading the Log In the following section, the client log will be uploaded to the Mobile Services and then viewed in the management cockpit. - In the viewDidLoad method, after super.viewDidLoad(), add the following code. do { try SAPcpmsLogUploader.attachToRootLogger() } catch { logger.error("Failed to attach to root logger.", error: error) } - Add the following function. private func uploadLogs(_ urlSession: SAPURLSession, _ settingsParameters: SAPcpmsSettingsParameters) { SAPcpmsLogUploader.uploadLogs(sapURLSession: urlSession, settingsParameters: settingsParameters) { error in if let error = error { self.logger.error("Error happened during log upload.", error: error) return } print("Logs have been uploaded successfully.") } } - Call the uploadLogs function at the end of the buttonPressed method. uploadLogs(myContext.sapURLSession, myContext.info[OnboardingInfoKey.sapcpmsSettingsParameters] as! SAPcpmsSettingsParameters) - If the log upload fails with the following exception it can be corrected by enabling Client Log Upload. Error: LogUploaderError: Network error. StatusCode: 403, Error: N/A), Response: {"status":{"code":403,"message":"Log Upload disabled for Application Connection ID","parameters":{}}}) Viewing the Uploaded Log In the following section, the client log previously uploaded will be viewed in the management cockpit. - Filters can be applied to limit the shown logs to match the application id (com.iossdk.gs) and on the type (Client Log). From this screen, the log can be clicked on to show a simplified view that contains the uploaded messages, or a log file can be checked and then either the download or view option can be clicked on to see the content that contains additional details such as the time the line was logged, the log level and the file name. An example log line follows as well, a screen shot showing the simplified format. #2.0#2017-11-09 06:33:25 AM#WARNING#/Users/p1743065160/Documents/iOSSDK/Getting Started/Getting Started/ViewController.swift####977c081f-3fa6-4ce2-a976-8addd4de5f97#73f2d61f-ad86-44a4-b476-cfe8dc13d398#com.iossdk.gs#buttonPressed#iXXXXX############Button pressed 1 times# Note that entries logged using print are not logged to the application log file. Previous (Registration) Home Next (Online OData) Hey Dan, is there a way to set the Component? This would make searching the Logs easier and also more readable. Regards, Chris An issue has been opened for this. I will update once it has been investigated. Regards, Dan van Leeuwen This has been fixed. The screen last screen shot in the blog above demonstrates this using the 3.0.200 version of the SDK. Hi Dan, I'm enjoying the blogs so thanks for taking the trouble to write them. In this blog I think you should be a bit more explicit about setting the log level in the cockpit. You say The log level of the application can be remotely set but I think you should say something like set the log level to warning in the cockpit. If you don't do that part then the example doesn't work and we don't see the logger output as the logger is turned off. In addition I had to reset the simulator before the change took effect (re-registering). I note that in your code screenshot you have set the log level in the buttonPressed function but you didn't ask us to add that line.
https://blogs.sap.com/2018/02/14/getting-started-with-the-sap-cloud-platform-sdk-for-ios-part-3-logging/
CC-MAIN-2022-05
refinedweb
1,128
55.54
Scroll down to the script below, click on any sentence (including terminal blocks!) to jump to that spot in the video! If you liked what you've learned so far, dive in! video, code and script downloads. This testing.php file is basically already a test... except it's missing the most important part: the ability to start shouting when something breaks. To test our API, we'll use PHPUnit! Yes! Awesome! I'm excited because even though PHPUnit isn't the most exciting tool, it's solid - and we're going to do some cool stuff with our tests. TIP In our other REST tutorial, we tested with Behat. Both are great, and really the same under the surface. Create a Tests directory inside AppBundle. Now mimic your directory structure. So, add a Controller directory, then an API directory, and finish it with a new PHPUnit test class for ProgrammerController. Be a good programmer and fill in the right namespace. All these directories: technically unnecessary. But now we've got a sane setup. Of course, we'll test our POST endpoint - so create public function testPOST(): I'm being inconsistent - the controller is newAction, but this method is testPOST - it would be cool to have these match - maybe even with a mixture of the two - like postNewAction(). Anyways, let's go steal our first request code from testing.php and paste it into testPOST: Ok cool. No asserts yet - but let's see if it blows up. I already installed PHPUnit into this project, so run php bin/phpunit -c app then the path to the test: php bin/phpunit -c app src/AppBundle/Tests/Controller/Api/ProgrammerControllerTest.php Pretty green! No assertions yet, but also no explosions. Solid start team! Ok, what should we assert? Always start with the status code - $this->assertEquals() that the expected 201 equals $response->getStatusCode(): Second: what response header should we send back whenever we create a resource? Location! Right now, just assertTrue that $response->hasHeader('Location'). Soon, we'll assert the actual value. And to put a bow on things, let's json_decode the response body into an array, and just assert that is has a nickname key with assertArrayHasKey, with nickname and $data: In a second, we'll assert the actual value. It's not a super-tight test yet, but let's give it a shot: php bin/phpunit -c app src/AppBundle/Tests/Controller/Api/ProgrammerControllerTest.php Yes! This time we deserve that green.
https://symfonycasts.com/screencast/symfony-rest/first-test
CC-MAIN-2020-34
refinedweb
415
67.65
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is one the shorter recipes, Recipe 7.2, “How to import multiple members in Scala (wildcard and curly braces syntax).” Problem You want to import one or more members into the scope of your current Scala program. Solution This is the syntax for importing one Scala class: import java.io.File You can import multiple classes the Java way: import java.io.File import java.io.IOException import java.io.FileNotFoundException Or you can import several classes the Scala way: import java.io.{File, IOException, FileNotFoundException} Use the following syntax to import everything from the java.io package: import java.io._ The _ character in this example is similar to the * wildcard character in Java. If the _character feels unusual at first, it helps to know that it’s used consistently throughout the Scala language as a wildcard character, and that consistency is very nice. Discussion The concept of importing code into the current scope is similar between Java and Scala, but Scala is more flexible. Scala lets you: - Place import statements anywhere, including the top of a class, within a class or object, within a method, or within a block of code - Import classes, packages, or objects - Hide and rename members when you import them Syntactically, the two big differences are the curly brace syntax, known as the import selector clause, and the use of the _ wildcard character instead of Java’s * wildcard. The advantages of the import selector clause are demonstrated further in Recipes 7.3 and 7.4. Placing import statements anywhere In Scala you can place an import statement anywhere. For instance, because Scala makes it easy to include multiple classes in the same file, you may want to separate your import statements so the common imports are declared at the top of the file, and the imports specific to each class are within each class specification: package foo import java.io.File import java.io.PrintWriter class Foo { import javax.swing.JFrame // only visible in this class // ... } class Bar { import scala.util.Random // only visible in this class // ... } You can also place import statements inside methods, functions, or blocks: class Bar { def doBar = { import scala.util.Random println("") } } See Recipe 7.6, “Using Scala Import Statements Anywhere”, for more examples and details about the use of import statements. The Scala Cookbook This tutorial is sponsored by the Scala Cookbook, which I wrote for O’Reilly: You can find the Scala Cookbook at these locations:
http://alvinalexander.com/scala/how-to-import-multiple-members-scala-wildcard-curly-braces-syntax
CC-MAIN-2020-05
refinedweb
425
65.62
PyQt QApplication takes 10 seconds - can I have a splash screen? I'm on OSX with PyQt4. If I run: from PyQt4.QtCore import * from PyQt4.QtGui import * import sys the imports takes < .5 second. Then I run: q = QApplication(sys.argv) which unfortunately takes a full 8 seconds! I've sort of resigned myself to paying this cost. Is there any way I can display a splash screen during this time? I wanted to use QSplashScreen, but I assume I need a QApplication first... Which QT-Version to you use? See also following links (no splahscreen but startup): "": "": "": I have PyQt 4.9.4 StackOverflow says 'There is a known bug in Qt 4.6.3 that cripples application start times.' I was hopefuly that I might have 4.6.3 b/c that might explain it, but now I'm not sure. I would like QApplication instantiation to be faster more than anything. Perhaps this has something to do with dynamic library allocation, as StackOverflow suggests. Can anybody who has experienced QApplication constructor running quickly describe how they install PyQt on OSX? I used an installer, maybe I should compile myself? I'm on: Python 2.7.3 PyQt 4.9.4 OSX 10.7.4 Any ideas, anyone? I have found an adequate solution. I installed Qt and PySide, and now QApplication constructor time is about 2 seconds. There is still some lag before my app shows up, but that is my own initialization, and now I can show a splash screen. Long live PySide.
https://forum.qt.io/topic/21014/pyqt-qapplication-takes-10-seconds-can-i-have-a-splash-screen
CC-MAIN-2018-51
refinedweb
258
79.87
Bare metal ELF Image compiled from GCC toolchain can debugged via standard GDB commands. GNU debugger will not be re-explained for Bare Metal applications. Refer to the generic pages for explanations on using the same. Even if the GDB is traditionally used with serial or ethernet based debugging, Gdbproxy enables debugging via JTAG also. A quick overview of this approach is given below. Refer to this presentation for more information: gdbproxy Running gdproxy - sample output: C:\Program Files\Analog Devices\GNU Toolchain\2010R1\elf\bin>bfin-gdbproxy.exe Remote proxy for GDB, v0.7.2, Copyright (C) 1999 Quality Quorum Inc. MSP430 adaption Copyright (C) 2002 Chris Liechti and Steve Underwood Blackfin adaption Copyright (C) 2008 Analog Devices, Inc. GDBproxy comes with ABSOLUTELY NO WARRANTY; for details use `--warranty' option. This is Open Source software. You are welcome to redistribute it under certain conditions. Use the '--copying' option for details. Found USB cable: ICE-100B ICE-100B Firmware Version is 2.0.0 IR length: 5 Chain length: 1 Device Id: 00110010011111001000000011001011 (0x327C80CB) Manufacturer: Analog Devices, Inc. (0x0CB) Part(0): BF537 (0x27C8) Stepping: 3 Filename: c:\program files\analog devices\gnu toolchain\svn-20101128\elf\b in\../share/urjtag/analog/bf537/bf537 /usr/src/packages/BUILD/blackfin-toolchain-2010R1/urjtag/src/bfin/bfin-part-bfin .c:154 bfin_wait_ready() Warning: untested cable or frequency, set wait_clocks t o 21 warning: bfin: no board selected, BF537 is detected notice: bfin: jc: waiting on TCP port 2001 notice: bfin: jc: (you must connect GDB before using jtag console) notice: bfin-gdbproxy.exe: waiting on TCP port 2000 Eclipsed provides a front end for GDB based debugging. This is useful for those who are more comfortable with a GUI or IDDE based environment. Refer to Eclipse pages for more info: Eclipse. Sample Project options for Eclipse (similar to VDSP Project Options): The MMR viewer for Bare metal applications: Developing and debugging Bare metal applications generally requires JTAG tools. Using a JTAG interface, users can accurately debug the application running on the target. However, it is also possible to run / debug the ELF Image with the boot-loader concept. Since most of the boot loaders are expected to support debugging through serial and ethernet (which enables them to load and debug Linux images), the same concept may be utilized to debug a bare metal ELF image, though with limited support. Boot loaders may vary in their support for bare metal debugging, but in general they should have these common functionalities: Users may find the following features particularly useful for bare metal applications (especially without JTAG): u-boot also supports kgdb to debug the Linux Kernel. This method maybe employed for debugging bare metal ELF Image also. /* TO DO: list the commands here*/ uMon or micromonitor bootloader has some capabilities that can be utilized for ELF image running and debugging. This software can either work standalone or it can also co-exist with u-boot such that the u-boot can load the ELF image of this bootloader. The following output was taken from uMon running on BF537 EZ-KIT Lite. To create the uMon ELF image (bram.elf), refer to uMon documentation at uMon. Then, with the target running u-boot, the image is transferred to the target's memory… bfin> tftp 0x1000000 bram.elf Using bfin_mac device TFTP from server 192.168.10.20; our IP address is 192.168.10.10 Filename 'bram.elf'. Load address: 0x1000000 Loading: ###################################################### done Bytes transferred = 786456 (c0018 hex) Then u-boot loads bram.elf and turns over control to its entrypoint; which in turn gives control of the board to uMon command prompt. bfin> bootelf 0x1000000 Loading phdr 0 to 0x02f00000 (289976 bytes) ## Starting application at 0x02f00000 ...tTFS altdevtbl[0] appears corrupt TFS altdevtbl[1] appears corrupt Misformed ethernet addr at: 0x20000010 MICRO MONITOR 1.18.17 Platform: ADDS-BF537-EVAL CPU: BlackFin BF537 Built: Jun 22 2011 @ 18:37:39 Monitor RAM: 0x2f46cb8-0x2f61ea0 Application RAM Base: 0x100000 IP: 0.0.0.0 CPU Version 3 uMON>help -i MICRO MONITOR 1.18.17 Platform: ADDS-BF537-EVAL CPU: BlackFin BF537 Built: Jun 27 2011 @ 18:11:56 Monitor RAM: 0x2f46d8c-0x2f61fc4 Application RAM Base: 0x100000 IP: 0.0.0.0 CPU Version 3 Stack: bottom=0x2f5f4e4, size=8192 Moncomptr: 0x02f00004 Etheradd_ptr: 0x20000010 AltTFSdevtbl: 0x20000030 Change parameters for network. uMON>set IPADD 192.168.10.10 uMON>set ETHERADD 00:11:22:33:44:55 uMON>set PROMPT = uMON> APPRAMBASE = 0x100000 BOOTROMBASE = 0x20000000 PLATFORM = ADDS-BF537-EVAL MONITORBUILT = Jun 22 2011 @ 18:37:39 MONCOMPTR = 0x2f00004 TARGETTIMER = 0x2f000a2 TICKSPERMSEC = 0x7a120 VERSION_MAJ = 1 VERSION_MIN = 18 VERSION_TGT = 17 CONSOLEBAUD = 57600 IPADD = 192.168.10.10 ETHERADD = 00:11:22:33:44:55 uMON>ether on Build the application ELF image. Note that the startup code of the bare metal application should not mess up with the Stack allocation done by uMon. It should also make sure to return back to uMon safely with mon_appexit(). An example that was compiled with '-nostartfiles' option is given below: #include <cdefBF537.h> #include <monlib.h> extern unsigned char _bss_start, _bss_end; int main(void); void _start(void) { register unsigned char *ramstart; ramstart = &_bss_start; while(ramstart < &_bss_end) *ramstart++ = 0; /* Connect the application to the monitor. This must be done prior to the application making any other attempts to use the "mon_" functions provided by the monitor. */ monConnect((int(*)())(*(unsigned long *)0x02f00004),(void *)0,(void *)0); int r = main(); mon_appexit(0); } int main(void) { *pPORTF_FER = 0x0000; // Setup for LEDs *pPORTFIO_DIR = 0x0FC0; // Setup port for output *pPORTFIO_SET = 0x0FC0; // Turn all LEDs on return 0; } Load and run the application image. uMON>tftp -F bare -fE 192.168.10.20 get bare_test_bf537 Retrieving bare_test_bf537 from 192.168.10.20... TFTP transfer complete. Rcvd 177937 bytes Adding bare (size=177937) to TFS... uMON>bare Application Exit Status: 0 (0x0) uMON> ELF Image can also be stored as a function that can be accessed via call command. uMON>tfs -v ld bare .text : copy 6704 bytes from 0x20102c1c to 0xffa00000 .bss : set 304 bytes at 0xff800000 to 0x00 .comment : 72 bytes not processed (tot=72) .debug_aranges: 64 bytes not processed (tot=136) .debug_pubnames: 1305 bytes not processed (tot=1441) .debug_info: 9381 bytes not processed (tot=10822) .debug_abbrev: 628 bytes not processed (tot=11450) .debug_line: 1296 bytes not processed (tot=12746) .debug_frame: 1904 bytes not processed (tot=14650) .debug_str: 1636 bytes not processed (tot=16286) .debug_loc: 2418 bytes not processed (tot=18704) .debug_macinfo: 142844 bytes not processed (tot=161548) .shstrtab : 166 bytes not processed (tot=161714) .symtab : 2832 bytes not processed (tot=164546) .strtab : 1949 bytes not processed (tot=166495) entrypoint: 0xffa00000 uMON>call $ENTRYPOINT Application Exit Status: 0 (0x0) uMON> uMon can be configured with a gdb server running on Ethernet - to provide basic download and then post-mortem analysis. If there was a crash or exit, the “application code, data and their symbols” would still be in memory and gdb could be connected to uMon to symbolically look at state. Note that currently there is no support for using gdb as a runtime debugger. At host, set up the gdb and debug symbolically (note: no breakpoint / step / run / continue). Some examples are given below. C:\Program Files\Analog Devices\GNU Toolchain\2010R1\elf\bin>bfin-elf-gdb.exe bare_test_bf537-mingw32msvc --target=bfin-elf"... (gdb) target remote udp:192.168.10.10:1234 warning: The remote protocol may be unreliable over UDP. Some events may be lost, rendering further debugging impossible. Remote debugging using udp:192.168.10.10:1234 warning: unrecognized item "OK" in "qSupported" response 0x00000000 in ?? () (gdb) print global_data $3 = 5678 (gdb) print 0xff800000 $6 = 4286578688 Note that the debugging context is within the executed application. By forcing a return via exception, gdb can look inside the registers also. #define EXCEPTION() asm("excpt 5"); /* Force exception */ (gdb) info registers r0 0x0 0 r1 0x40 64 r2 0xf870 63600 r3 0x2f4acfc 49589500 r4 0x2f5f0f4 49672436 ... Application can make use of the uMon in-built heap manager for dynamic allocations, instead of using the standard APIs. It gives a descriptive analysis of the allocation functions and usage. Note that the monitor itself uses malloc / free, so one would see additional numbers in the output. Application needs to call mon_malloc() & mon_free(p) to connect to the heap manager in the uMon. One example is given below. uMON>heap Heap summary: Malloc/realloc/free calls: 99/0/47 Malloc/free totals: 1604/812 High-water level: 792 Malloc failures: 0 Bytes overhead: 1060 Bytes currently allocated: 792 Bytes free on current heap: 63684 Bytes left in allocation pool: 0
https://docs.blackfin.uclinux.org/doku.php?id=toolchain:bare_metal:debugging
CC-MAIN-2017-13
refinedweb
1,430
57.98
Source code of Sequoia API TLDPublic Project description Getting Started Asyncio version of the standard lib xmlrpc Currently only aioxmlrpc.client, which works like xmlrpc.client but with coroutine is implemented. Fill free to fork me if you want to implement the server part. aioxmlrpc is based on httpx for the transport, and just patch the necessary from the python standard library to get it working. Installation pip install aioxmlrpc Example of usage This example show how to print the current version of the Gandi XML-RPC api. import asyncio from aioxmlrpc.client import ServerProxy @asyncio.coroutine def print_gandi_api_version(): api = ServerProxy('') result = yield from api.version.info() print(result) if __name__ == '__main__': loop = asyncio.get_event_loop() loop.run_until_complete(print_gandi_api_version()) loop.stop() Run the example poetry run examples/gandi_api_version.py Project details Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages. Source Distribution aioxmlrpc-0.6.4.tar.gz (4.2 kB view hashes)
https://pypi.org/project/aioxmlrpc/
CC-MAIN-2022-40
refinedweb
164
53.37
* A <code>SetCluster</code> instance is used for adding a given topic28 * to a cluster an other topic is part of, or for creating a new cluster.29 */30 public class SetCluster extends AdminRequest {31 private static final long serialVersionUID = 3888475137454407781L;32 33 /**34 * Identifier of the topic already part of a cluster, or chosen as the35 * initiator.36 */37 private String initId;38 /** Identifier of the topic joining the cluster, or the initiator. */39 private String topId;40 41 /**42 * Constructs a <code>SetCluster</code> instance.43 *44 * @param initName Identifier of the topic already part of a cluster, or45 * chosen as the initiator.46 * @param topName Identifier of the topic joining the cluster, or the47 * initiator.48 */49 public SetCluster(String initId, String topId) {50 this.initId = initId;51 this.topId = topId;52 }53 54 /**55 * Returns the identifier of the topic already part of a cluster, or chosen56 * as the initiator.57 */58 public String getInitId() {59 return initId;60 }61 62 /**63 * Returns the identifier of the topic joining the cluster, or the64 * initiator.65 */66 public String getTopId() {67 return topId;68 }69 }70 Java API By Example, From Geeks To Geeks. | Our Blog | Conditions of Use | About Us_ |
http://kickjava.com/src/org/objectweb/joram/shared/admin/SetCluster.java.htm
CC-MAIN-2017-30
refinedweb
204
55.95
Adding key/value pairs from a HashMap in to an ArrayList bob fissle Greenhorn Joined: Feb 02, 2012 Posts: 6 posted Feb 26, 2012 18:43:35 0 I'm trying to create a HashMap , loop through that HashMap , and finally, I'm trying create an ArrayList of key/value pairs -- from the HashMap -- that contain within its value set a parameter value. I realize that might be a little hard to understand, so I've provided my code to make sense of what I'm trying to accomplish.**/ } } } } } For the desired output we can assume that the productAttribute parameter value is "Computer". Current output of the addProduct ArrayList :] **/ Desired output of the addProduct ArrayList :" I can't seem to figure out what I'm doing wrong. Any help would be greatly appreciated. Paul Clapham Bartender Joined: Oct 14, 2005 Posts: 19098 8 I like... posted Feb 26, 2012 20:02:13 0 So you have a map which maps a String to a list of Strings. And if I understand your example right, you want to mutate that into a list of lists of Strings, where each of the inner lists comprises a key of the map followed by the list it's mapped to? Well, looking at the lists of Strings you have in your example, I don't understand why they are lists of Strings. To me they ought to be some kind of objects which are designed specifically for these products, because obviously the first entry in the list is some kind of a category, the second entry is a manufacturer, and so on. Just putting those things in a list is a misuse of lists. And likewise I don't see the point of making a slightly different list which just has the product code on the front. Perhaps it should be part of the product object which I was just suggesting. Making a list of products would make a lot of sense once you've done that, which is basically your non-OO requirement anyway. bob fissle Greenhorn Joined: Feb 02, 2012 Posts: 6 posted Feb 26, 2012 20:13:29 0 Thanks for the reply Paul. Yes, your understanding of what I'm trying to do is correct. Is there any chance you could provide some pseudo code on a better way of accomplishing the task at hand? Tim Moores Rancher Joined: Sep 21, 2011 Posts: 2409 posted Feb 27, 2012 00:31:43 0 This might be the beginnings of such a class. For the string types, other custom-made classes may be more appropriate; that depends on the design of your app and your requirements. public class Item { private String orderNumber; private String category; private String manufacturer; private String model; private BigDecimal price; } I agree. Here's the link: subject: Adding key/value pairs from a HashMap in to an ArrayList Similar Threads Apple iPad2 VS Asus PX-MU17-BU is rectangle? New class not working Java + "for" loop Read file from directory, update contents of the each file All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter JForum | Paul Wheaton
http://www.coderanch.com/t/568613/java/java/Adding-key-pairs-HashMap-ArrayList
CC-MAIN-2015-06
refinedweb
525
65.56
The: More... #include <TDocStd_Document.hxx> The: Constructs a document object defined by the string astorageformat. If a document is created outside of an application using this constructor, it must be managed by a Handle. Otherwise memory problems could appear: call of TDocStd_Owner::GetDocument creates a Handle(TDocStd_Document), so, releasing it will produce a crash. Abort the Command transaction. Does nothing If there is no Command transaction open. Prepares document for closing. methods for the nested transaction mode Sets version of the format to be used to store the document. Remove all stored Redos. Remove all stored Undos and Redos. Commits documents transactions and fills the transaction manager with documents that have been changed during the transaction. If no command transaction is open, nothing is done. Returns True if a new delta has been added to myUndos. Returns Standard_True done. Returns current storage format version of the document. Dumps the content of me into the stream. Returns saving mode for empty labels. Will Abort any execution, clear fields returns the document which contains <L>. raises an exception if the document is not found. Returns the number of redos stored in this document. If this figure is greater than 0, the method Redo can be used. Returns the number of undos stored in this document. If this figure is greater than 0, the method Undo can be used. Returns the labels which have been modified in this document. raise if <me> is not saved. returns the OS path of the file, in which one <me> is saved. Raise an exception if <me> is not saved. Returns value of <mySavedTime> to be used later in SetSavedTime() The current limit on the number of undos. returns True if a Command transaction is open in the curret . Initializes the procedure of delta compaction Returns false if there is no delta to compact Marks the last delta as a "from" delta. returns True if document differs from the state of last saving. this method have to be called only working in the transaction mode Returns True if the main label has no attributes. Returns Standard_True if mode is set. the document is saved in a file. Returns False if the document has been modified but not recomputed. Returns the main label in this data framework. By definition, this is the label with the entry 0:1. returns True if changes allowed only inside transactions Launches a new command. This command may be undone. Opens a new command transaction in this document. You can use HasOpenCommand to see whether a command is already open. Exceptions Standard_DomainError if a command is already open in this document. methods for protection of changes outside transactions Performs the procedure of delta compaction Makes all deltas starting from "from" delta till the last one to be one delta. Remove all modifications. After this call The document becomesagain Valid. Recompute if the document was not valid and propagate the reccorded modification. Will REDO one step, returns False if no redo was done (Redos == 0). Otherwise, true is returned, and one step in the list of redoes is done again. Removes the first undo in the list of document undos. It is used in the application when the undo limit is exceed. Sets saving mode for empty labels. If Standard_True, empty labels will be saved. if theTransactionOnly is True changes is denied outside transactions Notify the label as modified, the Document becomes UnValid. returns True if <L> has been notified as modified. Sets nested transaction mode if isAllowed == Standard_True. This method have to be called to show document that it has been saved. Say to document what it is not saved. Use value, returned earlier by GetSavedTime(). Set the limit on the number of Undo Delta stored 0 will disable Undo on the document A negative value means no limit. Note that by default Undo is disabled. Enabling it will take effect with the next call to NewCommand. Of course this limit is the same for Redo. The Storage Format is the key which is used to determine in the application resources the storage driver plugin, the file extension and other data used to store the document. Implements CDM_Document. Returns version of the format to be used to store the document. Will UNDO one step, returns False if no undo was done (Undos == 0). Otherwise, true is returned and one step in the list of undoes is undone..<> Update the document by propagation> Update the document from internal stored modifications. If you want to undoing this operation, please call NewCommand before.<> to change format (advanced programming)> Reimplemented from CDM_Document. Set modifications on labels impacted by external references to the entry. The document becomes invalid and must be recomputed.
https://dev.opencascade.org/doc/occt-7.6.0/refman/html/class_t_doc_std___document.html
CC-MAIN-2022-27
refinedweb
784
60.21
Joe Darcy has posted [URL=""]a fine note[/URL] on the problem of managing integer overflow in Java. This was [URL=""]raised again[/URL] last week at the JVM Language Summit. Joe’s blog has already [URL=""]attracted some good comments[/URL]. Here is my comment, which has inflated itself into a blog entry of its own..[B]Use Cases[/B] If [URL=""]pre-constructed exception[/URL] [URL="'s_law"]Benford’s law[/URL] suggest that random-looking inputs are paradoxically rare. Bignum addition is not likely, in practice, to create a bignum longer than its inputs, so the overflow condition will be rare on one out of the [I]N[/I].[B]API Design Cases[/B] Various [URL=""]subsequent commenting on Joe’s blog[/URL], I will make a link for each type of API.[B][URL=""]Throw to Slow Path[/URL][/B] For the record, here is a fragment from [URL=""]Joe’s example[/URL] which shows the previously mentioned technique of reporting overflow with an exception:[INDENT]static int addExact(int a, int b) throws ArithmeticException { ... }...int z;try { z = addExact(a, b); }catch (ArithmeticException ignore) { ... }[/INDENT][B][URL=""]Null to Slow Path[/URL][/B] Besides the half-measure of a slow path reached by an exception, there is another ingenious trick that [URL=""]Joe considers[/URL] and rejects: Report the exceptional condition by returning null instead of an boxed result. The effect of this is to extend the dynamic range of the operand word (32 or 64 bits) by one more code point, a sort of NaN value..[B][URL=""]Longs as Int Pairs[/URL][/B] Another option would be to work only with 32-bit ints and forget about longs. Then the API could stuff two ints into a long as needed. The code for addExact become.[INDENT]static long intPair(int a, int b) { return ((long)a >> 32)); }static int lowInt(long ab) { return (int)(ab >> 0); }static int highInt(long ab) { return (int)(ab >> 32); }[/INDENT. [B][URL=""]Multiple Return Values[/URL][/B] You may have guessed already that my favorite (future-only) realization of this would be [URL=""]multiple return values[/URL]. The intrinsics would look something like this:[INDENT)) { ... }[/INDENT]The idiom for detecting overflow is simple enough that it could be detected by simple pattern matching in the optimizer. Making it into an intrinsic (as noted before) helps programmers to use patterns which the compiler is expecting. The overflow detection intrinsic itself does not need any special magic. The 128-bit multiple intrinsic will almost certainly be special-cased by an optimizing dynamic compiler..[B][URL=""]Arrays as Values Pairs[/URL][/B] A simple expedient is to use a two-element array to hold the two returned values. Escape analysis (EA) is present in modern optimizing compilers. (See [URL=""]this example with JRockit[/URL].) One could hope that the arrays would “just evaporate”. But EA patterns are fragile; a slight source code variation can unintentionally destroy them. Most ameliorations by the programmer, such as attempting to cache the array for reuse, will break the real optimization.[B][URL=""]Wrappers as Value Pairs[/URL][/B].[B][URL=""]Value-like Pairs[/URL][/B] If we add value types to the JVM, with relaxed identity semantics, a value-like LongPair would play better with EA, since pair values could be destroyed and reconstituted at will by the optimizer. Alas, that also is in the future.[B][URL=""]Return by Reference[/URL][/B] Some.[INDENT)) { ... }[/INDENT][B][URL=""]Return by Thread Local[/URL][/B] Another.[B][URL=""]Static Single Assignment[/URL][/B] The idea of thread-locals is interesting, since they are almost structured enough to optimize as if they were registers. (This is counter-intuitive if you know that they are implemented, at least in the interpreter, via hash table lookups.) Perhaps there is a subclass of ThreadLocal that needs to be defined, with a restricted use pattern that can be optimized into simple register moves. (Such a standard restricted use pattern is [URL=""]static single-assignment[/URL], used in HotSpot.) If, after intrinsics are expanded, the second return value looks like a register (and nothing more) then the optimizer has full freedom to boil everything down to a few instructions.[B][URL=""]Return to an Engine Field[/URL][/B] So far we have supposed that the arithmetic methods are all static, and this is (IMO) their natural form. But it could be argued that arithmetic should be done by an explicit ArithmeticEngine object which somehow encapsulates all that goodness of those natural numbers. If you can swallow that, there is an unexpected side benefit: The engine is an acceptable (I cannot bring myself to say natural) place to store the second return value from intrinsics that must return one.[INDENT]/)) { ... }[/INDENT]With some luck in EA, the engine field (highWord above) might get scalarized to a register, and then participate in SSA-type optimizations.[B][URL=""]Continue in a Lambda[/URL][/B] With closures (coming to a JDK7 near you...) you could also drop to [URL=""]continuation-passing style[/URL] (CPS) to receive the two result words from the intrinsic:[INDENT)) { ... }[/INDENT]Optimizing this down to an instruction or two requires mature closure optimization, something we’ll surely get as closures mature. On the other hand, we will surely lack such optimizations at first. Those are a lot of choices for API design! I encourage you to add your thoughts to [URL=""]Joe’s blog[/URL]. [url=]Read More about [after the deluge: how to tidy an overflow...[/url]
http://fixunix.com/solaris-rss/583563-after-deluge-how-tidy-overflow-print.html
CC-MAIN-2016-18
refinedweb
926
54.83
Proposed features/car see Tag:shop=car for approved implementation With the help of ULFL, the former proposals Proposed_features/car_dealership and Proposed_features/auto_repair_shop have been merged into one new proposal with a lot of additional stuff. Contents Rationale Most satellite navigation systems already include information on car dealers and repair shops in their data. This is especially useful if you experience problems with your car while on the road. Description This proposal adds a new shop tag value called "car" (and related vehicles - even bicycles) to the world of OSM. Optional, but recommended tags include name=*, brand=* and others. While working out the current proposal, it was becoming more and more obvious that the required "subtags" would not be limited to cars, but also be suitable for motorcycles, bicycles and other kind of vehicles. Tags apply to nodes and areas. Interestingly, the set of properties (from name to repair) also seem to apply to all vehicles like motorcycles, bicycles, ... :-) There are car dealers also doing repairs and car repairers also selling some cars "left over from repairs" - you may choose their "main business" for shop=xy. Rendering - shop=car: car - shop=car_repair: car + wrench - shop=car_parts: car + "plus" - shop=motorcycle: motorcycle - shop=motorcycle_repair: motorcycle + wrench - shop=tyres: stack of tyres - ... Example Opinion - Thumbs up from me! MikeCollinson 08:29, 4 December 2007 (UTC) - I would comment that comma-separation is not a general convention within OSM. In cases where multiple values are required, semicolons have been used previously. Gravitystorm 10:06, 4 December 2007 (UTC) - Actually, there is a problem with semicolons in tags, see [1], [2], [3], [4] --Wabba 10:38, 4 December 2007 (UTC) - Actually, no there isn't anymore. This was an issue before API 0.5. We are now at API 0.6. Semicolon is kosher to separate multiple values in a tag. --Gorm 09:51, 17 April 2010 (UTC) - While that issue with database storage doesn't exist anymore, none of the current tools still don't support parsing a semicolon separated list; only those where a full text search makes sense can find all the combinations. It's still good to enter the data in any comprehensible format, though. Alv 12:23, 17 April 2010 (UTC) These tags should definitely be namespaced. (i.e. shop:car_repair:type=car/motorcycle/farm, shop:car_repair:brand=Mercedez, etc.) a tag of "type" is far far far too generic, and a tag of "repair" is meaningless without a namespace. --Hawke 09:32, 15 December 2007 (UTC) ...regardless of the namespace debate, these tag names are really a mess, and only make sense if they're all applied to the item in question. --Hawke 04:06, 21 December 2007 (UTC) The car 'symbol' noted is way too complex for use on a map. There are several decent icon sets available that would work much better. --Cohort - Wouldn't it be nicer to use the actual company logos for those companies that allow it? --N3S 17:13, 5 February 2009 (UTC) What about the type of small shop that does paint, brake pads, oil, body panels, but has nothing to do with actual vehicles? These are common in UK at least, and don't fit this - I agree with Hawke that this is a mess as it stands; shop=car_dealer, shop=motorspares, shop=motorcycle are all catered for in map-features already, so what's needed is a tag to clarify services available. I don't agree with Hawke that generic tags eg type are bad; obviously, the context is derived from the other tags associated, so a vague tag can be used in many different ways, but won't be used unless the renderer (or whatever) has picked up something else first. --DrMark 08:30, 21 December 2007 (UTC) - Mark.66: The problem as I see it is that there could be multiple keys which might want to have some additional information inferred from, say, "type"; if they're both applied to the same place the type tag will conflict. Further, any application of that data would need to know about each specific usage of "type" anyway, so there's no benefit in using a generic key. --Hawke 13:17, 21 December 2007 (UTC) - Vehicle inspection services could be added here too. --Onion 16:55, 18 May 2008 (UTC) - -1 for the comma separated list. Better use brand=foo brand=bar brand=spam (see Proposed_features/Value_separator). Makes it easier to search for a specific brand (navigation systems are not super computers :)). --Bkr 20:30, 3 June 2008 (UTC) - I like the feature 'tyres', because some countries have very bad road conditions --MatMac 01:54, 15 July 2008 (UTC) Some used car shops also buys vehicles, this can also be brand limited, or it can be general, so I suggest a tag buy=yes/brand/exchange/no where no is assumed default value, brand can indicate only brands listed in the list of brands, and exchange indicate that it only will buy your old car if you buy a car from them. --Skippern 17:46, 5 February 2009 (UTC) Merge with other trade services See Proposed_features/Service_business --Phobie 16:44, 6 September 2008 (UTC) How to parse that? You should always think about on how route-planners and renderer can parse these values! This proposal is like writing amenity=china_restaurant. This would result into to many values, think about shop=car_window_repair and shop=car_painting. "shop" should only contain a generic description like "vehicle", "food" or "alcohol" and further descriptions should go into other tags! I think vending- and repair-services should be separated! --Phobie 16:44, 6 September 2008 (UTC) Alternate Proposal I changed the example shown above after a short brainstorming --Phobie 16:44, 6 September 2008 (UTC)
https://wiki.openstreetmap.org/wiki/Proposed_features/cars
CC-MAIN-2018-30
refinedweb
959
59.94
GetX: Flutter State Managment Guide to using the GetX package to manage the state of widgets State management is undoubtedly the most discussed topic within the Flutter community, and no wonder. The choice has a determining factor in the development and maintainability of the code. There are many options and each of them has its advantages and disadvantages, that is why there is, to this day, no consensus on which is the best of all these options. Today I want to show you GetX. This package was a nice discovery for me and, after using it, it has become my first choice in state management. I invite you to try it and see for yourself the benefits it brings. What is GetX? GetX is a micro-Framework for Flutter that allows us, among many other things, to manage the state in a simple way by taking the logic out of our widgets. It is more than a state manager, it offers us a whole ecosystem within which we can manage navigation, internationalization, storage, http or websockets communication and a few other things. With GetX, all this is done intuitively and easily, without the need to write long lines of code. It allows, for example, to open a Snackbar or a dialogue without using the BuildContext. Get.snackbar('Title', 'Message'); One thing you should know is that GetX is currently the most liked package of all, so I encourage you to try it out and see why it is. In this article we are only going to look at State management, but if you are curious about what you can do with GetX, you can take a look at the documentation and you will see why it is so popular. Working with GetX In a nutshell, we create controllers that handle the state and we use widgets provided by GetX to wrap our widgets and, through the controllers, update the view. Controllers To create a controller we just need to define a class that extends of GetxController. This allows us to override some methods that manage the controller’s lifecycle and state update. In that class we will write all the logic we need to modify the widgets. import 'package:get/get.dart';class HomeController extends GetxController { @override void onInit() { super.onInit(); } @override void onClose() { super.onClose(); } someFunction() { // Do something } } Put and Find: Injection of the controller into the view Dependency Injection is another great tool offered by GetX, which could be the subject of another article. For now, we just need to know how these two methods work to inject controllers into widgets. The put method adds the controller we pass as an argument to the Get instance, making it accessible to the whole application. This method returns the controller ready to be used. HomeController _controller = Get.put(HomeController()); The find method searches for a controller that we have previously added with the put method. That way we don’t have to add it every time we want to use it. HomeController _controller = Get.find<HomeController>(); The way to work would be to add the controller the first time (put) and in the other screens, or in child widgets where we want to use it, we recuperate it from the dependencies (find). GetX Widgets GetX offers widgets ready to communicate with the controllers and manage the state for us. There are four widgets we can use: GetBuilder, Obx, GetX and MixinBuilder. Actually, what these widgets do behind the scenes is to inherit from StatefulWidget and handle state efficiently. The difference between them is based on the type of data they handle (reactive/non-reactive) and the performance they offer. To keep the article short, we will only look at Obx and GetBuilder as they are the most common ones. In the GetX repository you can find more information on how to work with the rest of them. Goodbye StatefulWidgets Yes, you read that right. With GetX we won’t have to use StatefulWidgets, all widgets will be StatelessWidgets, we won’t need to manage the state from the widget, as the controller will take care of it. Obx This widget works with reactive data. The nice thing about Obx is that the data is automatically updated in the views when we change its value in the controller. Its syntax is really simple. We just have to wrap the widgets whose state will be managed by the controller: Obx(()=> // Widgets) One thing you should know is that, to work with Obx, we have to use reactive variables, but don’t worry, it’s very easy thanks to GetX. The package offers several ways to convert variables to reactive form: we can use types, or just add .obs after their value. For example, let’s convert the variable var number=0;to reactive form: var number = 0.obs; RxInt number = RxInt(0); Rx<int> number = 0.obs; As in this example, we have at our disposal types for any primitive data and even for lists and objects: RxString, RxBool, RxList, Rx<MyObject> These variables will now have a value and an update method to modify that value. When this happens, GetX will rebuild the view for us. Obx example First of all, we create a new flutter project and add GetX to the dependencies: dependencies: get: ^4.3.8 Now let’s create a controller with some reactive variables and some functions that update those variables. For didactic reasons, I have included a User class at the end of the controller file so that we can see how it would be done with an Object. If we look at the methods, primitive data variables are updated by directly changing their value. On the other hand, to modify a property of the object, we use the update method of the reactive variable, as seen in updateUser(). In the view, the first thing we do is inject the controller with the put method and, at the same time, we store it in the _homeController variable. This controller variable is the one we will use to pass data and update functions to the text widgets and button callbacks. The widgets are wrapped in Obx, which is what allows us to update their values without us having to worry about anything. GetBuilder This widget offers simple state management. Unlike Obx, it does not work with reactive data, so we will have to call the update method in the controller every time we want to modify the state of the widget and it will be an update of all the variables that are handled in the GetBuilder state. This is what the above example would look like with GetBuilder: GetBuilder example In the controller, the only difference is the update method at the end of each function to trigger change detection. In the view we wrap widgets in GetBuilder, which receives the type of Controller that will handle it. child: GetBuilder<HomeController> In the init property we invoke the controller’s class, which initialises it and stores it in the dependencies, similar to the put method. The builder property, gives us the instance of the controller, in it we return the widgets. Conclusion So far we would have an introduction to this fabulous package in terms of state management. It is true that there are still many details to be seen, but I don’t think that is the aim of this article, rather it is a first approach to GetX to help us get started with it. Perhaps at first the particular way of working with GetX is not too comfortable, but as we get deeper into the Get ecosystem, we begin to understand the scope of its benefits. I encourage you to try it out on a project of your own, you won’t be disappointed. I hope this article has given you something useful. ✌️
https://padymies.medium.com/getx-flutter-state-managment-cf1975ec07ba?source=post_internal_links---------4----------------------------
CC-MAIN-2022-33
refinedweb
1,310
68.5
1067 [details] nUnit tests which fail under mono When adding a XNamespace element to an XElement the element is ignored. Example: var ns = XNamespace.Get(XmlSchema.InstanceNamespace); var element = new XElement("Demo", new XAttribute(ns + "nil", true), new XAttribute(XNamespace.Xmlns + "xsi", ns)); Assert.AreEqual("<Demo xsi:nil=\"true\" xmlns:xsi=\"\" />", element.ToString()); This test succeeds under MS.NET 4 but fails under mono 2.10.6. Mono returns duplicate namespace declaration: <Demo d1p1: Also MS.NET 4 has a defferent naming scheme if the namespace is not explicitly declared. Ms uses p1 as a default prefix while mono starts with d1p1. A test class is included as an attachment. Both test succeed under MS.NET 4, but fail under mono 2.10.6. This is pretty bad for XElement performance, but I made a fix in git master d18e065 anyways. Thanks for the report.
https://xamarin.github.io/bugzilla-archives/25/2564/bug.html
CC-MAIN-2019-26
refinedweb
145
63.05
#include "avfilter.h" #include "libavutil/avassert.h" Go to the source code of this file. Definition at line 55 of file bufferqueue.h. Referenced by ff_bufqueue_add(), and ff_bufqueue_peek(). FFBufQueue: simple AVFrame. Referenced by ff_bufqueue_get(), and ff_bufqueue_is_full(). Add a buffer to the queue. If the queue is already full, then the current last buffer is dropped (and unrefed) with a warning before adding the new buffer. Definition at line 71 of file bufferqueue.h. Referenced by filter_frame(), filter_frame_main(), filter_frame_over(), and process_frame(). Unref and remove all buffers from the queue. Definition at line 111 of file bufferqueue.h. Get the first buffer from the queue and remove it. Do not use on an empty queue. Definition at line 98 of file bufferqueue.h. Referenced by ff_bufqueue_discard_all(), filter_frame(), flush_segment(), push_frame(), try_filter_frame(), and try_filter_next_frame(). Test if a buffer queue is full. Definition at line 60 of file bufferqueue.h. Referenced by ff_bufqueue_add(), and filter_frame(). Get a buffer from the queue without altering it. Buffer with index 0 is the first buffer in the queue. Return NULL if the queue has not enough buffers. Definition at line 87 of file bufferqueue.h. Referenced by filter_frame(), push_frame(), request_frame(), try_filter_frame(), and try_filter_next_frame().
http://ffmpeg.org/doxygen/trunk/bufferqueue_8h.html
CC-MAIN-2013-20
refinedweb
195
72.02
Introduction! Motivation: Resource Management As someone much wiser than me said, "Necessity is the mother of invention". To really understand what a context manager is and how can we use it, we must first investigate the motivations behind it — the necessities that gave rise to this "invention". The primary motivation behind context managers is resource management. When a program wants to get access to a resource on the computer, it asks the OS for it, and the OS, in turn, provides it with a handle for that resource. Some common examples of such resources are files and network ports. What's important to understand is that these resources have limited availability, for example, a network port can be used by a single process at a time, and there are a limited number of ports available. So whenever we open a resource, we have to remember to close it, so that the resource is freed. But unfortunately, it's easier said than done. The most straightforward way to accomplish proper resource management would be calling the close function after we're done with the resource. For example: opened_file = open('readme.txt') text = opened_file.read() ... opened_file.close() Here we are opening a file named readme.txt, reading the file and saving its contents in a string text, and then when we're done with it, closing the file by calling the close() method of the opened_file object. Now at first glance this might seem okay, but actually, it's not robust at all. If anything unexpected happens between opening the file and closing the file, causing the program to fail to execute the line containing the close statement, there would be a resource leak. These unexpected events are what we call exceptions, a common one would be when someone forcefully closes the program while it's executing. Now, the proper way to handle this would be using Exception handling, using try...else blocks. Look at the following example: try: opened_file = open('readme.txt') text = opened_file.read() ... else: opened_file.close() Python always makes sure the code in the else block is executed, regardless of anything that might happen. This is the way programmers in other languages would handle resource management, but Python programmers get a special mechanism that lets them implement the same functionality without all the boilerplate. This is where context managers come into play. Implementing Context Managers Now that we are done with the most crucial part about understanding context managers, we can jump into implementing them. For this tutorial, we will implement a custom File class. It's totally redundant as Python already provides this, but nevertheless, it'll be a good learning exercise as we'll always be able to relate back to the File class that's already there in the standard library. The standard and "lower-level" way of implementing a context manager is defining two "magic" methods in the class you want to implement resource management for, __enter__ and __exit__. If you're getting lost—thinking, "what's this magic method thingy? I've never heard of this before"—well, if you've started doing object-oriented programming in Python, you surely have encountered a magic method already, the method __init__. For lack of better words, they're special methods that you can define to make your classes smarter or add "magic" to them. You can find a nice reference list of all the magic methods available in Python here. Anyway, getting back to the topic, before we start implementing these two magic methods, we'll have to understand their purpose. __enter__ is the method that gets called when we open the resource, or to put it in a slightly more technical way — when we "enter" the runtime context. The with statement will bind this method's return value to the target specified in the as clause of the statement. Let's look at an example: class FileManager: def __init__(self, filename): self.filename = filename def __enter__(self): self.opened_file = open(self.filename) return self.opened_file As you can see, the __enter__ method is opening the resource—the file—and returning it. When we use this FileManager in a with statement, this method will be called and its return value will be bind to the target variable you mentioned in the as clause. I've demonstrated in the following code snippet: with FileManager('readme.txt') as file: text = file.read() Let's break it down part-by-part. Firstly, an instance of the FileManager class is created when we instantiate it, passing the filename "readme.txt" to the constructor. Then, the with statement starts working on it — it calls the __enter__ method of that FileManager object and assigns the returned value to the file variable mentioned in the as clause. Then, inside the with block, we can do whatever we want to do with the opened resource. The other important part of the puzzle is the __exit__ method. The __exit__ method contains clean-up code which must be executed after we're done with the resource, no matter what. The instructions in this method will be similar to the ones in the else block we discussed before while discussing exception handling. To reiterate, the __exit__ method contains instructions to properly close the resource handler, so that the resource is freed for further use by other programs in the OS. Now let's take a look at how we might write this method: class FileManager: def __exit__(self. *exc): self.opened_file.close() Now, whenever the instances of this class will be used in a with statement, this __exit__ method will be called before the program leaves the with block, or before the program halts due to some exception. Now let's look at the whole FileManager class so that we have a complete idea. class FileManager: def __init__(self, filename): self.filename = filename def __enter__(self): self.opened_file = open(self.filename) return self.opened_file def __exit__(self, *exc): self.opened_file.close() Simple enough, right? We just defined the opening and cleaning-up actions in the respective magic methods, and Python will take care of resource management wherever this class might be used. That brings me to the next topic, the different ways we can use context manager classes, such as this FileManager class. Using Context Managers There's not much to explain here, so instead of writing long paragraphs, I'll provide a few code-snippets in this section: file = FileManager('readme.txt') with file as managed_file: text = managed_file.read() print(text) with FileManager('readme.txt') as managed_file: text = managed_file.read() print(text) def open_file(filename): file = FileManager(filename) return file with open_file('readme.txt') as managed_file: text = managed_file.read() print(text) You can see that the key thing to remember is, - The object passed to the withstatement must have __enter__and __exit__methods. - The __enter__method must return the resource that's to be used in the withblock. Important: There are some subtleties I left out, to make the discussion to-the-point. For the exact specifications of these magic methods, refer to the Python documentation here. Using contextlib The Zen of Python—Python's guiding principle as a list of aphorisms—states that, Simple is better than complex. To really drive this point home, Python developers have created a library named contextlib containing utilities regarding context managers, as if they didn't simplify the problem of resource management enough. I'm going to demonstrate only one of them briefly here, I recommend you to check out the official Python docs for more. from contextlib import contextmanager @contextmanager def open_file(filename): opened_file = open(filename) try: yield opened_file finally: opened_file.close() Like the code above, we can simply define a function that yields the protected resource in a try statement, closing it in the subsequent finally statement. Another way to understand it: - All the contents you'd otherwise put in the __enter__method, except the returnstatement, goes before the tryblock here — basically the instructions for opening the resource. - Instead of returning the resource, you yieldit, inside a tryblock. - The contents of the __exit__method goes inside the corresponding finallyblock. Once we have such a function, we can decorate it using the contextlib.contextmanager decorator and we're good. with open_file('readme.txt') as managed_file: text = managed_file.read() print(text) As you can see, the decorated open_file function returns a context manager and we can use that directly. This lets us achieve the same effect as of creating the FileManager class, without all the hassle. Further reading If you're feeling enthusiastic and want to read more about context managers, I encourage you to check out the following links:
https://stackabuse.com/python-context-managers/
CC-MAIN-2021-10
refinedweb
1,436
55.13
> So the player constantly move on a diagonal direction, and the camera follow him (on x and y, it's 2d gameplay) But when the player jump, i want the camera continue to follow him but not following him on his jump movement. I don't if it's clear ! :/ Is there a way to achieve that ? Edit : my first atempt was that, but cause the player is always moving, it's not working perfectly using UnityEngine; using System.Collections; public class cameraScript : MonoBehaviour { public Transform target; public CharacterController controller; private int offSetz = -100; public float offSetx; public float offSety; private float lockPos; void Start() { } void Update() { if (controller.isGrounded) { transform.position = new Vector3(target.transform.position.x + offSetx, target.transform.position.y + offSety, offSetz); lockPos = target.transform.position.y; } else { transform.position = new Vector3(target.transform.position.x + offSetx, lockPos + offSety, offSetz); } } } have you some script that controls camera? just disable or clamp there it's Z position there is no z axis, it's 2D gameplay I edited my question ! you should note that in question 8) what do you mean in 'it's not working perfectly' Cause the player continue moving on y axis even if he is not jumping. It's a diagonal direction, so the camera stop folowing him on y, but the player still move on this axis. I want the camera to just don't move when he is jumping, but still following him on his base movement. Answer by RodrigoSeVeN · Aug 05, 2012 at 04:51 PM I think I understood. This is more of a suggestion than the best solution. As far as I get it, you need to keep the camera's x axis aligned with the player at all times, and only when he jumps, you need the y axis to stay on the surface of the ground, instead of "jumping" with the player. The best suggestion I have, is to fire a ray from the player position, only when he is jumping, towards the ground, so you can get a position on the ground to use, instead of the y axis of the player while he is jumping. Before putting any code, this system should work like this: You fire the ray during the player jump(when not grounded). You will get a vector3(the hit.point), but you will only need the y value. To make it work correctly, you need to add another value to this result, that being the approximate height of the player(this height is actually the distance of his y position in relation to the ground he is touching, let me know if this is not clear for you). You take this y value and assign it to the camera position, and the camera should move diagonally on the ground, while the player is jumping. Now for the related code. You can call a function on the camera script that only sets the y value when the player is jumping(let the camera know when it happens). Also, I'm considering your camera already have the player as a target and that your ground has a collider, so here you go. (I only work with Javascript, but it won't be hard to translate. In case someone feels like doing so, please edit this code and let us know you did it.) var target:Transform; //The player var pHeight:float=0; //The player "height", play with this to see if you need it function AlignIfJumping(){ var hit:RaycastHit; if(Physics.Raycast(target.position, -Vector3.up, hit)){ var tempYPos:float=hit.point.y+pHeight; transform.position.y=tempYPos; } } Remember, you need to call this function on the camera, only when the player is jumping and right after the camera do it's auto alignment with the player position, so the y axis position is changed correctly before the frame ends. Yeah you understood it well ! Thx you man, it's working ! If i could i would "thumb up you"... but i can't... ^^ thx again ! Answer by Seth-Bergman · Aug 05, 2012 at 02:16 PM ok.. if it's just while jumping that's the issue, you need a separate var for that, something like: void Update() { if(Input.GetButton("Jump"))//or however you choose to determine this based on your code jumping = true; if (jumping) { transform.position = new Vector3(target.transform.position.x + offSetx, target.transform.position.y + offSety, offSetz); lockPos = target.transform.position.y; } else { transform.position = new Vector3(target.transform.position.x + offSetx, lockPos + offSety, offSetz); } if(controller.isGrounded) // may need to adjust this also.. just an example jumping = false; } Of course, this all depends on when your camera should or shouldn't follow on y. If there is a certain scenario that is the issue, you could conversely simply account for that in a similar way, something like: if (!diagonalMove && !controller.isGrounded) transform.position = new Vector3(target.transform.position.x + offSetx, lockPos + offSety, offSetz); else { transform.position = new Vector3(target.transform.position.x + offSetx, target.transform.position.y + offSety, offSetz); lockPos = target.transform.position. Camera rotation around player while following. 6 Answers Getting Camera to Stop Following Player 1 Answer Fixed camera on rails. 1 Answer Camera Scripting Help (Sims Style) 0 Answers How do I let a camera follow on one axis? 3 Answers
https://answers.unity.com/questions/296660/how-to-stop-the-camera-follow-the-player-on-his-ju.html
CC-MAIN-2019-26
refinedweb
887
57.16
Details - Type: Bug - Status: Closed - Priority: P1: Critical - Resolution: Done - Affects Version/s: 5.7.1, 5.8 - Fix Version/s: None - Component/s: QML: Declarative and Javascript Engine - Labels:None - Environment:macOS Description Hello, I would like to report a bug of loading Javascript file in Qt 5.7.1. It is a library packed by using webpack. That is working fine in Qt 5.7, but it will crash Qt 5.7.1 application in loading by import statement like this: import QtQuick 2.7 import QtQuick.Window 2.2 import "./lodash.js" as Lodash Currently I have no idea what actually is the cause of problem. But I have written an example code that could reproduce the bug. It is attached. Just extract the zip file , build by Qt 5.7.1 , run, then it will crash. You may comment the import statement above then it won't happen. Moreover, the full backtrace log in Mac is also attached QML debugging is enabled. Only use this in a safe environment. Error: signal 11: 0 lodashdemo 0x0000000107925a82 _Z15handleBacktracei + 34 1 libsystem_platform.dylib 0x00007fff8c401f1a _sigtramp + 26 2 ??? 0x0000000000001400 0x0 + 5120 3 QtQml 0x0000000107e1fc05 _ZNK3QV414FunctionObject14sourceLocationEv + 5429 4 ??? 0x0000000110fdcb72 0x0 + 4580035442 5 QtQml 0x0000000107e1fc05 _ZNK3QV414FunctionObject14sourceLocationEv + 5429 6 ??? 0x0000000110fc0461 0x0 + 4579918945 7 QtQml 0x0000000107e1fc05 _ZNK3QV414FunctionObject14sourceLocationEv + 5429 8 QtQml 0x0000000107e1f8a6 _ZNK3QV414FunctionObject14sourceLocationEv + 4566 9 QtQml 0x0000000107e20a0c _ZN3QV415BuiltinFunction4callEPKNS_7ManagedEPNS_8CallDataE + 252 10 QtQml 0x0000000107e93816 _ZN3QV47Runtime12callPropertyEPNS_15ExecutionEngineEiPNS_8CallDataE + 1190 11 ??? 0x000000010d5934a6 0x0 + 4518917286 12 QtQml 0x0000000107e1fc05
https://bugreports.qt.io/browse/QTBUG-57640?gerritIssueStatus=All
CC-MAIN-2021-49
refinedweb
236
52.66
Hi all, This is a problem that has been holding me up for a while in Python. I frequently get issues relating to "global ___ is not defined" and cannot figure out what I'm doing wrong. Here is a coin-flip function I wrote: def coinflip(): import random import time heads = 0 tails = 0 flips = 0 rec = open('coin toss.txt','w') rec.write('Coin Toss Record') rec.write('\n') N = int(raw_input('Welcome to the Coin Toss! How many times do you want to flip the coin?: ')) while (flips < N): flip = random.randint(1,2) if flip == 1: heads += 1 if heads > 0: rec.write('H ') time.sleep(.1) flips += 1 else: tails += 1 if tails > 0: rec.write('T ') time.sleep(.1) flips += 1 print "There were ", tails ," and ", heads ," heads." and the script I run the function in is: import coinflip import random coinflip.coinflip() When I run the script, it will ask for the number of flips, and then I get the error "global name 'random' is not defined." There is nothing else named random in the folder for the file to get confused about, and random works in other settings, just not when I try to use it when using a function in a script. I'm sure this is an obvious fix to those with more experience, but any help would be deeply, deeply appreciated.
https://www.daniweb.com/programming/software-development/threads/188757/problem-with-imports
CC-MAIN-2018-30
refinedweb
232
81.73
This article is part of my free Java 8 course focusing on clean code principles. In this short article, we will have a quick look at the Java Comparable Interface. A PDF of this article is also available here. What is the Comparable Interface Used For? How should we compare and sort things? Now that might seem like a weird question, but I want you to really think about it. Let’s say we have a set of apples: Example 1 How do we want to sort them? Do we want to sort them by weight? If so, are we sorting them from lightest to heaviest or heaviest to lightest? When we are sorting them, we need to repeatedly compare two apples' weights until all the apples are in the correct order. Is Apple 1 heavier than Apple 2? Is it heavier than Apple 3? We need to keep doing that until the list is sorted. The comparable interface helps us accomplish this goal. Comparable can’t sort the objects on its own, but the interface defines a method int compareTo(T). How compareTo() Works Let’s begin by utilizing the compareTo() method to see which apples are heavier. Example 2 The compareTo() method works by returning an int value that is either positive, negative, or zero. It compares the object by making the call to the object that is the argument. A negative number means that the object making the call is “less” than the argument. If we were comparing the apples by size, the above call would return a negative number, say -400, because the red apple is smaller than the green apple. If the two apples were of equal weight, the call would return 0. If the red apple was heavier, compareTo() would return a positive number, say 68. The Flexibility of compareTo() If we called the compareTo() method above repeatedly, we could sort our apples by size, which is great, but that’s not the end of the story. What if we want to sort apples by color? Or weight? We could do that too. The key is that our client, let’s call him Fatty Farmer, (see Example 3), needs to precisely define how the apples need to be sorted before we can start development. Example 3 He can do this by answering these two questions: - How does he want the apples to be sorted? What is the characteristic he would like us to compare? - What does ‘less than’, ‘equal to’, and ‘greater than’ mean in that context? It’s also possible to use multiple characteristics, as we’ll see a little bit later. Example 1: Sorting Apples By Weight For our first example, we’re going to sort our apples by weight. It only requires one line of code. Collections.sort(apples); Example 4 The above line of code can do all the sorting for us, as long as we’ve defined how to sort the apples in advance (That’s where we’ll need more than one line). Let’s begin by writing the apple class. public class Apple implements Comparable<Apple> { private String variety; private Color color; private int weight; @Override public int compareTo(Apple other) { if (this.weight < other.weight) { return -1; } if (this.weight == other.weight) { return 0; } return 1; } } Example 5 This is our first version of class Apple. Since we are using the compareTo method and sorting the apples, I implemented the Comparable interface. In this first version, we’re comparing objects by their weight. In our compareTo() method we write an if condition that says if the apple’s weight is less than the other apple, return a negative number, to keep it simple, we’ll say -1. Remember, this means that this apple is lighter than Apple ‘other’. In our second if statement, we say that if the apples are of equal weight, return a 0. Now if this apple isn’t lighter, and it isn’t the same weight, then it must be greater than the other apple. In this case we return a positive number, say, 1. Example 2: Sorting Apples By Multiple Characteristics As I mentioned before, we can also utilize compareTo() to compare multiple characteristics. Let’s say we want to first sort apples by variety, but if two apples are of the same variety, we should sort them by color. Finally, if both of these characteristics are the same, we will sort by weight. While we could do this by hand, in full, like I did in the last example, we can actually do this in a much cleaner fashion. Generally, it is better to reuse existing code than to write our own. We can use the compareTo methods in the Integer, String, and enum classes to compare our values. Since we aren’t using Integer objects, rather we are using ints we have to use a static helper method from the Integer wrapper class to compare the two values. public class Apple implements Comparable { private String variety; private Color color; private int weight; @Override public int compareTo(Apple other) { int result = this.variety.compareTo(other.variety); if (result != 0) { return result; } if (result == 0) { result = this.color.compareTo(other.color); } if (result != 0) { return result; } if (result == 0) { result = Integer.compare(this.weight, other.weight); } return result; } } Example 6 In Example 6, we compare the first quality of the apples that our client prioritized, their variety. If the result of that compareTo() call is non-zero, we return the value. Otherwise we make another call until we get a non-zero value, or we’ve compared all three characteristics. While this code works, it isn’t the most efficient or clean solution. In Example 3, we refactor our code to make it even simpler. @Override public int compareTo(Apple other) { int result = this.variety.compareTo(other.variety); if (result == 0) { result = this.color.compareTo(other.color); } if (result == 0) { result = Integer.compare(this.weight, other.weight); } return result; } Example 7 As you can see, this greatly shortens our code and allows us to make each comparison in only one line. If the result of a compareTo() call is zero, we just move on to the next “round” of comparisons within the same if statement. This, by the way, is a good example of what you do as a Clean Coder. Usually, you don’t instantly write Clean Code; you start with a rough idea, make it work, and then continuously improve it until you’ve made it as clean as you can. Comparable, hashCode, and Equals You may notice that the compareTo() looks a little bit like the hashCode() and equals() methods. There is one important difference, however. For hashCode() and equals(), the order in which you compare individual attributes does not influence the value returned, however in compareTo() the order of the objects is defined by the order in which you compare the objects. Conclusion To conclude I just want to underscore how important the Comparable interface is. It is used in both the java.util.Arrays and the java.util.Collections utility classes to sort elements and search for elements within sorted collections. With collections like TreeSet and Tree Map, it’s even easier — they automatically sort their elements which have to implement the Comparable interface. {{ parent.title || parent.header.title}} {{ parent.tldr }} {{ parent.linkDescription }}{{ parent.urlSource.name }}
https://dzone.com/articles/java-comparable-interface-in-five-minutes
CC-MAIN-2017-39
refinedweb
1,230
64.51
So of course I wanted to make a highly controvertial title, how many times have we seen `the fastest algorithm EVER` before; but I needed your attention and I was successful in that! However, my title is not without justification! The title of `fastest` does NOT belong to me for EVERY size copy. Since optimizing for any one size is a tradeoff. I think the only size I was consistently outperformed in Assembler was a 16-byte copy (and possibly some other small byte combinations, possibly also 8-bytes and 32-bytes if you optimize specifically to beat these algorithms). This code is faster for copies with size > 16 bytes. For less than that I only have a 1 or 2 clock cycle penalty! But for all the other sizes, that title belongs to me! These functions will also reach your MAXIMUM memory bandwidth limits very quickly! A. (I thought I would answer this question early as it must be on your mind!) 1) This is NOT a SINGLE memcpy/memmove function, this is actually THREE separate functions with different caracteristics, algorithms and optimizations; the code will choose the best function for the CPU at runtime, each function is built specifically for 3 different CPU architectures. 64-bit processors with SSE4.2 (Core i generation without penalties for unaligned memory), older 64-bit processors (Core, Core 2 and AMD equivalents) and 32-bit processors with SSE2. If none of these features are found, the functions will fall-back to using the built-in memcpy/memmove! 2) The first time you call either memcpy/memmove, they do a CPU feature detection (CPUID) and select the most optimal function for your CPU at runtime. This is a ONCE-off penalty the first time you call them. After that, it's gravy! So there are actually 3 self contained functions here, and they will select; and use the most optimal one automatically! 3) Most built-in memcpy/memmove functions (including MSVC and GCC) use an extremely optimized QWORD (64-bit) copy loop. The apex functions use SSE2 load/loadu/store/storeu and SSE streaming, with/without data pre-fetching depending on the situation. In-other-words, everything adapts to the situation for small or large copies! 4) If you don't have SSE2, they will default to the built-in functions which use QWORD. Basically the PC has to be older than 15 years for this to happen, as P4's in 2001 already had SSE2! We detect the presense of SSE4.2; CPU's with SSE4.2 have NO penalty for reading/writing unaligned SSE data (loadu/storeu). This is more or less the Core i generation! 5) In the LARGE data copy loop, they use SSE2 streaming intrinsics, these are the fastest data copy methods; I include a high performance 4K data prefetch (CPU hint). As the function is copying, it constantly issues a prefetching command 4K ahead. This design has never been done like this before! `tiberium` (one of the functions) will pre-align the memory (to 16-byte boundaries) to avoid misaligned penalties, then execute SSE streaming on the aligned bytes! The streaming intrinsics are designed by Intel (and AMD) for high performance! You WILL copy at the MAXIMUM bandwidth throughput of your machine! 6) These functions use EVERY trick in the book! They come from a LONG family of functions. Some of the techniques and algorithms I've used have never been published before. They were developed over several months in 2013/2014. Every copy size uses a different technique. The shortest code path is optimized for `size <= 112` bytes, then `size >= 16` then the rest. So small byte copies have the shortest code path with least jumps! 7) Although these are C/C++ functions, they were `designed by disassembly` ... meaning I was paying close attention to the compiler output. This is NOT normally advisable (we don't want the compiler to dictate how we design our functions), however, when you are designing things for maximum performance, it's important to pay attention to how the code will compile! The strange layout of the functions is a testament to my close observation of the compiler output. The way instructions are ordered also prevents the compiler from making some `assumptions`! They were desgined primary on the Visual Studio 2010 compiler, however, GCC never produced worse code, so they will compile equally well (usually even better) on GCC, and probably LLCV/Clang as well! 8) An optimized assembler version of these algorithms WILL be faster (I know because I have built assembler versions), but they are sometimes harder to implement/add to existing libraries. I wanted to give a copy/paste version of code that could be used anywhere. Also, the algorithm used by these functions are what make them faster, not micro-optimizations, although I did everything I could to help the compilers build the most optimal code! 9) There are several code paths, each one optimized for a different size. Please note, I'm writing/releasing this article over 2 YEARS AFTER writing these functions!; benchmarking them on a P4, a Core laptop, a Core 2 E6600, 3rd generation i5 3550 and i7, against the best of the best algorithms I could find (including Agner Fog's excellent A_memmove() from asmlib). Originally I started by disassembling and studying the memcpy() of Visual Studio, then GCC etc. I wrote several QWORD copy implementations but struggled to outperform the built-in functions with only C code. Eventually I started to study Agner Fog's A_memmove, which I had been using for several years. One of the code paths was an AVX (256-bit) version. Eventually I re-engineered his code into C so I could analyze the algorithm (my C version of his algorithm is called avx_memcpy0 in the string.zip file). It took at least 20 functions before I could outperform Agner's code and the built-in versions, mainly through my own ignorance. Eventually after about 100 function combinations I was able to consistently beat them. So in order to prevent myself from feeling the urge to go back and re-live this dark madness, I must release what I have and hope that someone can make sense of my madness! These are only ESTIMATES taken from the original article, which did not include my fastest implementations which were yet to come; so these estimates are from older slower variations. large copy (>= 128 bytes) 32-bit = 40% faster 64-bit = 30% faster small copy (< 128-bytes) 15%~40% faster These are very old numbers! The functions included here are faster! Depending on hardware of course! To be as brief as I can; the code consists of 3 files, a header (.h), .c file for C and .cpp file for C++ using the `apex` namespace! Choose if you want the C or C++ version ... no difference in terms of performance! You don't have to worry about this; but the code uses a memcpy/memmove dispatcher function based on your CPU features (inspired by Agner Fog). This is a ONCE off penalty the first time you call the functions to detect your CPU features like SSE4.2 (Core i) and SSE2 ... and then route the function pointer to the appropriate/most optimal function at runtime. I've included 3 functions for different scenarios. But as I said, you don't need to worry about this! Just call `apex::memmove()' in C++ or `apex_memmove()` in C. They are all safe to call on overlapping data. For overlapping data they read/write in reverse direction! Note: the CPU feature dection is NOT for the SSE 4.2 instruction set, it's for the ARCHitecture of the computers with that instruction set. ie. Computers with SSE4.2 have fast `UNaligned` memory reads. Meaning they have no clock cycle penalty from using `loadu` which is to load unaligned memory. So we don't have to `align` the memory by reading 1-15 bytes first. `kryptonite` does the copies on machines that have NO penalty for UNaligned reads (eg. Core i), and `tiberium` for machines that require alignment for optimal efficiency. `mithril` is used on 32-bit + SSE2 machines, or they will default to the normal/built-in memmove()/memcpy() so they will ALWAYS be safe to copy no matter what hardware they run on! I gave my fastest functions code names, hence the names `kryptonite`, `tiberium` and `mithril`. I wanted to present these general purpose functions because I believe they could make a significant contribution to the world! `apex` is the name of my general purpose function library, which includes many other functions which are ALL faster than stdlib, GCC, MSVC etc. I have faster functions for string manipulation, lcase, ucase, strlen, strcpy etc. But I have not release any others except these two. Anyways, enjoy the madness! I uploaded this file ONLY for RESEARCH purposes, for anyone investigating and doing research on this topic! It just includes most/many of my original functions with a lot of comments. About the first 100 functions were named `sse2_memcpy##`, then I changed the naming convention to `memmove##` because the `move` test is only about 1 or 2 clock cycles! It should include many DWORD/QWORD variations as well, although I haven't even looked in the file, it has been 2 years and if I look at that file it will haunt me. Just take what you can get and be happy please! Don't ask me questions about it unless you are desperate. I don't want to be sucked into that dark world again! Actually, the `string.zip` file below should contain a more complete account of my functions, as it contains my original AVX experiments etc. Download memmove-OLD-archive.zip Read Update 5 below! This file contains the original 80,000 lines of code! Note: this is for REASEARCH purposes! Don't read this unless you wanna go nuts! This includes my original conversion of Agner Fog's `A_memmove` AVX (256-bit) function written in Assembler but converted to C source code (avx_memcpy0)! I did the conversion with line-by-line comments! Download string.zip Some OLD benchmarks, again just for posterity. Don't ask what all the numbers mean, I knew what they meant at one time. Read Update 3 below for more info. Download benchmarks-OLD.zip The file contains an `optimized` assembler version of `mithril`. `mithril` is NOT my fastest version. This was a CONVERSION of the disassembled code. Read update 2 below! Download memmove64-OLDER-asm.zip Yes, however, I'll get you 99% of the way with these functions! I give other details on this below in the section where I copied my original unpublished article from 2 years ago, but I thought I would answer this question here anyway. I included my 64-bit Assembler version of `mithril` (memmove13/mm13) function in Update 2, and you can go through and analyse the changes I made to the code. Please remember that this is now almost 3 years after I wrote that assembler code, but I'm pretty confident that it's still probably one of the fastest memmove functions ever written (since I have some highly efficient copy algorithms in it that I never published!)! An assembler version WILL be faster, however, there are several things to keep in mind. When I wrote each C function, I looked VERY closely at the disassembly (that's why you see some highly irregular things like `size = -size`, and other weird tests. I made MANY algorithmic changes based on what I saw my compiler (Visual Studio 2010) was going. You can see the implication of looking at the disassembly when you see things like (size <=112) instead of 128, because Visual Studio was not using ALL the available registers. Same thing goes for XMM0-XMM5 ... I couldn't use 2 of the XMM registers, as soon as I used 7 or 8 XMM registers Visual Studio would just f*** up the whole thing and start writing data to temporary stack variables etc. (Visual Studio I believe reserves 2 XMM registers, can't remember why). GCC would be better, but I wanted to target the `least` common denominator between them! GCC can benefit even more from some of the other algorithms I wrote, they can be found in the zip file, but they are more specific, and I wanted a general purpose, copy/paste version that would compile fast on most guys machines! So, these C algorithms were `written by disassembly`, or at least `optimized by disassembly` ... so I'm confident they will compile to very good, high enough machine code! To optimize each function took me 2~3 hours, and in most cases I could only save a few clock cycles. I'm sure a much better assembler writer like Agner Fog (who I've been in contact with) can improve them further, but then you loose the convenience of a copy/paste C code. To have a copy/paste version in C that can be added to anyone's library was a far greater importance to me. Most guys would probably not attempt to implement/replace their memmove with assembler code, but C should have a much bigger audience! So yes, an optimized assembler version is faster, but these are faster than anything you've had before! Just copy/paste and compile (and sort out anything missing from your build)! I honestly can't remember why I was doing this. I KNOW it's an UNSIGNED value and I'm using a negative, I just can't remember why I was doing it. Somewhere in my code I saw a comment about `it saves 2 clock cycles`, but this is like 3 years later, and I'm confident in the algorithm because I tested and VERIFYIED ALL memory I copied/moved to make sure my algorithm was functioning correctly. This statement had something to do with the way Visual Studio was handling the alternatives. It was a hack/trick I was using to reduce instructions. I KNOW i'm not supposed to do stuff like this, but I don't give a damn. Use the code or be slow and don't use it ... I really don't care. Just leave the instruction. It was important! Self Update: I think this is supposed to be `size = ~size` ... but I'm just not sure anymore! Why the hell was I doing this? seriously, isn't it supposed to be `size = ~size`? Why wasn't I using that instruction then?? I must end this article here and just present the code to you, or I will never finish it. I want to release this code in the hopes that it will be useful to someone/ANYONE else. Maybe MicroSoft or the GCC/LLVM/Clang/stdlib guys can get some ideas from this; even if I help them improve their versions by 5%, 10% or 20%, I feel it would have been worth the madness. I know this article is much shorter than I wanted it to be, but I find that if I go into too much detail I get lost, frustrated to explain it and just go round in circles; so even if I feel this article is not very professional (I'm not a writer) I must release it as soon as I can! May this code go forth and improve humanity! I've decided to present `mithril` to you. It's located in the zip file as memmove13 (mm13). Ah, I just remembered that I have an optimized assembler version of this function as well, I'll release it after this! Q. What is `mithril`? A. `mithril` is one of the fastest, general purpose, multi-platform (32-bit AND 64-bit) implementations I have. This is a general purpose replacement for ALL built-in memmove/memcpy implementations in ALL compilers! This function WILL outperform both Visual Studio (2010) AND GCC memmove/memcpy, as long as you have a P4 (circa 2001) or newer! Since all MY PC's are less than 15 years old, and ALL 64-bit processors have SSE2, it's pretty safe to use! You could also just put an `#if is64bit` (`#if _WIN64') test in-front of it if you really want? Or if you are really serious, you can do a CPU feature detection like above. However, this function is ALSO optimized for 32-bit as they have fewer general purpose registers (the function uses fewer variables, which uses fewer registers so it's still well suited for 32-bit machines, but maintains an optimal and high efficiency inner loop, especially for larger data). This function WILL SIGNIFICANTLY outperform BOTH MSVC AND GCC built-in functions (in 99.9% of the situations) when compiled because of the algorithm! `tiberium` and `kryptonite` above are faster because they use more registers, optimized more for 64-bit. `mithril` is my proof that you can write a general purpose memmove/memcpy function in C that outperforms the build-in ones! You just need to spend a few months writing, testing, benchmarking and optimizing it! Or you can just copy/paste and compile my code! The original mm13 code included several alternative code paths, but I've removed them here for presentation purposes. If you want to study the original mm13 then search for `mithril` in the zip file! You can copy this code into any library/namespace you have, or just leave it global! This function will do BOTH memmove AND memcpy faster than anything else you have! Enjoy! I was asked to reduce the code length of the article. So I have included `mithril` in the `apex_memmove.zip` file above! `mithril` is used for the 32-bit code when SSE2 is detected! `mithril` above was the last function I converted to assembler. It took almost 3 hours to optimize each function after compiling and disassembling. So I stopped doing it after mithril. I've given this function to Agner Fog as well, so I thought I would release it here for academic studies. I will also upload my full/final 64-bit assembler file. Please note that this file is 3 years old, and it DOES NOT include `tiberium`/`kryptonite` above, only a few versions I disassembled and optimized. You can view the following code as the fastest 64-bit assembler version I ever produced (after disassembly and cleanup)! PS: It was MUCH faster and easier to produce/test/debug/benchmark these functions in C; than in assembler! Because I could just copy/paste entire sections/blocks of code in C to test various combinations for different sizes than to write these in pure assembler to begin with! That's why I could produce 140 different variations, it would take me months to write & test all those combinations in assembler (even with copy/paste you need to make sure your registers for each block/section are still the same, I have nightmares about it!)! FOR ACADEMIC PURPOSES! I removed the <code> section that was here. The assembler listing is too long. Look inside memmove64-OLDER-asm.zip for the asm_memmove13 function! Now I've uploaded ALL the files I can find. This file includes the original article template, which was unfinished and unpublished. As well as 4 `benchmarks.xls` files. I cannot remember what the hell all those benchmarks are about. I believe the value used was my `Bpc` value `bytes-per-counter` ... so more was better I guess. I just remember that it probably took me about 20~40 functions before I could start beating other implementations. If you flip though some of the tabs in the `benchmarks` files, especially in file 2 and 3, you should see some nice graphs I was plotting to analyze the characteristics of each function. The functions were tested the most on my Core i5 and Core 2 E6600. So you should see i5 and C2, but I also used a Core i7, Core (solo) etc. for testing. I tested them on all the machines I had available to me! Also, I remember testing all the sizes from 1~128 bytes; as well as MANY various large sizes; aligned, MISaligned, UNaligned, cached and uncached! I can't even remember what the difference between MISaligned and UNaligned was. I think MISaligned means that both source and destination are BOTH on unaligned addresses!?!? I had a VERY advanced testing/benchmarking test suite but I cannot find it now! :( If I ever find it, I'll upload it here! It was VERY impressive! I'm just so sorry I can't find it now! This is complete re-write of the memmove_dispatcher() function which detects the compiler, the CPU architecture AND the CPU features. I re-wrote this function because I'm sure there will be a lot of GCC guys that want to test/benchmark my functions, and __get_cpuid() is a bit of a pain to implement. So this should be a good copy/paste version for you! Please note, you will need to ADD the code for `mithril`, `tiberium` and `kryptonite` above! You need to rename the one function from `memmove` to `mithril` when you add it. `mithril` is used on 32-bit code when the CPU has SSE2 instructions (ie. 32-bit + SSE2 = `mithril`). If it's a super old CPU, then we just default to the standard built-in memmove/memcpy functions, which usually just use QWORDS for copies! Basically, once you've implemented this function, and added `mithril`, `tiberium` and `kryptonite` to the list, you have EVERY possible combination, a COMPLETELY faster memmove/memcpy implementation no matter what CPU architecture you are running! You'll cater for every situation! These functions WILL MAXIMIZE the memory bandwidth you have, particularly for large copies; which is quite possibly one of the fastest loops in the world! Happy copying/moving! And good luck trying to beat the speed of these functions! I have already included this code in the apex_memmove.zip file! While in communication with Agner Fog, I found my final implementation of all this code. It was sitting in a file called `string.hpp` ... no wonder I couldn't find it before! This file contains my original conversion of Agner Fog's A_memcpy() function into C code, the function is called avx_memcpy0() ... that's a zero! This is a very interesting function to study! It is a conversion of the AVX (256-bit) version of Agner Fogs code, he has several code paths based on CPU features (as I do), this was the most advanced one I found at the time I wrote the functions. My original goal was to better understand his code paths/structure, so I could investigate the design further! I wrote about 23 more AVX based functions after this before giving up on AVX entirely. In theory, AVX is supposed to be faster, however, in practice, design and testing, using AVX had little or no benefit! As I said to Agner Fog, I was testing on 3rd generation Core i, so it's entirely possible that there is a significant benefit in 4th generation, but I already reached the memory bandwidth limits, so there was no benefit for me! I release all this code WITHOUT warranty! `string.zip` is released for educational/research purposes. Especially if you want to compare/understand Agner Fog's functions in C code. It's usually easier to read and understand C code than assembler! This is actually my second attempt at writing this article. My first draft was written during this dark time in my life, it was very long and detailed but was never published (until today); because I started writing it after having written 22 functions, but kept coming up with new ideas and the document fell behind the details. I'm going to copy the original article here for reference. It documents SOME of the ideas I had at the time, but remember that it was only written after writing 22 functions, so I was only 20% of the way to insanity! The fastest functions I wrote were memmove09 for "size <= 112"; and memmove40 / memmove41 for "size > 112" Also, please note that I don't want to be asked what I was thinking at the time, it was over 2 years ago and much of the detail is lost to me. I only include this article for people really researching this topic! If you are just a regular developer wanting to use the functions, don't even look at the original article! It's very confusing! ... Start of original UNFINISHED/UNPUBLISHED article ... This is the story of my journey into obsession with writing a faster memcpy() implementation, one that I hope culminates and ends with this article! My only wish is that someone, somewhere will benefit from the many days I spent writing and profiling different algorithms, from this article and from the code I present, whether directly or indirectly! I will present an SSE2 intrinsic based memcpy() implementation written in C/C++ that runs over 40% faster than the 32-bit memcpy() function in Visual Studio 2010 for large copy sizes, and 30% faster than memcpy() in 64-bit builds. For small copy sizes, the speed will vary anywhere from 15% to 40% faster for various sizes below 128 bytes. This is only one of at least 22 SSE2 memcpy() functions I've written, each one with various characteristics, such as improvements for aligned/unaligned memory, various cache prefetching schemes and improvements for various copy sizes from small size with less than 16, 32, 64 or 128 bytes or larger copy sizes. This is NOT the fastest version I've written or the most compact, as each copy size both large and small have different ways to optimize them, but this is a nice general purpose implementation to just copy/paste, with some interesting characteristics! What started out as a way to implement a faster strlen() function in C/C++ (which I did), developed into a week long obsession to write a faster memcpy(). I have analysed every single aspect of a memcpy() procedure, where every "if" or "switch" statement you add is a trade-off, and every loop or additional variable influences performance. In fact, I have so much data from days of profiling various functions, I don't even know where to begin or how to present it all, let alone the 22 SSE2 memcpy() versions I wrote and what characteristics they represent, or the 26+ other types of memcpy() functions I wrote to test other methods, ideas or aspects. In total I've written more than 50 memcpy() or related functions, some were removed because they were just specific experiments, others became the basis for further study. While searching online for faster memcpy() implementations on several developer related forums and community sites, I find one response to be the most common (and most repulsive); "just use the standard memcpy() provided by your compiler, it's already been heavily optimized". Well, I don't think anyone spouting that nonsense has ever profiled memcpy(), and I doubt they've actually tried writing a better implementation, and if they're saying something like that and actually tried to write a better one and failed, then I have no respect for their skills or opinion on the subject! Now, the reason I call this "repulsive" isn't that memcpy() is in fact slower (in MSVC) than a custom writen SSE2 implementation, it's the fact that the question being asked was about addressing a "time-critical" portion of their code, and memcpy() was in fact a "bottleneck" of sorts, and any speed ups would be beneficial to the project. One thing I must say before you continue reading, is that all my functions are purely C/C++ implementations. Why? Well the main reason is the fact that I can't use inline assembler in 64-bit builds in Visual Studio. And the project I was working on is a Windows desktop/client application, which I usually build with Visual Studio, and the server applications I build with GCC on Centos. Bessides that, my assembler days ended with 32-bit CPU, FPU and MMX instructions, about 200~250 of them but I stopped because Visual Studio didn't support 64-bit inline assembler. I use MASM and I know I could build this in MASM as a separate library and link it, but I just wanted to investigate various algorithms first, and making quick changes or copy/pasting code from the middle of a C function is a lot quicker and easier to do than Assembler! Unfortunately, there are some assumptions and things that can be done in Assembler that I just can't properly simulate in C/C++, like jump-tables. I know GCC has a fairly nice jump-table construct for C, where you can use "@@label" to put the labels in an array, but Visual Studio doesn't have this. So the closest I can get in Visual Studio is trying to make the switch statements as close to the jump-table that I want in the hopes that the compiler will see the benefit of using a jump-table internally, but I know there are some switch statements or cases that it evaluates "manually", depending somewhat on your compiler settings. I know there are some architectural differences, but I don't have an AMD to test. I only have 3 more recent Intel processors, and newer processors are all I'm interested in. Also, I did have a look at the various AMD instructions timing and latencies in Agner Fogs "Instruction tables" for the various AMD architectures, and they look really similar to Intels on never architectures. One thing I must point out, is that the SSE2 implementation I will present here uses `loadu` (unaligned load) instructions to load less than 128 bytes of data. This instruction is slower on older CPU's, however, the main issue would be copying between 17~32 bytes, it `might` be a few cycles slower, because this requires 2x 16-byte loadu/storeu instructions, not enough to compensate for the 3 cycle loadu instruction. For example, the MOVDQU (loadu/storeu) instruction which loads and stores unaligned memory on the AMD K10 (2007) uses 1 cycle for `loadu`, 3 cycles for `storeu`, and 2 cycles for MOVNTDQ (streaming). However, from Bulldozer (2011), all 3 instructions take 1 clock cycle like Intel processors from Nehalem (2008), Sandy Bridge (2009) and Ivy Bridge (2011). I try to do what I can with "prefetching" very early but I don't have an old Intel or AMD to test, my hope is that the early prefetch will overcome some of the older CPU deficiencies. But the prefetch statements represent a measurable 2% improvement even on the latest Intel CPU's! From looking at Agner Fogs Instruction tables, I think the worst case scenario is going to be the Pentium M, Core Solo, Core Duo, Merom and Wolfdale artchitectures. On Pentium M, Core SOlo and Core Duo, `loadu` is 4 cycles, `storeu` is 8 cycles and the `streaming` instruction is 4 cycles. I use the `streaming` instructions when the copy is larger than 128-bytes to bypass the CPU cache, but `storeu` is used below 128-bytes. On these CPU's, you can use the aligned MOVDQA (load/store) instructions which use 2 cycles for `load` and 2 for `store`, but that means you would need to add more checks to align <= 128-bytes. I already handle the alignment on more than 128-byte copies, but not sizes below and including 128-bytes! I do have the early `prefetching`, which could compensate, for these cases. Alternatively, you can remove the "if size <= 128" statement completely, and let the main code which also does the aligning, handle less than 128-bytes. The reason I left this in is that it's faster on newer CPU's, and it demonstrates a few interesting cases! It's just an interesting piece of code to study and analyze! On Merom (2006~2009) and Wolfdale (2007~2011), I don't know what Intel did with the `storeu` (save unaligned memory) MOVDQU instruction, but it went from 8 cycles to 9 cycles (Unless Agner's document is wrong?). However, the aligned `load` and `store` instructions MOVDQA and the `streaming` MOVNTDQ instruction are all 1 cycle now. I used Visual Studio 2010 in Release build, in general with "Full Optimization" and "Favour Fast Code". All functions were timed with QueryPerformanceCounter() over several million calls, usually lasting several minutes or hours, depending on the nature of the test. I have been running tests overnight for the past week, I would run shorter tests during the day and then create some longer tests before going to bed, and run them while I sleep. Many of the tests were scheduled to run so long that they would take months to complete. 2x 1GB buffers were allocated in 64-bit mode, and 2x 512MB buffers in 32-bit builds. I have a core i5 as my primary development machine, but I also ran my tests on an i7 and core 2 duo. The specific timings and findings on various architectures didn't interest me as much as the timings of each function in relation to each other. I stopped timing on the other machines because the trend was generally the same. I don't have an AMD to use for testing. I did try one of their suggestions in the "Software Optimization Guide for AMD64 Processors" ... which I know is a super old article, but there not many articles on optimizing memcpy(). Anyway, I tried it but I feel there are better ways to optimize in light of more recent architecture. So let me remind the reader that this didn't start out as a `scientific` study and documenting my progress wasn't on the agenda, so I've actually lost many of my early notes. But I collected so much data, and spent so many hours investigating memcpy() that I feel it would be a shame if nobody else benefited from my findings and observations, and I had no idea it would take more than a week. I started by simply profiling memcpy() with a few simple functions I found online and wrote or modified myself. All the functions I wrote have exactly the same input and output as memcpy() from the standard library. I haven't profiled GCC's memcpy() implementation, because the original purpose of this was a Windows desktop/client application. One important aspect I should point out about my method of profiling, is that the functions were all put into a function pointer array. This completely eliminates any potential "inlining" benefit these functions might have over each other, but it also puts them all on a fair playing field. All the functions in the test array, were tested over exactly the same range of data, with random source and destination addresses within the allocated buffers. Before each test for that function, srand(0) was called to reset the PRNG so that each function was using exactly the same random numbers for the src and dst addresses as all the other functions. I've run every test you can imagine. Aligned/unaligned, small/large, with/without prefetching. The data I collected was actually so massive, the results file is more than 10,000 lines. I think that instead of explaining all the results, I will try to focus exclusively on the implementation I present compared to the 64-bit memcpy(). So when we talk about "aligned" memory, we could be talking about the `alignment` of the source or destination addresses on a 16 byte boundary, or an `aligned` copy size, eg. 16, 32 or 48-byte copy. Alignment plays a significant role when copying memory with SSE2, because some instructions are designed for aligned memory only, and they have significant performance benefits. This usually applies to older technology, but I've noticed that some of the newer `low power` CPU's from Intel also have a 2 clock cycle penalty for unaligned memory. Bessides that, I have noticed that even on my i5, aligned memory has a very small performance boost. There are several reasons for this, like unaligned memory often requires the CPU to read 2x cache lines, but I won't go into too many technical details here. Many SSE2 implementations don't handle unaligned memory at all, but I feel that this really limits you, so my implementation will accept unaligned memory, and in the worst case scenario, will align the destination address, but leave the source unaligned. Since the source is the "read" address (dst is "write"), it has a worst case scenario of 4-clock-cycles per 16-byte read, but since we spread things out a bit and use prefetching, this penalty should be minimized on older CPU's anyway. No matter if you send aligned/unaligned memory, the code will align the destination address for more than 128 bytes So what is Bpc? Well, it's a funny story. When I started profiling, I would have to look at this huge 64-bit number (which was the results from calls to QueryPerformanceCounter()), and try to figure out which were the fastest functions. This became very annoying, so I eventually changed to a "bytes-per-counter" ratio. It's basically the total bytes copied, divided by the difference between start and end calls to QueryPerformanceCounter(). Think of it as "bytes-per-cycle" or "bytes-per-call" or "bytes-per-copy" or "bytes-per-counter" or whatever ... I'll just call it "Bpc" In general, the bytes copied are astronomical numbers like 2015000000000, that's trillions of bytes over several minutes. Very impractical numbers to work with, and the cycle counts are much worse, so Bpc just gives me a number like 3515.685421 Bpc, which was the peak throughput I was able to achieve! So, in order to test various copy ranges, I wrote some specific functions, and some more general purpose functions. Some functions were written with one goal in mind, others to test a range of goals, or to see how the different methods could be linked together to form the final function. I believe a fast memcpy() implementation should be fast over every range of numbers, and in many cases the best way to do that is write code specific to that range. So the number ranges are 0-16 bytes, 17-128 and then greater than 128. Within each one of these 3 categeory of sizes, there are sub-ranges. For instance, 0-16 has 1-3, 4, 5-7, 8, 9-15 and 16 bytes. Each one of these has a "best method", but then the others will suffer. It's always a trade-off! For example, to copy 8 bytes, the fastest method would be to use a single 8-byte (64-bit) `long long`/__int64/int64_t copy, but then how do you handle the rest. More tests (if's) or a loop means slower copy. Do you do 16 bytes with 1x SSE2 copy, 2x 8-byte copies or 4x 4-byte copies. A 4-byte copy loop can handle 4, 8, 12 AND 16-bytes, but it's slower than 2x 8-byte copies. Anyways, there are so many different ways to copy data, it's mind-blowing. Every time you think you've developed the "silver-bullet", there's some case that just tanks! So this category of function were written to test small size copies, generally 16-bytes or less. Some used a for-loop to copy 1, 2 or 4-bytes at a time, and others use bitwise "&". In general, the for-loop overhead slows a function down, so bitwise operations are favourable. But you can't use bitwise for all 64-bits, we are just testing very small sizes and doing one or two copies at a time. There's actually so much to say about this category, but I'm really not sure how interesting it is for others, and in the grand scheme of things, I should have spent less time trying to optimize my 16 byte copies :p This is the common `naive` 32-bit copy. The 32-bit version of memcpy() in Visual Studio absolutely, definately uses this method to copy, because my implementation had identical performance. The main differences will probably be how they copy the last 3 bytes, and how they "address" the source/destination, do they increment both pointers, or use a common offset like I do? Doesn't matter really either way on modern processors, almost all methods result in the same speed due to the processors able to do more than one operation per cycle. I also wrote a few 8-byte (64-bit) (long long) copy functions. These functions performed within 10% of the 64-bit memcpy() function from Visual Studio. But this margin is not enough to convince me they use 8-byte copies internally. It's possible that they've unrolled the loop or there might be some assembler tricks they're using to get the extra 10% boost, I'm just not sure. This was the main body of research. I have kept 22 functions. They just represent various attempts at improving different aspects of the copy. Many of them look similar, except for just a few lines, and those were the lines I was testing. I've actually lost a few of the functions, sometimes I wrote a function, and tested it, when it failed to prove its point, I removed it. I profiled both the 32-bit and 64-bit, intrinsic and function call version of memcpy(). I used "#pragma intrinsic(memcpy)" or "#pragma function(memcpy)" statement for this, maybe I'm wrong but I can honestly say that there's little to no perceivable difference between the "intrinsic" and non-intrinsic versions. Maybe someone else can find a better way of forcing the compiler to use the 2 "theoretically" different versions. Under some conditions, I was able to force different results, by adjusting the compiler settings like "Minimize Size" and other settings like disabling inline expansion etc. Under some tests, against better judgement the non-intrinsic version was always faster. There were no tests I performed where the intrinsic version was faster than non-intrinsic (function call) version! So I would actually advocate disabling the memcpy() intrinsic with the above pragma, if you have/use other intrinsics! Nothing good came from using the memcpy() intrinsic on any machine I tested! I'd be happy to be proven wrong on this, tell me what to do, what compiler settings to enable/disable, and what code to test/run that demonstrates the differences clearly! Over a 256MB range of data, copied millions of times, with random addresses, the 64-bit memcpy() was 12.5% faster than 32-bit version (2700 vs. 2400 Bpc). To put this in perspective, here are some actual results, over millions of runs and several hours of profiling: memcpy() = 2407.409763 Bpc memcpy8() = 2426.479289 Bpc ** dword_memcpy1() = 2199.207560 Bpc *** dword_memcpy2() = 2400.391856 Bpc dword_memcpy3() = 2387.596476 Bpc dword_memcpy4() = 2406.398597 Bpc memcpy() = 2703.055754 Bpc memcpy8() = 2460.156299 Bpc dword_memcpy1() = 2341.839341 dword_memcpy2() = 2340.425519 dword_memcpy3() = 2343.732592 dword_memcpy4() = 2342.167511 ** memcpy8() is a "naive" simple memcpy() implementation I wrote, which just copies a "long long" (64-bit value) in a for-loop, and trailing bytes. *** Just some notes on the dword implementations so you understand them. dword_memcpy1() uses a while-loop, but the main problem is that it decrements a "bytes-copied" counter. The other implementations are just various memory addressing methods, I wanted to see how different memory calls affect performance. Even though there are some different numbers, I would say that the other functions have basically the same performance. But a difference of 200 Bpc from 2400 Bpc to 2200 Bpc is notable! Now, that brings me to the most important observations of the methods above. ???????????????? ... END OF UNFINISHED ORIGINAL ARTICLE ... This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL) uintptr_t mem = (uintptr_t)malloc(200000); apex_memcpy((void *)(mem + 12888), (void *)(mem + 3), 16145) Program received signal SIGSEGV, Segmentation fault. apex_tiberium (dst=0x7ffff7f9e27a, src=0x7ffff7f9b025, size=18446744073709551598) at apex_memmove.c:383 383 const __m128i xmm2 = _mm_loadu_si128( (__m128i*)((char*)src - 48) ); (gdb) bt #0 apex_tiberium (dst=0x7ffff7f9e27a, src=0x7ffff7f9b025, size=18446744073709551598) at apex_memmove.c:383 #1 0x00000000004004d4 in main (argc=<optimized out>, argv=<optimized out>) at memperf.c:67 apex_memmove.c:1626:18: warning: ‘*((void *)&cpuid+8)’ may be used uninitialized in this function [-Wmaybe-uninitialized] if ( cpuid[2] & bit_SSE4_2 ) General News Suggestion Question Bug Answer Joke Praise Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
https://www.codeproject.com/articles/1110153/apex-memmove-the-fastest-memcpy-memmove-on-x-x-eve
CC-MAIN-2022-21
refinedweb
7,501
62.07
: import React from 'react'; import { Text } from 'react-native'; Your component starts as a function: const Cat = () => {}; You can think of components as blueprints. Whatever a function component returns is rendered as a React element. React elements let you describe what you want to see on the screen. Here the Cat component will render a <Text> element: const Cat = () => { return <Text>Hello, I am your cat!</Text>; }; You can export your function component with JavaScript’s export default for use throughout your app like so: const Cat = () => { return <Text>Hello, I am your cat!</Text>; }; export default Cat; Class components tend to be a bit more verbose than function components. You additionally import Component from React: import React, { Component } from 'react'; Your component starts as a class extending Component instead of as a function: class Cat extends Component {} Class components have a render() function. Whatever is returned inside it is rendered as a React element: class Cat extends Component { render() { return <Text>Hello, I am your cat!</Text>; } } And as with function components, you can export your class component: class Cat extends Component { render() { return <Text>Hello, I am your cat!</Text>; } } export default Cat; React and React Native use JSX, a syntax that lets you write elements inside JavaScript like so: <Text>Hello, I am your cat!</Text>. The React docs have a comprehensive guide to JSX you can refer - Android - Web If you’re familiar with web development, <View>and <Text>might remind you of HTML! You can think of them as the <div>and <p>tags of application development. On Android, you usually put your views inside LinearLayout, FrameLayout, RelativeLayout, etc. to define how the view’s children will be arranged on the screen. In React Native, Viewuses Flexbox for its children’s layout. You can learn more in our guide to layout with Flexbox.. State: import React, { useState } from 'react'; Then you declare the component’s state by calling useState inside its function. In this example, useState creates an isHungry state variable: const Cat = (props) => { const [isHungry, setIsHungry] = useState(true); // ... };: <Button onPress={() => { setIsHungry(false); }} //.. /> Now, when someone presses the button, onPress will fire, calling the setIsHungry(false). This sets the state variable isHungry to false. When isHungry is false, the Button’s disabled prop is set to true and its title also changes: <Button //.. disabled={!isHungry} title={isHungry ? 'Pour me some milk, please!' : 'Thank you!'} />: const Cafe = () => { return ( <> <Cat name="Munkustrap" /> <Cat name="Spot" /> </> ); }; The older class components approach is a little different when it comes to state. As always with class components, you must import the Component class from React: import React, { Component } from 'react'; In class components, state is stored in a state object: export class Cat extends Component { state = { isHungry: true }; //.. } As with accessing props with this.props, you access this object inside your component with this.state: <Text> I am {this.props.name}, and I am {this.state.isHungry ? ' hungry' : ' full'}! </Text> And you set individual values inside the state object by passing an object with the key value pair for state and its new value to this.setState(): <Button onPress={() => { this.setState({ isHungry: false }); }} // .. /> Do not change your component's state directly by assigning it a new value with this.state.isHungry = false. Calling this.setState()allows React to track changes made to state that trigger rerendering. Setting state directly can break your app's reactivity! When this.state.isHungry is false, the Button’s disabled prop is set to true and its title also changes: <Button // .. disabled={!this.state.isHungry} title={ this.state.isHungry ? 'Pour me some milk, please!' : 'Thank you!' } /> Finally, put your cats inside a Cafe component: class Cafe extends Component { render() { return ( <> <Cat name="Munkustrap" /> <Cat name="Spot" /> </> ); } } export default Cafe;>.
https://reactnative.dev/docs/0.67/intro-react
CC-MAIN-2022-27
refinedweb
624
56.55
I'd like to add in come additional comments: The You're HOT and You're Freezing aren't working I'd like them when I get closer to the number like less than 5 numbers away I get the You're HOT instead of Warm and if I'm more than 30 away I'd like a Freezing statement...right now I can only get the You're HOT to come up when I guess the right number. Thanks in advance! Munk Code: import random # handy random-number functions def run(): # pick a number in the range 1-100 mynum = random.choice( range(100) ) + 1 yourguess = 200 # what user guessed lastdist = 0 # last distance to mynum tries = 0 # number of tries so far print "I'm thinking of a number from 1 to 100." # main loop: repeat until user gets it right while yourguess != mynum: tries = tries + 1 yourguess = input("Your guess? ") if (yourguess != mynum): # find how far off you are newdist = abs(yourguess - mynum) # print warmer/colder than last time if (lastdist == 0): print "Guess again..." elif (newdist > lastdist): print "You're getting colder." else: print "You're getting warmer." lastdist = newdist # print Hot/Freezing than last time if (newdist < 5 ): print "You're HOT" if (newdist > 30 ): print "You're Freezing" lastdist = newdist # end of the if statement # repeat until user gets it right print "Good job! That took", tries, "tries." # immediate-mode commands, for drag-and-drop or execfile() execution if __name__ == '__main__': run() raw_input("press Return>") else: print "Module warmer imported." print "To run, type: warmer.run()" print "To reload after changes to the source, type: reload(warmer)" # end of warmer.py
http://forums.devshed.com/python-programming/206292-check-last-post.html
CC-MAIN-2016-50
refinedweb
277
80.11
Sea Code Years ago I heard a rumor (and I. Now SeaCode has taken this idea to a new extreme. To skirt America's annoying worker-protection and tax laws, SeaCode plans to buy a cruise ship they'll outfit with 600 Indian and Russian programmers. It'll lie at anchor 3.1 miles off Los Angeles. This inexpensive labor will be just a half hour boat ride from shore, sparing their American customers the 14 hour flights to India. According to Forbes, workers will earn $1800 per month, quite a hefty hike over the $500 they'd get in their own countries but far less than their colleagues ashore. SeaCode's web site claims that .) Jack G. Ganssle is a lecturer and consultant on embedded development issues. He conducts seminars on embedded systems and helps companies with their embedded challenges. Contact him at . His website is . Under a proclamation made by President Clinton in 1999, U.S. agencies are authorized to enforce U.S. law up to 24 miles offshore (not 3 miles). A simple further proclamation is all that is required to extend the distance to 200 miles (which is the historical U.S. claim of exclusive economic zone). I wouldn't invest in this little venture, but hey… fill your boots… – Rennie Allen Outsourcing has already been tried!!! Yes, this is indeed quite true. Before anybody smirks at me; let me remind you that in the late 1980's and early 1990's, there was this massive rush to turnkey all kinds of development to development and build-mfr teams. The end result of this effort was pretty mixed as I recall. What wound up happening was a mixed bag of results. The most successful projects were those that were well run and managed by the customers. The biggest benefit was derived by customers that had a well developed plan and idea of what was needed for their markets. Also, a well developed plan and vision for what their products were supposed to do. Who knows? maybe this current outsourcing thing may follow the same pattern of what transpired during these times. The modern day embedded consulting is generally some Sr. level engineer bringing in some new core-level technology or competence that the client company wishes to have in-house, but does not desire to 'spin-up' by themselves. Eventually, this in-house consultant will leave for other pastures/clients when the said company grows to the mid-level size and starts building a larger type of organization. – Ken Wada I cann't believe this is real !!! I suggested an idea of building offshore hospital to a friend about a year ago as a joke to beat high medical cost here. mY friend is doctor so he did not like the idea… – Manoj Punamia Love your articles ( the tech ones anyway ) This latest article seems to indicate that you are are a tribalist xenophobe. xenophobe NOUN: A person unduly fearful or contemptuous of that which is foreign, especially of strangers or foreign peoples. Of course, we can quibble over “unduly” …… I , myself , am afraid of foggy bottom which siphons the creative lifeblood out of what once was the most innovative country on earth. – Gus S Calabrese Geez, never thought off-shoring was going to be taken so literally. I understand (sort of) economics and the need for companies to save (some) money (although why not start with the hefty salaries of the higher-ups, but that's for another response). But, my big problem is: Where do I go from here? I'm stunned, especially considering the comments from some of the higher-ups at the leading technology companies. I recently read Bill Gates' comments about off-shoring and eliminating the H1-B limit altogether. The reason behind this, don't let “too many smart people” come into the country. Wellthat's just plain B.S. I don't think these rules were put in place to prevent intelligence from entering the country. We're trying to prevent the “unreasonably inexpensive” engineers from overtaking our jobs. Sorry, I just can't live on $5000 a year. Maybe Congress can lower the price for a gallon of gas to $0.15, or set a law where the cost of milk is $0.05 a gallon ” until that is done, I can't afford to make $5000 per year. I was able to witness outsourcing as close as it gets ” the mortar hit right next to my (and my coworkers) foxhole. Embedded developers from India were brought in while I was working as a contractor right in front of full-time workers and us contractors. Slowly but surely the local contractors were not renewed and new, less expensive (as was pointed out to me by the hiring manager) Indian contractors were brought in. Full-timers, seeing the writing on the wall, quickly made their escape as well. Tasks were quickly shuffled around to make sure the Indian contractors had their queues filled with work ” important work, intellectual property work, things you wouldn't want competitors to find out about. Now one or two of these guys were decent engineers ” but they weren't “smarter” than other engineers I have worked with ” sorry Mr. Gates. So, I can understand that I need to stay ahead of the curve by being a better software engineer, expanding my skills, broadening my technical background, etc. But, then shouldn't that command a higher rate/wage? That's not true in this outsourcing market. The cheaper labor is the ideal candidate for the position. Does that mean I just wasted my time learning these new skills, enhancing my technical background (and studying for years to earn my BSEE)? What field do I go into as an embedded software engineer? I thought the skills I had obtained over the decade of work experience were highly technical and very specialized making them somewhat protected from becoming obsolete and outsourced. Not so, I guess. What should I go back to school to retrain and learn? Does this mean I should go back to school to study fast food creation since they can't move the Burger King down the block out of the country? It seems all, or at least a lot, of the white-collar jobs (lawyers ” well, who cares what happens to them ” Just kidding, nurses, doctors what's next) are in jeopardy of being outsourced from some of the articles I have read. It seems I have to go back to the bottom of the working scale and un-train myself from what I have learned. – Very concerned, Embedded software engineer Seacode idea is mind blowing. I once dreamed up an idea to have Indian doctors/Pharmacies on ships around USA. It is a good solution as long as the doctors can operate on ship. Some hospitals in India have health tourism packages. You come here for a medical procedure, and then recuperate in a resort for 15 days at a small percentage of the cost in US/UK. The airfare is the only major expense at $1500 or so. Will be very cost effective for major surgeries. Consider dental work. I was in US till August 2004. I was quoted $2000 for a dental job; I got done it in India for $170 at the most costly hospital here, by the best dentist. It was the best dental job I have seen. It also included anesthesiologist. 10 years back I went to a government dental clinic in India for a crown. They asked for 4$ for the porcelain and the procedure!!! I chose not to do the procedure there and get a second opinion. I suspect their charges are still at that level. I was in the US for 5 years; they managed not to me green card in all that time. My wife, also an engineer was not allowed to work during all that time. Finally I decided to come back and brought with me lot of the engineering jobs to India. Every week 2 to 3 American companies set up their office here in India. Each company hiring a minimum of 50 engineers or so. I see no respite for American engineers as long as dollar exchange rate is 1:44. It may be just the start, doctors and lawyers will not stay immune for that long. – sameer Your joke may be harmless. But a bout of xenophobia often starts with loss of jobs. Who knows if somebody decides to cool off overheated overseas economy with some bird-flu WMD's. SARS was able to cool off overheated east asia a couple of years back.Iraq war got support because of Anthrax scare. This is a dangerous joke. – sameer What stops americans from thinking beyond borders? A similar onland site could be set up across the Mexican border, the workers need only stay for a year and all wages are tax free. Most programmers would see a 30% increase at their current level and also the exchange rate benefit. A company could go across the border, create a “Cancun” environment and all would benefit without the tubulence at sea. No three mile requiement here. – Randolph Copeland May be russians are looking for a revenge, ah? They lost the cold war and ate their tanks, submarines, ICBM etc. as one of US-presidents promised to the nation. But it seems that the tanks finished 😉 Don't forget that everything in the universe strive to reach a normal dispersion. Especially such a liquid matter as money is. Why can't you agree that paytime has come? P.S. Don't take it so serious. This situation is just a backfire to the pain(t)ball game has been started an years ago. – Kolio I can't see that those “cruise ships” are going to be particularly fun places to work. They will need armed guards and dogs to keep the “seamen” from jumping overboard and swimming for shore. – John Teller Looking at the big picture, this “offshoring” thing has been happening to many other industries before, most notably manufacturing. If you've paid notice to all those little “freebies” that can be had from all the developer exhibits you've been to you'd find the sticker “Made in China” or “Made in Taiwan” or … you get the picture. And it's not as if this situation happened to occur accidentally. Countries manipulate their currencies so that their exports are cheaper and more attractive to countries like the U.S. The offshoring of IT jobs is just another “casualty” in the bigger picture. – MikeM Joke or not, that last joke made me laugh after reading such a true but bitter tale engineers in this beautiful country are facing. It wasn't until this began did I truely understand what it meant to take good and services off shore. Your article is accurate, capitalism brought this on. The problems we face with offshoring are often glossed over. – Mark Hurley Jack, Jack, Jack! “Come into port once a month to dump sewage”??? That costs real money! Just go out 12 (or 50) miles and you can pump everything overboard for free! ;^) – Bob Dowling Let me first admit that my job is in no danger of being outsourced, and I might feel differently about the situation if it were. That said, it disturbs me how little thought is typically given to the other side of this story, which is that the outsourcing trend has dramatically improved the standard of living of countless technically-gifted workers overseas who would otherwise be just scraping by. America is a very wealthy nation, and it's easy to forget that a seasoned engineer's salary here could support several families in a developing nation. I'm no more anxious than anyone else to give up my big house and fast cars, and if there comes a time that my job was being threatened by overseas workers, I will do everything in my power to hold onto it (and, consequently, my standard of living). Americans live in a largely egocentric society, and I fit quite well into that mold. But if I were an Indian looking to support my family and enjoy some comforts in life, I would work just as hard to take that job away. There may not be a right or wrong side to this problem–as the article mentions, it's just becoming a fact of life. Globalization is an inevitable outcome for any capitalist society, given enough time and ambition. Only so many jobs can be moved overseas, and the benefits of locality, experience, and ease of communication will eventually make the lower direct cost of overseas salaries less attractive. (The indirect costs can wreak havoc on your bottom line–there's no telling how many people decided not to make their next computer a Dell based on their inability to understand the technical support representatives.) I think SeaCode is a brilliant idea, but you can be sure that if it becomes a large enough trend, many of its fiscal benefits will eventually be legislated away. I, too, think 90% is a very optimistic number for revenue returned to the United States, and can only assume that ship resupply and company profits make up a big portion of that. The best way to keep our jobs is to be more innovative, efficient, and hard working than the alternatives. While we might not like it, it's hard to blame overseas engineers for doing the same thing, or U.S. companies for trying to stay competitive in the market by taking advantage of it. There will be cases of greed and ethics lapses that unfairly shift jobs one way or another, but the guilty parties will always find some way to cheat the system–at least this one is out in the open. – Scott Winder as i have seen my engineering consulting projects slow to a dribble, and now hearing of slave labor being ok if it is 3 miles off shore, I QUIT!and i did pretty well for a while. motorola, bell labs, two patents. peak income of around 120k.i guess i am lucky that i stayed in good physical shape as i approach 60. i just took a steady job as a certified personal trainer at $7.50/hr. ( it will grow to around 25% of my old engineering income) yes. that low. some of my phd friends from the labs have taken jobs at target.and how can any ee engineer recommend engineering to a student? oh, i forgot. the students are all foreign.and just try to convince a judge that your settlement payment to x family members should be reduced out of simple fairness. ha! right!i have to sell my little house.i remember the business majors in college. i should have done more drugs and beer like they did. they seem to be doing pretty well today.its good that i have not become bitter…. – Coder There are 2 points about offshoring, one serious, one humorous. Seriously, there are a lot of hidden costs associated with offshoring, including but not limited to communication issues, quality, time to market. Many companies who have jumped into offshoring have discovered them the hard way. Humorously? If you've been paying attention over the past 20 to 30 years, you'll see that first offshoring went to Japan, then Taiwan, then Singapore, then India, then Russia. A careful plot of the past data followed by a careful projection based on that past data clearly shows that we are directly in the path. Pretty soon, it will be too expensive to offshore to anywhere but the US. – don clay “The perfection of capitalism” is a simple game called Monopoly. If you've played it you realize that there is ever only one winner.Objectives such as “CEOs have a fiduciary responsibility to reduce costs wherever they can” are a choice. Some companies (can) choose to demolish the competition or they can choose to carve out a segment that best meets the needs of their employees. Not everyone needs to adopt the WalMart model. – grant It all good and well to out source, but I'm told frequently that we'll keep leadership and management here – but could someone please tell me where we are growing these folks? When we no longer have the expertise, we will be subject to what the market will bear for the product… – Moira M. Guffey Issues like outsourcing are a direct result of globalization, which is itself just a side effect of the technological progress. Certainly, no one likes to loose a job or not being able to get paid as much as one would like. However, complaining about it is like complaining about wind or sunshine, or the month of July. These things are just there and so is globalization. Now, one can definitely see globalization as a problem, but at the same time one can see it as an opportunity. For instance, one of my friend's father, after failing to find a good enough job as a software developer has started his own company in Ukraine doing software development for US clients. Guys behind Sea Code sure see globalization as an opportunity. It is hard to say if their idea will work, but this is not the point. Right now the biggest problem with outsourcing and running companies remotely is management. This may be a good opportunity for some embedded developers who are considering working for Burger King :). Another possibility is to work in regional customer support, or so called Applied Engineering supporting customers, troubleshooting installations etc. – Sasha Even I find the trend disturbing. Getting the job is so positive, loosing it to another is painful. But then it seems to do something slowly and not so noticeably is moving towards a global village. More familiarity of culture, languages, best practises( social mostly) and tolerance. Sometimes the situation reminds me of one of my past engineering teams where I (a high-headed engg from one of the best college etc.) to my pleasant surprise found that all humans are gifted in one or the other way and left to others some jobs got better done, leaving me to focus on the ones I am good at. Basically specialize in highest quality at lowest cost. And surely it has to do with one factor : cost of living index. Labour will remain cheap and jobs would keep moving from society with high-cost of livings to those which maintain a lower one. Cost-of-living is the fundamental gradient causing the flow and it will remain in motion till a minimum level of prosperity is reached across globe. “Sarve bhavantu sukhinah …” [Sanskrit verse : May all be happy] I sit on the other shore. I see the situation of my onshore brethren with compassion. – Suresh “CEOs have a fiduciary responsibility to reduce costs wherever they can” Funny, I thought management's PRIMARY responsibility is to provide shareholders a reasonable return (both short and long term) on their money. – Dave M Ok, global economy. Remember an experiment in 6th grade – two bottles with different level of water in each, connected with a closed pipe. What happens when the pipe is opened? The liquid flows into a bottle that has lesser volume in it until the levels even out. Now, the economy does not work like that – simply because it is not a smooth process. China and Russia will not wait until they match the US in technological abilities. China already pays ethnic Chinese living (working) in US to come back and start it there. There is occasional talk in Russian circles about doing the same thing. The bottom line – American technological superiority is coming to an end. Outsourcing is only hastens it. With half the country being mortgaged to the Saudis, come on, what kind of a managering elite you are talking about? The best you can hope for is managing a hair salon, where every single piece of equipment will be “MADE IN WHEREVER”. So sad. I didn't expect it. Unless there is another technological break-through, the US will rapidly become an English-speaking Russia. Don Clay is right: Pretty soon, it will be too expensive to offshore to anywhere but the US. – memsofit I would like to reply to Gus S Calabrese: The man who leaves his house to go out looking for someone to hate is a xenophobe. The man who comes home and finds someone rummaging through the silverware and kills said person is not. It is not xenophobic to fear that your job is going overseas because some incompetent manager doesn't want to pay an engineer a decent salary. It doesn't help that our idiot President encourages the practice. It is these bufoons who think that the bottom line is the only important thing that are the problem. It has been my experience that managers in this country don't want to take responsibility for anything anymore. Well, that's their job. If they don't want responsibility, they should go to work at Wendy's. The one's who have MBA's are the worst. So, no, railing against the system that wants a “better U.S.A.” through flag waving, but insists on sending all of the good jobs overseas is not xenophobia, it's well-placed anger. I hope you would agree–unless you want us to be a nation of illiterate potato farmers in three generations. – Michael Badillo I'm replying to Michael Badillo's response: I'm offended–I'm literate, I'm Irish, and I'm a potato farmer! My family has farmed potatoes since we came to this great country 7 generations ago. Farming is a noble pursuit –working the land–feeding millions. Personally, I hope this offshoring thing keeps going so more McDonalds (another Irish financial gift to our culture that you probably hate: did you eat there last week?) open up in more countires so we can make everyone as obese as we are and fill our pockets with more money! YAY! We're a bunch of greedy, fat Irish bastards!!!!! 😐 SERIOUSLY! Why potatoes, Michael? Why not corn or soybeans? Why the slight anti-Irish slur? Are you a – GASP – ANGLOPHOBE?!?!?! I actually agree with a lot of what you say and Gus is rather misguided. But – cmon – if you're gonna nail someone for being a xenophobe then make sure that there aren't any anti cultural messages in ANY of your rhetoric. Ok? – James McPharley Mr. McPharley, I certainly didn't mean to offend anyone's culture. I'm 3/4 Irish myself. The potato farmer is a quote from S.M. Stirling's “Island in the Sea of Time” novel. It was not meant to be construed as an ethnic slur (after all, potatoes are not indigenous to Ireland), and I sincerly apologize to any who've been offended. – Michael Badillo
https://www.embedded.com/sea-code/
CC-MAIN-2021-04
refinedweb
3,844
72.56
From: Phil Endecott (spam_from_boost_dev_at_[hidden]) Date: 2008-02-09 18:40:04 My review of the proposed logging library follows. Summary: I was disappointed by the amount of code needed to get the most basic logging working. The use of macros to declare loggers seems like a bad design choice. The absence of support for syslog was surprising. I encountered many compiler warnings. The documentation was unsatisfactory. Many of the features that I would have liked to see were missing. Despite all this, John seems to be enthusiastic and responsive: there is a real chance that he will be able to fix many of these problems. Detail: In order to evaluate the library I decided to apply it to Decimail, an IMAP mail server that I wrote. It currently does some fairly basic logging of the IMAP conversation, enabled by a flag in its configuration, to syslog. Most of the programs that I've written do some sort of logging. Typically it's something as simple as: #include <iostreams> cerr << "starting to frobnicate\n"; or #include <syslog.h> syslog(LOG_INFO,"starting to frobnicate"); or #include <assert.h> assert(frob!=-1); These techniques are all very simple to use, and I feel that a logging library needs to be equally straightforward for basic operations: #include <boost/logging.hpp> log << "starting to frobnicate"; Of course it needs to offer more features than that - but the most basic use needs to be simple. (If it's not that simple, then potential users will instead just write to cerr as above; as their needs slowly grow they'll add their own ad-hoc logging functions; it will then be too late to take the leap to a logging library.) So I started by reading the main_intro.html and getting_started.html docs. I eventually got to "Example 1", which described how I had to add two new files to my project (21 lines) and call an initialisation function from main(). I could then log by changing my code as follows: if (Configuration::singleton().get_bool("imapd_log_imap",false)) { //syslog(LOG_MAIL|LOG_DEBUG,"{%d} S: * %s",num,msg.c_str()); L_ << "{" << num << "} S: * " << msg; } Having fixed one error in the example (g_l_filter vs. g_log_filter) and copious warnings I was able to see log output on the console (twice?) and in a file. This was all a lot more effort than I was expecting, but it did seem to work. I found the use of macros in example 1 unsatisfactory. Specifically, the logger "object" which I declare in the header and to which I send my log messages (L_ in the code above) is actually a macro, not an object. This means that I have to handle it with great care. For example, say I currently have: void do_something(ostream& log_to, .......) { log_to << "starting to do something"; ... } and I want to convert this to use this library. I write: void do_something(logger& log_to, .......) { log_to << "starting to do something"; ... } This fails - and probably with an incomprehesible error message. The motivation for the macro is sensible: it evaluates to something like if (l.level > current_level) l so that time-consuming functions in the log line are not evaluated if they will not actually be stored. But I would much prefer to see this optimisation made more explicit, so that the user can tell what's going on and avoid it if they want or need to: logger l; l << "message"; // wasteful if logging is disabled, but do I care - foo(l); // - because this works as expected. LOG_IF_ENABLED(l) << expensive_function(); // if I do care, I can invoke a macro explicitly #define ll LOG_IF_ENABLED(l) // or if I want conciseness I can _choose_ to do this ll << expensive_function(); Or I could do this, without a macro at all, if I were the sort of person who felt that all macros were evil: if (l.enabled()) l << expensive_function(); I think that what's practically needed to make this work is to bundle together the current filter and logger objects into a single _object_, rather than bundling them together using a macro. Next I tried to use the library's "filter" mechanism in place of the if-condition you can see above. I looked at "Step 1: Filtering the message" at workflow.html, expecting to find a filter that I could initialise with my condition (as a value, or by reference to a variable, or passing a functor or function-pointer). But it seems that all of the provided filter classes are things to provide various sorts of thread-safety. Writing my own is not difficult, though it might be more conventional to use a functor (i.e. operator()()) rather than a class with an is_enabled member [this would allow you to use things like lambda expressions, I think]. So I wrote: struct log_imap_filter { bool is_enabled() const { return Configuration::singleton().get_bool("imapd_log_imap",false); } }; Using this involved more macros: // log.hh: typedef log_imap_filter filter_type; BOOST_DECLARE_LOG_FILTER(g_log_filter, filter_type) // log.cc: BOOST_DEFINE_LOG_FILTER(g_log_filter, filter_type ) I don't know why these need to be macros. It seems to obfuscate what is going on to me. The last thing that I needed to replace my syslog call was to specify the log level, which I noticed in workflow.html under "Step 2A: Gathering the message". (The fact that I couldn't find any description of this fairly central functionality anywhere else, e.g. in any of the pages in the tutorial section, seems typical of the documentation). Based on that example, I tried: L_(dbg) << "happily debugging"; which failed to compile. I haven't worked out what I should have written. I did try it with a namespace prefix. The final thing that I looked at in detail was scoped logging. When I'm writing more detailed logging code (e.g. for debugging) I generally make it scoped, i.e. reporting interesting function entries and normally exits. I like to indent each scope by a few characters in the log output, e.g. void foo() { cerr << "foo starting\n"; for(int i=0; i<5; ++i) { blah(i); } cerr << "foo done.\n"; } void blah(int i) { cerr << " blah " << i << "\n"; // note indentation ... } I read the scoped_logs.html page, and it seems that the BOOST_SCOPED_LOG[_CTX] macro deals with the starting/ending business. Compared to my explicit start/done output above, it has the feature that the done message will be generated if the function returns using an explicit return statement or if it throws an exception. This may be an advantage or a disadvantage: with my code, the absence of the done message would suggest that an exception might have occurred. Ideally the end-of-scope log message would indicate whether it was invoked during exception handling; could that be done using compiler-magic? But why does it have to be a macro? And there doesn't seem to be any indentation or other way of matching up the start and end messages. If they were matched up, then a log file viewer tool could provide collapse/expand tree view functionality (does Purify still do something like that?). I was also surprised that no use was made of __LINE__, __FUNCTION__ etc. in the scoped logging or other macros. I also don't see any way to couple the scoped logging features with enabling and disabling logging. Specifically, I might detect that something of interest is happening and want to increase the log level within that scope: void foo() { scoped_log sl(log); for (int i=0; i<100; ++i) { scoped_enabled_logging_if s(log, i==42); blah(i); // logging enabled in here only if i is 42 } } I didn't look in much detail at the "destinations" functionality, but I'd like to note some of the features that syslog offers for files that it writes to: - Flushing of files after each message is optional. Not flushing helps performance, but it might mean that critical messages are lost before a crash. - Enormous numbers of identical messages within a short period are compressed to a single line, "last message repeated 193247 times". - Periodic "MARK" lines can be generated to show that the application is still running. Other features that I've seen in applications that do their own logging to files include: - Creating new files for each sub-process or thread, by appending a thread identifier to the filename. - Truncating individual messages to some limit (e.g. to avoid logging a rogue char* that points to a huge block of stuff with a \0 a megabyte later), or individual fields within the log message. In my quick review I didn't see any of that functionality. The rolling_file feature looks useful for long-running applications where it's necessary to move the log files (e.g. to compress them) without interrupting the process. I suggest referring to the logrotate utility for how this sort of thing is often handled on Unix servers; for example, it can be configured to send a signal to a process to tell it to close and re-open its log file with the same filename. Finally I'd like to look at how the user can control the logging. I don't see any built-in functionality for this. I have a couple of suggestions: environment variables and command-line options. An environment variable could be used as follows. The code would do something like this: g_l()->writer().write(::getenv("MYAPP_LOG_FMT"), ::getenv("MYAPP_LOG_DEST")); The programmer's choice of format and destination may or may not override the user's choice via the variables. The user could then control the format and destination when invoking the program: $ export MYAPP_LOG_FMT='%time%($hh:$mm.$ss.$mili) [%idx%] |\n' $ export MYAPP_LOG_DEST='file(debug.log)' $ myapp Firefox has something a bit like that IIRC. For command-line integration, I suggest providing an initialisation function that processes argc and argv looking for debug options, and strips them: int main(int argc, char* argv[]) { log.init(argc,argv); // modifies argc and argc // following code doesn't see debug options ... } DirectFB has something like that. Again you could use this to define formats and destinations. You could also give the user control over scoped filtering via a command-line interface. For example: $ myapp --log:default=none --log:parser=debug --log:scheduler=info The names 'parser' and 'scheduler' would match scoped log-enable blocks. I could imagine hierarchical names too. I've used one commercial C++ application that has this sort of logging (you can indicate component, log level and destination), and it proved useful. Conclusion: * What is your evaluation of the design? Breaks up the problem into a sensible set of components. Basic usage requires too much effort. Lacks many features that I would find useful. Pervasive use of macros is unappealing. * What is your evaluation of the implementation? Seems to work. Many compiler warnings do not inspire confidence in code quality. Have not reviewed the code in any detail. * What is your evaluation of the documentation? Poor. But in part, that's because it is documenting the considerable effort required to get basic functionality working. * What is your evaluation of the potential usefulness of the library? Everyone needs logging. If they do it using this library, they'll have to write a lot of code themselves to implement their own filters, destinations and so on. In practice they won't bother and will write their own ad-hoc code. * Did you try to use the library? With what compiler? Did you have any problems? Yes, with gcc-4.1 on Linux. I encountered various warnings which John has already resolved. * How much effort did you put into your evaluation? About 6 hours. * Are you knowledgeable about the problem domain? I've written and used numerous programs with logging features, but have never attempted to write a logging library. And finally, every review should answer this question: * Do you think the library should be accepted as a Boost library? No, not in its current form. Phil. 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/2008/02/133257.php
CC-MAIN-2019-43
refinedweb
2,008
65.83
Please there trying to read in the file. I have tried force quitting pythonista, I have also powered on and off. But it remembers it wants to read that file regardless. I looked in the settings for pythonista, no setting that well. I am on v1.5 Any help appreciated, I am basically locked out of Pythonista now Try entering pythonista://in Safari, this should open the app without trying to restore the file you had open. I was trying to take a lot of files I dumped with JSON and concat to a single file basically. Even reading the resulting file programmatically had errors. So, now i read them in using JSON , creating a list of dicts then use pickle to write the list of dicts to disk. All works. Can not view the pickle file in pythonista, but that's fine. Reading the resulting pickled file into memory is correct. I should have never have saved JSON files in the first place I guess Again, thanks for the help JSON is not a format where you can concat a few files and it works. If you want to stick multiple JSON structures into one file, put them in a JSON array (Python list) and dump that to JSON. @dgelessus. I was doing that. Below is the code I was using. The output is with pickle, but same API call with JSON. Was meant as a quick and dirty way to put all my JSON data from multiple files into one file. About 1200 files, which is nothing. (Just IMDB text records) Anyway, works with pickle. I assume reading a pickle file back into memory is faster than a JSON file. Hmmm, that bad word again, assume! def build_new_datafile(out_filename): import os, os.path # read each file in the dir, they have prev # been saved with json.dump. # append each read dict into a list. # then just write out the whole list. lst = [] data_dir = settings.__EXT_INFO_DIR__ for f in os.listdir(data_dir): fspec = data_dir + f if os.path.isfile(fspec): fh = open(fspec) lst.append(json.load(fh)) fh.close() #write out the new pickled file out_dir = settings.__HOME_DIR__ fspec = out_dir + out_filename fh = open(fspec, 'wb') fh.truncate() pickle.dump(lst, fh) fh.close()
https://forum.omz-software.com/topic/1952/please-help-i-have-done-the-impossible-i-can-not-open-pythonista
CC-MAIN-2021-04
refinedweb
375
85.69
Ruby, part2September 22, 2007 12:06 pm General Thanks to Ubuntu, Ruby 1.9 is available in Gutsy. And I still cannot find the way (the letter:) to unpack UTF-16. Should I wait for Ruby 4 for UTF-16 support (necessary for proper handling of id3 tags)? And I am really happy to see ruby packaged for Maemon (now – with GNOME and Hildon, hurray!) PS And lads thanks for mentioning KCODE – at least handling of UTF-8 is bearable. September 22nd, 2007 at 1:41 pm Fortunately the Ruby community is very friendly and would probably welcome your rant. I recommend the Ruby Talk mailing list. What I could find is that Unicode strings are planned for Ruby 2.0 and: September 22nd, 2007 at 4:12 pm I don’t know what you mean by ‘unpacking’, but for UTF16 I tend to use require ‘iconv’ class Iconv def self.utf8_to_utf16(str); Iconv.iconv(“UTF-16LE”, “UTF-8”, str)[0]; end def self.utf16_to_utf8(str); Iconv.iconv(“UTF-8”, “UTF-16LE”, str)[0]; end end …to convert between utf8 and utf16. September 22nd, 2007 at 10:22 pm Rutger, I mean String.unpack function (modeled after the perl’s one AFAIK). It has syntax for UTF-8 but not for UTF-16. I know about iconv (and uconv) but that’s not exactly same thing… September 29th, 2007 at 1:14 pm There is a u16tou8 method in rbuconv, that goes like this: def u16tou8(str) ret = combineSurrogatePair(str.unpack('v*')).pack('U*') ret.taint if str.tainted? ret end Would this do what you want? Some useful utf8 methods btw can be found at Cheers, jose September 29th, 2007 at 1:50 pm jose, Thanks for the snippet and the links! Very useful!
https://blogs.gnome.org/sudaltsov/2007/09/22/ruby-part2/
CC-MAIN-2017-39
refinedweb
295
74.69
A LINQ Tutorial In my earlier post, we took a first look at a Linq query against a collection of integers. In this posting, we’ll look at creating a Linq query against a collection of objects. We first need an object; we’ll create a new class: Customer. (To do this, right click on the project and select Add->Class. Name the class customer.cs). public class Customer { public string FullName { get; set; } public string Address { get; set; } public string City { get; set; } public string State { get; set; } public string Phone { get; set; } In addition to the five automatic Properties, we’ll want a property that returns a small collection of Customer objects. We’ll make this last property static so that we don’t have to have an instance of Customer to obtain it, public static List<Customer> Customers { get { var _customers = new List<Customer>( ); var c = new Customer( ) { FullName = "George Washington", Address = "The President's House", City = "New York", State = "NY", Phone = "212-555-5555" }; _customers.Add( c ); c = new Customer( ) { FullName = "John Adams", Address = "The White House", City = "Washington", State = "DC", Phone = "202-555-5555" }; _customers.Add( c ); c = new Customer( ) { FullName = "Thomas Jefferson", Address = "The White House", City = "Washington", State = "DC", Phone = "202-555-5555" }; _customers.Add( c ); return _customers; } } You can see that this property returns a collection of Customers, initialized within the property itself to three Customer objects; two of whom reside in Washington, D.C. We can now return to MainPage.cs and write the code to obtain this collection and then to query against it, public MainPage( ) { InitializeComponent( ); List<Customer> customers = Customer.Customers; var query = from c in customers where c.City == "Washington" select new { FullName = c.FullName }; foreach ( var pres in query ) { TheListBox.Items.Add( pres.FullName ); } } The logic of the query is almost identical to the logic used in the previous example. It can be read as “from the customers collection find every customer whose city is Washington and select the FullName of that object into a new (unnamed) object. The foreach loop then takes the results and iterates through each entry, extracting the FullName property that was created in the unnamed object and displaying it in the list box. Note: These examples are being kept very short to encourage you to type them in and then to play with the results; this is the best way to get a feel for the invariants in Linq. Pingback: Tweets that mention Linq with Objects: Windows Phone From Scratch #34
https://jesseliberty.com/2011/02/15/linq-with-objects/
CC-MAIN-2021-25
refinedweb
419
60.04
I have to count characters, words and lines from a text file. I am able to count characters and lines but not words. This code is error-less, but the output for words always appear 0. Anyone able to help me see what's wrong and provide a way out? And I need one more requirement. I am only able to use system calls such as open, read, write, close instead of the usual fopen, fwrite, fclose. Could you help me see how it could be changed too? Its urgent, Thank you so much. (: /* This program counts characters words and lines in a text file */ #include <stdio.h> #define Space (cur == ' ' || cur == '\n' || cur == '\t') int main (void) { /*local definitions*/ int cur; int preCh; int countLn = 0; int countCh = 0; int countWd = 0; char word = 'O'; /* When word contains the letter I, we are in a word; when it contains the letter O, we are out of a word*/ FILE *fp1; /*Statements*/ if (!(fp1 = fopen("textFile.txt", "r"))) { printf("Error in opening textFile.txt for reading"); return (1); } /* if open error*/ while ((cur = fgetc(fp1)) != EOF) { if (cur != '\n') countCh++; else countLn++; preCh= cur; } /* while */ if (preCh != '\n') countLn++; if (Space) word = 'O'; else if (word == 'O') { countWd++; word = 'I'; } /*else*/ printf("\n"); printf("Number of characters: %d\n", countCh); printf("Number of lines: %d\n", countLn); printf("Number of words: %d\n", countWd); printf("\n"); fclose(fp1); return 0; } /*main*/
https://www.daniweb.com/programming/software-development/threads/263058/problem-in-my-code-for-counting-words-from-a-text-file
CC-MAIN-2017-34
refinedweb
241
90.19
SYNOPSIS #include <tracefs.h> int tracefs_instance_file_open(struct tracefs_instance *instance, const char *file, int mode); int tracefs_instance_file_write(struct tracefs_instance *instance, const char *file, const char *str); int tracefs_instance_file_append(struct tracefs_instance *instance, const char *file, const char *str); int tracefs_instance_file_clear(struct tracefs_instance *instance, const char *file); char *tracefs_instance_file_read(struct tracefs_instance *instance, const char *file, int *psize); int tracefs_instance_file_read_number(struct tracefs_instance *instance, const char *file, long long int *res); DESCRIPTION This set of APIs can be used to work with trace files in all trace instances. Each of these APIs take an instance argument, that can be NULL to act on the top level instance. Otherwise, it acts on an instance created with tracefs_insance_create(3) The tracefs_instance_file_open() function opens trace file from given instance and returns a file descriptor to it. The file access mode can be specified, see open(3) for more details. If -1 is passed as mode, default O_RDWR is used. The tracefs_instance_file_write() function writes a string str in a file from the given instance, without the terminating NULL character. When opening the file, this function tries to truncates the size of the file to zero, which clears all previously existing settings. The tracefs_instance_file_append() function writes a string str in a file from the given instance, without the terminating NULL character. This function is similar to tracefs_instance_file_write(), but the existing content of the is not cleared. Thus the new settings are appended to the existing ones (if any). The tracefs_instance_file_clear() function tries to truncates the size of the file to zero, which clears all previously existing settings. If the file has content that does not get cleared in this way, this will not have any effect. The tracefs_instance_file_read() function reads the content of a file from the given instance. The tracefs_instance_file_read_number() function reads the content of a file from the given instance and converts it to a long long integer, which is stored in res. RETURN VALUE The tracefs_instance_file_open() function returns a file descriptor to the opened file. It must be closed with close(3). In case of an error, -1 is returned. The tracefs_instance_file_write() function returns the number of written bytes, or -1 in case of an error. The tracefs_instance_file_append() function returns the number of written bytes, or -1 in case of an error. The tracefs_instance_file_clear() function returns 0 on success, or -1 in case of an error. The tracefs_instance_file_read() function returns a pointer to a NULL terminated string, read from the file, or NULL in case of an error. The returned string must be freed with free(). The tracefs_instance_file_read_number() function returns 0 if a valid integer is read from the file and stored in res or -1 in case of an error. EXAMPLE #include <tracefs.h> struct tracefs_instance *inst = tracefs_instance_create("foo"); if (!inst) { /* Error creating a new trace instance */ ... } if (tracefs_file_exists(inst,"trace_clock")) { /* The instance foo supports trace clock */ char *path, *clock; int size; path = = tracefs_instance_get_file(inst, "trace_clock") if (!path) { /* Error getting the path to trace_clock file in instance foo */ ... } ... tracefs_put_tracing_file(path); clock = tracefs_instance_file_read(inst, "trace_clock", &size); if (!clock) { /* Failed to read trace_clock file in instance foo */ ... } ... free(clock); if (tracefs_instance_file_write(inst, "trace_clock", "global") != strlen("global")) { /* Failed to set gloabl trace clock in instance foo */ ... } } else { /* The instance foo does not support trace clock */ } if (tracefs_dir_exists(inst,"options")) { /* The instance foo supports trace options */ char *path = tracefs_instance_get_file(inst, "options"); if (!path) { /* Error getting the path to options directory in instance foo */ ... } tracefs_put_tracing_file(path); } else { /* The instance foo does not support trace options */ } ... if (tracefs_instance_is_new(inst)) tracefs_instance_destroy(inst); else tracefs_instance_free(inst); ... long long int res; if (tracefs_instance_file_read_number(NULL, "tracing_on", &res) == 0) { if (res == 0) { /* tracing is disabled in the top instance */ } else if (res == 1) { /* tracing is enabled in the top instance */ } else { /* Unknown tracing state of the top instance */ } } else { /* Failed to read integer from tracing_on file */ } ... int fd; fd = tracefs_instance_file_open(NULL, "tracing_on", O_WRONLY); if (fd >= 0) { /* Got file descriptor to the tracing_on file from the top instance for writing */ ... close(fd); }).
https://trace-cmd.org/Documentation/libtracefs/libtracefs-instances-file-manip.html
CC-MAIN-2022-27
refinedweb
654
55.24
Version 2.3 release notes The Loki team is excited to announce the release of Loki 2.3! It’s been nearly 6 months since 2.2 was released and we have made good use of that time to bring forward several significant improvements and requested features. 2.3 is also the first version of Loki released under the AGPLv3 license. You can read more about our licensing here. Some parts of the Loki repo will remain Apache-2.0 licensed (mainly clients and some tooling), for more details please read LICENSING.md. Features and enhancements - Loki now has the ability to apply custom retention based on stream selectors! This will allow much finer control over log retention all of which is now handled by Loki, no longer requiring the use of object store configs for retention. - Coming along hand in hand with storing logs for longer durations is the ability to delete log streams. The initial implementation lets you submit delete request jobs which will be processed after 24 hours. - A very exciting new LogQL parser has been introduced: the pattern parser. Much simpler and faster than regexp for log lines that have a little bit of structure to them such as the Common Log Format. This is now Loki’s fastest parser so try it out on any of your log lines! - Extending on the work of Alerting Rules, Loki now accepts recording rules. This lets you turn your logs into metrics and push them to Prometheus or any Prometheus compatible remote_write endpoint. - LogQL can understand IP addresses! This enables filtering on IP addresses and subnet ranges. For those of you running Loki as microservices, the following features will improve performance operations significantly for many operations. - We created an index gateway which takes on the task of downloading the boltdb-shipper index files allowing you to run your queriers without any local disk requirements, this is really helpful in Kubernetes environments where you can return your queriers from Statefulsets back to Deployments and save a lot of PVC costs and operational headaches. - Ingester queriers are now shardable, this is a significant performance boost for high volume log streams when querying recent data. - Instant queries can now be split and sharded making them just as fast as range queries. A very common feature requested has also been included in 2.3: Without revisiting the decisions and discussions around the somewhat controversial behavior of unhealthy ingesters, you can now decided how you would like them to be handled: manually or automatically. Lastly several useful additions to the LogQL query language have been included: - More text/template functions are included for label_formatand line_formatwith PR 3515, please check out the documentation for template functions. - Also support for math functions withing label_formatand line_formatwas included with 3434. - Two additional metric functions with some interesting use cases first_over_timeand last_over_timewere added in PR 3050. These can be useful for some down sampling approaches where instead of taking an average, max, or min of samples over a range in a metrics query, you can select the first or last log line to use from that range. Upgrade considerations The path from 2.2.1 to 2.3.0 should be smooth, as always, please check out the Upgrade Guide for important upgrade guidance. One change we consider noteworthy however is: This change now rejects any query which does not contain at least one equality matcher, an example may better illustrate: {namespace=~".*"} This query will now be rejected, however there are several ways to modify it for it to succeed: Add at least one equals label matcher: {cluster="us-east-1",namespace=~".*"} Use .+ instead of .* {namespace=~".+"} This difference may seem subtle but if we break it down . matches any character, * matches zero or more of the preceding character and + matches one or more of the preceding character. The .* case will match empty values where .+ will not, this is the important difference. {namespace=""} is an invalid request (unless you add another equals label matcher like the example above). The reasoning for this change has to do with how index lookups work in Loki, if you don’t have at least one equality matcher Loki has to perform a complete index table scan which is an expensive and slow operation. Security fixes List of security fixes for 2.3.x. 2.3.0 security fixes 2.3.0 contains an important security fix: Note Exploitation of this vulnerability requires the ability for an attacker to craft and send directly to Loki an X-Scope-OrgID header, end users should not have the ability to create and send this header directly to Loki as it controls access to tenants and is important to control setting of this header for proper tenant isolation and security. We always recommend having a proxy or gateway be responsible for setting the X-Scope-OrgID. Bug fixes Lists of bug fixes for 2.3.x. 2.3.0 bug fixes - An important fix for leaking resources was patched with 3733, when queries were canceled a goroutine was left running which would hold memory resources creating a memory leak. - 3686 fixes a panic with the frontend when use with downstream URL. Note we recommend using the GRPC Pull Model, better performance and fair scheduling between tenants can be obtained with the GPRC Pull Model..
https://grafana.com/docs/loki/latest/release-notes/v2-3/
CC-MAIN-2022-27
refinedweb
887
53.1
SYNOPSIS #include <unistd.h> ssize_t pwrite(int fildes, const void *buf, size_t nbyte, off_t offset); ssize_t pwrite64(int fildes, const void *buf, size_t nbyte, off64_t offset); ssize_t write(int fildes, const void *buf, size_t nbyte); DESCRIPTION The If the number of bytes is 0, On a regular file or other file capable of seeking, the actual writing of data proceeds from the position in the file indicated by the file offset associated with the specified file descriptor. Before successful return from On a file not capable of seeking, writing always takes place starting at the current position. The value of a file offset associated with such a device is undefined. If the O_APPEND flag is set for the file descriptor, the file offset is set to the end of the file prior to each write and no intervening file modification operation occurs between changing the file offset and the write operation. If a If Writes larger than SSIZE_MAX are unsupported. After a - Any successful read()from each byte position in the file that was modified by that write returns the data specified by the write()for that position until such byte positions are again modified. - Any subsequent write()to the same byte position in the file overwrites thread to block, but on normal completion, it returns the request size, indicating that all data has been written. - If the O_NONBLOCK flag is set, write()requests are handled as follows: - The write()function does not block the thread. - For a write request of PIPE_BUF or fewer bytes, if there is sufficient space available in the pipe, write()transfers all the data and returns the number of bytes requested. Otherwise, write()transfers no data and returns -1 with errno set to EAGAIN. - For a write request of more than PIPE_BUF bytes, when at least one byte can be written, as much data as possible is transferred, and the number of bytes written is returned. Otherwise, no data is transferred, and write()returns -1 with errno set to EAGAIN. When attempting to write to a file descriptor (other than a pipe or FIFO) that supports non-blocking writes and cannot accept data immediately: - If the O_NONBLOCK flag is clear, write()blocks the calling thread until data can be accepted. - If the O_NONBLOCK flag is set, write()does not block the process. If some data can be written without blocking the process, write()writes what it can and return the number of bytes written. Otherwise, it returns -1 with errno set to EAGAIN. If the O_SYNC bit has been set, write I/O operations on the file descriptor complete only after the data has been flushed to the mass storage device. Upon successful completion, when the number of requested bytes is greater than 0, The The PARAMETERS - fildes Is the file descriptor of an open file to write to. - buf Is an array of data to write to the open file. - nbyte Is the number of bytes to write to the file. - offset Specifies the point in the file where pwrite()or pwrite64()begins writing. RETURN VALUES If successful, these functions return the number of bytes written to the open file descriptor fildes. The number of bytes written never exceeds nbyte. Otherwise, these functions return -1 and set errno to one of the following values: - EAGAIN The O_NONBLOCK flag is set for the file descriptor and the thread would be delayed in the write()operation. - EBADF The fildes parameter is not a valid file descriptor open for writing. - EFAULT The buf parameter is not a valid pointer. - EFAULT buf points outside the allocated address space of the process. - EFBIG An attempt is made to write a file that exceeds the file size limit of the process. - EFBIG The file is a regular file, nbyte is greater than 0 and the starting position is greater than or equal to the offset maximum established in the open file description associated with fildes. - EINTR A signal interrupted the call to write(), pwrite(), or pwrite64(). - EIO A physical I/O error has occurred. - ENOMEM Insufficient memory exists to complete the request. - ENOSPC There is no more free space on the device that fildes refers to. - ENXIO A request was made of a non-existent device, or the request was outside the capabilities of the device. - EOVERFLOW For pwrite()and pwrite64(), the specified offset would cause a write beyond the 2 GB boundary. - EPIPE An attempt is made to write to a pipe or FIFO that is not open for reading by any process, or that has only one end open. A SIGPIPE is also sent to the thread.FBIG error condition to be returned can be disabled by using the While the UNIX 03 specification states that AVAILABILITY MKS Toolkit for Professional Developers MKS Toolkit for Enterprise Developers MKS Toolkit for Enterprise Developers 64-Bit Edition SEE ALSO - Functions: creat(), dup(), dup2(), fcntl(), ioctl(), open(), pipe(), read(), readv(), socket(), writev() MKS Toolkit 9.2 Documentation Build 16.
http://www.mkssoftware.com/docs/man3/write.3.asp
crawl-001
refinedweb
828
59.53
UnSignpost:UnSignpost/20131217 From Uncyclopedia, the content-free encyclopedia December 17th, 2013 • Issue #196 • Archives • Press Room Where is the UnSignpost? No, it's not there. Seriously, where is it? Is it under your bed? Just look under it. Yeah, it's not there?! Right. Where else can it be? Think! This problem should be solved! We cannot go on without the UnSignpost: it's like a vital part of our community or something. It's hard to formulate thoughts, especially after the journalists stop formulating them for you. Yeah, and where are the journalists, by the way? You're not a journalist, are you? Why are you not a journalist, then? Hey, it looks like you don't care about our site! I mean, you are not supposed to, but this is at least something I can say. And this is what everyone says anyway. And a good newspaper should reflect people's opinion or something. And I don't think I can say something that I cannot say. Or can I?! Check under your bed again, it might be there now. How would it get there?! Well, flyers can fly around, that's what they are made for. Oh, yes, maybe the UnSignpost flew away. That's an idea. Have you progressed in your research? Aliens!!! . UnSignpost receives its own namespace!)! VFH Nominations and Features Top Feature of the week Top VFH Nominations - South American dreadnought race (6/0) - Bible Collector's Edition (5/0) - numbers (5/0) From User_talk:PuppyOnTheRadio The new UnSignpost journalists have found out a 2011 UnSignpost article about you and we now have some questions: - Do you really have issues? - Do you really smoke fungus? Or only sandwiches? - How did the UnSignpost influence your entire life? Anton (talk)) 20:24, November 12, 2013 (UTC) - Oh. Yeah, in the corner. Under the Anarchists handbook, the Satanic verses and the 23 copies of Catcher in the rye. • Puppy's talk page • 08:30 pm 12 Nov 2013 From User talk:Simsilikesims - Journalist:Simsie, would you like to be called administress? Anton (talk) 15:11, October 31, 2013 (UTC) - No, because I was under the impression that administrator is a unisex term. Besides, administress just sounds odd. -- Simsilikesims(♀GUN) Talk here. 08:33, November 1, 2013 (UTC) - Some odd user Oh... can I be called a useress? - On second thought, admistress does have a nice ring to it. -- Simsilikesims(♀GUN)GUN) Talk here. 14:35, November 2, 2013 (UTC) - When you were a child, did you wish to become a user on Uncyclopedia? Anton (talk)GUN) Talk here. 18:45, November 1, 2013 (UTC) - Journalist: You mean that I do not know when the Internet was invented?! I really do: it was during the second half of the 18th century! - Passing Star Trek Fan: Let me guess, Journalist: Invented by a team of Russian scientists. Just outside Leningrad. Spıke :17, November 2, 2013 (UTC) - Will a gasoline and oil-burning model with a "Star Fleet Academy" sticker on it do? I'll trade it to you in exchange for a brand new model. -- Simsilikesims(♀GUN) Talk here. 14:32, November 2, 2013 (UTC) - Journalist: Would you sell it to me for free? Anton (talk) 19:01, November 5, 2013 (UTC) - F.O.B. Seattle, I reckon. (Translation: Come and get it.) Spıke Ѧ 19:10 5-Nov-13 - Afraid not - it has sentimental value - I've had it for 18 years. -- Simsilikesims(♀GUN) Talk here. 19:12, November 5, 2013 (UTC) - Journalist: It also has a sentimental value for me. I've dreamed of it for 18 years. Anton (talk) 19:14, November 5, 2013 (UTC) - Well, if your dream is to spend more than it is worth in salvage value on maintenance, I'll keep you in mind next time I can afford a replacement. -- Simsilikesims(♀GUN) Talk here. 23:18, November 5, 2013 (UTC)
http://uncyclopedia.wikia.com/wiki/UnSignpost:UnSignpost/20131217
CC-MAIN-2016-26
refinedweb
650
78.35
liform-react: a form generator from JSON schema released: Our needs were quite specific, as we were writing a quite long “Wizard” form, so we wanted it to be flexible enough to accommodate this usage. Also, we wanted: - Integration with redux-form, a great form library, that allows to manage the form state in Redux a sane way. - Be able to customize widgets and the form itself in a great way. - Integrate JSON schema validation, with ajv. There are other generators out there, being perhps Mozilla’s React react-jsonschema-form the most popular, but it lacked some of the requirements, so we wrote our own. How to use it? import React from 'react' import { createStore, combineReducers } from 'redux' import { reducer as formReducer } from 'redux-form' import { Provider } from 'react-redux' import Liform from 'liform-react' const reducer = combineReducers({ form: formReducer }) const store = createStore(reducer) const schema = { 'type':'object', 'properties': { 'title': { 'type':'string', 'title': 'Title' }, 'type': { 'enum':[ 'One','Two' ], 'type':'string', 'title': 'Select a type' }, 'color': { 'type':'string', 'widget': 'color', 'title': 'In which color' }, 'checkbox': { 'type':'boolean', 'title': 'I agree with your terms' } } } } return ( <Provider store={store}> <Liform schema={schema} onSubmit={(v) => {console.log(v)}}/> </Provider> ) And this will produce this form. As you can see, the default theme is written in Bootstrap. This is not the theme we actually use, ours is quite specific. But you aren’t in any way tied to Bootstrap here, and you are more than welcome to write your own widgets and entire themes if you wish so. Check out the docs at to learn more about its features and how to use it! Enjoy! PS: If you happen to work with PHP you may have a look into this other post, about generating JSON schema from Symfony forms, as we have also written a library for this.
http://nacho-martin.com/liform-react-form-generator-json-schema.html
CC-MAIN-2017-26
refinedweb
304
57.81
Thermos FUNtainer 12oz 355ml bottle Name Tag Published 2019-09-12T03:20:14+00:00 Thermos FUNtainer 12oz 355ml bottle Name Tag Published 2019-09-12T03:20:14+00:00 My Daughter did not want a name tag attached to the handle..... sigh.... designed this to fit in the hinge of the Thermos FUNtainer 12oz 355ml bottle, Might also fit the 16oz 470ml bottle, but i don't have one to test, please leave a comment if you try i on the 16oz 470ml bottle. blank stl provided so that you can put your own name on it. designed in FreeCAD, curved name/text added in Blender to add name/text in blender 2.8 file > import > stl on the right, Context/Scene > Units > Unit Scale 0.001, Length Millimeters on top Overlays > 0.001 Add > Curve > Circle Context/Object > Scale, for X Y and Z to 33.75 add > text tab to edit text, Context/ObjectData > Font > Size 7.5 (adjust accordingly) Context/ObjectData > Extrude 2mm (or more) Context/Object > Rotation X 90, Rotation Z 180 i like to duplicate the text object at this point, select text, on top left, Object > Convert to > Mesh from Curve....text press "tab", drag mouse to select all the text object, press "x" on keyboard, > Limited Dissolve, "tab" to exit edit mode Context/Modifiers > Add Modifier > Deform > Curve Object > select the circle object, by default BezierCircle click on mode mode on top left, move to make it bigger along the circle, and mode to desired location. "Apply" when ready hide the text object click on the Thermos NameTag blank ocbject, to make a hole Context/Modifiers > Add Modifier > General > Boolean > Difference, object, select the mesh Text, apply delete all object , except for the tag, file > Export > STL import into slicer, print! TIP: to fit the tag to the bottle, do not try to bend the retaining tip, they will break, instead, with the name tag facing you, hold the back with your fingers, and press down on the middle (where the text are), with your thumb, this will flex the whole thing, and will make the retaining tip go further apart, put in one side first, then the other, and release,... FreeCad file included printed standing up with no support, but a little bit of cleaning was required under the retaining clips. (PETG is recomended over PLA on this orientation) for maximum strength, print with text facing up, with support, with 0.15 layer height, with a high wall line count, like 10, i use 15. Might need to sand the edges and corners a bit afterwards. if annealing PLA. scale it up o compensate for shrinkage, for mine it was 105.4% - 105.5%, but all pla are different, annealing done in 110 degress C, over 20 min, with support still attached.
https://www.myminifactory.com/object/3d-print-thermos-funtrainer-12oz-355ml-bottle-name-tag-100860
CC-MAIN-2019-47
refinedweb
471
64.85
Remove duplicate from sorted array How to remove duplicate from sorted array? You can use int counters, but you are not allowed to decalre another array. Mark Thursday, March 13, 2003 I am not sure if you are asking how to do this. But if you wanted to a solution I can provide 1. Since it is a sorted array any duplicates would be next to each other. So start at the beginning and compare each element to it neighbor on its right. If there are no duplicates then you have made n-2 comparisons and you are done. If you find a duplicate you are going to have a hole. Since it is an array an not a link list you will need to move every element down. (You could create a new array if that was allowed.) However you do not just want to start moving everything down, you can simply mark with a pointer or counter where the hole is and move on to the next comparison. When you get the next non-duplicate you move(copy) that element into the hole and increment your hole counter by 1. So here is some C code that will do just that. //Returns false on errors bool bRemoveDuplicates(int array[], int iSize){ if(iSize <1) return false; if(array == NULL) return false; if(iSize == 1) return true; int left_comp = 0; int right_comp = 1; bool start_move = false; int hole = iSize; for(; right_comp <iSize;right_comp++,left_comp++){ if(array[left_comp] == array[right_comp]){ if(!start_move){ start_move = true; hole = right_comp; } } else if(start_move){ array[hole++] = array[right_comp]; } } for(;hole<iSize;hole++){ array[hole] = 0; } return true; } void main(){ int array[] = {1,1,1,1,1,1,1,1,2,2,4,5,7,8,8,9,9,10,11,11,12,13,14}; int iSize = sizeof(array) / sizeof(int); int i; cout<<"Before List"<<endl; for(i=0;i<iSize;i++) cout<<array[i]<<" , "; if(!bRemoveDuplicates(array,iSize)){ cout<<endl<<"Error Occured"<<endl; } cout<<endl<<"After List"<<endl; for(i=0;i<iSize;i++) cout<<array[i]<<" , "; cin>>i; } Jacob Blumberg Thursday, March 13, 2003 Great. I was trying solution based on same line, but my logic was not flawless. Thanks again. (This was my first question on this site, While I'm preparing for job interview, you will more questions like this) Mark Friday, March 14, 2003 How about this? /* * 'a' is the array * 'n' is the number of elements in the array * Returns the number of elements in the array after * removing duplicate elements */ int unique(int *a, int n) { int i, k; k = 0; for (i = 1; i < n; i++) { if (a[k] != a[i]) { a[k+1] = a[i]; k++; } } return (k+1); } int main() { int a[] = {1, 1, 2, 2, 3, 3, 4, 4, 5, 5}; int n; n = unique(a, 10); for (i = 0; i < n; i++) printf("a[%d] = %d\n", i, a[i]); } Shiva Monday, March 24, 2003 I see, you are just doing the opposite of what I did, instead of keeping track of where they are equal you assume they are equal and make the special case when they are not. The question comes down to are there going to be more duplicates than not. Statistically there should be less duplicates if the numbers are completely random and span the full integer range. However if there are more duplicates you algorithm will run better. You are also making needless assignments in the case that there are no duplicates. You should also declare I in main and check your input for errors :) (nit picking) But it provides a bit cleaner approach. Jacob Blumberg Monday, March 24, 2003 I wonder if anyone remembers how to use pointers anymore. Seems to be a lost skill. Anways, lets make the problem simpler, by assuming that arrays of numbers are zero terminated (like C strings). Then I'd probably be thinking along these lines. int i, * p, * q ; for (i= *ablock, q= p= (ablock +1); (* q); q ++) { if (* q != i) { i= * q ; if (q != p) { *p= i ; } p ++ ; } } if (p != q) * p= 0 ; But that's not very readable. What I'd actually write since most likely sometime later in the future I'd be coming back to this and wonder what I was thinking should look more like this: /*** unique test a zero terminated array for consequtive duplicate values modifies array to only hold unique entries */ void unique(int * ablock) { int curval ; int * p, * q ; ASSERT(ablock != NULL) ; ASSERT(* ablock) ; // loop through looking for unique values for (curval= *ablock, q= p= (ablock +1); (* q); q ++) { if (* q != curval) { curval= * q ; // relocate value if new array is shorter if (q != p) { *p= curval ; } p ++ ; } } // terminate new list if shorter if (p != q) * p= 0 ; } This is pretty streamlined, assumes writes are kind of expensive, and will handle any valid array with one or more elements in it. Now as to testing it, you want to exercise a couple of different cases and make sure to get all the boundary conditions (no dups, dups at the end, dups at the begining, etc.) int main(int, char **) { int testa[]= { 1, 2, 4, 6, 7, 8, 9, 12, 15, 19, 0 }, testb[]= { 1, 1, 1, 4, 5, 9, 9, 10, 10, 12, 15, 18, 20, 0 }, testc[]= { 1, 2, 4, 5, 6, 8, 8, 8, 8, 8, 0 } ; int * p ; unique(testa) ; for (p= testa; (* p); p ++) { printf(" %d, ", * p) ; } printf("\n") ; unique(testb) ; for (p= testb; (* p); p ++) { printf(" %d, ", * p) ; } printf("\n") ; unique(testc) ; for (p= testc; (* p); p ++) { printf(" %d, ", * p) ; } printf("\n") ; } That should cover it. Derek Woolverton Wednesday, April 9, 2003 Recent Topics Fog Creek Home
https://discuss.fogcreek.com/techinterview/1070.html
CC-MAIN-2020-05
refinedweb
949
67.28
09 December 2010 19:42 [Source: ICIS news] TORONTO (ICIS)--RAG-Stiftung, the majority owner of Germany-based specialty chemicals major Evonik, on Thursday welcomed a key European Commission move to allow the country to continue subsidising its hard coal industry through 2018. “We welcome this move to phase out hard coal production in a socially acceptable manner, and we are confident that the Council will give its agreement,” RAG CEO Wilhelm Bonse-Geuking said in a short statement to ICIS. The Commission’s decision is still subject to approval by the Council of Ministers, expected on Friday. Under earlier proposals, the Commission had insisted on a phase-out of the subsidies four years earlier by 2014, which would have put pressure on RAG to sell off its main asset, Evonik, much faster than planned. Union officials had warned that a 2014 phase-out could hit jobs at Evonik. Under German legislation from 2007, RAG-Stiftung was set up as a coal foundation to oversee the phase-out, to be completed by 2018. Proceeds from the eventual sale of Evonik are meant to cover billions of euros in environmental costs related to the closure of the coal mines. Bonse-Geuking said RAG was confident it would be able to comply with the Commission’s terms and condition for a 2018 phase-out, without cutting job cuts. Evonik media officials did not respond to a request for additional comment. Commentators said ?xml:namespace> While RAG is Evonik's majority owner, private equity firm CVC owns a 25.01% minority stake in Evonik which it bought in 2008 for €2.4bn ($3.2bn). ($1 = €0.75)
http://www.icis.com/Articles/2010/12/09/9418202/evonik-owner-rag-welcomes-key-eu-move-on-german-coal.html
CC-MAIN-2013-48
refinedweb
274
56.39
Contents hide field changes in ticket history Description hide field changes in ticket history. Bugs/Feature Requests Existing bugs and feature requests for HideFieldChangesPlugin are here. If you have any issues, create a new ticket. Download Download the zipped source from here. Source You can check out HideFieldChangesPlugin from here using Subversion, or browse the source with Trac. Example click a hide field button, the field is not shown. to show again, click Hide fields button then uncheck it.27] by matobaa on 2013-01-11 17:17:13 - HideFieldChangesPlugin: PEP8 cleanup - [11326] by matobaa on 2012-02-25 16:42:14 - HideFieldChangesPlugin: use own namespace for htdocs Author/Contributors Author: matobaa Maintainer: matobaa Contributors: Attachments (3) - before.png (46.6 KB) - added by matobaa 2 years ago. to hide fields - after.png (35.9 KB) - added by matobaa 2 years ago. field is not shown - to_show.png (48.5 KB) - added by matobaa 2 years ago. to show again, click hide fields, unselect, then submit. Download all attachments as: .zip
http://trac-hacks.org/wiki/HideFieldChangesPlugin?version=1
CC-MAIN-2014-10
refinedweb
171
61.02
Where do things go? Now that we know how to define a class, and how to implement its methods, lets look at where things go. Note: These things are conventions in real life, but for me (and that means for you in this class) they are unbreakable rules! Rules: The class defintion belongs in a header file (.h), that has the exact same name and capitalization of the class. Example: Hello.h The class implementation belongs in a source file (.cpp) that has the exact same name and capitalization of the class. Example: Hello.cpp The header file will be guared against multiple inclusion with the #ifndef ... #define .. #endif construct The source file will always include its own class definition (e.g. #include "Hello.h" ) This way, there are always 2 files for each class (exception: pure virtual classes). Note: If you use eclipse you can have ecplise create these files for you (say New / Class) To start the program, we still need a main() function. This function should go into its own file, preferably something like "main.cpp". In good OO programs this function is very short! Example: #include "SomeClass.h" int main() { SomeClass *myInstance = new SomeClass(); myInstance->start(); delete myInstance; return 0; } Remember to always include things where there are used! Because I love graphics, here's another graphic showing the same thing: But enough theory, here is a complete example: #ifndef HELLO_H_ #define HELLO_H_ class Hello { private: bool formal; public: void greeting(); void setFormal(bool f); bool getFormal(); }; #endif /*HELLO_H_*/ #include "Hello.h" #include <iostream> using namespace std; void Hello::greeting() { if (formal) cout << "Hello, nice to meet you!" << endl; else cout << "What's up?" << endl; } void Hello::setFormal(bool f) { formal = f; } bool Hello::getFormal() { return formal; } #include "Hello.h" int main() { Hello *h = new Hello(); h->setFormal(true); h->greeting(); delete h; return 0; }
https://max.berger.name/teaching/s06/script/ch11s02.html
CC-MAIN-2021-21
refinedweb
309
65.22
onrails.org 2014-02-28T16:36:33-08:00 Daniel Wanja d@n-so.com Archiving OnRails.org 2012-11-26T00:00:00-08:00 <p>Since I started blogging on my <a href="">corporate blog</a> I neglected this blog. It is a little ironic as I’m doing more Rails work than ever and I have a few blog posts comming up. I contacted <a href="">Lee Marlow</a> and <a href="">Solomon White</a>, my long time cohosts of this blog and authors of some of the most famous blog entries of this blog, and we decided to put it in <em>archival</em> mode. We won’t add new entries but thought that as there was some good and now historical material we could just keep around.</p> <p>Enjoy!</p> <p>- Daniel.</p> I'm leaving Flex and it's not because of HTML5. 2012-06-01T00:00:00-07:00 <p>Note I cross posted this entry on my <a href="">new blog</a>.</p> <p <a href="">Australian Open Tennis Vault</a>, the <a href=""><span class="caps">NCAA</span> Vault</a>. I even co-authored a <a href="">Flex on Rails"</a> book.</p> <p <a href="">Rubymotion</a>. The cheer fact of being able to build iOS apps with the iOS <span class="caps">SDK</span>.</p> <p!</p> <p.</p> <p>And what about Flex mobile which is pretty awesome and is a great way to build iOS and Android apps for the enterprise? You may not know this, but I have been an Objective-C developer in the mid-90 on NeXTStep and followed the <span class="caps">WWDC</span> conference since many years before the iOS <span class="caps">SDK</span> was announced. Again I love Ruby and the iOS <span class="caps">SDK</span>,.</p> <p>Now will I still recommend Flex to anyone? The answer is clearly yes as there are still many situations and projects where Flex is a great match. At least until a good HTML5/JavaScript framework can provide the same productivity than with the Flex <span class="caps">SDK</span>. All the current <span class="caps">HTML</span> frameworks will evolve and morph drastically over the coming years. Which is a good reason to choose Flex if you want stability. These <span class="caps">HTML</span> frameworks will take several years to mature. This said I really enjoy Backbonejs, Spinejs, Ember-js and how they try to make development of Rich <span class="caps">HTML</span> Applications easier.</p> <p>So, here we go. Good bye Flex!</p> <p>- Daniel Wanja</p> UndoManager for ActionScript 2012-02-27T00:00:00-08:00 <p>UndoManager is A simple ActionScript library to add undo/redo functionality to your Flex/ActionScript projects. I just extracted this library from one of the project I’m working on.</p> <p><a href="">Read more on my new blog</a></p> <p>Enjoy!<br /> Daniel</p> Dentaku a calculator for Ruby 2012-01-26T00:00:00-08:00 <p>I.</p> <p>The result is Dentaku, a gem that parses and evaluates Excel-like formulas, allowing the use of named variables that will be substituted for real values at run time. So far, the result values will be either boolean or numeric, but strings will probably be added soon.</p> <p.</p> <p?</p> <p>We could create the following rules:</p> <pre><code> +-------------------------------+----------------------+ | conditions | points | +-------------------------------+----------------------+ | admin | 100 | | normal and age_in_weeks < 5 | age_in_weeks | | limited and age_in_weeks < 5 | 1 | | normal and age_in_weeks >= 5 | age_in_weeks + bonus | | limited and age_in_weeks >= 5 | 1 + bonus | | blacklisted | 0 | +-------------------------------+----------------------+ </code></pre> <p>Then, given a hash representing the user like:</p> <typo:code user = { :admin => false, :normal => true, :limited => false, :blacklisted => false, :age_in_weeks => 10, :bonus => 8 } </typo:code> <p>we could calculate the points for a vote by the represented user like so:</p> <typo:code def calculate_points_for(user, rules) calculator = Dentaku::Calculator.new rules.each do |rule| if calculator.evaluate(rule.conditions, user) return calculator.evaluate(rule.points, user) end end <ol> <li>no rules matched, default to zero<br /> 0<br /> end<br /> </typo:code></li> </ol> <p>So that’s what Dentaku is about — I hope someone else finds it useful. You can check it out, fork it, etc at the <a href="">Dentaku</a> Github page, or just `gem install dentaku` and start playing!</p> Adobe's Announcement on Flash: visually! 2011-11-21T00:00:00-08:00 <p>I’ve received so much feedback from many of my friends on Flex projects being cancelled or scheduled to be rewritten in another technology than Flex. Great Job Adobe, you did it!</p><p>So what was really announced last week is the following:<br /> <img src="" alt="" /></p><p>Yes, Adobe will stop development on the Flash Player in the Browser.<br /> Flash Player on the mobile will continue.<br /> Adobe <span class="caps">AIR</span> will continue, on the desktop and mobile.<br /> Captive runtime of <span class="caps">AIR</span> allows to create “native” apps on mobile and tablets (Android, iOS and more) and desktop WIndows and <span class="caps">OSX</span> apps that don’t need <span class="caps">AIR</span> to be distributed. Yep, that continues too.</p><p>Of course Adobe tried to clarify their statements after the fact saying the transition to HTML5 will take 3 to 5 years. The following is from Adobe’s website from Andrew Shorten & Deepa Subramaniam, see: <a href=""></a></p><p><strong>You said that you believe <span class="caps">HTML</span> is the “long-term solution for enterprise applications” – can you clarify this statement?</strong></p><p>HTML5 related technologies (comprising <span class="caps">HTML</span>, JavaScript and <span class="caps">CSS</span>) are becoming increasingly capable, such that we have every reason to believe that advances in expressiveness (e.g. Canvas), performance (e.g. VM and <span class="caps">GPU</span> acceleration in many browsers) and application-related capabilities (e.g. offline storage, web workers) will continue at a rapid pace. In time (and depending upon your application,<strong><span style="color: #ff0000;"> it could be 3-5 years from now</span></strong>), we believe HTML5 could support the majority of use cases where Flex is used today.</p><p>However, Flex has now, and for many years will continue to have, advantages over HTML5 for enterprise application development – in particular:</p><ul><li>Flex offers complete feature-level consistency across multiple platforms</li><li>The Flex component set and programming model makes it extremely productive when building complex application user interfaces</li><li>ActionScript is a mature language, suitable for large application development</li><li>Supporting tools (both Adobe’s and third-party) offer a productive environment with respect to code editing, debugging and profiling</li><p></ul><p> </p><p>I guess Adobe’s communication just accelerated that 3 to 5 year timeframe by quite a bit.</p><p>Enjoy!</p><p>Daniel</p></p> The Future of Flex. 2011-11-15T00:00:00-08:00 <p>At first I thought “Wow, Adobe really messed up their communication”. They could have focused on what they are adding, strong support for HTML5 and CSS4, Adobe <span class="caps">AIR</span>.</p> <p>At a second thought I think it’s pretty smart what Adobe did. The saying goes “If you can’t beat them, join them”. In fact the Flex against <span class="caps">HTML</span>!!</p> <p>Adobe has already two great tools for HTML5, Muse and Edge and needs to push them way further and also needs to create or acquire a great <span class="caps">HTML</span> component framework such as Sencha so they call build and sell new development tools as well as design tools for the new growing crowd of HTML5 developers.</p> <p>So where does that leave Flash and Flex. I use a lot Flex in the enterprise, and that’s where Adobe just did the most damage in my eyes. Go now try to convince any <span class="caps">CTO</span> <span class="caps">HTML</span> component framework emerges. If Adobe is smart they could provide that offering.</p> <p>Flex is also a great environment to develop “native” mobile applications that can run on iOS and Android. The forthcoming Flex <span class="caps">SDK</span> 4.6 will show that potential and it’s a great way to create cross platform mobile and tablet applications. Adobe will not kill Adobe <span class="caps">AIR</span> for the mobile as it’s a too appealing growth market. But that message didn’t get through to the main stream media.</p> <p>As Adobe said Flash for the desktop for games and Adobe <span class="caps">AIR</span> <span class="caps">SDK</span> and some of the key developers to the Apache Foundation will allow to continue to evolve the <span class="caps">SDK</span> <span class="caps">AIR</span> for mobile and this is the one area where they could even grow their developers basis if they get their message right. For me <span class="caps">AIR</span> for mobile/tablets and the Flex <span class="caps">SDK</span> 4.6 is one solution where I can build mobile apps faster than in any other environment and this will be a great business to be in, especially for the enterprise market.</p> <p>The smart enterprises will realize that Flex is stable and here to stay for the long run, even if it’s not in the spotlight. They will start <span class="caps">HTML</span> <span class="caps">HTML</span>/Javascript developers is even harder. This said, there is no denying that pretty quickly the HTML5 tools and frameworks will catchup with what Flex offers today in ease of development for enterprise applications.</p> <p>Personally I’m looking forward to see how these HTML5/Javascript tools/libraries will evolve and will play with many of them.</p> <p>So where does all this leaves you, the developer. Well, it’s for sure time to jump on the new <span class="caps">HTML</span>/Javascript bandwagon if you haven’t yet. I cannot see many companies starting new enterprise projects with Flex. If you are into mobile or tablet development give the new Flex <span class="caps">SDK</span> 4.6 a try, I believe there is a great potential for Flex to become a major player in the mobile development arena…targeting “native” applications and not the browser. Yep, your heard it here first ;-)</p> <p>Enjoy,<br /> Daniel</p> Flex With Ruby on Rails talk - An AdobeMax preview 2011-09-19T00:00:00-07:00 <p><iframe src="" width="400" height="300" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe></p> <p>This is a presentation I gave in September 2011 at the <a href="">Denver <span class="caps">RIA</span> Developers Group</a> showing how to create a Flex application that interacts with a Ruby on Rails server. In fact it was schedule for the Flash Builder track of Adobe Max but was bumped to the the <a href="">360Flex Unconference</a> as it was deemed too specialized for the general track. In this presentation I will show you how to interact with Rails using <span class="caps">REST</span>,.</p> Writing tests is not fun. Anyone who tells you otherwise is a liar.... 2011-08-30T00:00:00-07:00 <p>At least so says my good friend Sean Voisen in his latest blog entry <a href="">Thoughts on test-driven development</a>.</p> <p.</p> <p.<br />.</p> <p.</p> <p.</p> <p.</p> <p>I finally like Sean’s balanced view on test driven development: “But would I use <span class="caps">TDD</span> for every project I work on? Probably not. For personal “one-off†projects or projects I know will not see much future maintenance, the slower development time is simply not worth it. For serious, long-term projects however, <span class="caps">TDD</span> is now a must.”</p> <p>Testing remains hard, but it’s just essential if you want to become a great, agile, developer.</p> <p>Persevere and testing will become your friend!</p> <p>Enjoy!<br /> Daniel</p> Termistat : a status bar for your terminal 2011-08-26T00:00:00-07:00 <p>When.</p> <p>In order to be able to display both types of information concurrently, I built a simple gem called <a href="">termistat<.</p> <p>Here’s a screenshot of termistat in action:<br /> <img src="" alt="termistat screenshot" /></p> <p>Termistat requires the ffi-ncurses gem (which requires the ncurses library to be on your system), and has a configuration <span class="caps">DSL</span> to customize the appearance somewhat. Check it out and let me know if you have any ideas for improvement!</p> Redis-Flex: An ActionScript Library to integrate with Redis 2011-06-13T00:00:00-07:00 <p>Announcing <a href="">redis flex</a> An ActionScript Library to integrate with Redis.</p> <p>A while back I looked into accessing Redis directly from Flex and I found an existing library, <a href="">as3redis</a> that however didn’t support the new unified request protocol. So I wrote a minimalist wrapper that now allows to send commands to a redis server.</p> <p>To access the Redis server from Flex just instantiate a Redis instance:</p> <typo:code <redis:Redis </typo:code> <p>Then you can send commands:</p> <typo:code server.send(“<span class="caps">SET</span> A 123”); server.send(“<span class="caps">GET</span> A”); server.send([“rpush”, “messages”, “message one”]); </typo:code> <p.</p> <p>Enjoy!</p> <p>Daniel</p> To Infinity and... no beyond - An ActionScript bug...I mean, feature. 2011-05-27T00:00:00-07:00 <p.</p> <p>So I looked at the code and the service call was a plain HttpService call with the resultFormat set to object. The server returns <span class="caps">XML</span> but the Flash Player converts the <span class="caps">XML</span> to a tree of objects. This is where it get’s funny. In fact when the player converts your hash to Objects it checks if a value is a number or a string…Hey guess what “Infinity followed by something” is a number.</p> <p>Here are some conversion examples:</p> <table border="0"> <tr> <td>String</td> <td>Is Number</td> <td>Converted Number</td> </tr> <tr> <td>“123”</td> <td>true</td> <td>123</td> </tr> <tr> <td>“123 Abc”</td> <td>false</td> <td>NaN</td> </tr> <tr> <td>“Infinity”</td> <td>true</td> <td>Infinity</td> </tr> <tr> <td>“Infinity Abc”</td> <td>true</td> <td>Infinity</td> </tr> </table> <p>It’s the last conversion which is the root of the problem as “Infinity Abc” is a number that when casted translates to Infinity!</p> <p>So we found the problem but the solution is really don’t use the Flash Player to do the conversion for you using the return type “object”. Use “e4x” which would turn your object in <span class="caps">XML</span> or use <span class="caps">JSON</span> and do the conversion yourself.</p> <p>To Infinity… and beyond!</p> <p>Daniel</p> Building Rails Apps for Rich Client - Using the bulk_api from Flex. 2011-05-27T00:00:00-07:00 <p>In this screencast we are going to show how to build a Rails app in a couple of minutes that is optimized for Rich Client. The application is a todo application build in Flex connecting using the <a href="">bulk_api</a> to the Rails server using my new <a href="">bulk data source Flex framework</a>.</p> <p><iframe src="" width="400" height="300" frameborder="0"></iframe></p> <p>Enjoy!</p> <p>Daniel</p> Sitting is killing you 2011-05-24T00:00:00-07:00 <p>I started working standing, what seems now ages ago, after a chat with <a href="">Tony Hilerson</a> <a href="">Sean</a> tweeted about the following review on working while sitting…and I thought I share. Although I don’t know the source of that information, I can tell you that working standing is pretty fun.</p> <p><a href=""><img src="" alt="Sitting is Killing You" width="500" border="0" /></a><br /></p> railsconf - Day 3 2011-05-19T00:00:00-07:00 <p>Speaker Slides<br /> <a href=""></a></p><p>Official Photos<br /> <a href="../../"></a></p><p>Keynote Video and Other Interviews<br /> <a href="../../"></a></p><p>News and Coverage:<br /> <a href="../../"></a></p><h3>Sproutcore with Yehuda Katz</h3><p><em>This are some notes I took at the Sproutcore <span class="caps">BOF</span> tonight…</em></p><p.</p><p>Today they announce Sproutcore 2.0 alpha. It’s a 20k single file with contains the core abstraction. They have a separate library to access the database store that is also 20k, that will provide ActiveRecord like functionality.</p><p>Will release a dropin plugin for Rails and Sproutcore to connect automatically to a Rails application to do basic crud.</p><p>To install Sproutcore in a rails app you can use a generator which will do the following changes:</p><p>In your Gemfile</p><p> gem ‘bulk_api’</p><p>In the routes file</p><p> mount Bulk::Spourcore.new => “/_sproutcore”<br /> builk_routes “/api/build/”</p><p>It then created the app/sproutcore folder.</p><p>These are a few javascript classes that allow to deal with the Rails integration:</p><ul><li>SC.Application</li><li>SC.Store</li><li>SC.Record </li><p></ul><p>The generator can be used as follows for example to add a ‘projects’ resource:</p><p> rails g bulk:resource projects</p><p>Which adds the app/builk/projects_resource.rb. This class manages automatically all the crud operations from javascript. So the client side can auto commit some of the changes and can send multiple statements as one html requests.</p><p>Every Tuesday, starting in 2 weeks, at 10am <span class="caps">PST</span> they will have a one hour training session. </p><p> </p></p> RailsConf 2011 - Thank you! 2011-05-19T00:00:00-07:00 <div>It’s a wrap. Wow, that was fun and a great conference. It didn’t hurt that a party was planned every night. Engineyard, Bluebox, Github had open bars in a different places every night. Free beer for everyone. If that doesn’t feel like a tech bubble. But what fun it was. It wasn’t just the partying, lots of coding, people networking, awesome keynotes and tons of great talks that made this Railsconf the best in my view. RailsConf is a well oiled machine, but it takes lots of effort and planing to make it such a successful event. So thank you to everyone that works behind the scenes to get this event going. What impresses me the most is that the Rails core team manages to make Rails better – release after release, year over year. Better not with more features, but removing all the stuff that is not needed anymore and adding features that keeps the Rails community engaged and enthusiast. Rails 3.0 was a big refactoring that allowed this all and was released about this time last year. Rails 3.1 was announced at DHH’s keynote where he showed the way of where this can lead us and this will certainly trigger a new generations of mobile and desktop Rich Internet Applications powered by Rails. Rails 3.1 will be released this week, you can use the beta by doing a ‘gem install rails —pre’, and I’m actually excited to use CoffeScript. <span class="caps">CSS</span> and JavaScript are now first class citizen in Rails. This was the year of JavaScript at RailsConf, and if as usual Rails is right, it’s a showcase of where the industry is going. So now is the time to jump on board, Backbone.js, SproutCore , CoffeScript and Rails 3.1 here we come! </div><div></div><div></div><div>I was really excited by Yehuda Katz’s talk “Bridging The Gap – Using Rails To Write Dry Rich Client Applications” as this is was I am evangelizing since years, use Rails as an <span class="caps">API</span> with all the goodies it has to offer and create “fatter” client applications that are more compelling to use. Yehuda made a compelling presentation on what’s great about Rails beyond the view layer and pointed out that just saying use <span class="caps">REST</span> wasn’t enough to build the new style of apps that are starting to show up. Hence he described a new protocol built on top of <span class="caps">REST</span> to allow bulk updates. He and his team created a first implementation that can be used with Rails, <a href="">the bulk_api gem</a>. Of course I have still a foot in the Flex world and will leverage this work to Flex and will be cranking out a <a href="">BulkDataStore for Flex framework</a> over the next few weeks. Yea, Flex has still a few miles left :-) </div><div></div><div></div><div>Again, the biggest kudos goes to the presenters where, beside one talk that was ultra light, all talks where just awesome. I enjoyed the html5 tutorial the first day during which I had time code html5. This was followed by Bruce Williams and Jonh Athayde talk on Building Bulletproof Views. As usual Bruce loving code design and sense of esthetics managed to convey on how to be a better programmer through example. Really enjoyed it. There where just so many practical sessions, like how to scale your application, how to integrate diverse databases, how Saas works, a talk on CoffeScript, on testing the impossible, intense lightning talks, talks on HBase, and an ultra fun talk on Backbone.js.</div><div></div><div></div><div>The vendors area was also great fun and the usual suspect where present, Heroku, Engineyard, New Relics and others. Thanks for the pingpong ball gun and all the T-shirts. My wife can wait to see me in them!</div><div></div><div></div><div>Rails is the community. I was amazed on how many newcomers where here and how they are welcomed. This was not only apparent at the Ignite Rails event where presenters showed their enthusiasms of sharing knowledge but also apparent in all the discussions that where going on between sessions. Speaking of Ignite Rails, this was just awesome. 16 presenters, 5 minutes each = high energy. That Rocked. Another parallel event was BohConf, with many sessions and local Ruby and Rails developers hanging out just next to RailsConf and having many really cool sessions.</div><div></div><div>Finally it was great to meet again with the usual Denver crew. Now back to coding!</div><div></div><div><div>So if you didn’t make this year, make sure to put it on your calendar for next year!</div><p></div><div></div><div>Enjoy!</div><div>Daniel Wanja</div><div><a href="">@danielwanja</a></div></p> RailsConf 2011 - Day 2 2011-05-17T00:00:00-07:00 <p>Today is really the first day of the conference, yesterday was the tutorial day for which you had to pay extra. So I wonder how much more crowded it will be. The tutorials where great this year. In the evening the second Ignite Rails was held and was just awesome. All the talks just rocked! After Ignite, Engineyard invited everyone to an open tap at Max’s Taphouse. Not everyone will function at full capacity today.Don’t miss today’s <a href="">livestreamd keynote by David Heinemeier Hansson</a> starting at 9:15am Baltimore time.There will be ton’s of great sessions. I’ll update this blog entry with the information I gather as the day goes along.I’m looking forward tonight’s <span class="caps">BOF</span>:</p><p><img src="" alt="" width="450" /></p><p> </p><p>Keynote: the <span class="caps">ASSET</span> <span class="caps">PIPELINE</span> and our <span class="caps">POST</span>-<span class="caps">MODERN</span>, <span class="caps">HYBRID</span>, Javascript <span class="caps">FUTURE</span>:</p><p><img src="" alt="" width="564" height="411" /></p><p>Peter Cooper did a great job <a href="">covering the Keynote</a> on the <a href="">rubyinside</a> website.</p><p>All the slides from today (via<a href=""> Joel Oliveira</a>)</p><ul><li><a href="">Zach Holman – Double-Shipping Software for Profit</a></li><li><a href="">Jeff Casimir – Fat Models Aren’t Enough</a></li><li><a href="">Matt Parker – Readme Driven Development</a></li><li><a href="">John Nunemaker – Why You Should Never Use an <span class="caps">ORM</span></a></li><li><a href="">John Athayde and Bruce Williams – Building Bulletproof Views</a></li><li><a href="">Derek Collison – Cloud Foundry – The Rails Developer’s Perspective</a></li><li><a href="">Nick Gauthier – KnowSQL: Database Tricks To Make Your Life Easier</a></li><li><a href="">Clinton R. Nixon – Upgrading Legacy Rails Applications to Rails 3</a></li><li><a href="">Mikel Lindsaar – Keeping Rails on the Tracks</a></li><li><a href="">Adam Keys – Mixing a Persistence Cocktail</a></li><li><a href="">Hiro Asari – 20 Productivity Tips (pdf)</a> <a onclick="javascript:pageTracker._trackPageview('/outgoing/bit.ly/mqlGxi');" href="">(and keynote)</a></li><li><a href="">Matteo Latini – Building Bulletproof Views</a></li><li><a href="">Bryan Liles – Active Support</a></li><li><a href="">Eric Redmond – The Holy Grail of Databases</a></li></ul> RailsConf 2011 - Day 1 2011-05-16T00:00:00-07:00 RailsConf 2011 - Day 1 Today is the tutorial days. <h2>Tutorial 1 : html5tutorial</h2> I started RailsConf with the "Building Web Apps with HTML5: Beyond the Buzzword" by Mike Subelsky (<a href="">@subelsky</a>).<br/>.<br/> You can download his tutorial and all files from. Look at the tutorial.html file for instructions.<br/> Here are a few highlights of his talk:<br/> <h4>1 - Feature Detection</h4> By using the <a href="">Modernizr</a> library, we used modernizr-1.7.js, you can detect difference html5 of your browser. <br/> For example:<br/> <ul> <li>Modernizr.canvas</li> <li>Modernizr.websockets</li> </ul> <h4>2 - Basic Canvas Drawing</h4> You can get a 2d context and draw on the canvas via that context. You can use <i>fillRect</i> and other primitives like <i>moveTo</i> and <i>lineTo</i> to draw.<br/> <pre> var canvas = document.getElementById("main"); var context = canvas.getContext("2d"); context.fillRect(0,0,20,20); </pre> <br/> <canvas id="canvas_ex2_1" width="450" height="40"></canvas> <script> var canvas = document.getElementById("canvas_ex2_1"); var context = canvas.getContext("2d"); context.</canvas> <script> var canvas = document.getElementById("canvas_ex2_2"); var context = canvas.getContext("2d"); for (var i=0;i<180;i++) { context.fillStyle = i % 2 == 0 ? "red" : "blue"; var w = 5 context.fillRect(i*w+1,0,w-1,19); } </script> <h4>3 - Canvas Image Manipulation</h4> <pre> var img = new Image(); img.</canvas> <script> var canvas = document.getElementById("canvas_ex3"); var context = canvas.getContext("2d"); var img = new Image(); img.</canvas> <script src="" ></script> <script> function Exercise4() {} Exercise4.prototype.run = function() { var canvas = document.getElementById("canvas_ex4"); var context = canvas.getContext("2d"); var characters = new Image(); characters. </pre> Use the slider below to scale the image:<br/> <table border="0"> <tr> <td> <input id="username" placeholder="Your name"><br/> <input id="fn" placeholder="First name"><br/> <input id="ls" placeholder="Last name"><br/> <input id="ad" placeholder="Address" ><br/> <input id="size" type="range" min="4" max="320" step="8" value="60"> </td> <td> <canvas id="canvas_ex5" width="250" height="250"></canvas> </td> </tr> </table> <br/> We listen to the change event of the size input and call the draw() function. Note the last two of the drawImage below is the new width and height which will give us the scaling effect.<br/> <pre> <input id="size" type="range" min="4" max="320" step="8" value="60"> </pre> <pre> function draw() { context.clearRect(0,0,width,height); context.drawImage(characters,33,0,32,32,0,0,sizeAmt,sizeAmt); } </pre> <script> function Exercise5() {} Exercise5.prototype.run = function() { var canvas = document.getElementById("canvas_ex5"); var context = canvas.getContext("2d"); var characters = new Image(); characters.</canvas> <pre> canvas { background-color: black; } input { display: block; } </pre> <style> .dark-canvas { background-color: black; } canvas { background-color: #ccc; } input { display: block; } </style> <h4>8 - Web Sockets</h4> That was the fun part of the presentation, mike created the a small <a href="">ruby application</a> and had over 200 clients connecting to it. <br/> Here is an extract of the ruby program:<br/> <typo:code class TutorialServer def run EventMachine.run do EventMachine::WebSocket.start(:host => @host, :port => @port) do |socket| socket.onmessage do |msg| @logger.info "received: #{msg}" broadcast(msg) end end EventMachine::add_periodic_timer(10) { broadcast(JSON.generate({ :type => "ping" })) } end end def broadcast(msg) @sockets.keys.each { |socket| socket.send(msg) } end end TutorialServer.new('0.0.0.0',8011).run </typo:code> Then when the users moved the character image using the keyboard each keystroke was sent to his server.<br/> <typo:code // create the socket var ws = new WebSocket("ws://exp.subelsky.com:8011"); // sent to position+name to server ws.send(JSON.stringify({ name: name, x: x, y: y, type: "move" })); </typo:code> Ultimately he wanted to drive multiple clients from his server...but we ran out of time to dive into this. <br/> <h4>And much more..</h4> Mike covered additionally these topics: Embedded Media, Geolocation, Web Workers, Offline App<br/><br/> Well that was a couple of hours well spent! Go check out his material on github.<br/> <h2>Tutorial 2 : Building Bulletproof Views</h2> Now I'm at a great presentation from John Athayde & Bruce Williams on how to make elegant html, css and javascript. The slides will be posted online. <br/> Here are some of the topics:<br/> <ul> <li>The Art of Template Writing</li> <li>Nailing Navigation</li> <li>Maintainable Forms</li> <li>Don't Fear the Object</li> <li>Going Mobile</li> <li>packaging Assets</li> <li>Questions & Discussion</li> </ul> <p/> And the day is not over...Ignite Rails tonight.<br/> Enjoy!<br/> Daniel Wanja Unboxing Sifteo cubes 2011-04-28T00:00:00-07:00 <p>A good friend in Switzerland wanted the sifteo cubs, so I order a started kit for him which I just received. He told me I should check them out, now I want to keep them :-)<br /> They come with a bunch of games but they can also be used as controls for your computer. I’m looking forward to see what new interaction people create with these. I would love to control my home automation with these cubes.</p> <p>For the very curious (and patient) out there, here is the Uboxing video and the initial setup walk through:</p> <p><iframe src="" width="400" height="300" frameborder="0"></iframe></p> <p>For something more exiting here is David Merrill demo at Ted:</p> <p><a href=""></a></p> <p>;"></embed></object></p> <p>Check out their Websites <a href=""></a></p> Fuzzy Clock 1.3 for iPad - 9 designer clocks at an awesome price - FREE 2011-04-13T00:00:00-07:00 <p>Fuzzy Clock is now free. I’ve added three new clocks, a Polar clock from from the <a href="">Raphaël javascript library</a>, and two others are based on <a href="">CoolClock</a>. In addition to three new clocks Fuzzy Clock now has a option to disable the Auto-Lock allowing the clock to run forever on a stand without having the lock screen appear.</p> <p>Check out this video to see the new features.</p> <p><iframe src="" width="400" height="280" frameborder="0"></iframe></p> <p>Enjoy!<br /> Daniel</p> Journey into Android Development - Part 3 : Flex Development (Adobe AIR for Android) 2011-04-10T00:00:00-07:00 <p>Ok, today I’m at the 360Flex conference following Brent Arnold’s <span class="caps">AIR</span> for Android presentation. We are playing with the Flex <span class="caps">SDK</span> 4.5 to build an Android app however we had to sign an <span class="caps">NDA</span>, so I cannot say some of the detail unless it’s already on the internet. This said I assume that tomorrow Adobe will announce the official release of Flash Builder 4.5. And a ton’s of information was already published:</p> <ul> <li></li> <li></li> <li></li> </ul> <p>Here is TourDeFlex that shows all the capabilities of the Adobe <span class="caps">AIR</span> runtime. <a href="">Download TourDeFlex</a>. The source code can be found at</p> <p>In the training we created a small application that checks the capabilities of your device: <a href="">Download DeviceCapabiliites</a> <br /> The application uses the Capabilities api that checks various parameters of your device., such as multi-touch, camera, location. Here is the source code:</p> <script src=""></script><script src=""></script><p>Within Flash Builder in the properties of your project you can go to the Flex Build Packaging | Google Android and create a self-signed certificate.<br /> Then you can use the Project | Export Release Build… option to create an .apk file for your project.</p> <p>The application itself is not that exicting but allowed us to discover how to create <span class="caps">AIR</span> apps for Android using Flex and Flash Builder.</p> <p>Enjoy!</p> <p>Daniel.</p> <p><b><span class="caps">UPDATE</span> (4/10/11):</b> Et voilà Flex 4.5 is <a href="">announced</a>, but the final version will only be downloadable early May. Here is a good <a href="">article on mobile development.</a></p> T3 Metadata Editor - A cool Flex App 2011-04-09T00:00:00-07:00 <div style="text-align: center;"><img src="" alt="" width="386" height="458" /></div><p>A <a href="">“under the hood of a cool flex project.”</a></p><p>And to capture all that meta data regarding games and movies they created a whole server side infrastructure but they also needed a pretty face for all that power and I got lucky to be one of the main coder on the T3 Metadata Editor.</p><p>It’s fun to work on software that ends up in the press, here are a few extracts found on the web:</p><p><a href=""></a></p><p>Sony Pictures is utilizing the T3 Metadata Editor to:<br /> • Search by actor, line of dialogue, location, and a range of other parameters so that they can create interactive features that enable fans to search for words within the script and share their favorite moments<br /> • Manage restrictions around product placements, talent clearances, and music in order to dynamically create trailers, clips, and other edits for online promotion, social linking, and targeted ads</p><p>From <a href=""></a></p>.</p><p>You can find out more on the <a href="">products home’s page</a> :</p><p <a href="">Cameron</a> started the project he used the Parsley framework as one of the component was developed in pure Actionscript and we thought that Parsley could simplify integration. I still prefer Swiz, but Parsley is working out for this project.</p><p>Thanks again to the awesome team at Thought Equity, this is a fun project!</p><p>Enjoy!</p><p>Daniel Wanja.</p> Journey into Android Development - Part 2 : rooting the gTablet 2011-04-07T00:00:00-07:00 <p class="p1">Before continuing development I want to update the tablet. The cyanogenmod wiki seems a good resource <a href=""></a></p><p class="p1".</p><p class="p1">Note the wiki mentions to put the files on the root of the device, I did that via <span class="caps">USB</span> transfer.</p><p class="p1">So step 1) download ClockworkMod_Gtab_v08.zip, unzip and copy the recovery folder and update.zip to the root of the internal memory.</p><p class="p1">That worked, also I tried yesterday and push the power button and the volume up button, but that didn’t put me in the recovery mode. But pushing the volume up and power button works</p><p class="p1">Step 2) Flashing CyanogenMod via the Recovery. Note I should try via RomManager.</p><p class="p1"><a href=""><br /></a><a href=""></a></p><p class="p1"”. </p><p class="p1">Now I select “Install zip from sdcard” and select the google apps: gapps-gb-20110307-signed.zip.</p><p class="p1">Press the back button and select “reboot system now”. </p><p class="p1".</p><p class="p1">After a reboot the tablet is stuck in startup mode, shows “<span class="caps">ANDROID</span>” and that’s it. <span class="caps">USB</span> doesn’t connect, so now I have to find another way to get the next update on the tablet. Ok Wiping the data and cache as in step 2 put the tablet back in business.</p><p class="p1">All right that’s it for tonight, I shall check if I can’t find a better rom next.</p> <p><b><span class="caps">UPDATE</span></b>: (4/10/11) Actually after playing with the Cyanogen I must say it works quite well. I have no problem accessing the drive when connecting the table via <span class="caps">USB</span>. The device is very responsife and I had no issue installing the <a href="">Amazon AppStore</a>. Just download the .apk and moved it to the tablet and Angry Bird here I come.</p> Journey into Android Development - Part 1: the gTablet 2011-04-06T00:00:00-07:00 <p>I dabbled a while back with the Android <span class="caps">SDK</span> 1.5 but didn’t pursue that platform back then. With the advent of Amazon’s App Store, a bunch of cool tablets and Honeycomb, I thought it was time to take a Journey into Android land again. </p><p class="p1".</p><p class="p1">I must admit that I’m an Apple fan boy. I’ve had numerous MacBook, Macs, iPhones, iPads over the years and I will compare exploring the gTablet to my experience with the iPad (one).</p><p class="p1"><strong>First stop, opening the box and starting the gTablet</strong></p><p class="p.</p><p class="p1"><strong>The software</strong></p><p class="p1" <span style="text-decoration: underline;">unless</span> your are ready to update it. It’s not worth the $200 or more dollars like that. </p><p class="p1">Now this said before upgrading I want to see how I can create a simple app and move it onto the tablet. Note I won’t describe the development process, the <span class="caps">SDK</span>…</p><p class="p1"><strong><span class="caps">USB</span> Connection</strong></p><p class="p1">Now onto the fun stuff. I connected the usb call and can see the whole disk system right away…Note sure it’s the whole file system but it’s fun that you can add easily stuff on the tablet:</p><p class="p1"><img src="" alt="usb connection" width="450" /></p><p class="p1".</p><p class="p1"><strong>Installing the Android <span class="caps">SDK</span> on my Mac.</strong></p><p class="p1">Before I can install an app, I need to build one. A quick google search and onto. The page says "If you are new to Android, <a style="color: #006699;" href="">download the <span class="caps">SDK</span> Starter Package</a> first.". Let’s do that…<span style="color: #333333; font-family: arial, sans-serif; font-size: 13px; line-height: 16px;">. </span>After unziping it create the android-sdk-mac_x86 folder which I move to my /Developer folder.</p><p class="p1"><span style="color: #333333; font-family: arial, sans-serif; font-size: 13px; line-height: 16px;"><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; color: #000000; line-height: normal;">Then onto </span></span><span style="color: #333333; font-family: arial, sans-serif; font-size: 13px; line-height: 16px;"><a style="color: #006699;" href="">Installing the <span class="caps">SDK</span></a>. </span></p><p class="p1">Well, the instructions says to “On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android <span class="caps">SDK</span>, then execute: android”<span style="color: #333333; font-family: arial, sans-serif; line-height: 17px;">, let’s do that. Well I had to execute “sh android” as the script didn’t have the +x flag set. Ok that opens a ui and I select the <span class="caps">SDK</span> Platform for Android 2.2, <span class="caps">API</span> 8, revision. Later if rooting the gTablet works I will have to get another version, but as the stock software says it’s a 2.2 OS, let try with that <span class="caps">SDK</span>, so I just the the “Install Selected” from the UI. The UI shows the following log:</span><span style="color: #333333; font-family: arial, sans-serif; line-height: 17px;"> </span></p><blockquote><p class="p1">Downloading Android <span class="caps">SDK</span> Platform-tools, revision 3<br /> Installing Android <span class="caps">SDK</span> Platform-tools, revision 3<br /> ‘adb kill-server’ failed — run manually if necessary.<br /> Installed Android <span class="caps">SDK</span> Platform-tools, revision 3<br /> Downloading <span class="caps">SDK</span> Platform Android 2.2, <span class="caps">API</span> 8, revision 2<br /> Installing <span class="caps">SDK</span> Platform Android 2.2, <span class="caps">API</span> 8, revision 2<br /> Installed <span class="caps">SDK</span> Platform Android 2.2, <span class="caps">API</span> 8, revision 2<br /> ‘adb kill-server’ succeeded.<br /> <span class="caps">ADB</span>: * daemon not running. starting it now on port 5037 *<br /> ‘adb start-server’ succeeded.<br /> <span class="caps">ADB</span>: * daemon started successfully *</p><p></blockquote><p class="p1">And mentions that “Done, 2 packages installed”. </p><p class="p1"><strong>Building a first app using Appcelerator’s Titanium</strong></p><p class="p1">Well, I’ve an app that I wrote for the iPhone, I would like to see if Titanium’s cross platform premise holds. Let see what I need to sweat to get it running on the gTablet…First step let’s add the <span class="caps">SDK</span> to Titanium. My app was an “iPad” app to Titanium doesn’t even want to know about the Android <span class="caps">SDK</span>. So let’s create a new “Mobile” <span class="caps">SDK</span>…Hey, it finds an Android 1.6 <span class="caps">SDK</span>…I must have dabbled with that a while back. Finnally found the following on Appcelerator’s support pages "I<span style="color: #1d1d1d; font-family: 'Trebuchet MS', Tahoma, Arial, sans-serif; line-height: 20px;">f you’re installing the Android <span class="caps">SDK</span>, make sure to install the Platform-tools package, and as usual you will need the Google APIs Add-on". Ok, then let’s try that.</span></p><p class="p1">10pm and the kids go swiming early in the morning, so I’ll wrap up this experiment and continue over the next few days. </p><p class="p1">… to be continued</p><p> </p><p class="p1"> </p><p class="p1"><span style="color: #333333; font-family: arial, sans-serif; line-height: 17px;"><br /> </span></p><p class="p1"> </p><p class="p1"> </p><p class="p1"> </p></p> iPhone App: Mi-Fi 1.2 now with iOS 4.x support. A must have if you have an Mifi card. 2010-10-13T00:00:00-07:00 <div style="float:left; padding: 15px;"> <p><img src="" alt="mifi12.jpg" border="0" height="250" align="left" /><br /> <a href=""><br /> <img src="" alt="marketing_badge.png" border="0" width="121" height="61" align="left" /><br /> </a></p> </div> <p>I <span class="caps">SDK</span>..</p> <p:</p> <p><br/> <div style="text-align:center;"><img src="" alt="20101012MiFiWeeklySales.png" border="0" width="450" /></div></p> <p.</p> <p>Now internally I had to rewrite the application as somehow the Titanium <span class="caps">SDK</span> changed enough that I couldn’t get it to work. So the new code is also a lot cleaner, so maybe I could add a few features soon:</p> <p>In short this is the app.js</p> <typo:code <p>Titanium.include(‘resource.js’);<br /> Titanium.include(‘parser.js’);<br /> Titanium.include(‘controller.js’);</p> <p>var controller = new Controller();<br /> controller.start();</p> <p>var webview = Titanium.UI.createWebView({url:‘index.html’, controller:controller});<br /> var window = Titanium.UI.createWindow({fullscreen: true });<br /> window.add(webview);<br /> window.open();</p> </typo:code> <p>As you see it loads the index.html which renders the main view. Index.html loads index.js which declares a listener to the update_view event.</p> <typo:code <p>Ti.App.addEventListener(‘update_view’,function(e) {<br /> //..update the view using jquery based on e.state and e.info<br /> })</p> </typo:code> <p>The controller class checks every two seconds the state of the mifi card by getting the mifi status on the following url: “<span class="caps">TEXT</span>”. It then parse the data (different for each version of the card) and creates a unified javascript structure and fire the update_view event:</p> <typo:code Titanium.App.fireEvent(‘update_view’, {state:this.currentState, info:info}); </typo:code> <p>To make the calls to the mifi card I wrote a Resource class that abstracts the xhr request</p> <typo:code this.mifi = new Resource(“<span class="caps">TEXT</span>”); this.mifi.index(this.mifiResult.bind(this)); </typo:code> <p>Internally the resource uses the createHTTPClient and makes a standard ajax get call. I haven’t tried to use jquery’s .get function directly but assume it may not work with Titanium without some hacking…</p> <typo:code var xhr = Titanium.Network.createHTTPClient(); xhr.open(“<span class="caps">GET</span>”, url); xhr.send(); </typo:code> <p>So Titanium rocks and works pretty well, at least for many iPhone apps. Now let’s see how long it takes for the approval of another app that I submitted yesterday….</p> <p>Enjoy!<br /> Daniel Wanja</p> Making CRUD less "Cruddy", one step at a time 2010-10-04]”, join_item.id) output << hidden_field_tag(“#{ tag_prefix }[_delete]”, true) output << check_box_tag(“#{ tag_prefix }[_delete]”, false,> <p><strong><span class="caps">UPDATE</span>:</strong> There was a problem with the published code, which I corrected — sorry about that.</p> <p><strong><span class="caps">RAILS</span> 3 <span class="caps">UPDATE</span>:</strong> To get the code above to work with Rails 3 / Ruby 1.9.2, I had to change <code>class.class_name</code> to <code>class.name</code>, and call <code>.html_safe</code> on the initial string so that it would not get escaped.</p> Good RobotLeg presentation at 360Flex 2010-09-28T00:00:00-07:00 <p>P:</p> <ul> <li>View <ul> <li>the View is represented by your view components and their Mediators</li> <li>Mediators provide <span class="caps">API</span> for view components</li> <li>Mediators listen for view component events</li> <li>Mediators listen for framework events</li> <li>Mediators dispatch framework events</li> <li>view components are not coupled to their Mediators</li> <li>Mediators are coupled to their view components</li> <li>Mediators can access Service and Model classes directly</li> </ul></li> </ul> <ul> <li>Actor <ul> <li>Actor is the base class for Model and Service classes</li> <li>eventDispatcher is injected into Actor</li> <li>Actor provides a dispatch(event) method</li> <li>Actor is for your convenience</li> </ul></li> </ul> <ul> <li>Model <ul> <li>Models extend Actor</li> <li>Models provide an <span class="caps">API</span> for data</li> <li>Models sit between application data and other actors</li> <li>Models should not listen for framework events</li> <li>Models dispatch framework events</li> </ul></li> </ul> <ul> <li>Service <ul> <li>Services extend Actor</li> <li>Services usually implement an interface</li> <li>Services communicate with the outside world and provide an <span class="caps">API</span> to external services</li> <li>Services can parse results from external services</li> <li>Services do not store data</li> <li>Services do not receive framework events</li> <li>Services dispatch framework events</li> </ul></li> </ul> <ul> <li>Controller <ul> <li>represented by the Command class</li> <li>Commands are executed in response to framework events</li> <li>Commands are stateless</li> <li>Commands perform work on Service and Model classes and dispatch events (call other commands)</li> <li>Commands receive data from the events that trigger them</li> <li>Commands dispatch framework events</li> <li>Commands do not receive framework events</li> </ul></li> </ul> <p>You can get the slides <a href="">here</a> and also checkout <a href="">his blog entry</a> for more info.</p> <p>These days everyone has his preferred Flex framework. Mine is still <a href="">Swiz</a> as it doesn’t impose a structure like Cairgorm or RobotLeg. I’ve also just started on a new project that uses <a href="">Parsley</a>, so I’ve soon done them all!</p> <p>Enjoy!<br /> Daniel</p> Moving (again) from Heroku to EC2 2010-09-20T00:00:00-07:00 <p>If you read this then this blog is now running Typo 5.5 on Rails 2.3.9 on EC2.</p> <p <span class="caps">HTTP</span> performance by cranking up the “dynos” to 2 which would be an additional $36 a month. I still think it’s a good deal for a managed environment.</p> <p>However you also saw on my <a href="">last blog entry</a> that there are other issues with running Typo on Heroku and therefore I started playing with running Rails on EC2. And I like what I see and now that Amazon has an official and secured Amazon Linux <span class="caps">AMI</span>, I’ll be using that. Here are a few notes on how I did set it up.</p> <p>I started with the new Basic 32-bit Amazon Linux <span class="caps">AMI</span> 1.0 (). I take basically only a few clicks to get a server started. You can use the ec2 console () to create and connect to the server, however you need to use ec2-user instead of root to connect due to the way the Amazon Linux <span class="caps">AMI</span> is setup.</p> <p>Note Lee is right that if I continue to moving host I should create a Chef recipe for this.</p> <p><strong>Install dev tools</strong></p> <p>$ sudo yum install git<br /> $ sudo yum install make gcc-c++ zlib-devel openssl-devel<br /> $ sudo yum install ruby-devel ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs</p> <p><strong>Install MySQL</strong></p> <p>$ sudo yum install mysql mysql-server<br /> $ sudo /etc/init.d/mysqld restart<br /> $ mysql_secure_installation<br /> $ sudo yum install mysql-libs mysql-devel</p> <p><strong>Install ruby-mysql</strong></p> <p>$ sudo gem install mysql —no-ri —no-rdoc</p> <p><strong>Install rubygems</strong></p> <p>$ wget <br /> $ tar xzvf rubygems-1.3.7.tgz<br /> $ cd rubygems-1.3.7<br /> $ sudo ruby setup.rb<br /> $ cd ..</p> <p><strong>Install Rails (note I use 2.3.9 for Typo )</strong></p> <p>$ sudo gem install rails —no-ri —no-rdoc<br /> $ sudo gem install rails —no-ri —no-rdoc -v=2.3.9</p> <p><strong>Install Apache (2.2.15</strong>)</p> <p>$ sudo yum install httpd</p> <p><strong>Install Passenger</strong></p> <p>$ sudo gem install passenger —no-ri —no-rdoc <br /> $ sudo yum install httpd-devel<br /> $ passenger-install-apache2-module</p> <p><strong>Configure Passenger</strong></p> <p>nano /etc/httpd/conf/httpd.conf</p> <typo:code LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15 PassengerRuby /usr/bin/ruby </typo:code> <p>Suppose you have a Rails application in /somewhere. Add a virtual host to your<br /> Apache configuration file and set its DocumentRoot to /somewhere/public:</p> <typo:code <VirtualHost *:80> ServerName DocumentRoot /somewhere/public <Directory /somewhere/public> AllowOverride all Options -MultiViews </Directory> </VirtualHost> </typo:code> <p><strong>Installing Typo (from source)</strong></p> <p>see</p> <p>$ wget</p> <p>then unzip, that’s it. That’s your typo instance, now let’s configure it’s database.<br /> Note I moved it to /var/www/typo/</p> <p>Create config/database.yml i.e.<br /> <code>production adapter: mysql host: localhost username: yourusername password: secret database: onrails_prod</code></p> <p>Change the Rails version in config/environment.rb, replace 2.3.8 with 2.3.9</p> <p>RAILS_GEM_VERSION = ‘2.3.8’ unless defined? RAILS_GEM_VERSION</p> <p>setups gems required for Typo:<br /> $ sudo rake gems:install</p> <p><strong>Creating/Copying database:</strong></p> <p>Note I migrated my blog so I need to copy the database to the new server.</p> <p>$ scp -i .ssh/linux_ami.pem onrails_org.sql ec2-user@ec2-184-73-20-188.compute-1.amazonaws.com:onrails_org.sql<br /> $ mysql -u yourusername -p<br /> create database onrails_prod;<br /> exit<br /> $ mysql -u yourusername -p onrails_prod < onrails_org.sql</p> <p>As I also update Typo to a new version I had to run a migration:</p> <p>$ rake db:migrate RAILS_ENV=production</p> <p>Note if you want a clean install you can just to a rake db:create and rake db:migrate.</p> <p>Et voila! Well Heroku made it simpler but I always have fun playing with EC2.</p> <p>Enjoy!<br /> Daniel</p> Moving onrails.org to Typo 5.4.x, Rails 2.3.8 on Heroku 2010-07-12T00:00:00-07:00 <p> <p <a href="">Getting Typo 5.4 running on Heroku</a> So I gave it a try. The interesting part is that <a href="">onrails.org</a> <a href="">here</a> or you can clone the Typo git repository.</p><br /> <pre>$ git clone <br /> </pre><br /> <p><br /></p><br /> <pre>$ heroku create onrails<br /> git@heroku.com:onrails.git<br /> $ git init<br /> $ git add .<br /> $ git commit -m "Adding onrails.org using typo 5.4.4"<br /> </pre><br /> <p><br /> I then followed joels' <a href=""> article</a>.</p><br /> <pre>.gems<br /> rails = 2.3.8<br /> htmlentities <br /> json <br /> calendar_date_select <br /> bluecloth ~> 2.0.5<br /> coderay ~> 0.8<br /> mislav-will_paginate ~> 2.3.11 —source gems.github.com<br /> RedCloth ~> 4.2.2<br /> panztel-actionwebservice = 2.3.5<br /> addressable ~> 2.1.0<br /> mini_magick ~> 1.2.5<br /> </pre><br /> <p><br /> Finally I deployed the app with an empty database:</p><br /> <pre>$ git remote add heroku git@heroku.com:onrails.git<br /> $ git push heroku master<br /> $ heroku rake db:migrate # with empty db<br /> </pre><br /> <p><br />:</p><br /> <pre>$ heroku stack:migrate bamboo-ree-1.8.7<br /> </pre><br /> <p><br /> h2. Migrating the local MySQL database to Heroku's Postgres database. It's a rather straight forward process…just do</p><br /> <pre>$ heroku db:push<br /> </pre><br /> <p><br /> <typo:code> #' </typo:code>: <typo:code> ActionView::TemplateError (undefined method `interpolate_without_deprecated_syntax' for #<i18n::backend::simple:0x2b8d1ef90700>) on line #5 of themes/scribbish/views/articles/<em>coment.html.erb: </i18n::backend::simple:0x2b8d1ef90700></typo:code>:</p><br /> <pre>environment.rb<br /> class I18n::Backend::Simple<br /> def interpolate(locale, string, values = {})<br /> interpolate_without_deprecated_syntax(locale, string, values)<br /> end<br /> end<br /> </pre><br /> <p><br /> h2. custom domain I'm sure there are a few more details I missed and hope my readers will point them out, but let's jump and turn the switch on. So you need to switch on custom domains on heroku as follows:</p><br /> <pre>$heroku addons:add custom</em>domains<br /> $ heroku domains:add<br /> Added a custom domain name to onrails.heroku.com <br /> $ heroku domains:add onrails.org<br /> Added onrails.orgas a custom domain name to onrails.heroku.co<br /> </pre><br /> <p><br /> <b><span class="caps">UPDATE</span> 1:<.</p></p> RailsConf 2010 - Thank You! 2010-06-10T00:00:00-07:00 <p>Wow, RailsConf is over. It ended nicely with <a href="">@garyvee</a>.</p> .</p> <p>The best thing at this conference is the energy that transpires and I really feel energized and want to start some new Rails venture. It’s fun to see so many enthusiasts trying to learn, share, and push the community forward.</p> <p>I must admit I usually enjoy smaller conferences, like the <a href="">MoutainWest RubyConf</a> or the forthcoming <a href="">Moutain.rb</a>,.</p> <p>As usual there are always some talks that just suck. On the tutorial day I attended in the afternoon <a href="">Rails 3 Deep Dive</a> and it wasn’t about Rails 3 nor a deep dive. Another talk that didn’t turn out the way it should have been was <a href="">Scaling Rails on AppEngine with JRuby and Duby</a> where the speakers where knowledgeable but where note prepared enough and where counting on the wifi to work…The wifi never works at conference. This said the wifi was usually working pretty well at RailsConf this time.</p> <p>I don’t wanna focus too much on the talks that didn’t work out as most of the talks where great and also not all my talks in the past always worked out they way they could have ;-)</p> <p>One of the tutorial I really liked was <a href="">Acceptance Testing With Cucumber</a>..</p> <p>The first talk I attended on tuesday was <a href="">Building an <span class="caps">API</span> with Rails</a> which was a panel discussion with guys from Twitter, 37Signals, Github, the <span class="caps">NYT</span> and others. I really enjoyed that there was several distinct views on several aspects like on APIs like versioning, security, performance which relates exactly with some customer work I’m currently doing.</p> <p.</p> <p>Another great panel on tuesday was <a href="">The State of Rails e-Commerce</a>. I’m interested in ecommerce since <a href="">the first of Rails project</a> I worked on end of 2005.</p> <p>Then I went to see <a href="">Ilya Grigorik</a>.</p> <p ;-)</p> <p>What else was cool? Rich Kilmer gave a nice talk about Authentication in a RESTful World. Again, that’s totally relevant to a customer project of mine. One of the best talks out there was <a href="">Rocket Fueled Cucumbers</a> by Joseph Wilk, but I saw only the last quarter as I selected another talk that I decided to leave…too late.</p> <p><a href="">Matthew Deiters<.</p> <p>Besides the talks <a href="">Bluebox</a> threw a party at a local bar, besides the fact that <a href="">Fernand</a>.</p> <p.</p> <p>The Ruby Heroe Awards Ceremony is always fun to watch, and Gregg puts lots of effort into making them happen. Next time just let the winners make a thank speech…that would stress them a little.</p> <p>Overall there wasn’t enough coverage of Rails 3, I guess that’s gonna for next year when everyone migrated all there projects to it.</p> <p>So reflecting on these 4 past days…it was a great conference. A big thanks to the organizers and all the presenters</p> <p>Now time to kick off a new Rails 3 project.</p> <p>Enjoy!<br /> Daniel</p> RailsConf 2010 - Baltimore 2010-06-08T00:00:00-07:00 <div style="text-align:center;"><img src="" alt="20100606_RailsConf_View.jpg" border="0" width="500" /></div> <p>Here we go again RailsConf 2010 has started. The keynotes will be streamed online at and the <a href="">slides</a> of the presentation will also be posted there. I’ll provide more links once they become available.</p> <p>This is the view from my hotel which is 5 minutes from the convention center where RailsConf is going on.</p> <div style="text-align:center;"><img src="" alt="20100607_RailsConf_View_From_Hotel.jpg" border="0" width="400" /></div> <div style="text-align:center;"><img src="" alt="20100607_RailsConf_Submarine.jpg" border="0" width="300" /></div> <h2>Acceptance Testing with Cucumber</h2> <p>I’m now following the <a href="">Acceptance Testing with Cucumber</a> tutorial. You can find the app we built, a kanban manager, on <a href="">github</a>.</p> <p>Cucumber is executable documentation. Gurken is the <span class="caps">DSL</span> used to write your documentation in the form of</p> <pre> Scenario: Given When Then </pre> <p>The app has different git branches for each stage of the application. Checkout the move-card-passing branch for the most complete functionality. It contains great examples of feature test.<br /> <pre><br /> master f294f72 patch number<br /> remotes/origin/<span class="caps">HEAD</span> → origin/master<br /> remotes/origin/first-feature-failing 475eb7e words<br /> remotes/origin/first-feature-passing e4ea67a gemfile<br /> remotes/origin/latest eacd855 Merge<br /> remotes/origin/master f294f72 patch number<br /> remotes/origin/more-features-failing aa2d97b new failing features<br /> remotes/origin/more-features-passing 03b6b44 added lane ordering<br /> remotes/origin/move-card-failing 02fa766 add move_card feature</p> <ul> <li>remotes/origin/move-card-passing 8c1d751 move cards from one lane to another<br /> </pre></li> </ul> <h2><span class="caps">BUILDING</span> AN <span class="caps">API</span> <span class="caps">WITH</span> <span class="caps">RAILS</span></h2> <p>A <a href="">great discussion</a> on building APIs using Ruby and Rails:</p> <ul> <li><a href="">joshowens</a> – <a href="">Four Bean Soup</a></li> <li><a href="">joeferris</a> – <a href="">thoughtbot</a></li> <li><a href="">bitsweat</a> – <a href="">37signals</a></li> <li><a href="">noradio</a> – <a href="">twitter</a></li> <li><a href="">technoweenie</a> – <a href="">GitHub</a></li> <li><a href="">derekwillis</a> – <a href="">The New York Times</a></li> </ul> Dashcode 3.0 - the precursor to Gianduia - A Flash Killer? 2010-05-10T00:00:00-07:00 <p>All right beside the cheesy title of this blog entry I did play a few weeks ago with Dashcode 3.0 to build an iPad app for a customer. After seeing the <span class="caps">WWDC</span> 2009 presentation on DashCode 3.0 I realized how much leaps and bounds DashCode made over the last two years. Checkout the quick screen cast demo here after and let me know what you think!</p> <p>After looking into Dashcode 3.0 and doing some online search I found out that Jeff Watkins created several years ago <a href="">coherentjs</a>, a Cocoa inspired javascript framework, and he joined Apple to work on Dashcode. As you can see on <a href=""></a> he since left Apple and revived Coherent as a multiple browser framework.</p> <p>Based on the fact that <span class="caps">WWDC</span>.</p> <p>Now let’s quickly look at what Dashcode currently offers, it’s pretty cool:<="">Dashcode 3.0 – An <span class="caps">IDE</span> to build <span class="caps">HTML</span> apps for iPad, iPhone and Safari</a> from <a href="">daniel wanja</a>.</p></p> Shutting down Usage Report! 2010-04-27T00:00:00-07:00 <p>Oops,.</p> .</p> <p.</p> <p.</p> <p.</p> <p.</p> <p :-).</p> <p.</p> .</p> <p>If you read so far, thank you for sticking with me during this long thought process. For me at least it was useful ;-)</p> <p>Cheers,<br /> Daniel</p> Making CRUD less "Cruddy", one step at a time 2010-04-27> UsageReport Downloader for Amazon Web ServicesTM. A simple tool to download all you usage reports with one click. ec2, s3, sns, sqs and more 2010-04-20T00:00:00-07:00 <p>UsageReport Downloader for Amazon Web ServicesTM is a simple tool to download all you usage reports with one click.</p> <p>Install <a href="">UsageReport Downloader</a></p> <div style="text-align:center;"><img src="" alt="mainui.png" border="0" width="500" /></div> <p>The files are download in your documents folder. You can change the default folder. You selection is kept for the next time.</p> <p>Click the Download <span class="caps">XML</span> or Download <span class="caps">CSV</span> button to choose which format the report should be downloaded from and off you go…</p> <div style="text-align:center;"><img src="" alt="downloading.png" border="0" width="346" height="299" /></div> <p>All you files are download to the select download folder (here /Users/daniel/Documents/usagereport/downloads/Current\ Billing\ Period)</p> <div style="text-align:center;"><img src="" alt="downloadedfiles.png" border="0" width="339" height="164" /></div> <p>When the application start it checks if you already logged in and you will see the following message.</p> <div style="text-align:center;"><img src="" alt="pleasewait.png" border="0" width="381" height="34" /></div> You can stay logged in between launching the application, we recommend that you log out once you download all you files. <p>If you need to login just enter your email and amazon password as usual for.</p> <div style="text-align:center;"><img src="" alt="usernamepassword.png" border="0" width="480" height="147" /></div> <p>If you use the authentication tokens for signing in you will be presented this additional screen:</p> <div style="text-align:center;"><img src="" alt="token.png" border="0" width="451" height="120" /></div> <p>Et voila…Happy downloading!</p> <p>Please contact me at daniel@appsden.com for any bugs, issues, questions.</p> <p>Enjoy!<br /> Daniel Wanja</p> Cucumber, meet Routes 2010-04-06T00:00:00-07:00 <p>I’ve been loving Rails <span class="caps">BDD</span> with Cucumber for the past year or so — it helps me focus on the next required step to build a feature in my application, and better focus equals better development velocity. However, one thing I found tedious in starting with Cucumber was defining route matchers in <code>paths.rb</code>.</p> <p>The stock <code>path_to</code> method is implemented as a case statement, allowing you to add a case for each path you want to recognize. This works, but leaves you feeling a bit un-<span class="caps">DRY</span> since you’re basically duplicating information in your <code>routes.rb</code> file.</p> <p>Here’s a quick hack to <code>paths.rb</code> that lets you leverage your existing routes:</p> <p>change</p> <typo:code else raise “Can’t find mapping from \”#{page_name}\" to a path.\n" + “Now, go and add a mapping in #{__FILE__}” end </typo:code> <p>to</p> <typo:code else begin page_name =~ /the (.*) page/ path_components = $1.split(/\s+/) self.send(path_components.push(‘path’).join(‘_’).to_sym) rescue Object => e raise “Can’t find mapping from \”#{page_name}\" to a path.\n" + “Now, go and add a mapping in #{__FILE__}” end end </typo:code> <p>In your Cucumber steps, you can now use any named route that does not require a parameter. For example, <code>users_path</code> would become “the users page”, and <code>new_product_path</code> would become “the new product page”. As you add new resources, at least the index and new options should work out of the box — no further edits to <code>paths.rb</code> required!</p> <p><strong><span class="caps">UPDATE</span>:</strong></p> <p>w00t!</p> <p>This is <a href="">now</a> baked into cucumber-rails!</p> Call for help for a Amazon Web Services Usage Report visualizer tool 2010-04-05T00:00:00-07:00 <p>I’ve cross posted this call for help on the <a href="">Amazon Web Service Discussion Forum</a>.</p> <p>I need your help understanding your usage reports logs for a visualization tool I’m currently developing.</p> <p>I’ve been reading this forum for a while and found great information on it. The tool in question is for all Amazon services not just ec2, but I thought the ec2 forum was the most appropriate. Let me know if that’s not the case.</p> <p.</p> <p <span class="caps">AWS</span> Data Transfer Pricing. So the first version of the tool will focus more on visualizing usage rather than calculating price.</p> <p.</p> <p>The best help would be if I can have a copy of to the monthly usage logs by hour in <span class="caps">XML</span>.</p> <p>You can also just help by letting me know what size each of you log files is for each of the services when downloading it in <span class="caps">XML</span> format. And how many lines each of the files contains. That would verify some of the assumptions I’m currently making.</p> <p>To access your logs you must login to your aws.amazon.com account go to the Account page and select Usage Reports from the right menu. Select one of the service from the dropdown, the list includes the following:</p> <ul> <li>Amazon CloudFront, Amazon Elastic Compute Cloud</li> <li>Amazon Simple Storage Service</li> <li>Amazon <span class="caps">RDS</span> Service</li> <li>Amazon SimpleDB</li> <li>Amazon Simple Queue Service</li> <li>Amazon Virtual Private Cloud</li> </ul> <p>Then your are presented with the Download Usage Report form. For the Time Period field select “Last Month”. Then press the “Download report (<span class="caps">XML</span>)” button. This downloads the file my tool will analyze. Download it for each of the services.</p> <p.</p> <p>You can find my not so interesting notes on the development progress of my tool at. The tool will be made available via. My other blog is, I’m a Flex and Ruby on Rails developer in Denver.</p> <p>Any help is appreciated.</p> <p>Daniel Wanja <br /> d@n-so.com</p> Sneak peek of Usage Report for Amazon Web Servicesâ„¢ 2010-03-18T00:00:00-07:00â„¢ I have <a href="">been working</a> on a tool to visualize your Amazon Web Services usage logs for EC2, RDS, SQS, S3, SDB (and soon CF). There will be a limited free version and a full version that has the dashboard and the drill down for each of the services. This tool is still in development but my todo list is getting shorter...so you can have a sneakSneak peek of Usage Report for Amazon Web Servicesâ„¢</a> from <a href="">daniel wanja</a>.</p> MWRC 2010 - Notes from Day 1. 2010-03-12T00:00:00-08:00 <a href="">Jake Parsell</a> took some really great notes using Google Wave. I know the videos will be available shortly but in the mean time if you want to figure out what you may want to watch you can find out more details below: <style type="text/css"> #wave p.p1 {margin-left: 0.0px; font: 26.0px Arial} #wave p.p2 {margin-left: 0.0px; font: 13.0px Arial; min-height: 15.0px} #wave p.p3 {margin-left: 0.0px; font: 20.0px Arial} #wave p.p4 {margin-left: 17.0px; font: 13.0px Arial; color: #0e3ea8} #wave p.p5 {margin-left: 17.0px; font: 13.0px Arial} #wave p.p6 {margin-left: 34.0px; font: 13.0px Arial} #wave p.p7 {margin-left: 17.0px; font: 13.0px Arial; min-height: 15.0px} #wave p.p8 {margin-left: 0.0px; font: 20.0px Geneva; color: #234455} #wave p.p9 {margin-left: 34.0px; font: 13.0px Geneva; color: #234455} #wave p.p10 {margin-left: 34.0px; font: 13.0px Arial; min-height: 15.0px} #wave p.p11 {margin-left: 51.0px; font: 13.0px Arial} #wave p.p12 {margin-left: 68.0px; font: 13.0px Arial} #wave p.p13 {margin-left: 34.0px; font: 13.0px Arial; color: #0e3ea8} #wave p.p14 {margin-left: 85.0px; font: 13.0px Arial} #wave p.p15 {margin-left: 51.0px; font: 13.0px Arial; min-height: 15.0px} span.s1 {font: 20.0px Geneva; color: #234455} span.s2 {font: 20.0px Geneva; color: #003366} span.s3 {font: 13.0px Geneva; color: #234455} span.s4 {font: 13.0px Arial; text-decoration: underline ; color: #0e3ea8} span.s5 {text-decoration: underline ; color: #0e3ea8} span.s6 {color: #000000} span.s7 {text-decoration: underline} span.s8 {background-color: #ffe500} </style> <div id="wave"> <p class="p1"><b>MWRC</b></p> <p class="p2"><br></p> <p class="p3"><span class="s1">Giles Bowkett</span><b> - making some music with ruby </b><span class="s2">Archaeopteryx</span></p> <p class="p4"><span class="s3">- <a href=""><span class="s4">Giles Bowkett: Archaeopteryx: A Ruby MIDI Generator</span></a></span></p> <p class="p5">- learn probability matrix</p> <p class="p5">- google is easy if you understand prob matrix</p> <p class="p5">- google spell check in 21 lines of python</p> <p class="p5">- wonder how easy OCR would seem in this context?</p> <p class="p5">- don't understand python community.... why are there not more dick jokes about pythons?</p> <p class="p6">- how is there not a web framework called trouser snake?</p> <p class="p5">- oh yeah... better talk about lambdas</p> <p class="p7"><br></p> <p class="p3"><span class="s1">James Golick</span><b> - Cooking with Chef - @jamesgolick </b><a href=""><span class="s5"><b>github.com/jamesgolick</b></span></a></p> <p class="p4"><span class="s6">- <a href=""><span class="s7">Chef: Quick and Tasty Ruby Powered Server Configuration</span></a></span></p> <p class="p5">- sysadmin work is boring</p> <p class="p5">- too many config languages</p> <p class="p5">- amazed if anyone can get nagios working on a consistent basis</p> <p class="p5">- ues recipes to install packages</p> <p class="p5">- recipes written in ruby</p> <p class="p5">- create services -> status, restart, reload, etc.</p> <p class="p5">- templates to create config files</p> <p class="p6">- erb</p> <p class="p5">- notifies restart if config changes</p> <p class="p6">- autoreload on save very handy for things like dynamic lists of ips that change when you start a new EC2 instance</p> <p class="p5">- makes setting up stuff like haproxy and heartbeat easier</p> <p class="p5">- security</p> <p class="p6">- easy to include iptables</p> <p class="p6">- <span class="s8">always turn off password ssh logins</span> - easier to remember when part of your cookbook</p> <p class="p5">- look into chef server and chef client</p> <p class="p7"><br></p> <p class="p8">Joe Damato - RVM</p> <p class="p9">- <a href=""><span class="s7">RVM: Ruby Version Manager - RVM Ruby Version Manager - Documentation</span></a></p> <p class="p6"><span class="s3">- </span>RVM gemset - different gemsets for the same ruby version per project</p> <p class="p6">- create rvmrc to switch env automatically when you cd into a project directory</p> <p class="p6">- export gemsets?</p> <p class="p6">- should you use gemsets or just bundler</p> <p class="p10"><br></p> <p class="p8">Loren Segal - Documentation with YARD</p> <p class="p9">- <a href=""><span class="s7">YARD 0.5.3 - The Longest</span></a></p> <p class="p6">- Yet Another Ruby Documentor</p> <p class="p6">- Talk about documentation in general</p> <p class="p11">- Documentation to help you think about your API</p> <p class="p11">- What makes documentation good?</p> <p class="p12">- consistency -> pick a style and stick with it</p> <p class="p12">- correct -> it can be wrong and should be audited</p> <p class="p12">- coherent</p> <p class="p6">- YARD</p> <p class="p11">- meta-data</p> <p class="p11">- @param [Symbol] req_type :get or :post</p> <p class="p11">- ....</p> <p class="p11">- yard-respec</p> <p class="p12">- shows rspec specs alongside method docs</p> <p class="p11">- yard-sinatra</p> <p class="p12">- shows your routes for api</p> <p class="p10"><br></p> <p class="p2"><br></p> <p class="p8">Michael Jackson - Rack for web developers</p> <p class="p13"><span class="s6">- <a href=""><span class="s7">Rack: a Ruby Webserver Interface</span></a></span></p> <p class="p6">- Read the Spec</p> <p class="p6">- blah, blah, blah</p> <p class="p6">- rack is cool in that it allows web frameworks to communicate with web servers, but not sure you care that much unless making a web framework</p> <p class="p10"><br></p> <p class="p3"><b>Yehuda Katz - Modularity - Lessons learned from Rails 3</b></p> <p class="p6">- Try to become modular too soon and you will be wrong</p> <p class="p6">- Become modular once lack of modularity is hurting you, then decouple</p> <p class="p6">- Constants -> Globals</p> <p class="p6">- router.url_for in rails 3</p> <p class="p6">- easier to track down where instance variables came from than Globals</p> <p class="p6">- eliminate things that are global</p> <p class="p11">- tests are the canary in the coal mine</p> <p class="p11">- instead of hard coding contants, pass things around</p> <p class="p11">- be subspicious of Contant.foo</p> <p class="p6">- stop caring about object allocations</p> <p class="p11">- object allocations are essentially free</p> <p class="p6">- Render</p> <p class="p11">- Controller -> ViewPathSet -> ViewPath -> Template (on file system)</p> <p class="p11">- Used to assume actual file path</p> <p class="p12">- hard to cache</p> <p class="p12">- Template.new takes a path</p> <p class="p11">- Now</p> <p class="p12">- Caller -> LookupContext -> ViewPaths -> PathResolver-> Resolver -> Template</p> <p class="p12">- Template.new takes a source</p> <p class="p12">- Could overide PathResolver to pull from database or S3 or something</p> <p class="p14">- could be useful in making a CMS system with Rails</p> <p class="p6">- Use Modules</p> <p class="p11">- don't put methods you want people to be able to override in a class, make a module</p> <p class="p11">- then you cna call super</p> <p class="p11">- Use ActiveSupport::Concern</p> <p class="p15"><br></p> <p class="p3"><b>Paul Sadauskas - HTTP</b></p> <p class="p6">- read the spec :-)</p> <p class="p6">- prevent the requests that you don't have to answer</p> <p class="p6">- Persistent Connections - so you don't have to create a new TCP connection for every request --- keepalive=onC</p> <p class="p6">- Caching</p> <p class="p11">- how do you decide when something is stale?</p> <p class="p15"><br></p> <p class="p15"><br></p> <p class="p3"><span class="s1">Jeff Casimir </span><b>- Ruby Processing</b></p> <p class="p6">- dynamically generate images in ruby app</p> <p class="p6">- uses jruby</p> <p class="p6">- first built to create verticle column headers</p> <p class="p6">- Distributed Programming with Ruby -> to learn how to send jobs to ruby processing from rails</p> <p class="p6">- Beanstalkd -> simple fast background processing -> brew install beanstalkd </p> </div> MWRC 2010 - Day 1 Live Video 2010-03-11T00:00:00-08:00 <p><a href="" title="Moutains Pano + fingers by danielwanja, on Flickr"><img src="" width="500" height="108" alt="Moutains Pano + fingers" /></a></p> <p>The <a href="">schedule</a>. So I will sit back and enjoy the show.</p> <p><strong>Follow it live on <a href="">Justin TV</a>!!</strong></p> <p><object type="application/x-shockwave-flash" height="300" width="400" id="live_embed_player_flash" data="" bgcolor="#000000"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="movie" value="" /><param name="flashvars" value="channel=mwrc&auto_play=false&start_volume=25" /></object><a href="" class="trk" style="padding:2px 0px 4px; display:block; width:345px; font-weight:normal; font-size:10px; text-decoration:underline; text-align:center;">Watch live video from Mountain West Ruby Conference on Justin.tv</a></p> <p>Salt Lake City is definitively a beautiful city, surrounded by it’s mountains…</p> <p><a href="" title="Library by danielwanja, on Flickr"><img src="" width="350" alt="Library" /></a></p> <p><a href="" title="Library by danielwanja, on Flickr"><img src="" width="350" alt="Library" /></a></p> 360Flex last day. 2010-03-11T00:00:00-08:00 <p>What <a href="">MountainWest RubyConf 2010</a>.</p> <h3>Optimize it! ActionScript Tips for iPhone Games Renaun Erickson</h3> <p>Renaun is Plaform Evangelist for Adobe since last week. He will put up the slides and code on his <a href="">blog</a> later today. Many of the tips are good for any Flash/Flex app not just for iPhone ones.</p> <ul> <li>Packager for iPhone (<span class="caps">PFI</span>)</li> <li><span class="caps">LLVM</span> cross compiles</li> </ul> <p>He will focus the talk on Memory/Cpu/Mouse Move and Game Timers.</p> <p>Instead of going to the Flex/Silverlight talk, sorry Jun and Eric, I went to Nate Beck’s talk on pushbutton. And Doug McCune had something special <a href="">planned</a> for Nate’s birthday…</p> <p><object width="400" ><param name="movie" value=""></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400" ></embed></object></p> <p>Flex 4: It’s a Wrap</p> <p><object width="400" ><param name="movie" value=""></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="400"></embed></object></p> <p>Thank’s Tom and John…the conference was awesome!</p> 360 Flex - Day 2 (Tuesday) - Live Blogging 2010-03-09T00:00:00-08:00 <p>As you saw yesterday afternoon I didn’t blog too much, so let’s how today goes. The party last night was really fun, lot’s of networking, rock band playing and just a nice general geek atmosphere.</p> <h2>Evolution of <span class="caps">RIA</span> Design Principals</h2> <p>Right now the “Evolution of <span class="caps">RIA</span> Design Principals” panel is about to start.</p> <p>Panel is:</p> <ul> <li>Chet Haase – Senior Computer Scientists at Adobe</li> <li>Bill Scott – Director UI Engineering at Netflix</li> <li>Ehud Waizer – <span class="caps">SAP</span></li> <li>Paul Guirata – Catalyst Resources</li> </ul> <p>Context: oriented to customer facing applications. Not games.</p> <h3>Chet Haase</h3> <p>He works on effects at Adobe. Effects used in a subtle way can make the user more effective.</p> <p>What are the top 3 rules</p> <ol> <li>Transitioning</li> <li>Anticipatory</li> <li>well-timed.</li> </ol> <p>Don’t Lose the User.</p> <h3>Bill Scott</h3> <p>Principles for Interesting Moments</p> <ul> <li>Input where you output</li> <li>Require a light footprint</li> <li>Stay in the flow</li> <li>Offer invitations</li> <li>Be reactive</li> <li>Use transitions</li> </ul> <h3>Paul Giurata</h3> <p>Modular<br /> Reusable</p> <ul> <li>Panel vs Page</li> <li>Panels being reusable application(s)</li> <li>Panels being re-used down to the code level</li> <li>Panels potentially being entirely separate applications</li> </ul> <p>Bill mentions <a href="">Christine Perfetti</a> has a <a href="">few videos</a> on usability testing.</p> <h3>Compiled Favorite Principles</h3> <ul> <li>Transitioning (Animations)</li> <li>Anticipatory</li> <li>Timing</li> <li>Don’t Lose the User</li> <li>Interesting Moments</li> <li>Modular</li> <li>Reusable</li> </ul> <p>Consistency .via. developers working from the same code. Not a style guide as it’s open for interpretation.</p> <h2>Whats New in Flex 4 that’s <span class="caps">NOT</span> Spark! – Deepa Subramaniam</h2> <p>Deepa was on the engineering team for 7 years and now just got promoted as product manager.</p> <p>She will put the slides on her <a href="">blog</a>. So I will go easy with the notes.</p> <p>We will talk about:</p> <ul> <li>Enhanced States</li> <li>Pixel Bender Integration</li> <li>Text (<span class="caps">TLF</span>)</li> <li>2-way Data Binding</li> <li>Advanced <span class="caps">CSS</span></li> <li><span class="caps">OSMF</span></li> <li>MXItemRenderer</li> <li>RSLs</li> <li>Charting Enhancements</li> <li>ASDoc</li> <li><span class="caps">MXML</span> Vector</li> <li>Compile time <span class="caps">FXG</span> Optimization</li> <li>Improved Compiler</li> </ul> <h3>2-Way Databinding</h3> <p>Inline declaration using the syntax, @{bindable_property}</p> <pre> <s:TextInput <s:TextInput </pre> <h3>Enhanced States Syntax</h3> <ul> <li>AddChild/RemovedChild replaced with includeIn/excludeFrom</li> <li>State Groups</li> </ul> <pre> <m:states> <m:Sate <m:Sate <m:Sate </m:states> <Button label="b1" includeIn="A,B" /> <Button label="b2" includeIn="C" /> </pre> <h3>Text</h3> <ul> <li><span class="caps">FTE</span> – Flash Text Engine in FP10</li> <li><span class="caps">TLF</span> – Text Layout Framework, set of ActionScript classes build atop <span class="caps">FTE</span>. Is <span class="caps">XML</span>-based markup</li> </ul> <p>Each text element maps to a class<br /> <pre><br /> <div> flash.textLayout.elements.DivElement<br /> <p> flash.textLayout.elements.ParagraphElement<br /> <span> flash.textLayout.elements.SpanElement<br /> <tab> flash.textLayout.elements.TabElement<br /> </pre></p> <p><span class="caps">TLF</span> Partitioning:</p> <ul> <li>Simple, plain text</li> <li>Rich text</li> <li>Rich editable text</li> <li>Rich, editable, selectable text</li> </ul> <h3>Pixel Bender Integration</h3> <ul> <li>Pixel Bender: language for hardware-indepdent image processing algorithm</li> <li>Shader: compiled instance of a Pixel Bender kernel</li> <li>Flex introduces the ShaderFilter class. Simplifies pixel bender such that they can be invoked in <span class="caps">MXML</span></li> </ul> <h3>Advanced <span class="caps">CSS</span></h3> <ul> <li>Flex 3: type and class selectors</li> <li>Flex 4: Multiple class selectors, id selectors, descendant selectors, pseudo-selectors, pseudo-state selectors</li> </ul> <p>Eg pseudo-state selectors</p> <pre> @namespace s "library://ns.adboe.com/flex/spark"; s|Button:up { color:#000000; } s|Button:down { color:#FFFFFFF; } </pre> <h3><span class="caps">OSFM</span></h3> <ul> <li>Generic framework for managing media in Flash applications</li> <li>Offers playback functionality, exposed in the Spark video component</li> <li>replaces FLVPlayback</li> <li>org.osmf.media.MediaPlayer</li> <li>Play, pause, stop, loop, seek, volume, autoLoop, autoPlay, …</li> </ul> <h3>MXItemRenderer</h3> <ul> <li>Spark ItemRenderers for use with MX List-based components</li> <li>Extends Spark ItemRenderer and handles the contractual differences</li> </ul> <h3>Charting Enhancements</h3> <ul> <li>FilterFunctions for chart types. Can specify custom filter functions against the data set</li> <li>Inverted axis support</li> <li>RendererDirection in PieSeries</li> <li>Performance related bug fixes</li> </ul> <h3>RSLs</h3> <ul> <li>By default <span class="caps">RSL</span> is turned on.</li> <li>Default linked HelloWorld is 78% smaller</li> <li>How to <a href="">monkey patch when using RSLs</a>. If you monkey patch you loose the benefits off RSLs</li> <li>Flex is split in 6 RSLs: textlayout, osmf, framework, spark, sparkskins, rpc</li> </ul> <h3><span class="caps">MXML</span> Vector</h3> <ul> <li>New type</li> <li>Like Arrays but contents are restricted to a single base type</li> <li>Faster than array</li> </ul> <pre> <fx:Vector <fx:String>hi</fx:String> <fx:String>bye</fx:String> </fx:Vector> </pre> <h3>Compile-time <span class="caps">FGX</span> Optimization</h3> <ul> <li><span class="caps">FXG</span> directly to <span class="caps">SWF</span> representation</li> <li>Faster and smaller</li> <li>.fxg or past <span class="caps">FXG</span> into an <span class="caps">MXML</span> Component uses compile-time <span class="caps">FXG</span> Optimization</li> </ul> <h3>ASDoc</h3> <ul> <li>Comments in <span class="caps">MXML</span></li> <li>Support <span class="caps">DITA</span> creation</li> <li>Max, Win, Linux</li> </ul> <h3>Improved Compiler</h3> <ul> <li>Incremental compilation. 50-80% better</li> <li>Full compilation: 30-40% better (large apps)</li> <li>Compiler Memory Usage: large apps are 30% better. multi-project apps are 70% better. Small apps are similar to Flex 3</li> </ul> 360 Flex - Day 2 (Monday Afternoon) - Live Blogging 2010-03-09T00:00:00-08:00 <div style="text-align:center;"><img src="" alt="360flex_6_robot.png" border="0" width="400" height="300" /></div> <h3>Obey: Building a Rules Engine with AS3 and the Hamcrest <span class="caps">API</span> – Drew McClean & RJ Owen</h3> <div style="text-align:center;"><img src="" alt="360flex_7_rules.png" border="0" width="400" height="290" /></div> <p>How are rules defined and implemented?</p> <p>Rules Engine Anatomy: Facts → Rules [Conditions=>Actions] → Output</p> <p>Battery is down!</p> <h3>Flex + Phidgets = Beer – Kevin Hoyt</h3> <p>Kevin’s presentation was how to drive a <a href="">phidgets</a> board to control dispensing beer to users with an rfid, taking a picture along the way and counting the numbers of beers that user had so far. The board is driven from a Flex application. It was really impressive presentation.</p> <h3>Intro to Flex Typography – Matt Guest</h3> <ul> <li>Flash Text Engine</li> <li>Text Layout Framework</li> </ul> Import your MacHeist serials to AppShelf 2010-03-08T00:00:00-08:00 <p>If:</p> <span class="caps">RUBYOPT</span>=rubygems ruby generate-appshelf.import.rb MacHeist-Serial.html <p>The script will create an import file named “nano-bundle-3.appshelf” in your current directory. Enjoy!</p> <script src=""></script> 360 Flex - Day 2 (Monday Morning) - Live Blogging 2010-03-08T00:00:00-08:00 <table><tr><td><br /> <img src="" alt="360flex_1_ebay.png" border="0" width="221" height="166" /></td> <td> <p><img src="" alt="360flex_2_ebay.png" border="0" width="124" height="166" /></p> <p></td></tr></table></p> <p>Actually today is the first day of the conference. Yesterday was a tutorial day which was really fun. Today there will be a bunch of 1h20m sessions throughout the day. The conference is at the ebay headquarters.</p> <div><img src="" alt="360flex_3_keynote.png" border="0" width="221" height="166" /></div> <p.</p> <h3>Keynote</h3> <p>Now onto the main keynote by Deepa Subramaniam on the Adobe Flash Platform for her first keynote given ever. She is the new Product Manager of the Flex <span class="caps">SDK</span>.</p> <ul> <li>The Flex 4 release is coming really soon.</li> <li>Overview of Flex 4</li> <li>Demo of spark components</li> <li>Data-Centric Development</li> <li>Video from the Flex team (geek funny)</li> </ul> <div style="text-align:center;"><img src="" alt="360flex_4_ Deepa.png" border="0" width="337" height="202" /></div> <p>It’s great that Deepa become the project manager of Flex 4, she understand what’s programming is about. She now continues her talk on the Open Screen project.</p> <p>Developing multi-screen applications (phone .vs. desktop…)</p> <p>Cross screen challenges/Cross device challenges</p> <ul> <li>Screen size</li> <li>Input mechanisms</li> <li>Performance</li> <li>Context/use case changes</li> <li>Screen size, orientation</li> <li>…</li> </ul> <p>Flex can help – <strong>Slider</strong> (Mobile Flex Framework)</p> <ul> <li>Deliver top quality experience</li> <li>Across multiple platforms</li> <li>Within performance constraints</li> </ul> <p>The Slider team is hard a work and hope to have a preview available this year :-(… I want it earlier!</p> <p>Growing Flex Ecosystem:</p> <ul> <li>Functional Testing Tools</li> <li>Performance and Load Test Tools</li> <li>Flex Components</li> <li>Frameworks</li> <li><span class="caps">AMF</span> servers</li> <li>Tooling Extensions</li> <li>Licensing+Encryption</li> <li>Security Testing</li> </ul> <p>All data visualization components now available in the free open-source Flex <span class="caps">SDK</span>!</p> <p>Cool John is saying that they are recording the videos of each session.</p> <h3>Appocalypse Soon? The remaking of ‘Flex Components’ – Michael Labriola</h3> <p>It’s full house for Michael’s talk. I’m not sure how much live blogging I should do has they are video tapping each session.</p> <p>This session is part of his continuing quest to teach Flex from the inside out. To learn about the Flash Player and the Flex framework.</p> <p>Going to derive the Flex framework. Implement a custom component.</p> <ul> <li>Flex 3 and Flex 4 components both descend from UIComponents</li> </ul> <p>Michael is not explain how the code execution is managed by the Flash Player and executed during a frame.</p> <ul> <li>All the basic Flex 3 methods also apply to Flex 4.</li> <li>Flex 3: A base class and then a descendent class for each Layout. Problem i.e. verticalScrollPolicy=“off” to avoid unwanted scrollbars.</li> <li>Flex 4: doesn’t derive layout behavior but can assemble it. Frame (Horizontal, Vertical, Diagonal). So the visuals don’t exist inside of the class.</li> <li>Flex 4 are based on two separate pieces: the form and the function.</li> </ul> <ul> <li>Separating these pieces favors composition over inheritance. By separating these we gain and we loose…</li> <li>Gain: have one set of functionality look many different ways</li> <li>Loose: a lot of dead weight and lots of extra classes</li> <li>Two type of components: Controls and Containers</li> <li>Flex 4: two types of things… those that can be skinned and those that cannot</li> <li>Groups are the base type of container</li> <li>Groups don’t have visual identify</li> <li>BasicLayout, HorizontalLayout, VerticalLayout, TileLayout</li> </ul> <p>New Hierarchy:</p> <pre> UIComponent SkinnalbeComponent SkinnableContainerBase SkinnableContainer Applicaiton Panel Window SkinnableDataContainer </pre> <ul> <li>Skins are classes defined in <span class="caps">MXML</span></li> <li>Applied to components using the skinClass or by <span class="caps">CSS</span></li> <li>Components: declare skin parts and declare skin states</li> </ul> <p>Skins: specify a HostComponent</p> <pre> <fx:Metadata> [HostComponent("spark.components.Button")] </fx:Metadata> </pre> <p>Declare states</p> <pre> <s:states> <s:State <s:State </s:states> </pre> <ul> <li>How it all works: components need to size themselves, need to be created at runtime, need to interact with parents and children</li> <li>Instanciation: all Flex components start with a constructors. Constructors in Flex add event listeners and setup initial properties…That’s it.</li> <li>Display List: list of all the components that are on the screen at one point or another</li> <li>Creating children: all visual children of a component are created in the createChildren method. The visual children of a component exists in the skin and so the skin is first created at this time.</li> <li>Skin Methods: attachSkin, detachSkin, partAdded, partRemoved</li> <li>Sizing: each component implements the measure() method. Flex works on the principle that children must be sized before their parent and it makes the sizing process potentially asynchronous. It works via a priority queue. Priority based on nest level.</li> <li>Flex 4: children leave inside a skin and not the parent. The skin is a component, so we ask it the size of it’s children.</li> <li>Measured Data: measure is only a suggestion.</li> <li>Sizing: parents size children. A component does not size itself.</li> <li>Sizing and Positioning: sizing and positioning is done in a method called updateDisplayList().</li> <li><span class="caps">UDL</span>: components are given a size. One the size is given, the component is free to do what is wishes. For the most part, this information is simply passed down to the skin. Again recursion.</li> </ul> <p>This was a great talk and clarifies many things which is great timing as I’m starting to dive deeper into Flex 4.</p> <p><a href="">To be continued…</a></p> 360 Flex - Day 1 (Sunday) - Live Blogging 2010-03-07T00:00:00-08:00 <p>We just had a great breakfast at Peggy Sue’s Dinner…and moved over to the Ebay Headquarters where the conferences is about to start.</p> <p>I’ll be taking notes during the day and updating this page as we go one.</p> <p><span class="caps">UPDATE</span>: Now that I typed all that I realized that Justin put up the slides and code on his blog: <a href=""></a>.</p> <h1>Connecting Arduino Hardware to Flex: Justin Mclean</h1> <p>twitter: justinmclean<br /> Justin is from Sydney, Australia.</p> <p>Content:</p> <ul> <li>Arduino platform, how to program and how to connect to Flex</li> <li>2/3 Arduino 1/3 Flex</li> <li>Hands on</li> </ul> <h3>So we’ll go through the followings:</h3> <ul> <li>Digital Inputs</li> <li>Digital Outputs</li> <li>Analogue Inputs</li> <li>Pulse Width Modulation</li> <li>Serial Communication</li> <li>Connecting to Flex</li> <li>Review and wrap up</li> </ul> <p.</p> <div style="text-align:center;"><img src="" alt="arduino.png" border="0" width="400" height="300" /></div> <p>The hardware is provided to all participants by <a href=""><strong>sparkfun.com</strong></a></p> <h3>Software</h3> <p></p> <div style="text-align:center;"><img src="" alt="arduino_software.png" border="0" width="350" height="247" /></div> <p>Also install the serial driver: FTDIUSBSerialDriver_10_4_10_5_10_6</p> <h3>Other Hardwares</h3> <ul> <li>ATmega micro-controller from Atmel. It mostly runs in cars.</li> <li>Arduino Duemilanove</li> <li>Arduino Pro and Pro mini</li> <li>Lyllypad (warable)</li> <li>Funnell IO</li> <li>Mega</li> <li>Many others</li> </ul> <h3>ATMega328</h3> <ul> <li>Hight performance low power <span class="caps">RISC</span></li> <li>16 Mzh up to 16 mips (faster as your first pc you owned – if you are a bit older)</li> <li>32K of Memory</li> <li><span class="caps">SPI</span> and 2 wire serial interfaces</li> <li>External interrupts, timers, pulse width modulation</li> </ul> <h3><span class="caps">IDE</span></h3> <ul> <li><span class="caps">IDE</span> open sourcee and cross platform.</li> <li>Based on the Processing language</li> <li>Many open source sketches (projects) and libraries availables. Ethernet library, servers, …</li> </ul> <h3>First Program</h3> <typo:code <p>int ledPin = 13; // <span class="caps">LED</span> connected to digital pin 13</p> <p>// The setup() method runs once, when the sketch starts<br /> void setup() { <br /> // initialize the digital pin as an output:<br /> pinMode(ledPin, <span class="caps">OUTPUT</span>); <br /> }</p> <p>// the loop() method runs over and over again,<br /> // as long as the Arduino has power</p> <p>void loop() <br /> {<br /> digitalWrite(ledPin, <span class="caps">HIGH</span>); // set the <span class="caps">LED</span> on<br /> delay(1000); // wait for a second<br /> digitalWrite(ledPin, <span class="caps">LOW</span>); // set the <span class="caps">LED</span> off<br /> delay(1000); // wait for a second<br /> }</p> </typo:code> <p>Now this will make the led blink:<>Programming</h3> <ul> <li>C like language based o wiring</li> <li>Write code and compile in <span class="caps">IDE</span></li> <li>Upload compiled code using <span class="caps">USB</span></li> <li>Hard to debug</li> </ul> <h3>Circuit Basics</h3> <ul> <li>Ground and power</li> <li>Potential difference required for current ot flow</li> <li>Conductors and resistors</li> </ul> <h3>Digital Inputs/Outputs</h3> <ul> <li>Digital pins on Arduino are dual purpose</li> <li>Digital logic and voltage on = 5V off = 0V</li> <li>Can be set to be input or output via pinMode</li> </ul> <h3>Variables</h3> <ul> <li>boolean, char, byte, int, long, float, double, string and array</li> <li>int 16 bits, long 32 bits, float 32 bits</li> <li>Strings are nul terminated ‘\0’</li> <li>Declare by <datatype> <variable name>; eg int i;</li> </ul> <p>It’s actually C++…What?! At a Flex conferences :-)</p> <h3>Setup Function</h3> <ul> <li>Used for initialization</li> <li>Run when program loaded or board reset</li> <li>Best place to place calls to pinMode</li> </ul> <h3>LEDs</h3> <ul> <li>Current will only flow in one direction</li> <li>Longest pin connect to positive side, shortest to ground</li> <li>Dont’ connect directly to power source use in series with resistors</li> </ul> <div style="text-align:center;"><img src="" alt="leds.png" border="0" width="300" height="225" /></div> <h3>Resistors</h3> <ul> <li>Resistors limit current flowing through them</li> <li>Value and tolerance indicated by cooler bands</li> <li>Resistor values for LEDs</li> <li>For <span class="caps">RGB</span> or <span class="caps">LEG</span> digits you need multiple resitors</li> <li><span class="caps">REG</span>/<span class="caps">GREEN</span>/<span class="caps">BLUE</span> 180 oms, <span class="caps">WHITE</span>/<span class="caps">ULTRAVIOLET</span> 100 oms</li> </ul> <div style="text-align:center;"><img src="" alt="resistors.png" border="0" width="300" height="225" /></div> <h3>Debugging ia Serial Port</h3> <ul> <li>Use Serial.begin to set speed</li> <li>Serial.print, Serial.println to output</li> <li>Use serial monitor in <span class="caps">IDE</span> to view</li> </ul> <h3>Blinking <span class="caps">LED</span></h3> <p>Same program that the first program but this time we just set the led to the pin 3 which is connected to the board.<>Digital Inputs</h3> <ul> <li>Some logic as inputs; hight 95V0 or low (0V)</li> <li>Simplest digital input switch</li> <li>Call pinMode to set as digital input as input</li> </ul> <h3>Connect Switch</h3> <ul> <li>Wire up push button on breadboard</li> <li>Change code to turn light on/off</li> </ul> <p.</p> <typo:code <p>int led = 3;<br /> int button = 4;</p> <p>void setup() {<br /> Serial.begin(9600);<br /> pinMode(led, <span class="caps">OUTPUT</span>);<br /> pinMode(button, <span class="caps">INPUT</span>);<br /> }</p> <p>void loop() {<br /> if (digitalRead(button) == <span class="caps">HIGH</span>) { <br /> Serial.println(“on”); <br /> digitalWrite(led, <span class="caps">HIGH</span>); <br /> } else {<br /> Serial.println(“off”); <br /> digitalWrite(led, <span class="caps">LOW</span>); <br /> }<br /> }</p> </typo:code> <p>So let’s look at the wiring and how the switch operates:<>Internal Pullup Resistors</h3> <ul> <li>Set mode to input</li> <li>digitalWrite to <span class="caps">HIGHT</span> to turn on</li> <li>digitalWrite to <span class="caps">LOW</span> to turn off</li> </ul> <p>So there is something like the 10K resistor built-in the board to avoid using an extra resistor on the board to make sure the switch values are on or off.</p> <h3>Switch Issues</h3> <ul> <li>Switches can bounce and give and off values while switching</li> <li>Noise can give false results</li> <li>More a problem when switching needs to be counted</li> <li>Use timer to solve issue (time = millis())</li> </ul> <h3>Analog Inputs & Potentiometer </h3> <ul> <li>Can read values via analogRead</li> <li>Result is in range 0 to 1023 (10 bits)</li> <li>Potentiometer is Variable resistor</li> <li>Eg Read potentiometer values with Analog Inputs</li> </ul> <typo:code <p>int led = 3;<br /> int pot = 0;</p> <p>void setup() {<br /> Serial.begin(9600);<br /> pinMode(led, <span class="caps">OUTPUT</span>);<br /> }</p> <p>void loop() {<br /> int value = analogRead(pot);<br /> digitalWrite(led, <span class="caps">HIGH</span>); <br /> // Set delay based on analog input<br /> delay(value);<br /> digitalWrite(led, <span class="caps">LOW</span>); <br /> delay(value);<br /> }</p> </typo:code> <p.</p> <div style="text-align:center;"><img src="" alt="potentiometer.png" border="0" width="400" height="300" /></div> <h3><span class="caps">LDR</span></h3> <ul> <li>Light dependent resistor (high resistance)</li> <li>Set flash rate based on value of <span class="caps">LDR</span></li> </ul> <p>This is a great full day tutorial and everyone seems to have fun. It’s pretty basic, but it’s the first time I program hardware.</p> <p>Now we are writing fadeIn and fadeOut functions and get the light to pulse on and off</p> <pre> void fadeIn(int led) { for (int i=0; i<256; i++) { analogWrite(led, i); delayMicroseconds(5000); } } void fadeOut(int led) { for (int i=255; i >= 0; i--) { analogWrite(led, i); delayMicroseconds(5000); } } void loop() { fadeIn(led); fadeOut(led); } </pre> <p>Now we replace the light sensor by a temperature sensor. There are also air quality sensors, breathalyzers.</p> <h3>Flex</h3> <p>Communication between Flex and Arduinos.</p> <ul> <li>Software on Arduino (Firmata)</li> <li><span class="caps">USB</span> serial to socket proxy</li> <li>Flex event based library to talk to socket (as3Glue)</li> </ul> <p>Firmata is an Arduino library that support a binary protocol over serial interface. It’s Bi-directiona. Use version 2.</p> <p>In the Arduino <span class="caps">IDE</span> let’s load the StandardFirmata program (File|Examples|Firmata|StandardFirmata). It’s a 286 lines program similar to the code we wrote so far, but more complex.</p> <p>Server Proxy</p> <p>From the server proxy (end of page)</p> <p>To configure proxy first find what your serial device is. <br /> In terminal do: ls /dev/cu*</p> <p>/dev/cu.Bluetooth-Modem <br /> /dev/cu.Bluetooth-<span class="caps">PDA</span>-Sync <br /> /dev/cu.usbserial-A600ailA</p> <p>Then add this line to your serproxy.cfg:<br /> serial_device=/dev/cu.usbserial-A600ailA</p> <p>Then we just start the server proxy:<br /> $ ./serproxy <br /> Serproxy – ©1999 Stefano Busti, ©2005 David A. Mellis – Waiting for clients</p> <p>Now in Flex you need to add the as3glue code () then you can drive arduino as follows:</p> <pre>); } </pre> <p>A qik look at the class room in the middle of coding their Flex app to drive their Arduino device:</p> <p>="streamID=515f621ccf514b6b8ad9dfb0c62ad851&autoplay=false" /><embed src="" quality="high" bgcolor="#333333" width="425" height="319" name="qikPlayer" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="" FlashVars="streamID=515f621ccf514b6b8ad9dfb0c62ad851&autoplay=false"></embed></object></p> <p>Now we are going to write some Flex code to have some buttons that turn on/off some functions of the board.</p> <pre>); } </pre> <p>Thanks Justin, great talk!</p> vault.ncaa.com : under the hood of a cool Flex project. 2010-03-05T00:00:00-08:00 <div style="text-align:center;"><img src="" alt="vault.png" border="0" width="350" height="378" /></div> <p><a href="">Thought Equity Motion</a> and <a href=""><span class="caps">NCAA</span></a> two days ago officially released the <a href="">Ncaa Vault</a>. A cool Flex app backed by an incredible video database with awesome metedata about each game…and released just in time for March Madness.</p> <p>Here are a few of the announcements and online articles describing the services:</p> <ul> <li><a href="®%20and%20Thought%20Equity%20Motion%20Unveil%20First%20Ever%20Video-Powered%20Vault%20for%20NCAA%20March%20Madness®?title=NCAA®%20and%20Thought%20Equity%20Motion%20Unveil%20First%20Ever%20Video-Powered%20Vault%20for%20NCAA%20March%20Madness®&mkid=tw_3-3-10">NCAA® and Thought Equity Motion Unveil First Ever Video-Powered Vault for <span class="caps">NCAA</span> March Madness®</a> – by Thought Equity</li> <li><a href="">N.C.A.A. Tournament Goes Online, Clip by Clip</a> – by the New York Times</li> <li><a href="">Say Hello to <span class="caps">NCAA</span> Vault, Adieu to Productivity</a> – by Wired</li> </ul> <p>In fact with the Vault you can have a <span class="caps">URL</span> right into a specific moment of any game and Wired picked out a great <a href="">last second tying shot</a>.</p> <p>The twittersphere feedback is also <a href="">pretty impressive</a>.</p> <p>This is the most visible Flex app I worked on :-) Late January <a href="">Cameron Pope</a> contacted me to ask if I could help on a Flex project for <span class="caps">NCAA</span> and Thought Equity. The funny part is that I didn’t know that Cameron was such a great Flex developer, I met him via the Denver Ruby on Rails User Group (derailed) and I also didn’t know what <span class="caps">NCAA</span> was (don’t shoot, I didn’t grow up in the US and we don’t have TV). So when I asked my father in law about <span class="caps">NCAA</span>.</p> <p>Cameron was the main Flex developer and I just worked part time on Monday’s on this project. If you need and incredible Flex developer just contact Cameron.</p> <p>Now let’s dive more into the Flex nitty-gritty details:</p> <p>For the mvc architecture we used the <a href="">Swiz Framework</a>:</p> <div style="text-align:center;"><img src="" alt="timeline.png" border="0" width="350" height="129" /></div> <p>So each line of the timelime is rendered by the TimeLineItemRender and you can just autowire the model which contains the playhead position.</p> <pre> [Autowire] [Bindable] public var vaultModel:Vault; </pre> <p>The we can set the style name accordingly based on the play’s start time and the current playhead position:</p> <pre>Degrapha</a> for skinning () using an approach similar to this <a href="">example</a> (example <a href="">source</a>)</p> <p>Most of my work was around the searching, bug fixing and general architecture overview. We took a similar approach to the one I described <a href="">here</a> in order to avoid most of the server round trips during searching.</p> <p>The Flex app is just a pretty face, behind the scene Thought Equity provides an incredible services that they will expose in many ways, the start can be seen <a href="">here</a> and all that data will be able to be accessed via <span class="caps">API</span> and other means.</p> <p>This was a short but incredible project for me, the guys at Though Equity have such an incredible vision on how to turn these sport videos into something so much bigger! Thank you guys for getting me on board.</p> <div style="text-align:center;"><img src="" alt="thoughtequity.png" border="0" width="245" height="30" /></div> <p>Enjoy!<br /> Daniel Wanja</p> Time.onrails.org is closing! 2010-02-18T00:00:00-08:00 <p>I.</p> <p>I will turn down the service on March 17th at 9pm.</p> <p.</p> <p>For posterity here is the “official” announcement blog entry of the creation of the service:</p> <p><a href="">April 13, 2006 – <span class="caps">LAUNCH</span> time.onrails.org, time tracking made simple! </a></p> <p>And here are <a href="">few more articles</a> related to time.onrails.org.</p> <p>Here is part of the email I send to the users:</p> <p><cite><br /> Time.onrails.org is closing down March 17th 2010 at 9pm Mountain time.</p> <p>You can export your time entry for each project by clicking on the export buttons at the bottom of each project page or you can export your full account by just login and then go to this url:</p> <p> Â</p> <p>This will export each of the projects will all sections including the notes.</p> <p>Please start transitioning to a new service now.</p> <p>As a replacement service I would suggest harvest () which offers a free plan which allows for 2 projects, 4 clients, unlimited invoicing for 1 user absolutely <span class="caps">FREE</span>.</p> <p.</p> <p.</p> .</p> <p.</p> <p>Please don’t hesitate to contact me for any question at daniel@onrails.org.</p> <p>Thank you again for having tried out or being a user of time.onrails.org over all these years.</p> <p>Kind regards,<br /> Daniel Wanja<br /> </cite></p> Rails 3: Rack Middleware 2010-02-18T00:00:00-08:00 <p>I’m watching the <a href="">Rails Online Conference</a>, February 2010 Exploring Rails 3 and really like how they setup the rack middleware.</p> <p>…From the slides.</p> <h1>Rack Middleware</h1> <p><a href=""></a></p> <h3>Content Modifying</h3> <pre> Rack::Chunked Rack::ContentLength Rack::ConditionalGet Rack::ContentType Rack::Deflater Rack::ETag Rack::Head Rack::MethodOverride Rack::Runtime Rack::Sendfile Rack::ShowStatus </pre> <h3>Behavioral</h3> <pre> Rack::CommonLogger Rack::Lint Rack::Lock Rack::Reloader </pre> <h3>Routing</h3> <pre> Rack::Cascade Rack::Recursive Rack::Static Rack::URLMap </pre> <h1>Rack::Contrib</h1> <p><a href=""></a></p> <pre> Rack::AcceptFormat Rack::Access Rack::Backstage Rack::Callbacks Rack::Config Rack::Cookies Rack::CSSHTTPRequest Rack::Deflect Rack::Evil Rack::HostMeta Rack::JSONP Rack::LighttpdScriptNameFix Rack::Locale Rack::MailExceptions Rack::NestedParams Rack::NotFound Rack::ProcTitle Rack::Profiler Rack::ResponseCache Rack::ResponseHeaders Rack::RelativeRedirect Rack::Signals Rack::SimpleEndpoint Rack::TimeZone </pre> <h1>Coderack.org</h1> <p>Check also out <a href=""></a> …99 pieces of Rack Middleware</p> <h1>RailsGuide: Rails On Rack</h1> <p><a href=""></a></p> Mi-Fi 1.1 in AppStore Now and what I learned along the way... 2009-11-17T00:00:00-08:00 <p>During <a href="">360idev</a> (Sept 27-30) I wrote a small app to check the battery and connectivity level of my <a href="">Mifi Card</a>. I didn’t think many people would have an iPhone and a Mifi card. The iPhone is already 3g, but effectively there is not tethering allowed and the AT&T network is crapy. Nevertheless I thought my <a href="">Mi-Fi App</a> could be useful to others and along the way I would learn what it takes to submit an app to the AppStore.</p> <p><br/> <a href="">Rogue Amoeba</a> <a href=""><</code>jkkmobile</a>..</p> <p><br/>.</p> <p><br/> <span class="caps">SDK</span>.</p> <h2>But will it make me rich?</h2> Well, that was not the intend of the Mi-Fi app and I sold it for $0 and I can assume that I won’t make it up in numbers. So what are the numbers? <div style="text-align:center;"><img src="" alt="download.png" border="0" width="500" /></div> <p :-)</p> <p>The interesting thing is that when Andy Ihnatko <a href="">tweeted about it </a>and Robert Scoble <a href="">re-tweeted it</a> the downloads made a nice bump:</p> <p><cite>“This is a must-have iPhone app for MiFi users: shows complete status of device. — big thanks to @2busy2blog – Andy Ihnatko”</cite></p> <p>And it shows of the iPhone community is active as many iPhone blogs picked on it, here are a few reviews:<>So this was a good first learning experience and hopefully there will be more.</p> <p>Enjoy!<br /> Daniel</p> Amazon RDS: Amazon Relational Database Service or MySQL in the Cloud for Ruby On Rails. 2009-10-29T00:00:00-07:00 <p>For <span class="caps">RDS</span>.</p> <p>You can find more information on Amazon Relational Database Service (<span class="caps">API</span> Version 2009-10-16) <a href="">here</a>.</p> <p>Prerequisite: you need to <a href="">signup</a> for an account on aws.amazon.com, it can be used for EC2, S3, SimpleDb and all the other services <span class="caps">AWS</span> provides.</p> <h2>1) Install the Command Line Toolkit</h2> <p>First thing, go download the command line toolkit and read the <span class="caps">README</span>.<span class="caps">TXT</span> on how to install it. In short you unzip the files, I did put mine at /Developer/aws/RDSCli-1.0.001. Then you create a credential file which contains your <span class="caps">AWS</span> access key id and secret key. Then I configured my ~/.bash_profile as follows:</p> <typo:code> <p>export AWS_RDS_HOME=/Developer/aws/RDSCli-1.0.001<br /> export AWS_CREDENTIAL_FILE=$AWS_RDS_HOME/credential-file-path.conf<br /> export JAVA_HOME=/Library/Java/Home<br /> export <span class="caps">PATH</span>=$AWS_RDS_HOME/bin:$<span class="caps">PATH</span></p> </typo:code> <p>to see that the command line toolkit is setup correctly type $rds —help</p> <p>You will need the command line tool to execute several commands described here after.</p> <h2>2) Create an Instance</h2> <p>Let’s create a MySQL Server instance. <span class="caps">RDS</span> offers the following 5 server instance classes:</p> <ul> <li>db.m1.small (1.7 GB of <span class="caps">RAM</span>, $0.11 per hour)</li> <li>db.m1.large (7.5 GB of <span class="caps">RAM</span>, $0.44 per hour)</li> <li>db.m1.xlarge (15 GB of <span class="caps">RAM</span>, $0.88 per hour)</li> <li>db.m2.2xlarge (34 GB of <span class="caps">RAM</span>, $1.55 per hour)</li> <li>db.m2.4xlarge (68 GB of <span class="caps">RAM</span>, $3.10 per hour)</li> </ul> <p>I will choose a small instance which I will call dbserver1 with a database name db1 and allocate 5g of database space. I also set the master username as admin and password as secret.</p> <typo:code> <p>$ rds-create-db-instance —db-instance-identifier db1 —allocated-storage 5 —db-instance-class db.m1.small —engine MySQL5.1 —master-username admin —master-user-password secret —db-name db1 —headers</p> </typo:code> <p>The output is the following:</p> <typo:code> <p><span class="caps">DBINSTANCE</span> DBInstanceId Class Engine Storage Master Username Status Backup Retention<br /> <span class="caps">DBINSTANCE</span> db1 db.m1.small mysql5.1 5 admin creating 1 <br /> <span class="caps">SECGROUP</span> Name Status<br /> <span class="caps">SECGROUP</span> default active<br /> <span class="caps">PARAMGRP</span> Group Name Apply Status<br /> <span class="caps">PARAMGRP</span> default.mysql5.1 in-sync</p> </typo:code> <p>Now you have a server running and you are being billed $0.11 per hour, that’s like $80 a month without bandwidth but with backup…and it took only 2 minutes to get going. Can’t beat that.</p> <p>To see all the instances you have you can issue the</p> <typo:code> <p>rds-describe-db-instances —headers</p> </typo:code> <h2>3) Grant Network Access</h2> <p>So I will grant access from my notebook, assuming the ip address is 24.19.0.48 (you can also specify ranges i.e. 24.19.0.0/50). (Note that access was revoked by <span class="caps">AWS</span>, not sure why??)</p> <typo:code> <p>rds-authorize-db-security-group-ingress default —cidr-ip 24.19.0.48 —headers</p> </typo:code> <p>I also have an ec2 instance which I want to grant access to</p> <typo:code> <p>rds-authorize-db-security-group-ingress default —ec2-security-group-name watchthatsite —ec2-security-group-owner-id 526541544691</p> </typo:code> <p>Note the ec2-security-group-owner-id is your Amazon <span class="caps">AWS</span> account number, you can find it for example on you account activity page. To see your security configuration issue the following command: rds-describe-db-security-groups default —headers</p> <h2>4) Using the Database</h2> <p>To use your database you first need to find out the endpoint address of your new server. So describe you instances:</p> <typo:code>rds-describe-db-instances —headers command</typo:code> <typo:code> <p><span class="caps">DBINSTANCE</span> DBInstanceId Created Class Engine Storage Master Username Status Endpoint Address Port AZ Backup Retention<br /> <span class="caps">DBINSTANCE</span> db1 2009-10-28T22:53:31.666Z db.m1.small mysql5.1 5 admin available db1.cyhik6zpub5c.us-east-1.rds.amazonaws.com 3306 us-east-1b 1 <br /> <span class="caps">SECGROUP</span> Name Status<br /> <span class="caps">SECGROUP</span> default active<br /> <span class="caps">PARAMGRP</span> Group Name Apply Status<br /> <span class="caps">PARAMGRP</span> default.mysql5.1 in-sync</p> </typo:code> <p>You find out your endpoint address, for me db1.cyhik6zpub5c.us-east-1.rds.amazonaws.com</p> <p>So now you can connect to your database:</p> <typo:code> <p>mysql -h db1.cyhik6zpub5c.us-east-1.rds.amazonaws.com -P 3306 -u admin -p db1</p> </typo:code> <p>Let’s configure my Rails application to point to that database and run a migration:</p> <p>So I change my config/database.yml to point to the above database</p> <typo:code> <p>development:<br /> adapter: mysql<br /> host: db1.cyhik6zpub5c.us-east-1.rds.amazonaws.com<br /> reconnect: false<br /> database: db1<br /> username: admin<br /> password: secret</p> </typo:code> <typo:code> rake db:migrate </typo:code> <p>Wow, seem to work.</p> <p>Let connect to the mysql console and do a show tables;</p> <pre> +-------------------+ | Tables_in_db1 | +-------------------+ | schema_migrations | | users | | watches | +-------------------+ </pre> <p>Yep, all there.</p> <p>Now I still have to move my old production database to the new one, so let’s dump the data from my old database:</p> <typo:code> <p>mysqldump watchthatsite_development -u admin > wts.sql</p> </typo:code> <p>and reload that data in the new database:</p> <typo:code> <p>mysql -h db1.cyhik6zpub5c.us-east-1.rds.amazonaws.com -P 3306 -u admin -p db1 < wts.sql</p> </typo:code> <p>Restarting my Rails server…That’s all!</p> <p>Enjoy,<br /> Daniel.</p> You Mifi card status iPhone App on the Available on the AppStore now. 2009-10-14T00:00:00-07:00 If you have an iPhone and like several people i know you didn't tether it and you are not happy with AT&T's 3G network chances are you have a Mifi 2200 card from Sprint or Verizon. These Mifi cards are pretty cool and now you can use the <a href="">Mi-Fi</a> app from your iPhone and see the following status: Battery Level, Connectivity, Data Received and Transmitted (since connected), Time Connected and IP address. Try it out and if you like it rate it! Enjoy! Daniel. <div style="text-align:center;"> <img src="" alt="mi-fi.png" border="0" width="250" /> <a href=""><img src="" /></a> </div> 360iDev is next week in Denver...and it's nearly sold out! 2009-09-23T00:00:00-07:00 <p><a href="">360iDev</a>.</p> <p>You can find the schedule as <a href=""> ical</a> or <a href="">download a pdf</a></p> <p>Here is my schedule:</p> <p>On Sunday I’ll attend the “Hands-On with the Appcelerator platform.” session.</p> <p><strong>Monday</strong></p> <div style="text-align:center;"><img src="" alt="360idev_monday.png" border="0" width="500"/></div> <p><strong>Tuesday</strong></p> <div style="text-align:center;"><img src="" alt="360idev_tuesday.png" border="0" width="500" /></div> <p><strong>Wednesday</strong></p> <div style="text-align:center;"><img src="" alt="360idev_wednesday.png" border="0" width="500" /></div> <p>If you are not <a href="">signed up</a> yet…you better hurry.</p> <p>I hope I’ll see you there!</p> <p>Daniel</p> RMagick (from source) on Snow Leopard 2009-09-04T00:00:00-07:00 <p>After the release of 10.5, I published an article about <a href="">building RMagick from source on Leopard</a>. I won’t rehash the why, you can read the original article for that. My clean install necessitated updating the RMagick script, so here’s what worked for me to install from source on Snow Leopard! For the impatient, here’s the download link: <a href="">rmagick-build.sh</a></p> <p>First, we start with installing <code>wget</code>, as it seems to be a bit more clever than <code>curl</code> about dealing with mirrors, etc. Then, we compile and install each prerequisite package. Finally, we install the gem.</p> <p>All the links in the script worked for me, but, depending on your location, network, conditions, etc, your mileage may vary. Enjoy!</p> <typo:code> <p>#!/bin/sh</p> <ol> <li>install wget, which is cleverer than curl<br /> curl -O<br /> tar zxvf wget-1.11.tar.gz <br /> cd wget-1.11<br /> ./configure —prefix=/usr/local<br /> make<br /> sudo make install<br /> cd /usr/local/src</li> </ol> <ol> <li>prerequisite packages<br /> wget<br /> tar zxvf freetype-2.3.9.tar.gz<br /> cd freetype-2.3.9<br /> ./configure —prefix=/usr/local<br /> make<br /> sudo make install<br /> cd /usr/local/src</li> </ol> <p>wget<br /> tar zxvf libpng-1.2.39.tar.gz<br /> cd libpng-1.2.39<br /> ./configure —prefix=/usr/local<br /> make<br /> sudo make install<br /> cd /usr/local/src</p> <p>wget<br /> tar xzvf jpegsrc.v6b.tar.gz<br /> cd jpeg-6b<br /> ln -s `which glibtool` ./libtool<br /> export MACOSX_DEPLOYMENT_TARGET=10.6<br /> ./configure —enable-shared —prefix=/usr/local<br /> make<br /> sudo make install<br /> cd /usr/local/src</p> <p>wget<br /> tar xzvf tiff-3.9.1.tar.gz<br /> cd tiff-3.9.1<br /> ./configure —prefix=/usr/local<br /> make<br /> sudo make install<br /> cd /usr/local/src</p> <p>wget<br /> tar xzvf libwmf-0.2.8.4.tar.gz<br /> cd libwmf-0.2.8.4<br /> make clean<br /> ./configure<br /> make<br /> sudo make install<br /> cd /usr/local/src</p> <p>wget<br /> tar xzvf lcms-1.17.tar.gz<br /> cd lcms-1.17<br /> make clean<br /> ./configure<br /> make<br /> sudo make install<br /> cd /usr/local/src</p> <p>wget<span class="caps">GPL</span>/gs870/ghostscript-8.70.tar.gz<br /> tar zxvf ghostscript-8.70.tar.gz<br /> cd ghostscript-8.70<br /> ./configure —prefix=/usr/local<br /> make<br /> sudo make install<br /> cd /usr/local/src</p> <p>wget<span class="caps">GPL</span>/gs860/ghostscript-fonts-std-8.11.tar.gz<br /> tar zxvf ghostscript-fonts-std-8.11.tar.gz<br /> sudo mv fonts /usr/local/share/ghostscript</p> <ol> <li>Image Magick<br /> wget<br /> tar xzvf ImageMagick.tar.gz<br /> cd `ls | grep ImageMag —disable-openmp<br /> make<br /> sudo make install<br /> cd /usr/local/src</li> </ol> <ol> <li>RMagick<br /> sudo gem install rmagick<br /> </typo:code></li> </ol> <p><b style="color:red"><span class="caps">UPDATE</span></b> There is a bug with libgomp that breaks the <code>convert</code> utility (See comments below). the <code>--disable-openmp</code> configure option has been added to the script to fix this.</p> <p><b style="color:red"><span class="caps">UPDATE</span> 2</b> A new patchlevel of ImageMagick has been released that supersedes the original one referenced in this script, and the original has been removed from the server. Thanks to Sebastian for this update that will grab the latest release.</p> Introducing Hashdown 2009-08-04T00:00:00-07:00 <p>If <a href="">hashdown</a> plugin that provides hash-like access for reference data records, and also adds some dropdown option list generation support, since this data is often used to populate select list in forms.</p> <p>As an example of what hashdown does, suppose we have the following model:</p> <typo:code <p>class CardType < ActiveRecord::Base<br /> end</p> </typo:code> <p>with the following data:</p> <typo:code> <p><ins><del>-</del>-</ins>———-<ins><del>-</del>———————-</ins><br /> | id | code | name |<br /> <ins>====</ins>=+====+<br /> | 1 | visa | Visa |<br /> | 2 | mc | MasterCard |<br /> | 3 | disc | Discover |<br /> | 4 | amex | American Express |<br /> <ins><del>-</del>-</ins>———-<ins><del>-</del>———————-</ins></p> </typo:code> <p>By adding the following line to the model:</p> <typo:code <p>class CardType < ActiveRecord::Base<br /> finder :code<br /> end</p> </typo:code> <p>You get the functionality of a hash-like square-bracket accessor for the model that will let you do something like:</p> <typo:code <p>@order.card_type = CardType[:visa]</p> </typo:code> <p>The underlying implementation is similar to:</p> <typo:code <p>def CardType < ActiveRecord::Base<br /> def self.[](value)<br /> find_by_code(value)<br /> end<br /> end</p> </typo:code> <p>…except it adds a caching layer to boost performance by preventing repeated database access.</p> <p>Adding the following directive:</p> <typo:code <p>def CardType < ActiveRecord::Base<br /> selectable<br /> end</p> </typo:code> <p>to the model gives you a class method called <code>select_options</code> that can be used to populate a select list like this:</p> <typo:code <p><%= form.select :card_type_id, CardType.select_options %></p> </typo:code> <p>produces:</p> <typo:code <input type="select" name="order[card_type_id]" id="order_card_type_id"> <option value="1">Visa</option> <option value="2">MasterCard</option> <option value="3">Discover</option> <option value="4">American Express</option> </input> </typo:code> <p>By default, this will use the <code>id</code> attribute as the submitted value of the option and call a <code>display_name</code> method (if it exists) for the displayed value of the option, falling back to the <code>name</code> method/attribute. Each of these can be overridden by passing a symbol attribute / method name, or a lambda that will be executed to generate the value. For (a contrived) example:</p> <typo:code <p><%= form.select :card_type_id, CardType.select_options(:key => :code, :value => lambda{|card_type| card_type.name.reverse }) %></p> </typo:code> <p>produces:</p> <typo:code <input type="select" name="order[card_type_id]" id="order_card_type_id"> <option value="visa">asiV</option> <option value="mc">draCretsaM</option> <option value="disc">revocsiD</option> <option value="amex">sserpxE naciremA</option> </input> </typo:code> <p>Again, the <code>select_option</code> results are cached for better performance.</p> <p>This is a pretty small plugin that I’m using to <span class="caps">DRY</span> up some code in a current project I’m working on. Let me know if you have feature requests (or fork and patch it on <a href="">GitHub</a>!)</p> Behind the scene: Quiltivate.com a beautiful Flex on Rails website. 2009-07-16T00:00:00-07:00 I met Phil several years ago at Derailed, the (Denver Ruby on Rails user group, and for a long time he was curious about how Flex can be integrated with Rails, about the graphical possibilities that Flex offers, the advantages over plain HTML/CSS/Javascript. Then he told me Kacie, his wife, had an idea about a website. She is passionate about quilts and has an eye for details and excellence. Phil is a geek that loves Rails, Kacie loves quilts, it's like Quilting meets Web 2.0 and <a href="">quiltivate.com</a> was born. In fact Phil and Kacie hired me to create a Quilt Builder that integrates with <a href="">Quiltivate.com</a>. Kacie had the vision for the whole concept, a simple to use quilt builder that removes lots of the hassle of calculating how much fabric of what color is needed and allows to play with blocks, shapes and colors. She drew a paper prototype that really highlights the tag line of their site" Innovating Traditional Quilting". <a href="">Quiltivate.com</a> offer much more than a Quilt Builder, it's a blog and a community centered around the art and craft of quilting. Over the last year I spent a couple of hours here and there, well a little more than that, to transform the paper prototype into a real Flex application. Rather than writing about what the tool does and how it does it, let's have a little look at behind the scene of the Quilt Builder with this video: <object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="" /><embed src="" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object><p><a href="">Behind the scene: Quiltivate.com a beautiful Flex on Rails website.</a> from <a href="">daniel wanja</a>.</p> Check out <a href="">quiltivate.com<. Screencast: Testing Flex Apps with Cucumber - Take 2 2009-07-13T00:00:00-07:00 I was not really happy with <a href="">last week's screencast</a> I did on testing Flex with Cucumber. Effectively doing screencast is not an easy endeavor and trying to it myself is making me appreciate all the other screencast I watch so much more. So last week I just wasn't comfortable while I recorded it, not sure why, but I thought I should try to capture it again. And the second time around I felt better, maybe I should alway take two takes (or even more :-). So here is the new one... <object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="" /><embed src="" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object><p><a href="">Screencast: Testing Flex Apps with Cucumber - Take 2</a> from <a href="">daniel wanja</a>.<br/> To run this code you need to have all the gems installed. So config your Rails to run Cucumber with FunFx (in config/environments/test.rb): <typo:code config.gem "rspec", :lib => false, :version => ">= 1.2.7" config.gem "rspec-rails", :lib => false, :version => ">= 1.2.7" config.gem "webrat", :lib => false, :version => ">= 0.4.4" config.gem "cucumber", :lib => false config.gem "funfx" config.gem "safariwatir" </typo:code> Config Cucumber to have @flex available (in features/support/env.rb) <typo:code require 'funfx' require 'funfx/browser/safariwatir' browser = Watir::Safari.new browser.goto("") Before do @flex = browser.flex_app('flashContent', 'flashContent') end at_exit do browser.close end </typo:code> In the same file disable transactional fixtures <typo:code Cucumber::Rails.use_transactional_fixtures </typo:code> Ensure that your Flex application is compiled with the funfx library and the automation library linked in. <typo:code <flex-config> <compiler> <include-libraries <library>../../lib/funfx-0.2.2.swc</library> <library>../../lib/automation.swc</library> <library>../../lib/automation_agent.swc</library> <library>../../lib/automation_dmv.swc</library> <library>../../lib/automation_agent_rb.swc</library> </include-libraries> </compiler> </flex-config> </typo:code> Screencast: Testing Flex Apps with Cucumber 2009-07-08T00:00:00-07:00: <object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="" /><embed src="" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object><p><a href="">Testing Flex Apps with Cucumber</a> from <a href="">daniel wanja</a> The source code can be found on <a href="">github</a> Enjoy! Daniel <br/> UPDATE: An updated version (and slightly) different version of the screencast can be found <a href="">here</a>. RailsConf 2009 Day Two 2009-05-07T00:00:00-07:00 <p>Day Two got off to a good start. Engine Yard did a promotional pitch — the speakers could have been a bit more polished, but it was interesting stuff about their one-button-deployment, and overall not bad for an advertisement.</p> <p <strong>sharing code</strong>. His point was that in his eyes, it’s better to focus more on the community: share code, contribute to open source projects, even write documentation for existing projects. Being a <strong>good</strong> developer trumps being a famous developer. The complete text of the talk is <a href="">online here</a> .</p> <p>For the first session of the day, it was a tough call between Rack/Sinatra and Metric Fu. I finally went with:</p> <h2>Using metric_fu to Make Your Rails Code Better – Jake Scruggs</h2> .</p> <p>He touched on coverage as a baseline that you should be doing as a part of your code analysis, then went on to complexity analysis, reviewing two tools available to analyze the “complexity” of your code: Flog and Saikuro. Flog examines your code (<code>flog -g app</code>”.</p> <p.</p> <p!</p> !</p> <p>Next up was Flay, which detects non-<span class="caps">DRY</span>-ness in code, anything from strict copy-n-paste to functionally identical blocks with different variable names to do..end blocks matching curly-brace blocks.</p> <p <code>rake metrics:all</code>. For more info, installation instructions, etc., see: <a href=""></a> Looking forward to adding this bag of tricks to our CI toolset.</p> <h2>Rails 3: Step off of the Golden Path – Matt Aimonetti</h2> <p.</p> <p>Currently, as <span class="caps">DHH</span> mentioned in the opening keynote, there is no official release for Rails 3. However, much work has been done, and a direction / ideas are emerging that will be implemented once an official release is ready. These include:</p> <ul> <li>improved performance</li> <li>increased modularity</li> <li>agnosticism</li> <li>public api</li> <li>mountable apps</li> </ul> <p>Matt emphasized that there will be no drastic changes, and by default, <code>rails app</code> <strong>need</strong> something different than the default stack.</p> <p>Some of the options you will be able to choose from:</p> <ul> <li>JavaScript frameworks, including jQuery, <span class="caps">YUI</span>, ExtJS, MooTools, Prototype, or the ability to write your own, and plug it in.</li> <li>Different templating engines: <span class="caps">HAML</span>, ERb (this is already doable in Rails)</li> <li>Different ORMs: ActiveRecord, DataMapper, <span class="caps">SEQUEL</span>, Hibernate, non-<span class="caps">RDBMS</span> stores like CouchDB, Tokyo Cabinet, etc.</li> </ul> <p>At this point, Matt gave a demo of some of the nicer features in DataMapper, contrasted with ActiveRecord:</p> <ul> <li>DataMapper re-uses existing Ruby object for both sides of a <code>has_many</code> / <code>belongs_to</code> relationship. In other words, if I load parent and child records from the database, and look at <code>parent.object_id</code> as compared to <code>child.parent.object_id</code>, under DataMapper, these will point to the same object automatically, while with ActiveRecord, these will be separate objects. (Note that <a href="">inverse_of</a> was recently checked into rails, which enables this in ActiveRecord as well )</li> <li>DataMapper does automatic lazy loading as well as strategic eager loading, so in this scenario:</li> </ul> <typo:code <p>@parent = Parent.find(12345)<br /> @parent.children.each do |child|<br /> puts child.name<br /> end</p> </typo:code> <p>ActiveRecord would need some hints (<code>:include => :children</code>) to be added to the original query to avoid the N+1 iteration problem, where DataMapper is clever enough to figure that out and generate 2 <span class="caps">SQL</span> queries for you automatically.</p> <ul> <li>The ability to have multiple repositories (which looks like it means databases), and a <code>copy</code> method on models to clone data from one database to another — one use case would be an automatic archive or backup process that copies data generated within the last week to a backup database.</li> <li>Query Path, allowing more flexibility in <span class="caps">SQL</span> condition generation (<span class="caps">WHERE</span> name <span class="caps">LIKE</span> ‘<span>foo</span>’)</li> <li>one potential gotcha that was mentioned: DataMapper does not support <span class="caps">STI</span> and Polymorphic associations as well as ActiveRecord does</li> </ul> <p>Finally, he highlighted some options that would be available for even further customization, such as defining your own:</p> <ul> <li>file structure</li> <li>router <span class="caps">DSL</span></li> <li>request handling<br /> But he voiced the opinion that the vast majority of Rails apps will not need anything like this — make sure your need justifies coloring outside the lines.</li> </ul> <p>All in all a good presentation, maybe a bit much focus on DataMapper specifically. However, I personally enjoyed the DataMapper bits, and might have to try it out on a project, if it’s a fit.</p> <h2>Art of the Ruby Proxy for Scale, Performance, and Monitoring – Ilya Grigorik</h2> <p>I skipped out on the afternoon sessions, so my next talk was Ilya’s — never disappointing. Ilya spoke about EM-Proxy, his event machine based proxy. He gave good example code of how EM proxy could be used to implement transparent and intercepting proxies.</p> <p).</p> <p.</p> <p>These examples were centered around <span class="caps">HTTP</span> requests, but he went on to show some other examples of how this is not protocol-specific: you are just dealing with data over a socket connection, so as long as you understand the underlying protocol, EM-Proxy could be useful. His examples showed <span class="caps">SMTP</span> proxies for accepting/rejecting incoming mail by email address and implementing a spam filter by forwarding the incoming mail to Defensio before passing it along to your real <span class="caps">SMTP</span>.</p> <p>Slides are available here: <a href=""></a></p> <p>Another packed day at RailsConf 09, one more to go!</p> RailsConf 2009 Day One 2009-05-06T00:00:00-07:00 <p>I.</p> <p>Starting with the <span class="caps">DHH</span> Keynote. David’s talk was entitled “Rails 3 and the Real Secret to High Productivity”.</p> <p>He started off by reviewing some of the so-called “mortal wounds” Rails has experienced:</p> <ul> <li>It was deemed as not enterprise-ready, just a lot of hucksters trying to generate interest in Ruby to sell their own books, etc.</li> <li>it encountered an “attack of the clones” in which several other languages/frameworks tried to duplicate (what they felt was) the one “key” feature that was the root cause of Rails’ explosion in success and popularity</li> <li>some early adopters switched back (Derek Sivers, CD Baby)</li> <li>some early adopters encountered serious problems (Twitter), which may or may not have been Rails-specific issues, but were perceived as such</li> <li>some people complained about “feature bloat” (Array#fourteenth, etc.)</li> </ul> <p>The takeaway from this review: There is no one best tool for <strong>every</strong> job — it’s okay if not everyone chooses Rails. Rails can’t be distilled down to a single feature, it must be viewed as a sum of its components. Emotions or reactions can be quite strong, but are usually not all that important/long-lasting.</p> <p>Next, he outlined some central ideas of the Rails 3 philosophy:</p> <ul> <li>Lock up all the unicorns: This is not a complete rewrite. Many people might look at Rails 3 and be disappointed, expecting more radical changes.</li> <li>No “Sacred Cows” allowed: Everything is on the table for possible change in Rails 3. That being said, it’s important to note that any changes causing backward compatibility issues will need a <strong>very</strong> good justification to be accepted/implemented.</li> <li>“Have it your way”: The default application generated under Rails 3 will rock, but you can ask for things to be done a different way and override the defaults. This seems like a natural extension of the templates now available in Rails 2.</li> </ul> <p>He also covered some of the progress made to date in Rails 3. It sounds like things are not going as fast as was hoped, but there is code available now in GitHub — just no officially tagged release.</p> <p>Plans for Rails 3 include:</p> <ul> <li>a new router, with the ability to route requests by subdomains, user-agent strings, etc. also able to route to other rack machinery</li> <li><span class="caps">XSS</span> protection, in which any text output will be html-escaped by default, requiring you to explicitly request raw output if/when you need it.</li> <li>JS will be unobtrusive and framework-agnostic. This is one of the more exciting plans for me. tags will be generated with the <span class="caps">HTML</span> 5 validating data-* attributes, which can be used as unobtrusive javascript hooks:</li> </ul> <h3><span class="caps">HTML</span><br /> <typo:code<br /> <a href="/person/1" data-Delete This Person</a></h3> </typo:code> <h3>JavaScript<br /> <typo:code<br /> $(document.body).observe(“click”, function(event) { <br /> var element = event.findElement(“a[‘data-remote’]”); <br /> if (element) { <br /> var method = element.readAttribute(“data-method”) || “get”; <br /> new Ajax.Request(element.readAttribute(“href”), { method: method }); <br /> event.stop(); <br /> } <br /> });</h3> </typo:code> also, much like the database adapters in ActiveRecord, there might be a “driver” layer between the Rails javascript calls and the underlying javascript framework, enabling easy adoption of jQuery, MooTools, or any alternative framework. <ul> <li>more agnosticism in <span class="caps">ORM</span> choice and generators</li> <li>more refactoring of various “crufty” areas of the framework, speed related improvements</li> </ul> <p.</p> <h2>Don’t Mock Yourself Out – David Chelimsky</h2> <p!</p> <p>Here are the highlights:</p> <p>David Started with a review of the difference between mocks and stubs — basically, mock objects care about which methods are or aren’t called during the test, stubs are “dumb” containers to give canned responses to methods. See <a href="">Martin Fowler’s explanation</a> for more information.</p> <p>Here are examples of when stubs might be useful:</p> <ul> <li>isolation from non-determinism: when dealing with any randomly generated values, your tests face brittleness from non-determinism. Similar for timestamps, date ranges, etc.</li> <li>isolation from external dependencies: Anything that connects to an external resource (e.g. network/db) can benefit from (smart) mocking. You should still test the “real” operation, but for adding permutations/edge case tests, mocks can speed up your test suite by multiple orders of magnitude.</li> <li>polymorphic collaborators : (strategies / mixins/plugins) calling a method on the “main” object ends up delegating to a method somewhere else</li> </ul> <p>Here are examples of when mocks might be useful:</p> <ul> <li>testing side effects (e.g. something gets logged)</li> <li>testing caching / memoization — ensure an expensive method gets called exactly once.</li> <li>interface discovery : “outside-in” development : build a mock of something before it exists, use to discover the “ideal” interface, how you will be using this in the real world.</li> </ul> <p>At this point, we started getting to Rails-specific content. David pointed out that if you are doing traditional Unit/Functional/Integration tests, it’s not <span class="caps">DRY</span> <strong>is</strong> the domain expert.</p> <p>A couple of helpful tips — if you care about <strong>which</strong>.</p> <p>Upcoming “stubble” project helps with this.</p> <h2>UI Fundamentals For Programmers – Ryan Singer</h2> <p>Next, I saw Ryan Singer (37 Signals) talk about UI design concepts for developers. This was a high-level talk to help developers with the approach to take to UI/design, not a how-to, recipe style talk.</p> <p>First of all, Ryan advocates taking a <span class="caps">BDD</span>, outside-in approach — including the UI. The UI is the closest thing to the user, so start there and work your way in, implementing backend functionality as you need.</p> <p.</p> <p>You should form a model (conceptual model, not ActiveRecord model) of the domain problem that makes sense to the customer and is implementable (feasable). Recommended reading: Domain-Driven Design by Eric Evans. (also Tufte for information display in general)</p> <p>Designers tend to think in “Screens” as the atomic unit of work. This plays nicely into <span class="caps">REST</span>/Resource conventions, mapping e.g. displaying a particular object to the “show” action of your resource controller. For multiple related objects, break the screen into multiple areas that each represent a resource.</p> <p>Be careful with contrast-make sure that you emphasize the most important elements on the page. Watch colors, sizes, etc. Don’t present a visual “buffet line” — aim more for a “gourmet meal”. Less is more.</p> <p.</p> <p>Some rules of thumb: helpers should not generate blocks of <span class="caps">HTML</span> (although generating an <span class="caps">HTML</span> element is probably ok — think image_tag); Organize your <span class="caps">CSS</span>/JS around <span class="caps">REST</span> conventions for your application; Treat ERb partials that generate <span class="caps">HTML</span> just as you would an image tag; Use helpers to reveal intention.</p> <h2>Smacking Git Around – Scott Chacon</h2> <p>Scott’s talk (aka the Git Firehose) was just as awesome (and fast-paced) as last year. Much too quick to take good notes, but I was able to capture a couple of useful tips & tricks:</p> <p>First, on the concept of reachability: every commit that is an ancestor of your current commit. Git uses this in the dot-dot syntax for git-log and subtracts the first from the second. So <code>git log origin/master..master</code> gives you everything in your local master not already pushed to the remote repo. Or, after a fetch, reversing it (<code>git log master..origin/master</code>) gives you all commits you just pulled down that haven’t been merged into local master. Handy! A couple of alternate syntaxes: <code>git log branch_a --not branch_b</code>, or <code>git log branch_a ^branch_b</code>. This is also extensible to more than two branches: <code>git log origin/master master ^experiment</code> would give you all commits on origin/master and/or master that are not in experiment.</p> <p: <code>git diff master...topic</code> (asking git “what would happen if I merged the two branches?”)</p> <p>He talked about subtree merging as an alternative to submodules. Basically, the process is:</p> <ol> <li>add a remote to the project you want to add as a subtree and fetch:<br /> <typo:code<br /> git remote add rails_remote git@github.com:myfork/rails<br /> git fetch rails_remote<br /> </typo:code></li> <li>check out a local branch of the other project:<br /> <typo:code<br /> git checkout -b rails_branch rails_remote/master<br /> </typo:code></li> <li>return to your project and use git-read-tree to add the subtree, then add and commit:<br /> <typo:code<br /> git checkout master<br /> git read-tree —prefix=vendor/rails -u rails_branch<br /> git add vendor/rails<br /> git commit<br /> </typo:code></li> </ol> <p>This keeps your ability to make changes to the remote project and submit them back upstream:</p> <ol> <li>make change(s) to in remote project and commit</li> <li>go to remote project’s local branch<br /> <typo:code<br /> git checkout rails_branch<br /> </typo:code></li> <li>merge your changes in:<br /> <typo:code<br /> git merge -s subtree —no-commit —squash master<br /> </typo:code></li> </ol> <p>This obviates the need for braid/piston! See for more info.</p> <p>Also mentioned was patch staging — simple, but incredibly useful! Say you’ve made multiple changes to the same file, and you want to commit some, but not all. With patch staging (<code>git add -p</code>), you can select the hunks you want to stage for commit — awesome!</p> <p>More useful info, including how to give Git the ability to diff binary files (kinda, but it can work). Slides are posted at</p> <h2>Quality Code with Cucumber – Alsak Hellesøy</h2> / <span class="caps">BDD</span> in anything serious, but I’m looking forward to trying this out — looks pretty interesting.</p> <h2>Ruby Heros / Evening Keynote</h2> <p>The day ended with the Ruby Hero awards, and then the <span class="caps">DHH</span> /.</p> <p>Overall, a good but exhausting day here in Vegas. If you’re here, look me up and say hi, or give me a follow (rubysolo on Twitter).</p> RailsConf 2009 2009-05-05T00:00:00-07:00 <p>Slides of the presentations can be found <a href="">here</a> as they are released</p> <p>Follow “official” news on <a href="">Twitter</a>.</p> <p><a href=""><span class="caps">DHH</span> Keynote</a> notes and <a href="">slides</a>. The video is <a href="">here on blip.tv</a></p> <p>Video on the tutorials day from the <a href="">Railsenvy</a> team.</p> <p>More videos on <a href="">blip.tv</a>.</p> <p>And lots of <a href="">pictures</a>.</p> <p>Some good notes from <a href="">day1</a>.</p> <p>Please tweet links to @danielwanja for any good blog articles that does live coverage. I’ll post the links here.</p> <p>We have Solomon White that regularly blogs on covering the conference…let’s see the note he takes ;-)</p> <p>Ruby Heroes:</p> <div style="border: 1px solid grey"> <p>RT @igrigorik: congrats to #railsconf ruby heroes! cheers guys! @brynary, @tmm1, @luislavena, @pat, @dkubb, @jnunemaker</p> </div> <ul> <li>Bryan Helmkamp</li> <li>Aman Gupta</li> <li>Luis Lavena</li> <li>Pat Allan</li> <li>Dan Kubb</li> <li>John Nunemaker</li> </ul> ActiveRecord's accepts_nested_attributes_for specification 2009-04-12T00:00:00-07:00 <p>I was trying to figure out how to use the new AvtiveRecord accepts_nested_attributes_for functionality that enables saving nested active records. In fact I will try to use that functionality from a Flex application using the <a href="">RestfulX</a> framework.</p> <p.</p> <p>I just generated a basic specs from the associated test case which I included here after and this give a good idea of what the <i> accepts_nested_attributes_for</i> method supports:</p> <p>Nested Attributes In General</p> <ul> <li>Base should have an empty reject new nested attributes procs</li> <li>Should add a proc to reject new nested attributes procs</li> <li>Should raise an argumenterror for non existing associations</li> <li>Should disable allow destroy by default</li> <li>A model should respond to underscore delete and return if it is marked for destruction</li> </ul> <p>Nested Attributes On A Has One also work with a hashwithindifferentaccess</li> <li>Should work with update attributes as well</li> <li>Should not destroy the associated model until the parent is saved</li> <li>Should automatically enable autosave on the association</li> </ul> <p>Nested Attributes On A Belongs To work with update attributes as well</li> <li>Should not destroy the associated model until the parent is saved</li> <li>Should automatically enable autosave on the association</li> </ul> <p>Nested Attributes On A Has Many Association<br /> and Nested Attributes On A Has And Belongs To Many Association</p> <ul> <li>Should define an attribute writer method for the association</li> <li>Should take a hash with string keys and assign the attributes to the associated models</li> <li>Should take an array and assign the attributes to the associated models</li> <li>Should also work with a hashwithindifferentaccess</li> <li>Should take a hash and assign the attributes to the associated models</li> <li>Should take a hash with composite id keys and assign the attributes to the associated models</li> <li>Should automatically build new associated models for each entry in a hash where the id is missing</li> <li>Should not assign delete key to a record</li> <li>Should ignore new associated records with truthy delete attribute</li> <li>Should ignore new associated records if a reject if proc returns false</li> <li>Should sort the hash by the keys before building new associated models</li> <li>Should raise an argument error if something else than a hash is passed</li> <li>Should work with update attributes as well</li> <li>Should update existing records and add new ones that have no id</li> <li>Should be possible to destroy a record</li> <li>Should not destroy the associated model with a non truthy argument</li> <li>Should not destroy the associated model until the parent is saved</li> <li>Should automatically enable autosave on the association</li> </ul> Time tracking on Rails 2.3.2 2009-03-24T00:00:00-07:00 <a href="">time.onrails.org</a> was first deployed in 2005 and the last time I deployed it was in July 2007. This application is in use by several hundred people daily and several thousands did sign up over the year. It's written in old-style Rails (pre-resources) and I did port it to Rails 1.2 a while back. So today I decided to run the test suite and had a list of deprecation warnings for Rails 2.0. I did fix them all, then decided to run against Rails 2.3.2. A couple of more issues where identified (tests with fixtures should use ActionController::TestCase and ActiveRecord::TestCase) and all tests where passing. I used to have a timezone bug related to the old Rails support of time zones, so I decided to bite the bullet and try out the Rails 2.0 time zone support and found a good description <a href="">here</a>. The change was straight forward, et voila, time.onrails.org running on 2.3....not so quick. I did a <em>cap deploy</em> and then realized that I didn't have the latest version of Rails on my deployment system, nor did I have the latest version of the gems. So after a '<em>gem update --system</em> I encountered a gem related issue but with this <a href="">solution</a> I was back in business....Et voila, time.onrails.org running on 2.3.2! Note it's still old style Rails and needs a good rewrite, but if you need a free time tracking application, just go try it out. Confreaks: MountainWest RubyConf 2009 - videos available 2009-03-18T00:00:00-07:00 The confreaks guy processed many of the videos and they start to appear on the MWRC section of their site: <a href=""></a> Check it out, lot of good stuff. Thanks again to the MWRC organizers. Flex on Rails position at Rosetta Stone in Boulder. 2009-03-16T00:00:00-07:00 At the RMAUG I met Kadri, the Director of Speech Technologies from Rosetta Stone, and he mentioned they where looking from a Flex/Rails developer. You can see the job posting <a href="">here</a>. Unfortunately I didn't have more time to speak with Kadri so I can not tell you much about the position or the company but If you are in Boulder and fit the profile why not just contact them. Enjoy! Daniel. 55 minute video: Flex on Rails presentation at RMAUG on March 10th 2009-03-16T00:00:00-07:00 This is the edited version of the talk Tony Hillerson and Daniel Wanja gave at the Rocky Mountain Adobe User Group on March 10th. There is an echo the first two minutes, then the sounds stabilize. We also had a software issue on Tony's notebook and display port issue on Daniel's, parts which I edited out. The demo gods where not with us that night :-), but we had fun and I hope we answered many of the questions the attendance had. Also we wanted to tailor the talk on Ruby on Rails rather than on Flex and be an open format, but we had more questions than anticipated and presented only 10% of the material we had. <object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="" /><embed src="" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object><br /><a href="">Flex on Rails presentation at RMAUG on March 10th</a> from <a href="">daniel wanja</a> on <a href="">Vimeo</a>. Note: during the first 2 minutes there is an echo. Sound skips from time to time throughout the video. The talk was recorded by RMAUG and posted on <a href="">their blog</a>, and can be viewed using Connect <a href="">here</a>. Thanks again to everyone who attended! Daniel. MWRC - Thanks you, that what awesome! 2009-03-15T00:00:00-07:00 We are at the airport on the way back to Denver from the <a href="">MountainWest RubyConf</a>. This was the best conference I went to in years. Fast passed talk with just incredible material and every presenter was just excellent. So to the organizers and presenters....Thank you! I'll be back! This was the Official Meme: <a href=""><img src="" /></a> Check out some of the comments from the last few hours or check all tweets regarding<a href=""> #mwrc</a>. MWRC - Moutain West Ruby Conference is about to start. 2009-03-13T00:00:00-07:00 <div style="text-align:center;"><img src="" alt="20090313_mwrc_attrium.jpg" border="0" width="500" /></div> <p>The <a href="">Confreaks</a> guys did setup their cameras, sound and lights, so you will certainly be able to see all the talks in a few weeks.</p> <p <a href="">talks</a> looks really cool and tonight the <a href="">Engine Yard’s Hackfest 2.0</a> in suite next to mine at the Hilton Salt Lake City Center.</p> Advanced Ruby - Day 3 2009-03-11T00:00:00-07:00 <div style="text-align:center;"><img src="" alt="20090311_avancedruby.jpg" border="0" width="500"/></div> <p>The first two days of the training were really excellent. Great pace, clear explanations and samples, very technical, Chad and Dave really rock at Ruby.</p> <h2>Making Domain-Specific Languages</h2> <p>We start with a discussion on <span class="caps">DSL</span> versus an <span class="caps">API</span>.</p> <h3>Meat-and-Potato DSLs</h3> <ul> <li>Block based <span class="caps">API</span>.</li> <li>Directly manipulating domain model classes</li> <li>Defining classes and methods</li> <li>Manually typing repetitive, low-level code</li> </ul> <p>Example is Rake. Rake is a dependency oriented programming language.</p> <p>Eexample from Dhaka (a paraser generator)</p> <typo:codefor_pattern(“\n”) do<br /> create_token(“newline”)<br /> end</typo:code> <h3>method_missing Trick</h3> <typo:coderequire ‘pp’<br /> <br /> class CommandListener<br /> def initialize<br /> @commands = []<br /> end<br /> <br /> def method_missing(*args)<br /> @commands << args<br /> self<br /> end<br /> end<br /> <br /> listener = CommandListener.new<br /> <br /> listener.instance_eval do<br /> this object accepts whatever you type and stores it<br /> end<br /> pp listener</typo:code> <p>outputs:</p> <pre> #<CommandListener:0x80264 @commands= [[:you, CommandListener], [:whatever, #<CommandListener:0x80264 ...>], [:accepts, #<CommandListener:0x80264 ...>], [:object, #<CommandListener:0x80264 ...>], [:this, #<CommandListener:0x80264 ...>], [:it], [:stores, #<CommandListener:0x80264 ...>]]> </pre> <typo:codelistener = CommandListener.new<br /> listener.instance_eval do<br /> this.object.accepts.whatever.commands.and.stores.it<br /> end <br /> <br /> pp listener</typo:code> <p>outputs:</p> <pre> #<CommandListener:0x712b4 @commands= [[:this], [:object], [:accepts], [:whatever], [:commands], [:and], [:stores], [:it]]> </pre> <p>Note any keyword can be used with method_missing…E.g. <em>freeze</em> is not a missing method.</p> <p>Now by using a BlankSlate object we can avoid this issue:</p> <typo:codeclass BlankSlate<br /> instance_methods.each do |method|<br /> undef_method(method) unless method =~ /^__/ || method == ‘instance_eval’<br /> end<br /> end</typo:code> <p>We can now create a command listener that can use any commands:</p> <typo:coderequire ‘pp’<br /> <br /> class CommandListener < BlankSlate<br /> def initialize<br /> @commands = []<br /> end<br /> <br /> def method_missing(*args)<br /> @commands << args unless [:inspect, :to_s].include? args.first <br /> self<br /> end<br /> <br /> def pretty_print(pp)<br /> pp.output.write @commands.inspect<br /> end<br /> <br /> end<br /> <br /> listener = CommandListener.new<br /> <br /> listener.instance_eval do<br /> You can even type freeze!<br /> end<br /> pp listener</typo:code> <p>And we get the following output:</p> <pre>[[:freeze!], [:type, #<CommandListener:0x7ee28>], [:even, #<CommandListener:0x7ee28>], [:can, #<CommandListener:0x7ee28>], [:You, #<CommandListener:0x7ee28>]]</pre> <p>On the same principals we just create a morse encoder, and of course Dave had to show off and interface with the speech function of <span class="caps">OSX</span> and another version that interfaces with the <span class="caps">MIDI</span> controller.</p> <h2>Exotic Control Flow</h2> <p>Creating a loop with continuations</p> <typo:codedef start_loop<br /> callcc{|c|c }<br /> end<br /> <br /> def end_loop©<br /> c.call©<br /> end<br /> <br /> <br /> i = 0<br /> again = start_loop<br /> <br /> puts i<br /> i += 1<br /> <br /> end_loop(again) unless i > 5</typo:code> <h2>Moving on…</h2> <p>We voted on what to cover next as we won’t have time to cover every thing…and the winners are:</p> <pre> * Concurrency .................. * Debugging/Profiling ................ * JRuby ...... * Ruby Extras ........... * Distributed Programming ...................... </pre> <h2>Distributed Programming</h2> <h3>DRb</h3> <p><strong>Marshaling</strong></p> <p>>> h = {:x => 1}<br /> >> Marshal.dump(h)<br /> => “\004\b{\006:\006xi\006”<br /> >> Marshal.load(_)<br /> => {:x=>1}</p> <p><strong><span class="caps">DRB</span> Server</strong></p> <typo:coderequire ‘drb/drb’<br /> require ‘ostruct’<br /> <br /> DRb.start_service(“druby://localhost:4321”, OpenStruct.new)<br /> DRb.thread.join</typo:code> <p><strong>DRb Client</strong></p> <p>require ‘drb’<br /> <typo:code<span class="caps">DRB</span>.start_service<br /> o = DRbOject.new_with_url(“druby:’’localhost:4321”)<br /> o.last_accessed = Time.now<br /> o.some_other_arbitrary_method = “Set this on the open struct”</typo:code></p> <p>By default Pass-by-value, but can be Pass-by-reference can be enabled by including DRbUndumped.</p> <ul> <li>Rinda</li> <li>Ring</li> </ul> <p>…</p> <p>That’s all Folk! …my hands/brain where running tired during the last hour :-)</p> <p>That was an incredible 3 days thanks to Chad and Dave. So if you want to dive deeper in Ruby, the <a href="">Advanced Ruby </a> is the best way to get there!</p> <p>Enjoy!<br /> Daniel</p> Starting an intense Ruby week. 2009-03-10T00:00:00-07:00 It starts with three days at the <a href="">Advanced Ruby</a> training followed by two days at the <a href="">Mountain West Ruby Conference</a>. On Tuesday evening, I'll be giving a talk at the <a href="">Rocky Mountain Adobe Users Group</a>. I'll be blogging about these events here...so stay tuned. <div><a href="" title="I'm attending MountainWest RubyConf 2009!"> <img src="" width="250" height="200" border="0" alt="I'm attending MountainWest RubyConf 2009!"> </a></div> Advanced Ruby - Day 2 2009-03-10T00:00:00-07:00 I just missed the first half hour of the training due to a long commute due to a little snow in Denver. Chad completed the design discussion on Inheritance .vs. Composition, using mixins and modules. <typo:code> 1.class.ancestors => [Fixnum, Integer, Numeric, Comparable, Object, Kernel, BasicObject] 1.class.instance_methods(false) => [:to_s, :-@, :+, :-, :*, :/, :div, :%, :modulo, :divmod, :fdiv, :**, :abs, :magnitude, :==, :<=>, :>, :>=, :<, :<=, :~, :&, :|, :^, :[], :<<, :>>, :to_f, :size, :zero?, :odd?, :even?, :succ] m = 1.method(:inspect) => #<Method: Fixnum(Kernel)#inspect> </typo:code> We are moving on to performance. <h2>...make it fast.</h2> Rails doesn't scale and Ruby is slow. This said Ruby is arguably the slowest of the scripting languages with a naive implementation. But for 99% of the work we do, it's fast enough...Now let's talk about that last 1%. Premature optimization is the root of all evil - Donald Knuth. <h3>Benchmarking</h3> In 1.9 <typo:coderequire 'benchmark' puts Benchmark.measure {(1..1000000).map{|num| ""+num.to_s}} 0.940000 0.050000 0.990000 ( 1.001714) </typo:code> In 1.8 <typo:codeputs Benchmark.measure {(1..1000000).map{|num| ""+num.to_s}} 1.800000 0.050000 1.850000 ( 1.850319) </typo:code> Yea, 1.9 is twice as fast. Now to compare approaches, here using map or inject...which one is the fastest: <typo:coderequire 'benchmark' Benchmark.bm do |b| b.report("map") {(1..1000000).map{|num| ""+num.to_s}} b.report("inject") {(1..1000000).inject(""){|accum, num| ""+num.to_s}} end user system total real map 1.970000 0.070000 2.040000 ( 2.077786) inject 1.910000 0.010000 1.920000 ( 1.978541)</typo:code> <h3>Don't Use Ruby</h3> * C (or OCAML?) extensions * Sockets * DL * Don't use Ruby at all DL is "Pure Ruby" way of calling native code form shared libraries. <typo:coderequire 'dl/import' require 'dl/struct' </typo:code> <h3>memoization</h3> <typo:codedef fib(n) @k||={} n<=2 ? 1 : (@k[n-1]||=fib(n-1))+(@k[n-2]||=fib(n-2)) end puts fib(200) 280571172992510140037611932413038677189525 Program exited with code #0 after 0.02 seconds</typo:code> Now the same code as above without the cluttering <typo:codedef fib(n) if n <= 2 1 else fib(n-1) + fib(n-2) end end alias :pre_memoized_fib :fib def fib(n) @cache ||= {} @cache[n] ||= pre_memoized_fib(n) end </typo:code> <h2>The Ruby Object Model</h2> Now we move onto the essence of an Object in Ruby. * self is the "current object" * self always as a value * two things change self: 1) method calls 2) class or module definition <typo:codeclass << str # << opens up the singleton class. Arrows seem to go wrong way. p self # ghost class: <Class:#<String:0x1d0ec>> - class of the class String def speak puts "miaow" end end puts str.speak class Dave class << self # puts the methods into the singleton class and becomes class methods def do_something end end end class Person < Struct.new(:name, :age) def greet puts "Hello #{self.name}" end end f = Person.new("Chad", 28) </typo:code> <typo:codemodule Logger def log(msg) puts msg end end class Album include Logger end Album.ancestors # => [Album, Logger, Object, Kernel] # Note that Logger becomes ancestor of Album...It's insert a generated class named after the module that shares the method table. </typo:code> Module can extend an object: <typo:codemodule Speak def hello puts "hello" end endsome notes</a> then. I will therefore sit back, relax, and code along his examples. <h2>Library Organization</h2> Multipart Request - revisited 2009-03-09T00:00:00-07:00 I just posted on <a href=""></a> a post on creating Multipart Request with Flex to post data such as XML, images to a Rails server. Check it out! Advanced Ruby - Day 1 2009-03-09T00:00:00-07:00 <p>Let’s get started. I’m at the <a href="">Advanced Ruby</a> training. Here are the topics we gonna cover</p> <ul> <li>Blocks, Procs, and Closures</li> <li>Ruby 1.9</li> <li>Your Own, Private Ruby</li> <li>Design in a Dynamic Language</li> <li>Messin’ with Types</li> <li>…make it fast.</li> <li>The Ruby Object Model</li> <li>Metaprogramming</li> <li>Making Domains-Specific Languages</li> <li>Concurrency</li> <li>Exotic Control Flow</li> <li>Library Organization</li> <li>Debugging and Profiling</li> <li>JRuby</li> <li>Ruby Extras</li> <li>Distributed Programming</li> <li>Onward and Upward!</li> </ul> <p.</p> <p>So this morning I woke up and installed Ruby 1.9. I didn’t use multiruby as many do I just downloaded <a href="">Ruby 1.9.1-p0</a> from. These are the steps to install:<br /> <pre><br /> cd ruby-1.9.1-p0<br /> autoconf<br /> ./configure —prefix=/usr/local/ruby1.9<br /> make<br /> sudo make install<br /> </pre></p> <p>Then you can check the version by</p> <typo:code> <p>$/usr/local/ruby1.9/bin/ruby -v <br /> ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-darwin9.6.0]<br /> $/usr/local/ruby1.9/bin/irb <br /> RUBY_VERSION <br /> => “1.9.1”</p> </typo:code> <p>I didn’t add /usr/local/ruby1.9/bin to my path, so the default ruby is still my mack default, 1.8.6 of my mac (ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]).</p> <p>Keep on reading to see some of the code we are walking through. This said it’s hard to convey how much value Chad and Dave are passing along with all their deep explanations of each of the examples…</p> Integrating FTP with Rails 2009-03-06T00:00:00-08:00 <p>One interesting problem we faced at <a href="">VideoPros</a> was file upload. In our application domain, the files tend to be orders of magnitude larger than, say, an avatar attachment for your blog post. <span class="caps">HTTP</span> <a href="">here</a>.</p> <p><strong><span class="caps">UPDATE</span></strong>: Here’s a <a href="">good screencast</a> that goes over getting this set up on <span class="caps">OSX</span> — you’ll need some extra arguments to correctly compile and install the apache module.</p> <p>This worked well, but we still got requests for an alternative: the users wanted to use <span class="caps">FTP</span> to upload their files. The workflow would be: users would connect and upload a batch of video files into their <span class="caps">FTP</span> “inbox”. After the upload(s) were complete, the users would create video objects in the database and attach the uploaded files. As an interesting twist, the users requested the ability to re-use their existing application usernames and passwords to access <span class="caps">FTP</span>. Our goal was to meet this requirement while providing secure, low-maintenance <span class="caps">FTP</span> service.</p> <p>A bit of research turned up <a href="">PureFTPd</a>, <span class="caps">UNIX</span> crypt as formats for the password column. We’re using <a href="">ReSTful Auth</a>, which means that our password are <span class="caps">SHA</span>-1’ed. This, combined with wanting to define users’ home folders programatically rather than storing them in the database, eliminated MySQL auth as a possibility for our implementation.</p> <p>However, all was not lost. According to the documentation, another option for authentication is <a href="">Ext Auth</a>,!</p> <p>To get started, first install Pure-FTPd. In my environment, this was as simple as:<br /> <typo:code<br /> ./configure —with-extauth<br /> make<br /> sudo make install</p> </typo:code> <p-<span class="caps">DRY</span> but faster method of using the mysql gem directly. The first order of business is to load the user record that matches the specified username.</p> <typo:code <p>begin<br /> dbh = Mysql.real_connect(config[‘host’], config[‘username’], config[‘password’], config[‘database’])<br /> res = dbh.query(%Q{<br /> <span class="caps">SELECT</span> *<br /> <span class="caps">FROM</span> users<br /> <span class="caps">WHERE</span> state = ‘active’<br /> <span class="caps">AND</span> login = ‘#{ENV[’AUTHD_ACCOUNT’].gsub(/‘/, "’‘“)}’<br /> <span class="caps">LIMIT</span> 1<br /> })<br /> user = res.fetch_hash<br /> res.free<br /> rescue Mysql::Error => e<br /> ensure<br /> dbh.close if dbh<br /> end</p> </typo:code> <p <span class="caps">UNIX</span> user and group ids and home directory path. Whether or not the user is authenticated, we send back “end”</p> <typo:code <p>if user[‘crypted_password’].nil?</p> <ol> <li>no active user with given login<br /> puts “auth_ok:0”<br /> else</li> <li>validate given password<br /> hashed_pw = Digest::SHA1.hexdigest(“<del>-#{user[‘salt’]}</del>-#{ENV[‘AUTHD_PASSWORD’]}—”)<br /> if user[‘crypted_password’] != hashed_pw<br /> puts “auth_ok:0”<br /> else<br /> puts “auth_ok:1”<br /> puts “uid:#{UID}”<br /> puts “gid:#{GID}”<br /> puts “dir:#{RAILS_ROOT}/private/ftp/#{user[‘login’]}”<br /> end<br /> end</li> </ol> <p>puts “end”</p> </typo:code> <p>Here’s the final product: <a href="">ftpd-auth-handler</a></p> <p>This turned out to be a pretty straightforward implementation, but the functionality is quite useful for us. Shout out to the <a href="">VideoPros</a> crew for agreeing to share this — hopefully this will help someone who needs to integrate <span class="caps">FTP</span> with their Rails app!</p> iPhone Mockups 2009-02-27T00:00:00-08:00 <p>The <a href="">next version</a> of <a href="">Balsamiq</a>, a really cool tool to create low fidelity mockups, will support mocking up of iPhone apps. That’s gonna be the quickest way to visuaizel and experiment with you next killer iPhone app idea.</p> <p>Balsamiq allows to drag and drop components on a canvas and then just add content via text, which will be rendered as an image. So the text on the right below creates the interface on the right. That’s too cool.</p> <table> <tr halign="top"> <td> <pre> A Simple Label - Delete + Add and sub-menu, > Two Labels, yup v A Checkmark, (>) * A Bullet, Read > _ Space for an icon __ Space for a big icon On button, ON Off button, OFF v And empty row, (above) </pre> </td> <td> <p><img src="" alt="balsmaiq_iphone.png" border="0" width="222" height="390" /></p> </td> </tr> </table> Flex On Rails talk in Denver - Thursday 22nd 2009-01-19T00:00:00-08:00 <p>Tony and I will be giving a talk on Flex on Rails at Derailed, the Denver Rails User Group. This will take place at <a href="">Forest Room 5</a> in <span class="caps">LODO</span> at 6:30pm, this coming Thursday 22nd.</p> <p>On the agenda.</p> <ul> <li>6:30 – 7:00: Meet and mingle</li> </ul> <ul> <li>7:00 – 8:30: Flex on Rails – From the authors Daniel Wanja and Tony Hillerson</li> </ul> <ul> <li>8:30 – … : Book raffle and spirits.</li> </ul> <p>We will show highlights of each of the chapters and samples from the book.</p> <p>I hope to see you there!<br /> Daniel</p> New Book: "Flex on Rails: Building Rich Internet Applications with Adobe Flex 3 and Rails 2" 2009-01-03T00:00:00-08:00 <div style="text-align:center;"><img src="" alt="2009.01.02 CoverSmall.jpg" border="0" width="500" height="333" /></div> <p>Finally our book on using Flex with Rails is released and will appear over the next few days in stores around the US and is available on <a href="">Amazon</a>. I received a couple of copies from the publisher and it felt like an accomplishment to hold a physical version in my hands. I am sure my co-author, <a href="">Tony</a>, felt the same. Good job man! With this release we are also launching <a href=""></a> where you can find all the source code of the book as well as other resources related to Flex and Rails, and our blog <a href=""></a> the blog for everything on Flex with Ruby On Rails…</p> <p <a href=""></a> and <a href=""></a>. I hope you enjoy the book and the sample applications. So go check it out and let us know what you think.</p> <p>Daniel.</p> <h2>Description</h2> <p>“There’s no question you’re going to be a better Flex and Rails developer when you’re done reading this book.â€<br /> –From the Foreword by Matt Chotin, Senior Product Manager, Adobe Systems, Inc.</p> <p> <br />).</p> <p> <br /> Flex on Rails begins with the absolute essentials: setting up your environment for Flex and Rails, passing data with <span class="caps">XML</span>, and integrating Flex front-ends with Rails back-ends. Then, using practical, easy-to-understand code examples, the authors take you from the basics to advanced topics only discussed in this book. Techniques covered here include </p> <ul> <li>Constructing sophisticated interfaces that can’t be created with <span class="caps">AJAX</span> alone</li> </ul> <ul> <li>Using RESTful services to expose applications for access via APIs</li> </ul> <ul> <li>Testing Flex and Rails together</li> </ul> <ul> <li>Using Flex Frameworks</li> </ul> <ul> <li>Getting Flex into your build/deploy process</li> </ul> <ul> <li>And more… </li> </ul> <p>The authors also offer practical introductions to powerful complementary technologies, such as RubyAMF and Juggernaut.<br />  </p> .</p> <h2>Table of Contents</h2> <pre> </pre> The future of Rails: Rails 3.0 2008-12-24T00:00:00-08:00 <p>The:</p> <ul> <li><a href=""></a></li> <li><a href=""></a></li> <li><a href=""></a></li> <li><a href=""></a>s</li> <li><a href=""></a></li> </ul> <p>Merry Christmas/Hanukkah/Hollidays!</p> <p>Daniel.</p> Flex Job: Full time Flex developer in Denver at Videopros.com 2008-12-23T00:00:00-08:00 <p>Solomon, who also writes on this blog, is currently doing Ruby on Rails work for <a href="">videopros.com</a> and they are looking to hire a Flex developer to complement their small development team. Here are the details…</p> <div style="text-align:center;"><img src="" alt="VP_Logo_300x100.jpg" border="0" width="300" height="100" /></div> <p>We seek a Flex on Rails Kingpin to lead our development team. This is for a full-time or contract-to-hire position. Private consultants should not apply. Depending on skill level and commitment an equity stake is available.</p> <p>Compensation</p> <ul> <li>70-100K</li> <li>Potential Equity</li> <li>Potential Profit Sharing</li> </ul> <p>Skills and Experience</p> <ul> <li>Ruby on Rails | 2.5 Years minimum</li> <li>Flex | 1 Year minimum</li> <li>Web Services</li> <li>Experience as the lead developer for a commercial project.</li> <li>Agile development</li> <li>Subversion (<span class="caps">GIT</span>)</li> <li>Linux</li> <li>MySQL</li> <li><span class="caps">XML</span></li> </ul> <p>Benefits</p> <ul> <li>Competitive Salary</li> <li>Health Insurance</li> <li>Long Term Disability Insurance</li> </ul> <p>About Us – The VideoPros Dojo</p> <p>Dojo means “place of the Way.†Much like a martial arts practice hall, the <span class="caps">WAY</span> we operate at VideoPros is a pursuit for mastery in the face of adversity and challenge. The true challenge is not between people and external things – but within ourselves. 
<br />.</p> <p>Apply</p> <p>VideoPros is motivated to fill this position quickly. To apply, email your resume and one reason why you want to join us at the Dojo to:<br /> Careers{at}VideoPros{dot}com</p> Screencast: Using Webby to create a static website. 2008-12-11T00:00:00-08:00 I am currently using <a href="">Webby</a> to generate a static website. I think it's a pretty cool tool, so I made a small video to show how to get started with it and explain what it does. Check it out: <object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="" /><embed src="" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object><br /><a href="">Screencast: Using Webby to create a static website</a> from <a href="">daniel wanja</a>. Enjoy! Daniel. RubyConf 2008 videos available at confreaks.com - Thank you! 2008-12-01T00:00:00-08:00 <p>I couldn’t make it this year to RubyConf so I am really thankful to see that most of the presentations are online at <a href="">confreaks</a>. It’s just awesome that these videos are made available online and so quickly after the conference and for free. It’s a real tribute to the Ruby community and it’s open and sharing spirit. Thanks guys! My understanding is that the <a href="">rubyconf</a> pays <a href="">Confreaks</a> to take, processes and distribute these videos. Let me know if the arrangement is different, to give credit where credit is due. Thanks RubyConf and the presenters, and good job Confreaks.</p> <p>Here are the videos I selected for my commute this week.</p> <ul> <li><a href="">Keynote</a> – Dave Thomas</li> <li><a href="">Questions & Answers</a> – Yukihiro ‘Matz’ Matsumoto</li> </ul> <ul> <li><a href="">Introducing Red Sun – Ruby to Flash</a> – Jonathan Branam</li> <li><a href="">MacRuby: Ruby for your Mac</a> – Laurent Sansonetti</li> <li><a href="">OS X Application Development with HotCocoa</a> – Rich Kilmer</li> <li><a href="">Hacking with ruby2ruby</a> – Marc Chung</li> <li><a href="">Using Git in Ruby Applications</a> – Scott Chacon</li> </ul> <ul> <li><a href="">Adrenaline-Driven Development</a> – Bruce Williams</li> <li><a href="">Fear of Programming</a> – Nahaniel Talbott</li> <li><a href="">Recovering from Enterprise</a> – Jamis Buck</li> </ul> <p>View the full list of videos available <a href="">here</a>.</p> <p ;-).</p> <p?</p> <p>Enjoy!<br /> Daniel</p> Moving "private" and non-Rails related entries to http:blog.wanja.com 2008-11-17T00:00:00-08:00 I received a couple of comments and emails about my non-Rails related entries, more specifically about the iPhone related entries. So from now on I will move these type of entries to my new "private" blog <a href=""></a>. <a href=""></a> Rails Deployment On Heroku Using Git 2008-11-08T00:00:00-08:00 I was checking out different sites to deploy the Rails apps we presented with Tony at RailsConf for our Powering AIR with Rails tutorial and the easiest and fastest way is still <a href="">heroku.com</a>. So for the 3rd app, <a href="">TwitterFriends</a>, I make this little video showing how I deployed the Rails to heroku using the heroku gem and git: <object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="" /><embed src="" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object><br /><a href="">Rails Deployment On Heroku Using Git</a> from <a href="">daniel wanja</a> on <a href="">Vimeo</a>. Note flexonrails.com is still "under constructions" and I am adding stuff for the launch of the book...which is now set to shortly after December 19th. Yea! Determine Test Coverage on your Flex Projects with Flexcover. 2008-10-24T00:00:00-07:00 <p>This week I was playing with <a href="">Flexcover</a> <span class="caps">SDK</span> to use with FlexBuilder. Again this is a non-scripted screencast with several “oops” and a big Swiss-French accent which I hope you will find useful.</p> <p>The key here is if you do Flex, write unit tests and use this test coverage tool.<="">Setting up Flexcover as test coverage tool for your Flex applications.</a> from <a href="">daniel wanja</a> on <a href="">Vimeo</a>.</p> <p>Enjoy,<br /> Daniel.</p> Flex test coverage? 2008-10-11T00:00:00-07:00 <p>It’s hard to imaging writing a Rails application without using <a href="">rcov</a> and get that fuzzy feeling you tested most if not all you application. Or at least get a good idea of what’s tested. I <a href="">heard</a> <a href="">article</a> describing <a href="">Flexcover</a>, just what I was looking for. Please share your experience.</p> <p>Thanks!<br /> Daniel.</p> <p><span class="caps">UPDATE</span>: <span class="caps">MIT</span> license. Cool!</p> iPhone NDA - Call for arms [Update: NDA lifted :-)] 2008-09-26T00:00:00-07:00 <p><span class="caps">UPDATE</span>: today (10/01/2008) Apple <a href="">lifted</a> the iPhone <span class="caps">NDA</span>. New agreement will come out in a week (or so).</p> <p>Until now I wasn’t concerned about the iPhone <span class="caps">NDA</span> <span class="caps">NDA</span>, ticked me off. That’s what the <a href="">“Prag’s”</a> released in their news: “It now appears that Apple does not intend to lift the <span class="caps">NDA</span> any time soon. Regrettably, this means we are pulling our iPhone book out of production.”</p> <p>Damn that! That was <span class="caps">THE</span> <span class="caps">NDA</span>:</p> <p><span class="caps">WHY</span>?</p> <p>Why does Apple keeps this <span class="caps">NDA</span>…I just doesn’t make sense. Let the development community go crazy, share the knowledge, create something unique beyond what you have. Apple, you are making your development community <span class="caps">ANGRY</span>.</p> <p>I tried to find a good reasons why there is still this <span class="caps">NDA</span> in place, but there is just no reason. What did I miss? What has Apple to gain? What can we do?</p> <p>Please leave your thought as comment here after.</p> <p>Daniel.</p> First Apple Store in Switzerland and it's in Geneva my ex-home town. 2008-09-26T00:00:00-07:00 <p><img src="" alt="2202E22E-571F-4452-BD1F-1298E43E8A10.jpg" border="0" width="400" /></p> <p>Photo from <a href="">iphonemag.ch</a>.</p> <p>Cool now my brother doesn’t have to bug me to check out stuff at the Apple Store every time something new comes out ;-).</p> <p>Also with the current value of the dollars you now can buy a MacBook Air for 199 Swiss Francs :-)</p> Full time hard core Flex Developer position in Denver. 2008-09-22T00:00:00-07:00 <p>One of my customers, Fiserv Insurance Solutions, looks for an experienced Flex Developer for one of it’s new project. In short they are looking for a good Flex developer. Here is an extract of the job post and you can read more about <a href="">here</a>.</p> <p>We are seeking a senior level software developer proficient in ActionScript and Flex to join our team building the cutting-edge browser-based applications. Extensive experience with Rich Internet Application (<span class="caps">RIA</span>) <span class="caps">RIA</span> applications, and at least a year of full time, hard core Flex experience. Also required is experience with Flex Remoting (<span class="caps">AMF</span>) and experience with Flex frameworks such as Mate, PureMVC or Cairngorm.</p> <p>Knowledge and Desire Skills</p> <ul> <li>Experience with Flex <span class="caps">MVC</span> frameworks: Mate, Cairngorm, etc.</li> <li>Source control system</li> <li>Agile development methodology, <span class="caps">SCRUM</span> preferred</li> <li>Effective, creative problem solving skills</li> <li>Strong organization skills, self-motivated, team player</li> <li>Excellent verbal and written communication skills</li> <li><span class="caps">MUST</span> be proficient in ActionScript 3.0 and Adobe Flex development</li> <li>Experience with custom component development</li> <li>Extensive experience with AS3 & <span class="caps">MXML</span></li> <li>Experience building large, enterprise applications with Flex</li> <li>Strong Object Oriented Programming expertise</li> </ul> <p>Deep understanding of Flex internals:</p> <ul> <li>data binding</li> <li>event system</li> <li>data grids & custom renderers</li> <li>module-based application development</li> <li>internationalization & localization</li> <li><span class="caps">AMF</span> Remoting</li> </ul> Sarah Palin Email...forget privacy on the net. 2008-09-18T00:00:00-07:00 <p>I was watching <a href="">Bill O’reilly</a>.</p> <p>So here is what my quick search returned:</p> <ul> <li>Watched Bill Oreilly and heard about the hack.</li> <li>Checked cnn.com home page…nothing.</li> <li>Search google and followed the first link…which was a link to a Yahoo <a href="">news story</a>, with not much information.</li> <li>Then <a href=" ">searched</a> twitter and followed a link from chrisgen to <a href=""></a></li> <li>That link was point to the following links on artvoice.com with some pictures of the email<br /> <strong>* <a href=""></a><br /> *</strong> <a href=""></a><br /> <strong>* <a href=""></a><br /> *</strong> <a href=""></a><br /> ** <a href=""></a></li> <li>Checked out <a href="">digg</a> which pointed to <a href=""></a></li> <li>Which highlighted some name that I fed to the google machine: Ivy Frye Nizich, Michael</li> <li>Which pointed to two interesting links, the first being down:<br /> <strong>* <a href=""></a><br /> *</strong> <a href=""></a></li> </ul> <p>Well that was futile search, but I wanted to see how news spreads on the internet and how the force will try to stop it. Now it’s time to check out <a href="">Star Wars the Force Unleashed</a> for the iPhone.</p> .</p> <p>That’s the most political blog ever as I don’t want to bug my readers here, I’m definitively less expressive than my friend <a href="">John</a>, but in any case and for the future or the country my children, go <a href="">Obama</a>!</p> Ignite Denver - 6 hours left to register - it's free and at an Irish Pub 2008-09-09T00:00:00-07:00 <p>Ignite Denver: you can register <a href="">here</a> and read more about it <a href="">here</a></p> <p>When: Wednesday, September 10, 2008 from 06:00 PM – 11:00 PM (MT)</p> <p>Where: Fado Irish Pub, 1735 19th Street, Denver, CO</p> <p><img src="" /></p> <p>Some of the talks planned for Denver on the 10th:</p> <ul> <li>Kevin Hoyt – The wonderful world of Cigars</li> <li>Rob McNealy – Social media for low tech companies (AskAFloorGuy.com)</li> <li.</li> <li>Brian Holmes – how to swear in French</li> <li>Jim Hutchison – The glamorous world of Entertainment Business lighting and how rockstar-ish it can and cannot be, followed by a side order of ridiculously simply difficult lighting math chased with industry information and quirky stories. Living like a rockstar is fun!</li> <li>Andrew Hyde – TechStars is a entrepreneur boot camp that every summer selects and seed funds 10 startups. From an inside viewpoint, what is the experience like? What are the biggest lessons, and the biggest challenges of starting the startup.</li> <li>Scott Dudley – Digital Theatrics</li> <li>Dave Taylor – Filmbuzz (get your hollywood news fix!)</li> <li>Jun Heider – 5 minute intro to the world of Hackintosh</li> </ul> Feature article on Compassionate Communications, a Ruby on Rails website. 2008-09-03T00:00:00-07:00 <p>A while back I worked with Lee and Sean on <a href="">Compassionate Communications</a> which was featured in an interview/article in the <a href="">San Diego North County Times</a> last week. Read it <a href="">here</a>.</p> Flex on Rails: the book - release date? 2008-08-29T00:00:00-07:00 <p>As you may know we started a while back with <a href="">Tony</a>:<br /> <ul><br /> <li>1/16/2009 <a href="">buy.com</a> – $29.70<br /> <li>02/28/2009 <a href="">amazon.co.uk</a> – $28.79<br /> <li>May 29, 2008 <a href="">oreilly.com</a><br /> <li>12/26/2008 <a href="">biggerbooks.com</a> – $38.21<br /> <li>12/1/2008 <a href="">loot.co.za</a> – R385.00<br /> <li>12/26/2008 <a href="">ecampus.com</a> – $38.99<br /> <li>2008/12/2 <a href="">monoclip.jp</a><br /> <li>2009/01 <a href="">bookweb.kinokuniya.jp</a><br /> <li>2009/01<a href=""></a> – 5,772(税込) この商品は1500円以上国内配送料無料</p> </ul> Flex from Ford, Power by Microsoft. 2008-08-29T00:00:00-07:00 <p><img src="" alt="20080828_FlexByFord.png" border="0" width="517" height="256" /><br /> Is Ford is jumping on the Flex bandwagon? And powered by Microsoft?</p> <p><img src="" alt="20080828_poweredByMicrosoft.png" border="0" width="135" height="57" /></p> Check out the Advanced ActiveRecord Envycast 2008-08-29T00:00:00-07:00 <p>I just went through the first <a href="">screencast</a> from the <a href="">Rails Envy</a> <a href="">check it out</a>.</p> <div style="text-align:center;"><img src="" alt="20080829_EnvyCast.jpg" border="0" width="480" height="396" /></div> Flash Player 10 Mobile for iPhone? 2008-08-27T00:00:00-07:00 <style> .qttitle { padding-left: 120px; min-height: 120px; background-image: url(); background-position: top left; background-repeat: no-repeat; vertical-align: middle; } .playButton { background-color: rgb(20,20,20); cursor: pointer; font-weight: bold; font-size: 1.25em; opacity: .8; filter: alpha(opacity=80); -moz-border-radius: 1em; -webkit-border-radius: 1em; position: relative; top: 50%; zoom: 100%; padding: .5em 1em; color: white; } .playBackground { background-color: rgb(0,0,0); opacity: 0.0; filter: alpha(opacity=0); position: absolute; top: 0px; left: 0px; } </style> I was viewing the video of the <a href="">Day 1 Keynote</a>): <script src="" language="JavaScript" type="text/javascript"></script> <script src="" language="JavaScript" type="text/javascript"></script> <script type="text/javascript"><!-- QT_WritePoster_XHTML('Click to Play', '', '', '246', '385', '', 'controller', 'true', 'autoplay', 'true', 'bgcolor', 'black', 'scale', 'aspect'); //--> </script> <noscript> <object width="246" height="385"="246" height="385" type="video/quicktime" pluginspage="" src="" href="" target="myself" controller="false" autoplay="false" scale="aspect"> </embed> </object> </noscript> That's when he changed the skin: <div style="text-align:center;"><img src="" alt="20080827_flexiphoneskin.png" border="0" width="567" height="179" /></div> That would be cool if we could soon start coding in Flex for the iPhone. Enjoy! Daniel. What are all the Rails Date Formats? 2008-08-20T00:00:00-07:00 <p>Ever forget what all the Rails defined <code>Date/DateTime/Time#strftime</code> formats are? Or forget what ones you added to the project yourself?</p> <p>Ala <code>rake routes</code> comes <code>rake date_formats</code>:</p> <script src=""></script><p>Sample output from a Rails 2.1 app:<br /> <pre><br /> Date<br /> ====<br /> db:‘%Y-%m-%d’ 2008-08-20<br /> long_ordinal:‘&proc’ August 20th, 2008<br /> long:‘%B %e, %Y’ August 20, 2008<br /> rfc822:‘%e %b %Y’ 20 Aug 2008<br /> number:‘%Y%m%d’ 20080820<br /> short:‘%e %b’ 20 Aug</p> <p>DateTime<br /> ====<br /> db:‘%Y-%m-%d’ 2008-08-20 16:56:21<br /> long_ordinal:‘&proc’ August 20th, 2008 16:56<br /> long:‘%B %e, %Y’ August 20, 2008 16:56<br /> rfc822:‘%e %b %Y’ Wed, 20 Aug 2008 16:56:21 -0600<br /> number:‘%Y%m%d’ 20080820165621<br /> short:‘%e %b’ 20 Aug 16:56</p> <p>Time<br /> ====<br /> db:‘%Y-%m-%d %H:%M:%S’ 2008-08-20 16:56:21<br /> long_ordinal:‘&proc’ August 20th, 2008 16:56<br /> long:‘%B %d, %Y %H:%M’ August 20, 2008 16:56<br /> rfc822:‘%a, %d %b %Y %H:%M:%S %z’ Wed, 20 Aug 2008 16:56:21 -0600<br /> short:‘%d %b %H:%M’ 20 Aug 16:56<br /> number:‘%Y%m%d%H%M%S’ 20080820165621<br /> time:‘%H:%M’ 16:56<br /> </pre></p> Nested to_xml for awesome_nested_set 2008-08-19T00:00:00-07:00 <p>I was updating an example build using the better_nested_set to use the awesome_nested_set. One thing that I didn’t find in awesome_nested_set are some helper methods that are returning a full tree of the nested set as one <span class="caps">XML</span> document. With better nested set I could do</p> <typo:code <p>Category.result_to_attributes_xml(Category.root.ancestors)</p> </typo:code> <p>So I have added the following <em>full_xml</em> method to my nested active record to recurse all the children. Note that the <em>full_method</em> calls the <em>full_method</em> on the children passing along the xml builder that is created by the to_xml method and passed as the <em>xml</em> variable to block, thus building a nested <span class="caps">XML</span> document.</p> <typo:code <p>class Category < ActiveRecord::Base<br /> belongs_to :parent, :class_name => “Category”<br /> acts_as_nested_set</p> def full_xml(builder=nil) to_xml(:builder => builder, :skip_instruct => true) do |xml| children.each { |child| child.full_xml(xml) } end end <p>end</p> </typo:code> <p>Obviously it would be nice that the awesome_nested_set provides such a method.</p> <p>So let’s assume I create the following nested structure:</p> <typo:code <p>Category.transaction do<br /> root = Category.create(:name => “Main Category”)</p> cameras = <span class="caps">DVD</span>”, :qty_in_stock => 0).move_to_child_of(dvds) Category.create(:name => “<span class="caps">DVD</span>”, :qty_in_stock => 100).move_to_child_of(dvds) <p>end</p> </typo:code> <p>I can now get the whole nested structure in one go:</p> <typo:code <p>Category.roots.first.full_xml</p> </typo:code> <p>And get the following <span class="caps">XML</span> in return.</p> <p><typo:code lang=“xml><br /> <category><br /> ”datetime">2008-08-18T14:46:07Z</created-at><br /> <description nil="true"></description><br /> <id type="integer">1</id><br /> <lft type="integer">1</lft><br /> <name>Main Category</name><br /> <parent-id</parent-id><br /> <qty-in-stock</qty-in-stock><br /> <rgt type="integer">28</rgt><br /> <updated-at2008-08-18T14:46:07Z</updated-at><br /> <category><br /> <created-at2008-08-18T14:46:07Z</created-at><br /> <description nil="true"></description><br /> <id type="integer">11</id><br /> <lft type="integer">2</lft><br /> <name>Dvds</name><br /> <parent-id1</parent-id><br /> <qty-in-stock</qty-in-stock><br /> <rgt type="integer">9</rgt><br /> <updated-at2008-08-18T14:46:07Z</updated-at><br /> <category><br /> <created-at2008-08-18T14:46:07Z</created-at><br /> <description nil="true"></description><br /> <id type="integer">14</id><br /> <lft type="integer">3</lft><br /> <name><span class="caps">DVD</span></name><br /> <parent-id11</parent-id><br /> <qty-in-stock100</qty-in-stock><br /> <rgt type="integer">4</rgt><br /> <updated-at2008-08-18T14:46:07Z</updated-at></p> </category> <category> <created-at2008-08-18T14:46:07Z</created-at> <description nil="true"></description> <id type="integer">13</id> <lft type="integer">5</lft> <name>HD <span class="caps">DVD</span></name> <parent-id11</parent-id> <qty-in-stock0</qty-in-stock> <rgt type="integer">6</rgt> <updated-at2008-08-18T14:46:07Z</updated-at> </category> <category> <created-at2008-08-18T14:46:07Z</created-at> <description nil="true"></description> <id type="integer">12</id> <lft type="integer">7</lft> <name>Blueray</name> <parent-id11</parent-id> <qty-in-stock10</qty-in-stock> <rgt type="integer">8</rgt> <updated-at2008-08-18T14:46:07Z</updated-at> </category> </category> <category> <created-at2008-08-18T14:46:07Z</created-at> <description nil="true"></description> <id type="integer">7</id> <lft type="integer">10</lft> <name>Cell Phones</name> <parent-id1</parent-id> <qty-in-stock</qty-in-stock> <rgt type="integer">17</rgt> <updated-at2008-08-18T14:46:07Z</updated-at> <category> <created-at2008-08-18T14:46:07Z</created-at> <description nil="true"></description> <id type="integer">10</id> <lft type="integer">11</lft> <name>Prepaid Cards</name> <parent-id7</parent-id> <qty-in-stock3</qty-in-stock> <rgt type="integer">12</rgt> <updated-at2008-08-18T14:46:07Z</updated-at> </category> <category> <created-at2008-08-18T14:46:07Z</created-at> <description nil="true"></description> <id type="integer">9</id> <lft type="integer">13</lft> <name>Phones</name> <parent-id7</parent-id> <qty-in-stock20</qty-in-stock> <rgt type="integer">14</rgt> <updated-at2008-08-18T14:46:07Z</updated-at> </category> <category> <created-at2008-08-18T14:46:07Z</created-at> <description nil="true"></description> <id type="integer">8</id> <lft type="integer">15</lft> <name>Accessories</name> <parent-id7</parent-id> <qty-in-stock8</qty-in-stock> <rgt type="integer">16</rgt> <updated-at2008-08-18T14:46:07Z</updated-at> </category> </category> <category> <created-at2008-08-18T14:46:07Z</created-at> <description nil="true"></description> <id type="integer">2</id> <lft type="integer">18</lft> <name>Cameras & Photo</name> <parent-id1</parent-id> <qty-in-stock</qty-in-stock> <rgt type="integer">27</rgt> <updated-at2008-08-18T14:46:07Z</updated-at> <category> <created-at2008-08-18T14:46:07Z</created-at> <description nil="true"></description> <id type="integer">6</id> <lft type="integer">19</lft> <name>Digital Cameras</name> <parent-id2</parent-id> <qty-in-stock5</qty-in-stock> <rgt type="integer">20</rgt> <updated-at2008-08-18T14:46:07Z</updated-at> </category> <category> <created-at2008-08-18T14:46:07Z</created-at> <description nil="true"></description> <id type="integer">5</id> <lft type="integer">21</lft> <name>Analog Cameras</name> <parent-id2</parent-id> <qty-in-stock0</qty-in-stock> <rgt type="integer">22</rgt> <updated-at2008-08-18T14:46:07Z</updated-at> </category> <category> <created-at2008-08-18T14:46:07Z</created-at> <description nil="true"></description> <id type="integer">4</id> <lft type="integer">23</lft> <name>Accessories</name> <parent-id2</parent-id> <qty-in-stock12</qty-in-stock> <rgt type="integer">24</rgt> <updated-at2008-08-18T14:46:07Z</updated-at> </category> <category> <created-at2008-08-18T14:46:07Z</created-at> <description nil="true"></description> <id type="integer">3</id> <lft type="integer">25</lft> <name>Bags</name> <parent-id2</parent-id> <qty-in-stock2</qty-in-stock> <rgt type="integer">26</rgt> <updated-at2008-08-18T14:46:07Z</updated-at> </category> </category> </category> </typo:code> <p>How do you deal with that situation?</p> 360Flex sessions video - Day one 2008-08-19T00:00:00-07:00 <p><iframe src=“” scrolling=“auto” frameborder=“no” align=“center” height = “220px”</iframe></p> <p>Sessions Posted:</p> <ul> <li>TicketMaster Kiosk by Kevin Fauth</li> <li>Flex Accessibility by Giorgio Natili</li> <li>Reading the Flex source code by Jonathan Branam</li> <li>Project Workflow by Axel Jensen</li> <li>Creating Reusable Components by Ben Clinkbeard</li> </ul> <p><a href="">From Ted’s blog.</a></p> iPhone in nearly every state. 147 out of 188 stores. 2008-07-22T00:00:00-07:00 <p><img src="" alt="20080722_IphoneEveryWhere.png" border="0" width="286" height="184" /></p> <p>From <a href="">hasiphone.com</a> July 22nd 2pm.</p> hasiphone.com now with US map 2008-07-21T00:00:00-07:00 <p>Thanks to the <a href="">Degrafa</a> library I was able to add a “US Map of iPhone 3G” Availability in an hour to the <a href="">hasiphone.com</a> application.</p> <div style="text-align:center;"><img src="" alt="20080721_hasiphoneusmap.png" border="0" width="495" /></div> <p.</p> <p>Enjoy!<br /> Daniel.</p> <p><img src="" /> is cool</p> 4 stores out of 188 has iPhones 3G 2008-07-21T00:00:00-07:00 <div style="text-align:center;"><img src="" alt="20080721_ModelByStores.png" border="0" width="668" height="201" /></div> <p>The.</p> <div style="text-align:center;"><img src="" alt="20080721_4stores.png" border="0" width="486" height="103" /></div> <p>Data from: Apple.com and visualized by <a href="">hasiphone.com</a></p> hasiphone.com - Statistics and Overview of iPhone availability at US Apple Stores 2008-07-18T00:00:00-07:00 <p>As part of the iPhone 3G mania I checked out Apple iPhone 3G availability <a href="">website</a> and that’s how I found where to buy my iPhone in Denver. I was however also wondering how many Apple store still had the iPhone in the US, so I wrote <a href=""></a> that provides an overview of the availability of the iPhone 3G in the US based on the data provided by Apple website. <div style="text-align:center;"><img src="" alt="20080717_hasiphone.png" border="0" width="453" height="273" /></div></p> <p>On the server an <span class="caps">AIR</span> application checks once a day the new availability data, crunches it up and saves it a a serialized datastructure to a ByteArray. The Hasiphone Flex application reads this data and visualizes it. Well, I spend 4 hours (which I didn’t really have before my vacations) on it, so their may be some glitches here and there. Leave comment on this blog if you find any issues.</p> <p>Also a note of caution on the data. Like Apple’s site mentions it’s updated only once a day in the evening. One of the sales guy also mentioned to me that any iPhone that has an issue and cannot be sold but still is in stock may appear as available, thus their are stores that don’t have any 3G to sell but still show up on the list.</p> iPhone 3G or not? 2008-07-08T00:00:00-07:00 <p>Since <a href="">How to replace an original iPhone with an iPhone 3G</a>. Now if only my wife didn’t want my current iPhone, I wouldn’t have to buy the new one :-)</p> Compassionate Communications. A different kind of Rails application. 2008-06-19T00:00:00-07:00 I have been working with Sean and Lee on <a href="">Compassionate Communications</a> a Ruby on Rails website. My role was small thanks to the <a href="">ActiveMerchant</a> plugin, I helped with the online payment but my part was done in no time. The site launched just before Rails Conference and I wanted to write about what the site is. It's about giving, reaching out, helping...but I didn't find the right words to describe it. The team at <a href="">Compassionate Communications</a> made the following video that captures the essence of what they want to achieve way better I could describe..so go check it out. <div id="video_container" style="border: 1px solid rgb(204, 204, 204); padding: 4px;"> <embed id="mediaplayer" width="420" height="280" flashvars="usefullscreen=false&volume=100&width=420&height=280& </div> Running mod_rails on Leopard (OSX 10.5) 2008-06-14T00:00:00-07:00 <p>From the command line:</p> <typo:code> <p>gem install passenger<br /> sudo passenger-install-apache2-module</p> </typo:code> <p>The Apache 2 module was successfully installed.</p> <p>Please edit your Apache configuration file, and add these lines:</p> <p>Hey…where is the configuration. Google told me to read this blog entry:</p> <p>So copy these three lines and add them to the end of this file: /etc/apache2/httpd.conf</p> <p>$ sudo mate /etc/apache2/httpd.conf</p> <p>Start and stop Apache go the to the System Preferences|Sharing and select the Web Sharing service:</p> <div style="text-align:center;"><img src="" alt="20080616_syspref.jpg" border="0" width="467" height="382" /></div> <p>Then the install script gives you the following instructions.</p> <typo:code> <p>Deploying a Ruby on Rails application: an example</p> <p>Suppose you have a Ruby on Rails application in /somewhere. Add a virtual host<br /> to your Apache configuration file, and set its DocumentRoot to<br /> /somewhere/public, like this:</p> <VirtualHost *:80> ServerName DocumentRoot /somewhere/public </VirtualHost> <p>And that’s it! You may also want to check the Users Guide for security and<br /> optimization tips and other useful information:</p> /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/doc/Users guide.html <p>Enjoy Passenger, a product of Phusion () :-)<br /></p> </typo:code> <p>Now where is “my” apache configuration file? And more important where is yours? On the command line do</p> <p>$ ls /etc/apache2/users/</p> <p>And I see daniel.conf, so let’s edit that one. I am developing one Rails app in this folder: /Users/daniel/SvnProjects/for/stockportfolio/rails. So let’s define this application in that conf file:</p> <p>$ sudo mate /etc/apache2/users/daniel.conf</p> <typo:code> <p><Directory “/Users/daniel/SvnProjects/for/stockportfolio/rails/”><br /> Order allow,deny<br /> Allow from all</p> </Directory> <p><VirtualHost *:80><br /> ServerName dev.stockportfolio.com<br /> DocumentRoot /Users/daniel/SvnProjects/for/stockportfolio/rails/public</p> </VirtualHost> </typo:code> <p>Note the /public at the end of the folder in the DocumentRoot. <br /> Now I am adding dev.stockportfolio.com in my /etc/hosts file. So just add the following line</p> <typo:code> <p>127.0.0.1 dev.stockportfolio.com</p> </typo:code> <p>Now go back to the system preference sharing tab and restart the web service. Now you have your application running … in production mode. Just point your browser to dev.stockportfolio.com.</p> <p>Enjoy Daniel!</p> Advanced Rails Studio: Day 3 2008-06-14T00:00:00-07:00 <p>We are onto the 3rd day of the training, and the guys are still kicking. We are now onto Asynchronous processing. That’s good as I needed to catch up on what’s out there. I didn’t know about Starling. A light-weight queue server, might be a better solution than the heavier BackgroundRb based on the scenario you need to address. Any of you using Starling? Chad now goes into creating a plugin…ReviewableFu! Now onto debugging. And Caching.<br /> <br/> Thanks guys awesome training, you covered tons of good material. Again, really worthwhile if you want to go to the next level with Rails.</p> At the Advanced Rails Studio in Denver 2008-06-13T00:00:00-07:00 <p>We are just starting Day 2. Mike Clark and Chad Fowler are giving the training and are really good at it. They are 24 people taking the training, most not from Denver, and one from Mexico. Right now attendees are not awake and Mike and Chad are trying to wake us up. Yesterday we covered routes, looked at the Rails and Mongrel source code, looked at a RESTful application, covered ActiveResource, and checked ActiveRecord Associations. It’s nice to be able to sit back and take time to play with all these goodies without having to deliver code. It’s a nice refresher for me. Next step will be meta programming.</p> <h3>Here are some notes from the ActiveRecord Associations part of the training:</h3> <p><strong>Join Model</strong>: has_many :through</p> <p><strong>Polymorphic Associations:</strong> has_many :address, :as => :addressable</p> <p><strong>Custom Finders:</strong></p> <typo:code <p>class User <br /> has_many :visits do<br /> def recent(limiit – 5)<br /> find(:all, :order => ‘created_at <span class="caps">DESC</span>’, :limit => 5)<br /> end<br /> end</p> </typo:code> <p><strong>Active Record Scoping:</strong></p> <p>with_scope # protected now</p> <p>before_filter :find_account</p> <p><strong>Scoped Relationships:</strong></p> <typo:code <p>@event.registations.find(params[:id])<br /> @user.events.find_by_id(params[:id])<br /> @event.registations.find(:all, :conditions => “pre_register is true”)</p> </typo:code> <p><strong>Named Associations:</strong></p> <typo:code <p>class Event < ActiveRecord::Base<br /> has_many :registrations<br /> has_many :pre_registrations,<br /> :class_name => “Registration”,<br /> :conditions => “pre_register is true”<br /> end</p> <p>@event.pre_registrations</p> </typo:code> <p><strong>Named Scope:</strong></p> <typo:code <p>class Coupon < ActiveRecord::Base<br /> named_scope :limit_not_exceeded, :conditions => “use_count < max_uses”<br /> named_scope :usable_in_store, :conditions => “external_only is false”<br /> end</p> <p>Coupon.limit_not_exceeded<br /> Coupon.usable_in_store<br /> Coupon.limit_not_exceeded.usable_in_store</p> </typo:code> <p><strong>Dynamic Named Scope:</strong></p> <typo:code <p>class Coupon < ActiveRecord::Base<br /> named_scope :not_expired, lambda { { :conditions => [‘expires_at > ?’, Time.now] } }<br /> named_scope :used_at_most, lambda { |uses| { :conditions => [‘use_count <= ?’, uses] } }<br /> end</p> <p>Coupon.not_expired<br /> Coupon.used_at_most(30)<br /> Coupon.not_expired.used_at_most(10)</p> </typo:code> Advanced Rails Studio: Meta Programming 2008-06-13T00:00:00-07:00 <p>Chad is giving a very nice presentation walking us through meta programming step by step. You can see the code examples we are creating during his talk, but just looking at the code will note give the whole picture.</p> Advanced Rails Studio: Custom Form Builder 2008-06-13T00:00:00-07:00 <p>Custom Form Builder</p> <p>Use a custom form builder to clean up your html.erb files.</p> <typo:code <p>class LabelFormBuilder < ActionView::Helpers::FormBuilder<br /> helpers = field_helpers +<br /> %w{date_select datetime_select time_select} +<br /> %w{collection_select select country_select time_zone_select} -<br /> %w{hidden_field label fields_for} # Don’t decorate these</p> helpers.each do |name| define_method(name) do |field, *args| options = args.last.is_a?(Hash) ? args.pop : {} label = label(field, options[:label], :class => options[:label_clas]) @template.content_tag(:p, label +’<br/>’ + super) #wrap with a paragraph end end <p>end</p> </typo:code> <p>Then you can remove all the <p> and label tags from you form.</p> <typo:code <h1>Editing user</h1> <p><% form_for(@user, :builder => LabelFormBuilder) do |f| <span>><br /> <</span>= f.error_messages <span>><br /> <</span>= f.text_field :name <span>><br /> <</span>= f.text_field :address <span>><br /> <</span>= f.text_area :comment <span>><br /> <</span>= f.check_box :check <span>><br /> <</span>= f.submit “Update” <span>><br /> <</span> end %></p> <p><%= link_to ‘Show’, @user <span>> |<br /> <</span>= link_to ‘Back’, users_path %></p> </typo:code> <p>Add this to your application initializer to have all form use this form builder</p> <typo:code> <p>ActionView::Base.default_form_builder = LabelFormBuilder</p> </typo:code> <p>Then you can replace<br /> <typo:code><br /> <% form_for(@user, :builder => LabelFormBuilder) do |f| %></p> </typo:code> <p>with <br /> <typo:code><br /> <% form_for(@user) do |f| %></p> </typo:code> <p>Now the same form with no custom builder was looking like this before.</p> <typo:code> <h1>Editing user</h1> <p><% form_for(@user) do |f| <span>><br /> <</span>= f.error_messages %></p> <p> <%= f.label :name %><br /> <%= f.text_field :name %> </p> <p> <%= f.label :address %><br /> <%= f.text_field :address %> </p> <p> <%= f.label :comment %><br /> <%= f.text_area :comment %> </p> <p> <%= f.label :check %><br /> <%= f.check_box :check %> </p> <p> <%= f.submit “Update” %> </p> <p><% end %></p> <p><%= link_to ‘Show’, @user <span>> |<br /> <</span>= link_to ‘Back’, users_path %></p> </typo:code> RailsConf 2008 Ruby Hero Awards Video 2008-06-01T00:00:00-07:00 <p><a href="" title="Ruby Heroes"><img alt="Ruby Heroes" src="" /></a>< Ruby Hero Award Video</a> on <a href="">Vimeo</a>.</p> <p>The guys over at <a href="">Rails Envy</a> somehow managed to present (and create) the Ruby Heroes Awards at RailsConf…funny as usual. Check out this video extracts from the talk.</p> <p><span class="caps">UPDATE</span>: what I didn’t mention for this video and what remi realized is that I was sitting way back in the room and took only sections of the video and it’s quite ruff and shaky.</p> RailsConf 2008 Git Talk by Scott Chacon Video 2008-06-01T00:00:00-07:00 <p><strong>Update</strong>: Scott did a voice-over with his slides he presented at Railsconf, so to get the full presentation, head-over at <a href="">gitcasts</a> now. The video here after is only a subset of the talk, so first go check out his <a href="">gitcast</a>.</p> <p>Most awesome talk of RailsConf 2008.< Git Talk by Scot Chacon Video</a> on <a href="">Vimeo</a>.</p> <p</p> <p>Warning: I apparently didn’t choose the right conversion ratio and the image is a little squeezed…and again…I was still sitting at the back of the room.</p> RailsConf 2008 David Heinemeier Hansson's Keynote Video 2008-05-31T00:00:00-07:00 David Heinemeier Hansson Keynote</a> on <a href="">Vimeo</a>.</p> <p.</p> <p>Warning: I didn’t edit the video and didn’t have a tripod so it’s quite ruff and shaky. Also oreilly is going to publish an high quality official one.</p> <p><strong>Update</strong>: video was gone…seems to be back now.</p> RailsConf tutorial and source code open sourced 2008-05-30T00:00:00-07:00 <p>Thanks to everyone that attended the Powering <span class="caps">AIR</span> with Rails talk. That was really cool. I didn’t realize how hard it is to give such talks, but hey…party time now. It’s fun to give a presentation the first day at a conference, we can now enjoy the rest of the conference.</p> <p>You can find the slides and the source code at:</p> <p><a href=""></a></p> <p>We presented the following 10 <span class="caps">AIR</span> applications:</p> <pre> </pre> <p>Enjoy,</p> <p>Daniel and Tony!</p> RailsConf 2008 is started. 2008-05-29T00:00:00-07:00 <p!</p> <p>Enjoy, Daniel.</p> Powering AIR Applications with Rails - RailsConf tutorial preview. 2008-05-23T00:00:00-07:00 <p>Last night I gave a 2 1/2 hour tutorial preview at Derailed (Denver’s Ruby On Rails User Group) of the <a href="">talk</a> <a href="">Tony</a> and myself will be giving at RailsConf next week. This allowed me to understand if we have enough material and what needs to be changed for the different sections we are going to present. I guess we have too much material as I wasn’t able to present some of the apps I have created for the presentation. Attendance was pretty low, about 15 people, but the feedback was excellent and it seems they have appreciated the talk. For the talk we will be showing how to code many of the features and ways in which using <a href=""><span class="caps">AIR</span></a> can enhance your Rails application. Lot’s of code in the second part. We will cover the different APIs <span class="caps">AIR</span> provides such a File system access, Native Drag&Drop, Native Windowing, Dock Notification, Sending binary files to S3 via attachment_fu, taking photos from your webcam and sending them directly to your Rails app (attachment_fu again!), how to manipulate the <span class="caps">HTML</span> <span class="caps">DOM</span>, and of course a couple of twitter related apps, one using <a href="">twitter4r</a> and the other spidering twitter.com (I hope I am not the guy who is bringing it down)…and much more. If you intend to attend drop us a line. See you there!</p> <p>Daniel. </p> My RailsConf Schedule 2008-05-09T00:00:00-07:00 <p>Railsconf now has an <a href="">iCal version</a></p> <div style="text-align:center;"><img src="" alt="20080508_RailsConfSchedule.jpg" border="0" width="520" /></div> Interview with the owner of MunchAway: an online food ordering application build with Ruby On Rails. 2008-05-07T00:00:00-07:00 <p>Interview with the owner of MunchAway: an online food ordering application build with Ruby On Rails.</p> <div style="text-align:center;"><img src="" alt="20080506_MunchAwayMenu.jpg" border="0" width="456" height="273" /></div> <p>I was working at the end of last year and the beginning of this year part time on a cool Ruby on Rails project. I recently contacted the owner of the project and asked him if I could interview him to share his thoughts on different aspects on the project in an interview to be posted on my blog. He shared openly his views on Ruby on Rails, on using a mix of consultants and employes, and on the project in general. I think you find will his answers informative.</p> <p>Rob, the owner of <a href="">lt2sys.com</a> had a vision to make an online food ordering platform that can easily add online food ordering to Restaurants that already use an existing point of sale (basically the touch screens when you order your food at the restaurant). So Rob put together a team of consultants, employees and offshore Rails developers and created the application which has a front-end online ordering, a back-end system to configure new stores, and communication system that interacts with the point of sales. The development of the initial phase took several month and the system is now live serving many restaurants.</p> <p><strong>Interview with the Rob, the owner of lt2sys</strong></p> <div style="text-align:center;">On Using Rails</div> <p><strong>Question</strong>: What made you choose Ruby on Rails to develop your solution?<br/> <strong>Rob</strong>: I made a strategic decision to use what I perceived to be the best available web development technology available. This was difficult for me because by using Ruby on Rails, I was choosing a technology that I had no personal experience in using. I read many blogs and product reviews, and discussed this with my internal staff.<br/></p> <p><strong>Question</strong>: Did you consider other technologies like .Net, Java, Php, Phyton? <br/> <strong>Rob</strong>: Beside Ruby, the only other product that I considered besides Rails was .Net. We have a lot of .<span class="caps">NET</span> expertise inhouse, and I had some Java <span class="caps">JSP</span> experience. We had one developer in house with Ruby on Rails expertise.. I didn’t really consider Java because I wanted to use something that my internal team would be willing to use. That came down to Ruby or .<span class="caps">NET</span> We debated this for quite a while. I ultimately decided on Ruby because of my longterm frustrations of using Microsoft development products. Every new version of .<span class="caps">NET</span> requires more and more resources, the development tools take longer to use, and it seems that Microsoft is constantly changing the languages or key features that you come to rely on. <br/></p> <p><strong>Question</strong>: Where do you see the strong/weak points of Rails? <br/> <br /> <strong>Rob</strong>: My in-house developers and I have had a hard time adapting to development with Rails. This was a key goal of the project – to develop additional inhouse expertise in Rails. I was unable to find sufficient time, and one of my senior .Net developers grew frustrated with Rails and stopped developing with it (however he learned Ruby and continues to contribute with that expertise). On the plus side, for those that understand the Ruby on Rails framework, they do seem to develop new features quickly.<br/></p> <p><strong>Question</strong>: Would you Rails for another project? <br/> <strong>Rob</strong>: From a technology viewpoint, the answer is Yes, but from a business viewpoint I haven’t made a decision on that yet. <br/></p> <p><strong>Question</strong>: What do you think of developing and running Rails applications for so many customers? <br/> <strong>Rob</strong>: I took a big risk in utilizing Rails to develop this application. So far it’s working, but the actual performance of the application is just barely acceptable. We need to optimize the application for further expansion.<br/></p> <div style="text-align:center;">On Using a mix on Consultants/Employees/Offshore Resources</div><p><br/></p> <p><strong>Question</strong>: You used a mix of consultants, employees and offshore resources for this project, can you elaborate on this choice? <br/> <strong>Rob</strong>: After I had completed the project’s high level design specifications (40+ pages) and a detailed data model in a “platform neutral” fashion, I was in a position to determine how I wanted to develop the project. I knew that due to internal resource constraints that outsourcing was the only real alternative to getting the project done in a timely manner. So I approached the problem of finding outside resources and making a final choice between using Ruby on Rails or .<span class="caps">NET</span> more or less simultaneously. Cost was an issue; but also what concerned me was that since I was not providing an extremely detailed design and I didn’t have the right system architecture experience to personally architect an enterprise web application using either Rails or .<span class="caps">NET</span>, I wanted the initial developers to be very senior and highly experienced developers who could look at the big picture of systems design and put something together that would support a large number of simultaneous users. I also needed to transfer a lot of domain knowledge to them, so I decided that going offshore for the initial phase of development would entail a tremendous amount of brain damage at best and a highly risky proposition in any case. So I decided that finding the right developers to initially build the system the right way was in our best interest. <br/></p> <p><strong>Question</strong>: How did you ensure proper workflow between the different teams? <br/> <strong>Rob</strong>: The application has a consumer front end, an administrative console, and a communications component with the restaurant.. I put my Ruby on Rails experts on design of the Front End application, my internal Ruby on Rails expert on the Administrative console, and a 2nd internal resource on the communications component. As I had spec’d out the communications component in great detail this was easier to manager. My ruby on rails experts that were working on the consumer application reviewed the data model and reworked it to make it work better with ruby. I acted as project manager and worked to explain the domain knowledge to all parties and resolve design issues as they occurred. It was a very hands on approach.<br/></p> <p><strong>Question</strong>: Did you have difficulties finding Rails consultants? <br/> <strong>Rob</strong>: I did. There didn’t seem to be much of a pool locally. Because I needed to transfer a lot of domain knowledge I wanted to find people locally that could come into the office and work. I was able to find 2 very key people to do the Ruby on Rails development, but struggled to find a graphics designer that had experience with Ruby on Rails and Liquid. It seemed to be a very small community of people that actually knew how to work with the technology.<br/></p> <p><strong>Question</strong>: How did you select an offshore service provider? <br/> <strong>Rob</strong>: I did a number of web searches to find companies offshore that claimed to have experience. I emailed each and began a dialogue with the ones that responded. I had several conversations with each company. Some I dropped off the list because I frankly couldn’t understand what there were saying! Another company I dropped off because I had a conversation with their lead technology guy and he started dissing the technology choices and suggested they could do better. It seemed like a classic case of <span class="caps">NIH</span>. The problem with that was I was looking for a company to take over the project and do new development, not rewrite the product! I ultimately got down to two companies, both of which seemed acceptable. I choose one and gave them a project that I felt was low risk to start with. Even if they failed completely the product would not be in jeopardy. Fortunately they did a good job and over time have made several enhancements to the product.<br/></p> <div style="text-align:center;">On Using Hosted environment .vs. hosting your own servers</div><p><br/></p> <p><strong>Question</strong>: You choose a hosted environment, did you consider using your own servers? <br/> <strong>Rob</strong>: No. That would require additional investment in IT management resources that frankly we don’t have.<br/></p> <p><strong>Question</strong>: What do you think of Engineyard? <br/> <strong>Rob</strong>: Engine Yard has been a great choice for us because they have acted as the IT department for MunchAway. It’s great that almost every time I call them a real person that knows something answers the phone!<br/></p> <div style="text-align:center;">On the Project Development</div> <p><strong>Question</strong>: Did the project work as expect?<br/> <strong>Rob</strong>: Performance is an issue for us. This is really the only issue, and I expect that we will be able to resolve it over time.<br/></p> <p><strong>Question</strong>: Did you encounter issues?<br/> <strong>Rob</strong>: The issue that we ran into was that we expected to provide an application that would be easily maintainable the graphics designers by our users. This has not been the case, in fact, we have had to retain a graphics designer with Ruby on Rails and Liquid expertise to help us in this area.<br/></p> <p><strong>Question</strong>: What’s planned next for the application? <br/> <strong>Rob</strong>: The consumer side of the application needs to be extended so that it can be easily used on IPhone and Blackberry devices. <br/></p> <div style="text-align:center;">On the Application</div> <p><strong>Question</strong>: Is this you first online food ordering application you developed? <br/> <strong>Rob</strong>: Not directly. We originally developed a middleware application that provides the ability for web developers to interface with Restaurant Point of Sale. This is in use with several different online ordering companies for several years. MunchAway connects to that middleware and provides the full online ordering solution for restaurants.<br/></p> <p><strong>Question</strong>: What differentiates your platform from your competitors? <br/> <strong>Rob</strong>: Technically, because our middleware application extracts the restaurant’s menu from the point of sale system, we can construct a customer’s web ordering system quickly and maintain it very easily. Also, many online ordering solutions do not integrate with the point of sale system at all; they use a fax machine or email as the delivery mechanism for the order. From a business standpoint we are unique in that we market the product through a well established point of sale dealer network which understands the restaurant customer base and this is a real value add.<br/></p> <p><strong>Question</strong>: Why do you offer a subscription based solution rather than providing one off solutions for you customers? <br/> <strong>Rob</strong>: <span class="caps">SAAS</span> makes sense for our customers as we offer the hosting service as well as ongoing product improvement to our entire customer base.<br/></p> <div style="text-align:center;">On Running the Application</div> <p><strong>Question</strong>: How restaurants (locations) are now served with your platform? <br/> <strong>Rob</strong>: At each restaurant we install our middleware application which acts as the conduit between the MunchAway website and the Restaurant Point of Sale System. The middleware extracts menus (which incorporates the business rules of ordering each item on the the <span class="caps">POS</span>)_and posts them to the MunchAway website; it also accepts orders from the website and posts them on the restaurant point of sale system. This is a major plus for the restaurant as this eliminates all the labor involved in reentering the order and insures no mistakes are made in the process.<br/></p> <p><strong>Question</strong>: How quickly can you add a new customer/new locations? <br/> <strong>Rob</strong>: 4 man hours to add the customer’s first location, which includes installing the software at the restaurant <span class="caps">POS</span> and applying the customer’s graphic look and feel to the MunchAway website. Locations 2 thru X take 1 hour each to setup.<br/></p> <p><strong>Question</strong>: Can a customer change the look and feel of your solutions? <br/> <strong>Rob</strong>: No. This was an original goal of the project, but this has not yet been achieved. We rely on a graphic designer with ruby on rails and liquid experience to make customer customizations as needed.<br/></p> Just signed up for Advanced Rails Studio 2008-05-02T00:00:00-07:00 <p><a href="">It’s</a> in Denver on June 12 to 14. And from May 29th to June 1st I’ll be at RailsConf. Wouhao…Not sure when I will do customer work, but it’s gonna be a fun couple of month ahead. I haven’t been at a Rails studio before, but have been at the <a href="">The Rails Edge Conference</a> and it was a pretty awesome and intense conference, so I expect a lot from the Rails Studio. I’ll keep you informed. Of course before that there will be RailsConf 2008, last year I thought it was getting too big for a conference, but it was still really fun to geek out there. So let’s get ready!!! Let me know if you attend one or the other of these conferences/trainning.</p> Color Syntax copying for TextMate 2008-04-29T00:00:00-07:00 <p>Just in time for preparing our RailsConf talk I found out how to copy text with color syntax from TextMate. Simply Ctrl+Alt+Cmd+R in TextMate and paste in Keynote. Of course you need the copy-as-rtf-tmbundle from <a href="">Max Muermann</a>. I was using XCode for that before, but the keyword detection was different that Textmate’s which I prefer.</p> <p>To install:<br /> <typo:code><br /> cd ~/Library/Application\ Support/TextMate/Bundles<br /> git clone git://github.com/drnic/copy-as-rtf-tmbundle.git “Copy as <span class="caps">RTF</span>.tmbundle”</p> </typo:code> <p>DrNic put the bundle on <a href="">github</a>.</p> Flash Media Server(s) in Ruby? 2008-04-25T00:00:00-07:00 <p>While preparing an application to be presented during our <a href="">talk</a> for RailsConf I was looking for a “Flash Media Server” written in Ruby that could record video form a Flash Player. I found <a href="">rubyizumi</a> but it doesn’t support recording (to my understanding). In Javaland they are a couple, <a href="">red5</a> and <a href="">demou</a>, but they are too convoluted for just a demo. Red5 allows Ruby scripting which is pretty cool. I found one which I really like and will certainly use which is named <a href="">haxe Video</a> which is written in <a href="">haXe</a> and is very succinct and works. It’s open source and can be found on <a href="">googlecode</a>. Of course there is Adobe’s <a href="">Flash Media Server</a> but I would prefer finding a Ruby specific solution. Do you know any Flash Media Server written in Ruby? Drop me a line or a comment.</p> Don't use networksolutions.com for you domain name searches... 2008-04-24T00:00:00-07:00 <p>I frequently get “great” ideas and reserve some domain names. Call me silly, but this makes the ideas more tangible even if I never work on them. I book my domain names through 1and1.com, for about $7 a year, but I do usually the search on netsol.com . So I searched for some names this morning, then decided to abandon, my idea didn’t need a separate domain for now, and to my surprise I got the following dialog when leaving the site:</p> <p><img src="" alt="20080424_netsol.jpg" border="0" width="392" height="262" /></p> <p>So what does that mean? Well, it seems if I click OK they will hide the names I searched for from others users who are doing searches for 4 days. So my recommendation: don’t use networksolutions.com for your search.</p> WebSnapshot Updated. 2008-04-22T00:00:00-07:00 <div style="text-align:center;"><img src="" alt="websnapshot_1.jpg" border="0" width="450" /></div> <p>The guys running the Adobe <span class="caps">AIR</span> Marketplace contacted me a couple of weeks ago to publish Websnapshot on the market place. Then they kindly gave me a free Thawte code signing certificate. So I republished the app and changed the skin, I used the Darkroom theme found on <a href="">scalenine.com</a>. Thawte didn’t make it easy on me to get the certificate. The main issue was that I didn’t have a phone number associated with my company name, therefore Thawte wanted me to send a phone bill with my company name (thug!) or a notarized letter. I had to resend three times the letter as first they couldn’t read it, then it didn’t show some required date…Well, finally I got the certificate and could sign the application. I don’t believe it will make a difference to many users as most people currently install non-signed apps anyhow. Now that certificate was changed from the initial I used to sign the application it will however require that you uninstall first the application if it was already installed.</p> <p>You can now find the application on the <a href="">Marketplace</a> or <a href="">here</a>.</p> <p>It’s basically the same version than before with just a minor scaling issue fixed. What I need to add next is auto update, custom filenames, saving to s3 and Flickr.</p> <p>Enjoy!<br /> Daniel.</p> Google's appengine is up and running. 2008-04-08T00:00:00-07:00 <p><a href="">Appengine</a> is Google’s answer to Amazon’s web services (ec2, s3, …). I just signed up and got the following message: “Thanks for checking in! When space in the Google App Engine preview release becomes available, we’ll notify you by emailing…”</p> <p>While waiting you can read there <a href="">doc</a> or download the <a href=""><span class="caps">SDK</span></a>.</p> <p>They have some <a href="">demo apps</a>. Also, the runtime or development language of choice seems to be Python…hopefully Ruby is next on the line.</p> <p>Update: 11:14pm Got an Invitation to try Google App Engine saying my account has been activated. The account allows me to create 3 applications.</p> iPhone SDK - first 5 minutes. 2008-03-07T00:00:00-08:00 <p>Off course I couldn’t resist, I had to give it a try. The sdk is a whopping 2GB download and 5.6 Gb install. It installs all the developers tools, java, gcc4.2, WebObjects, the kitchen sink. Upon successful installation the system needs to be restarted.</p> <p>Start XCode and select ‘New Project…’ from the File menu.<br /> You can then select from 3 type of iPhone Applications <br /> <div style="text-align:center;"><img src="" alt="20080307_1_iphone_projects.gif" border="0" width="455" height="103" /></div></p> <p>Let’s try the Cocoa Touch List and I name my test project TimeList.</p> <p>This creates a standard XCode project:<br /> <div style="text-align:center;"><img src="" alt="20080307_2_XCodeProject.jpg" border="0" width="447" height="335" /></div></p> <p>I clicked “Build and Go”…the application is compiled and linked after 20 seconds got an emulate iPhone with the TimeList app visible:</p> <div style="text-align:center;"><img src="" alt="20080307_3_iPhoneHome.jpg" border="0" width="231" height="445" /></div> <p>Clicking on it we get a pre-populated list of timezones which behaves just like an iPhone:</p> <div style="text-align:center;"><img src="" alt="20080307_4_TimeList.jpg" border="0" width="231" height="445" /></div> <p>Note the emulator application is called Aspen Simulator, it has a ‘Hardware’ menu that should allow to rotate the UI but that doesn’t seem to work. The emulator really feels like an iPhone, all the finger gestures can be done with the mouse and the UI behaves like an iPhone. Pretty cool.</p> <p>Let’s look at the TimeListAppDelegate generated code:</p> <typo:code> <p>//<br /> // TimeListAppDelegate.m<br /> // TimeList<br /> //<br /> // Created by Daniel Wanja on 3/7/08.<br /> // Copyright <i>MyCompanyName</i> 2008. All rights reserved.<br /> //</p> <p>#import “TimeListAppDelegate.h”</p> <p>@implementation TimeListAppDelegate</p> <p>@synthesize window;<br /> @synthesize tableView;</p> <p>- init {<br /> if (self = [super init]) {<br /> // Your initialization code here<br /> }<br /> return self;<br /> }</p> <p>- (void)applicationDidFinishLaunching:(UIApplication *)application {<br /> // Create window<br /> self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];</p> <p>// Set up table view<br /> tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];<br /> tableView.delegate = self;<br /> tableView.dataSource = self;</p> // Show the window with table view <p>[window addSubview:tableView];<br /> [window makeKeyAndVisible];<br /> [tableView reloadData];<br /> }</p> <p>- (void)dealloc {<br /> [tableView release];<br /> [window release];<br /> [super dealloc];<br /> }</p> <p>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {<br /> return 1;<br /> }</p> <p>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {<br /> return [[NSTimeZone knownTimeZoneNames] count];<br /> }</p> <p>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath withAvailableCell:(UITableViewCell *)availableCell {<br /> UISimpleTableViewCell *cell = nil;<br /> if (availableCell != nil) {<br /> cell = (UISimpleTableViewCell *)availableCell;<br /> } else {<br /> CGRect frame = CGRectMake(0, 0, 300, 44);<br /> cell = [[[UISimpleTableViewCell alloc] initWithFrame:frame] autorelease];<br /> }<br /> cell.text = [[NSTimeZone knownTimeZoneNames] objectAtIndex:[indexPath row]];<br /> return cell;<br /> }</p> <p>@end</p> </typo:code> <p>Looks like I have lots to read about before I can start changing that application. From what I can decipher once the application is initialized a UITableView is created and the delegate of the table view becomes the TimeListAppDelegate whish implements the numberOfRowsInSection and cellForRowAtIndexPath methods which uses the NSTimeZone knowTimeZonesNames as data source.</p> <p>That was my first 5 minutes with the <span class="caps">SDK</span>. More to follow…now I have to go back to work :-( Next thing I will try out is the Interface Builder…stay tuned.</p> <p>Enjoy!<br /> Daniel.</p> gemedit version 0.0.2 has been released! 2008-03-07T00:00:00-08:00 <p>A utility to view a gem’s source in your favorite editor</p> <p>Changes:</p> <h2 id="002_20080307">0.0.2 2008-03-07</h2> <ul> <li> <p>1 minor enhancement:</p> <ul> <li>add -p/–pretend option to show what gem(s) would be edited and with what command</li> </ul> </li> <li> <p><a href=""></a></p> </li> </ul> gemedit version 0.0.1 has been released! 2008-02-29T00:00:00-08:00 <p>Check out my first published gem: <b>gemedit</b></p> <p>A utility to view a gem’s source in your favorite editor</p> <p>Changes:</p> <ol> <li>0.0.1 2008-02-27</li> </ol><ul> <li>1 major enhancement: <ul> <li>Initial release</li> </ul></li> </ul> <ul> <li><a href=""></a></li> </ul> <p>Specials thanks go to the following gems for making it easy to put this out there:</p> <ul> <li><a href="">newgem</a> by <a href="">Dr. Nic Williams</a></li> <li><a href="">hoe</a> by <a href="">Ryan Davis</a></li> <li><a href="">rubyforge</a> by <ul> <li><a href="">Ara T Howard</a></li> <li><a href="">Ryan Davis</a></li> <li><a href="">Eric Hodel</a></li> </ul></li> </ul> WebSnapshot and RailsLogVisualizer ported to AIR 1.0 2008-02-26T00:00:00-08:00 <p>I ported the <a href="">WebSnapshot</a> and <a href="">RailsLogVisualizer</a> application to <span class="caps">AIR</span> 1.0</p> <p><a href=""><img src="" alt="20080225_WebSnapshot.jpg" border="0" width="225" height="137" /></a></p> <p><a href=""><img src="" alt="20080225_RailsLogVisualizer.jpg" border="0" width="225" height="137" /></a></p> <p>Enjoy,<br /> Daniel</p> Something in the AIR? 2008-02-23T00:00:00-08:00 <p><a href="">360Flex</a> in Atlanta starts this monday. I was at the first 360Flex conference last year and it was a blast. I will miss going to that one. Also it seems that many Flex User Groups meetings around the world (Atlanta, <a href="">Bangalore</a>, <a href="">London</a>, <a href="">Denver</a>, <a href="">Amsterdam</a>) will held on this monday. When so many planets will align perfectly something special is bound to occur.</p> <p>So more specifically from the Special Meeting invites:</p> <ul> <li>Exclusive user group video presentation by Adobe Chief Software Architect, Kevin Lynch</li> <li>In-person presentation from Adobe Platform Evangelist, Kevin Hoyt</li> <li>And…<strong>important product news!</strong></li> </ul> <p>That can mean only one thing. It’s gonna be soon time to recompile all my apps ;-)</p> <p>Update 1: the Denver meeting is not on the 25th but on March 11th.<br /> Update 2: Ted Patrick <a href="">announces</a> yesterday that the Flex 3.0 and <span class="caps">AIR</span> 1.0 releases is days away.<br /> Update 3: <a href="">Flex 3.0</a> and <a href=""><span class="caps">AIR</span> 1.0</a> are out. Go try out <a href="">FlexBuilder</a> if you haven’t yet, it’s the easiest way to get started.</p> Heroku.com - An impressive online Ruby on Rails Platform. 2008-02-21T00:00:00-08:00 <p>You’ve have to try it to believe it. It’s awesome that you can create a Rails application and deploy it all online. Nothing to install, it’s all there. I think it’s an awesome addition to the Rails world. It may not replace your development environment, but for deployment it’s pretty flexible and is based on <a href="">Amazon EC2</a>.</p> <p>From their website the feature description is as follows:</p> <ul> <li>Instant Deployment</li> <li>Create and Edit Online</li> <li>Integrated Stack</li> <li>Elastic Performance</li> <li>Share and Collaborate</li> <li>Import & Export</li> <li>Full Ruby Environment</li> <li>Gems & Plugins</li> <li>Rails Console</li> <li>Generate Code</li> <li>Painless Migrations</li> <li>Rake Console</li> </ul> <p>But you gotta see this to believe it. I made a quick screencast, so if you are not scared of a thick (swiss) french accent, have a look: (click image to open screencast in separate browser):<br /> <a href="" target="_blank"><br /> <div style="text-align:center;"><img src="" alt="20080220_HerokuSmall.jpg" border="0" width="319" height="198" /></div></a></p> <p>I can foresee, at least hope, that they will quickly add support for subversion and for Capistrano based deployment, hence becoming the ultimate deployment platform for Rails in addition to the powerful and flexible environment they already provide.</p> <p>I signed up and received my invite three days later. If you can’t wait send me an email daniel[at]onrails.org, and I sign you up, that will allow to skip the wait.</p> <p>Enjoy,<br /> Daniel.</p> Flexible Rails: A book on using Flex with Rails. 2008-02-20T00:00:00-08:00 <p>As many of you know I really enjoy using Flex with Rails. So I finally picked-up a copy of <a href="">FlexibleRails</a> <span class="caps">AMF</span>. So congratulations Peter of getting this done!</p> Dealing with HTTP errors in a Flex with Rails application. 2008-02-20T00:00:00-08:00 <p>The Flash Player is restricted in the way it deals with <span class="caps">HTTP</span> errors. This is mainly due to provide cross browser consistency and I believe is due to the restrictions the browser imposes on the Flash Player plugin. In fact when your Flex application performs <span class="caps">HTTP</span> requests using the HTTPService class, the request is passed by the Flash Player to the browser and in case of an Rails error (500, 404, …) the response is somehow crippled on the way back.</p> <h2>Problem</h2> <p>So let’s consider that the Flex application requests to update a Person but the validation fails. In the update method of our Rails controller the <span class="caps">HTTP</span> Status is set to :unprocessable_entity. This corresponds the <span class="caps">HTTP</span> error code 422.</p> <typo:code <ol> <li><span class="caps">PUT</span> /people/1</li> <li><span class="caps">PUT</span> /people/1.xml<br /> def update<br /> @person = Person.find(params[:id])</li> </ol> respond_to do |format| if @person.update_attributes(params[:person]) flash[:notice] = ‘Person was successfully updated.’ format.html { redirect_to(@person) } format.xml { head :ok } else format.html { render :action => “edit” } format.xml { render :xml => @person.errors, :status => :unprocessable_entity } end end end </typo:code> <p>Now in our Flex application by default we cannot identify that the error 422 occured, more annoyingly we cannot retrieve the Rails error messages. All we get back is the following:</p> <typo:code> <p>[FaultEvent fault=[<span class="caps">RPC</span> Fault faultString=“<span class="caps">HTTP</span> request error” faultCode=“Server.Error.Request” faultDetail=“Error: [IOErrorEvent type=”ioError" bubbles=false cancelable=false eventPhase=2 text=“Error #2032: Stream Error. <span class="caps">URL</span>:”]. <span class="caps">URL</span>:"] messageId=“65EBBA92-5911-68D2-1710-18A687C28455” type=“fault” bubbles=false cancelable=true eventPhase=2]</p> </typo:code> <h2>Solution</h2> <p <span class="caps">HTTP</span> Status error code in Rails and as the Flex application deals with <span class="caps">XML</span> responses, simply check in Flex if the response starts with <errors>. This can then also be dealt with in the Flex application in one place of the application. In a Cairngorm application I had the Delegate transform these “errors” responses to Faults.</p> <p>Here is an example of the change to the Rails ApplicationController.</p> <typo:code <p>class ApplicationController < ActionController::Base</p> after_filter :flex_error_handling def flex_error_handling response.headers[‘Status’] = interpret_status(200) if response.headers[‘Status’] == interpret_status(422) end def rescue_action_in_public(exception) render_exception(exception) end def rescue_action_locally(exception) render_exception(exception) end rescue_from ActiveRecord::RecordNotFound, :with => :render_exception def render_exception(exception) render :text => “<errors><error>#{exception}</error></errors>”, :status => 200 end <p>end</p> </typo:code> Does a good idea make a good business?...One year later! 2008-02-07T00:00:00-08:00 <p>A year ago we started a <a href="">new venture</a> to create small internet “service” business. We had an idea, and started implementing it Monday nights. I would like to use this blog post to reflect on where we are at. The short story is that a year after we still haven’t released a version and that feels a little frustrating. A year ago I asked on this blog if a good idea makes a good business? I was really trying to think about which of the different ideas we had I wanted to follow. Several people contacted me on the blog and offline, and I liked <a href="">Pascal’s</a> comment on the question mentioning that it boils down to execution. Reflecting on this, I believe we executed well, we persevered, we made huge progress, we solved many technical challenges, the application starts to look good, starts to work pretty well, is useful, but is not done yet. The main reasons is that we need to build a massive server side infrastructure to support this service. This isn’t as bad as it sounds as today with EC2, S3, and other hosting providers you can create some pretty scalable solutions in a pretty cost effective way, but we need to nail this down before starting to open the service to the public. Now you may wonder why we don’t just doit! This is the reasons why I am writing this post. I’ll be slowing down my “outside normal work” activities over the next several month to focus on our soon to be released child #3. Lee also just had child #1, and it will certainly take him some time to adjust to his new environment and schedule. It wouldn’t be fair to let Sol carry the development on by himself during that time and Lomax, the designer, really needs the developers to get the backend going before adding his magic design touch to the user interface. So I believe focus, patience and perseverance is also required to make a good business. It’s hard to explain in words, but the service we are developing will be useful for many internet users in it’s first iteration, and we already envision the next version that will allow to target online companies and will provide them with a unique service which hopefully will be very profitable for us. So I hope we will pickup the development in a couple of month and just be able to get it out the door. This will then only be the beginning…</p> <p>Have fun!<br /> Daniel.</p> RailsConf registration opens today. Be ready! 2008-01-29T00:00:00-08:00 <p>May 29-June 1, 2008 in Portland, Oregon,</p> <p><span class="caps">UPDATE</span>: registration is now <a href="">open</a>.</p> <p>UPDATE2: I’ll be presenting with <a href="">Tony</a> a 3 hour tutorial on <a href="">Powering <span class="caps">AIR</span> Applications with Rails</a>. See you all there!</p> I Always Knew IE Was Shifty 2008-01-27T00:00:00-08:00 <p>While <span class="caps">HTML</span> 4.01 strict:</p> <typo:code <p><!<span class="caps">DOCTYPE</span> html <span class="caps">PUBLIC</span> “-//W3C//<span class="caps">DTD</span> <span class="caps">HTML</span> 4.01//EN”><br /> <html><br /> <head><br /> <title>IE Shifting Bug</title><br /> <style type="text/css"><br /> div { position: relative;}</p> </style> </head> <body> <div style="float:right; width:49%"> <div style="display:none;"> some hidden content </div> <div id="container"> <label>Overlap Me:</label> <input type="text" value="<< this should shift"> <input type="submit" value="«this too"> </div> </div> <!-- trigger to illustrate the bug: --> <p> <input type="button" value="apply background color" onclick="document.getElementById('container').style.backgroundColor = 'yellow'"> </p> </body> </html> </typo:code> <p <em>length</em> of the label seems to come into play as well — if you add even one more character to the label text, things return to “normal”.</p> <p.</p> BenchmarkForRails Viewer Ruby on Rails plugin (with Juggernaut's server push technology). 2008-01-06T00:00:00-08:00 <p>Release early, release often they say. I don’t know if I’m going to release often but this is very early for this project. In fact yesterday I was testing the excellent <a href="">Juggernaut plugin for Ruby on Rails</a>, a “server push technology”, created by <a href="">Alex McCaw</a> and at the same time I was trying out the <a href="">BenchmarkForRails</a> plugin. The BenchmarkForRails plugin adds some detailed log information about the time breakdown for a request in the following format:<br /> <pre><br /> - [0.0954] <span class="caps">GET</span> /categories <del>-</del>——————————<br /> 0.0791 action<br /> 0.0098 development mode<br /> 0.0026 finders<br /> 0.0003 session<br /> 0.0001 rendering<br /> 0.0001 filters<br /> <del>-</del>—————————————- BenchmarkForRails -<br /> </pre></p> <p:</p> <p><br /> <img src="" alt="20080105_bencmarkforrailsviewer.jpg" border="0" width="456" height="192" /></p> <p>Note: that’s the only view currently supported. The ‘last’, ‘last 5’, ‘last’, ‘last 5 (same), selection will provide different views of your requests but this functionality isn’t yet coded. Also filtering by controller and action would be nice.</p> <p>Like I said this is very early but combining Benchmarking with server push technology offers quite some potential, but let’s keep it simple for now…</p> <p).</p> <p.</p> <p><strong><span class="caps">INSTALLATION</span></strong></p> <p>You need the following plugins: benchmarkforrails, juggernaut, and benchmarkforrails_viewer</p> <p>a) benchmarkforrails<br /> <pre><br /> $ svn export vendor/plugins/benchmarkforrails<br /> </pre></p> <p>b) juggernaut<br /> <pre><br /> $ svn export vendor/plugins/juggernaut<br /> $ rake juggernaut:reinstall <br /> </pre><br /> This creates the conf/juggernaut.yml and conf/juggernaut_hosts.yml file. <br /> Note juggernaut has detailed installation instruction. But in short you need the json and the eventmachine gems.</p> <p>c) benchmarkforrails_viewer<br /> <pre><br /> $ svn export vendor/plugins/benchmarkforrails_viewer<br /> $ rake benchmarkforrails_viewer:reinstall<br /> </pre><br /> The later copies the UI files into the public/benchmark folder.</p> <p><strong><span class="caps">RUNNING</span> <span class="caps">THE</span> <span class="caps">VIEWER</span></strong></p> <p>1) Start the juggernaut push_server. <br /> <pre><br /> cd vendor/plugins/juggernaut/media/<br /> # The first time you need to generate a config file using:<br /> ruby juggernaut -g<br /> # Start the push_server<br /> ruby juggernaut <br /> </pre></p> <p>2) In a different terminal start your rails server, ./script/server</p> <p>3) Start the BenchmarkForRails Viewer:<br /> Note you need the Flash Player 9 installed.</p> <p>4) Run your application (only in development) as usual and see the request benchmarks in the viewer.</p> <p.</p> <p>Enjoy!<br /> Daniel</p> What's in for 2008 2008-01-03T00:00:00-08:00 <p>Thank you and Happy New Year to all the readers. 2007 was impressive over 101,740 page views on this blog. I am always amazed that people come read what is on this blog, as it’s often written very late at night or on the spur of the moment. Thank you again. As usual there are many objectives I didn’t reach in 2007, but the ride was worthwhile. So without commitments :-) here are a couples of things I like to work on (and blog about) in 2008:</p> <ul> <li>MySpyder.net with Lee, Sol, and Lomax we started a side project early last year. It’s looking really promising but we recently went back to the drawing board to be able to scale massively from a server side point of view. Many blog entries originate from this project. I hope that we get this project back on track and be able to show something cool in a couple of month.</li> </ul> <ul> <li>Flex On Rails – the book. One must be nuts to write a book, so I though why not give it a try. It’s definitively a long process but I have some partners in crime that seem even crazier than me…so there is hope that we get something cool out the doors.</li> </ul> <ul> <li>Flex Dynamic Scaffolding for Rails. This is more a thought, but I would love to create a small Scaffolding framework showing off the potential of Flex.</li> </ul> <ul> <li>RailsLogVisualizer plugin. A nice plugin to shows real time usage of a Rails application.</li> </ul> <ul> <li>Amazon Web Services. Build a nice application that makes uses of S3, EC2, SimpleDB and DevPay. I should be able to find a problem to my solution.</li> </ul> <p>Have a great year everybody!<br /> Daniel</p> BlazeDS and open source version of livecycle data services... 2007-12-13T00:00:00-08:00 <p>That sounds cool. Read all about it here…</p> <p><a href=""></a></p> <p>Maybe not. Techcrunch released this message on their blog but no text was attached and comments where closed. Maybe somebody clicked the submit button to quickly. Now I am curious…</p> <p><span class="caps">UPDATE</span>: 10:17pm Denver time…it’s official: <a href=""></a></p> Rails 2.0 2007-12-07T00:00:00-08:00 <p><a href="">Rails 2.0 is out</a>! Thanks guys for all the hard work, this release is just impressive.</p> Analyzing the Subversion logs from the Rails project with mx:OLAPCube 2007-11-29T00:00:00-08:00 <p>I started playing with <a href="">Anthony Eden’s</a> <a href="">ActiveWarehouse</a> and followed his <a href="">excellent tutorial</a> on how to analyze the Ruby On Rails Svn Commit Log with the ActiveWarehouse framework. Of course this made me want to try to do the same with the new mx:OLAPCube and mx:OLAPDataGrid provided by Flex 3 as part of the DataVisualization components. Let me just say this…I am not done playing with either the Flex OLAPCube nor the Rails ActiveWarehouse framework as these are pretty complex beasts. Both of these frameworks are overlapping and complementary. There are overlapping as both can digest raw data and perform aggregation of that data. They are complementary in the sense that a server side warehouse needs a good visualization front-end. Maybe the OLAPCube and OLAPDataGrid can be this front-end. In my initial trials I haven’t come up with a compelling way to integrate both, but by using some simple <span class="caps">SQL</span> I could extract the data from the ActiveWarehouse and pass it to the OLAPCube.</p> <p>Before going on you may want to read Anthony’s <a href="">blog</a> and check his presentation on <a href="anthonyeden.com/assets/2007/5/20/activewarehouse.pdf">Data Warehouses with ActiveWarehouse</a>. I didn’t find much information on the Flex OLAPCube besides these: <a href="">Feature_Introductions:<em>OLAPDataGrid on Adobe’s labs</a>, <a href="">Flex 3: Feature Introduction Video for <span class="caps">OLAP</span> Support</a>, and these </em>beta2.zip">Flex examples</a>.</p> <p>So I create the following sample application. You can try it out <a href="" target="_blank">here</a>. Note it’s pretty slow, it takes up to a minute to aggregate 10000 values. The Flex team mentioned they didn’t optimize this component yet. I can confirm this. But I may also have messed something up as these are only my initial steps with that component. The application displays the Author dimension with the Author Name as rows and the Time dimension with the Year and Quarter as columns. The facts is the File Change count during that period. Flex calls the “facts” a measure. <br /> <br/> <img src="" alt="20071128_OLAPCube.jpg" border="0" width="495" /><br /> <br/> <a href="" target="_blank">Run the applicaiton</a></p> <p>To extract the data from the ActiveWarehouse I created this <span class="caps">SQL</span> to join the facts table with all the dimensions table. I need to find out if the ActiveWarehouse doesn’t just return this data in xml format by using it’s build-in classes.</p> <typo:code def report_as_xml sql = <<-<span class="caps">EOSQL</span> <span class="caps">SELECT</span> date.calendar_year, date.calendar_quarter, date.calendar_month_name, author.name, file_revision_facts.file_changed AS `file_changed` <span class="caps">FROM</span> file_revision_facts <span class="caps">JOIN</span> date_dimension as date ON file_revision_facts.date_id = date.id <span class="caps">JOIN</span> author_dimension as author ON file_revision_facts.author_id = author.id <span class="caps">WHERE</span> date.calendar_year > ‘2005’ <span class="caps">EOSQL</span> @@xml ||= ActiveRecord::Base.connection.select_all(sql).to_xml(:dasherize => false) render :text => @@xml end </typo:code> <p>In Flex the OLAPCube can be loaded with the <span class="caps">XML</span></p> <typo:code> <p>var data:ICollectionView = new ArrayCollection(result.records.record); // is Array<br /> cube.dataProvider = data;<br /> cube.addEventListener(CubeEvent.CUBE_COMPLETE, creationCompleteHandler);<br /> cube.refresh();</p> </typo:code> <p>Once the cube is loaded you can slice and dice it in many ways by using an OLAPQuery. I still need to figure out all the possibilities which are offered.</p> <typo:code> <p>[Bindable]<br /> private var cubeResult:IOLAPResult;</p> <p>private function creationCompleteHandler(event:CubeEvent):void<br /> {<br /> //Cube was created, let’s query it<br /> var query:OLAPQuery = new OLAPQuery;</p> <p>// <span class="caps">TIME</span> <span class="caps">DIMENSION</span> <br /> var yearSet:IOLAPSet = new OLAPSet;<br /> yearSet.addElements(cube.findDimension(“Time”).findAttribute(“Year”).members);</p> <p>var quarterSet:IOLAPSet = new OLAPSet;<br /> quarterSet.addElements(cube.findDimension(“Time”).findAttribute(“Quarter”).members);</p> <p>//year-quarter<br /> var newTimeSet:IOLAPSet = yearSet.crossJoin(quarterSet);</p> <p>// <span class="caps">AUTHOR</span> <span class="caps">DIMENSION</span> <br /> var authorSet:IOLAPSet = new OLAPSet;<br /> authorSet.addElements(cube.findDimension(“Author”).findAttribute(“Name”).members);</p> <p>// <span class="caps">ROW</span>/<span class="caps">COLUMNS</span> <br /> var rowAxis:IOLAPQueryAxis = query.getAxis(OLAPQuery.ROW_AXIS);<br /> rowAxis.addSet(authorSet.hierarchize(true));<br /> var colAxis:IOLAPQueryAxis = query.getAxis(OLAPQuery.COLUMN_AXIS);<br /> colAxis.addSet(newTimeSet.hierarchize(true));</p> <p>// <span class="caps">QUERY</span> <span class="caps">CUBE</span><br /> var token:AsyncToken = cube.execute(query);<br /> token.addResponder(new AsyncResponder(displayResult, olapFaultHandler));<br /> }<br /> private function displayResult(result:Object, token:Object=null):void<br /> {<br /> cubeResult = result as IOLAPResult;<br /> }</p> </typo:code> <p>The cube result is the dataProvider of the Cube which in it’s simplests form can be defined as follows:</p> <typo:code> <mx:OLAPDataGrid </typo:code> <p>I’ve then added a change listener for the grid to create the dataProvider for the ColumnChart.</p> <typo:code> <p>[Bindable]<br /> private var chartData:Array;</p> <p>private function gridSelectionChanged():void {<br /> if (!(olapGrid.selectedItem is OLAPAxisPosition)) return;<br /> var rowIndex:Number = olapGrid.selectedIndex;<br /> var axis:IOLAPQueryAxis = cubeResult.query.getAxis(OLAPQuery.COLUMN_AXIS);<br /> var columnLength:Number = cubeResult.getAxis(OLAPQuery.COLUMN_AXIS).positions.length;<br /> var newChartData:Array = [];<br /> for (var i:int=0;i<columnLength;i++) {<br /> var tuple:OLAPTuple = axis.tuples[i];<br /> var key:String = tuple.explicitMembers.toArray().join(“,”);<br /> if (key.indexOf(“(All)”) > -1) continue; newChartData.push({key:key, value:cubeResult.getCell(rowIndex, i).value});<br /> }<br /> chartData = newChartData;<br /> }</p> </typo:code> <p>This code to extract a time serie for the chart is a little “hairy”. I hope the Flex team has some OLAPCharts on their todo list ;-)<br/> <typo:code><br /> <mx:ColumnChart<br /> <mx:series><br /> <mx:ColumnSeries</p> </mx:series> <mx:horizontalAxis> <mx:CategoryAxis </mx:horizontalAxis> </mx:ColumnChart> </typo:code> <p>This are my first tribulations with both frameworks. Over the next few month I will have to dive more deeply into the possibilities which are offered. Thanks to both teams as this is pretty cool.</p> <p>Enjoy!<br /> Daniel.</p> Scripting the Leopard Terminal 2007-11-28T00:00:00-08:00 <p>Hypothetical situation: you’re sitting down with your favorite tasty beverage close at hand for some Rails hacking, and what commands do you run every single time? It’s probably something like this:</p> <typo:code <p>cd Projects/KillerApp<br /> mate .<br /> rake log:clear<br /> tail -f log/development.log</p> <p>[Command – T for new tab]<br /> cd Projects/KillerApp<br /> mongrel_rails start</p> <p>[Command – T for new tab]<br /> cd Projects/KillerApp<br /> ruby script/console</p> <p>[Command – T for new tab]<br /> cd Projects/KillerApp<br /> rake</p> <p>…etc…</p> </typo:code> <p>Hmmm. We’re coding <span class="caps">DRY</span>, but this bootstrap process doesn’t seem very <span class="caps">DRY</span>. This had been bugging me, so I set out on a Google quest to learn to script Terminal.app in Leopard so that I could do something about it. I first looked at <a href="">AppleScript</a>,:</p> <typo:code <p>tell executive SteveJobs<br /> tell developers at Apple<br /> set theScriptingLanguage of <span class="caps">OSX</span> to Ruby<br /> end tell<br /> end tell</p> </typo:code> <p>Which was a good thought, but didn’t actually do much. At <a href="">RubyConf</a> last year, <a href="">Laurent Sansonetti</a> talked about <a href="">RubyOSA</a>, a scripting bridge between Ruby and the Apple Event Manager, which sounds great, because you can code in Ruby and control AppleScript-able applications, like iTunes. So I ran this:</p> <typo:code <p>require ‘rbosa’<br /> terminal = <span class="caps">OSA</span>.app(‘Terminal’)</p> </typo:code> <p>Which resulted in this rather discouraging output:</p> <typo:code <p>RuntimeError: Can’t get the target bundle signature<br /> from /Library/Ruby/Gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:329:in `__scripting_info__’<br /> from /Library/Ruby/Gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:329:in `app’<br /> from (irb):3</p> </typo:code> <p>Hmmm. Not exactly useful. Maybe if I did my coding in iTunes, I could use RubyOSA to build some useful automation. Hopefully someone at Apple can fix Terminal — Hint, Hint. Back to Google…</p> <p>I eventually ran across Matt Mower’s <a href="">scripting a better ‘cd’ and then some</a>.</p> <p>So Matt’s gp command uses another Ruby / Apple event bridge, called <a href="">Appscript</a>,.</p> <p><code>gem install rb-appscript</code>, and let’s play. In <span class="caps">IRB</span>:</p> <typo:code <p>>> require ‘appscript’<br /> >> include Appscript<br /> >> term = app(‘Terminal’)<br /> => app(“/Applications/Utilities/Terminal.app”)<br /> >> term.windows<br /> => app(“/Applications/Utilities/Terminal.app”).windows<br /> >> term.windows.first<br /> => app(“/Applications/Utilities/Terminal.app”).windows.first</p> </typo:code> <p>Okay, this is a bit strange — it seems to just repeat what you say back to you. After a bit of playing, I understand what’s going on. Some of the methods aren’t executed until you explicitly tell them to execute. For instance:</p> <typo:code <p>>> term.windows.get<br /> => [app(“/Applications/Utilities/Terminal.app”).windows.<acronym title="915"><span class="caps">ID</span></acronym>, app(“/Applications/Utilities/Terminal.app”).windows.<acronym title="498"><span class="caps">ID</span></acronym>, app(“/Applications/Utilities/Terminal.app”).windows.<acronym title="667"><span class="caps">ID</span></acronym>]<br /> >> term.windows.first.get<br /> => app(“/Applications/Utilities/Terminal.app”).windows.<acronym title="915"><span class="caps">ID</span></acronym></p> </typo:code> <p.</p> <p <code>do_script(command)</code> method, which, when called on the terminal application object, launches a new terminal window and runs the specified <span class="caps">UNIX</span> command in it.</p> <typo:code <p>>> term.do_script(“ls”)<br /> => app(“/Applications/Utilities/Terminal.app”).windows.<acronym title="951"><span class="caps">ID</span></acronym>.tabs<sup class="footnote" id="fnr1"><a href="#fn1">1</a></sup></p> </typo:code> .</p> <p>The Appscript examples show creating new TextEdit documents by executing:</p> <typo:code <p>app(‘TextEdit’).documents.end.make(:new => :document)</p> </typo:code> <p>And the Appscript dictionary of Terminal showed the <code>make</code> method, and <code>window</code> and <code>tab</code> classes, so I figured something like this might work:</p> <typo:code <p>>> window = term.windows.first.get<br /> => app(“/Applications/Utilities/Terminal.app”).windows.<acronym title="915"><span class="caps">ID</span></acronym><br /> >> window.make(:new => :tab)<br /> Appscript::CommandError: CommandError<br /> <span class="caps">OSERROR</span>: -10000<br /> <span class="caps">MESSAGE</span>: Apple event handler failed.<br /> <span class="caps">COMMAND</span>: app(“/Applications/Utilities/Terminal.app”).windows.<acronym title="915"><span class="caps">ID</span></acronym>.make({:new=>:tab})</p> <p>from /Library/Ruby/Gems/1.8/gems/rb-appscript-0.4.0/lib/appscript.rb:505:in `<em>send_command’<br /> from /Library/Ruby/Gems/1.8/gems/rb-appscript-0.4.0/lib/appscript.rb:585:in `method</em>missing’<br /> from (irb):11</p> </typo:code> <p>Appscript is having none of that. After many frustrating, fruitless attempts to create a new tab, I found a workaround in native AppleScript <a href="">here</a>. Here’s the Appscript translation:</p> <typo:code <p>app(“System Events”).application_processes[<br /> “Terminal.app”<br /> ].keystroke(“t”, :using => :command_down)</p> </typo:code> <p>Well, okay, sending a Command-T keystroke works, but it’s a little disappointing. Anyone who knows how to programatically create a new tab, feel free to chime in on the comments, and I’ll update the script.</p> <p><code>do_script(command)</code> also takes an optional parameter specifying options. One of the available options is <code>:in</code>, which tells terminal in which window and tab to run the command. Putting this together, we can run a command in the new tab we just created:</p> <typo:code <p>app(‘Terminal’).do_script(“ls”, :in => window.tabs.last.get)</p> </typo:code> <p?</p> <typo:code <p>>> tab = term.do_script(“ls”)<br /> => app(“/Applications/Utilities/Terminal.app”).windows.<acronym title="1159"><span class="caps">ID</span></acronym>.tabs<sup class="footnote" id="fnr1"><a href="#fn1">1</a></sup><br /> >> tab.window<br /> RuntimeError: Unknown property, element or command: ‘window’<br /> from /Library/Ruby/Gems/1.8/gems/rb-appscript-0.4.0/lib/appscript.rb:591:in `method_missing’<br /> from (irb):11<br /> from :0</p> </typo:code> <p>:</p> <typo:code <p>>> window = eval(“app(\”/Applications/Utilities/Terminal.app\“).windows.<acronym title="1159"><span class="caps">ID</span></acronym>”)<br /> => app(“/Applications/Utilities/Terminal.app”).windows.<acronym title="1159"><span class="caps">ID</span></acronym></p> </typo:code> <p>I’m not proud of it, but it works. Again, if someone knows the “right” way to do this, please let me know—although programatically creating a tab should obviate the need for this hack, too.</p> <p.</p> <p>Matt later enhanced his script to <a href="">label the iTerm tabs</a> so that you can easily find the tab you need, so naturally I <del>stole</del>.</p> <p.</p> <p>You can download the finished script <a href="/files/hack">here</a>. I call it hack, because <code>hack KillerApp</code> flows so nicely as a command. Also, that’s the way I roll. Feel free to send in money, or flattery, or hate mail, I suppose. Thanks to Matt Mower for the inspiration and also to all the other references I’ve linked!</p> flash.utils.ByteArray compressing 4.1MB to 20K 2007-11-27T00:00:00-08:00 <p>I am currently preparing a demo using an mx:OLAPCube and OLAPDataGrid which analyze the Rails svn commit log. however I don’t want to deploy a specific server side application as the Cube can load data from <span class="caps">XML</span>. So I have an report.xml that is 4.1MB. I created the following <span class="caps">AIR</span> application (ZlibCompressor.mxml) that use the standard compression provided by the ByteArray class to compress this file down to 20Kb. The application that consumes this file (UnzipTest.mxml) uses the URLLoader to read this file straight into a ByteArray and uncompress the data. It’s fast!</p> <p>The key code for compression is the ‘compress’ and ‘uncompress’ method provided by the ByteArray. Note the URLLoader dataFormat is set to “binary”.</p> <h3>ZlibCompressor.mxml</h3> <typo:code> <p><?xml version=“1.0” encoding=“utf-8”?><br /> <mx:WindowedApplication xmlns:<br /> <mx:Script><br /> <![<span class="caps">CDATA</span>[<br /> import flash.desktop.ClipboardFormats; <br /> import flash.utils.CompressionAlgorithm;<br /> public function onDragIn(event:NativeDragEvent):void {<br /> var transferable:Clipboard = event.clipboard;<br /> if (transferable.hasFormat(ClipboardFormats.FILE_LIST_FORMAT)) {<br /> DragManager.acceptDragDrop(this);<br /> } <br /> }<br /> public function onDrop(event:NativeDragEvent):void {<br /> var fileList:Array = event.clipboard.dataForFormat(ClipboardFormats.FILE_LIST_FORMAT) as Array;<br /> if (fileList.length==0) return;</p> <p>var inFile:File = fileList<sup class="footnote" id="fnr0"><a href="#fn0">0</a></sup>;<br /> var fileStream:FileStream = new FileStream();<br /> fileStream.open(inFile, FileMode.<span class="caps">READ</span>);<br /> var ba:ByteArray = new ByteArray();<br /> fileStream.readBytes(ba, 0, fileStream.bytesAvailable);<br /> fileStream.close();</p> <p>var newFileName:String = inFile.nativePath+".zlib";<br /> ba.compress();</p> <p>var outFile:File = new File(newFileName);<br /> fileStream = new FileStream();<br /> fileStream.open(outFile, FileMode.<span class="caps">WRITE</span>);<br /> fileStream.writeBytes(ba, 0, ba.length);<br /> fileStream.close(); <br /> } <br /> ]]></p> </mx:Script> </mx:WindowedApplication> </typo:code> <h3>UnzipTest.mxml</h3> <typo:code> <p><?xml version=“1.0” encoding=“utf-8”?><br /> <mx:Application xmlns:<br /> <mx:Script><br /> <![<span class="caps">CDATA</span>[<br /> import mx.rpc.events.ResultEvent;<br /> import flash.utils.ByteArray;</p> import flash.events.*; import flash.net.*; <p>private function loadData():void {<br /> var loader:URLLoader = new URLLoader();<br /> loader.dataFormat = “binary”;<br /> loader.addEventListener(Event.<span class="caps">COMPLETE</span>, completeHandler); <br /> var request:URLRequest = new URLRequest(“../data/report.xml.zlib”);<br /> loader.load(request);<br /> }<br /> private function completeHandler(event:Event):void {<br /> var loader:URLLoader = URLLoader(event.target);<br /> var ba:ByteArray = loader.data;<br /> ba.uncompress();<br /> var s:String = ba.toString();<br /> var xml:<span class="caps">XML</span> = new <acronym title="s"><span class="caps">XML</span></acronym>;<br /> }<br /> ]]></p> </mx:Script> </mx:Application> </typo:code> Acts_as_nested_set ActiveRecord rendered with mx:Tree in Flex. 2007-11-24T00:00:00-08:00 <p>ActiveRecord: app/models/category.rb<br /> <typo:code<br /> class Category < ActiveRecord::Base<br /> acts_as_nested_set<br /> end</p> </typo:code> <p>Controller: app/controllers/categories_controller.rb<br /> <typo:code<br /> class CategoriesController < ApplicationController<br /> def index<br /> Category.result_to_attributes_xml(Category.root.full_set)<br /> end<br /> end</p> </typo:code> <p>Flex Application: ActsAsNestedSet.mxml<br /> <typo:code<br /> <?xml version=“1.0” encoding=“utf-8”?><br /> <mx:Application xmlns:<br /> <mx:HTTPService<br /> <mx:Tree</p> </mx:Application> </typo:code> <p>Result:<br /> <img src="" alt="20071123_categories.jpg" border="0" width="264" height="296" /></p> <p><span class="caps">XML</span> generated by Category.result_to_attributes_xml(Category.root.full_set):<br /> <typo:code<br /> <node name="Main Category" id="15" description=""><br /> <node name="Cameras & Photo" id="16" description=""><br /> <node name="Bags" id="17" description=""/><br /> <node name="Accessories" id="18" description=""/><br /> <node name="Analog Cameras" id="19" description=""/><br /> <node name="Digital Cameras" id="20" description=""/></p> </node> <node name="Cell Phones" id="21" description=""> <node name="Accessories" id="22" description=""/> <node name="Phones" id="23" description=""/> <node name="Prepaid Cards" id="24" description=""/> </node> <node name="Dvds" id="25" description=""> <node name="Blueray" id="26" description=""/> <node name="HD DVD" id="27" description=""/> <node name="DVD" id="28" description=""/> </node> </node> </typo:code> <p>I used the plugin.</p> <p>Too cool!</p> <p><span class="caps">UPDATE</span>: The BetterNestedSet plugin doesn’t work out of the box with Rails 2.0 RC1. Thanks Joel for that info. Read more in the comment of this blog entry.</p> <p>UPDATE2: Thanks Fabien, BetterNestedSet now works with Rails 2.0!</p> RailsLogVisualizer0.7 for AIR beta 2. 2007-11-08T00:00:00-08:00 I recompiled the RailsLogVisualizer for AIR beta. I added drag&drop of log files to bypass an AIR bug on Leopard. File.browseForOpen doesn't trigger the Event.SELECT when the file is selected. I haven't yet tried this version of the application on older versions of OSX or on Windows. Let me know how it works. Also the feedback when loading large log files could be improved, as the application seems to freeze once the progress bar is complete. Just be a little patient as the AVM is working hard for you to compute all these number. <h3>Install RailsLogVisualizer0.7.air</h3> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="RailsLogVisualizer" width="215" height="138" codebase=""> <param name="movie" value="" /> <param name="FlashVars" value="appUrl=" /> <embed src="" quality="high" bgcolor="#ffffff" FlashVars="appUrl=" width="215" height="138" name="RailsLogVisualizer" align="middle" play="true" type="application/x-shockwave-flash" pluginspage=""> </embed> </object> <h3>Install Manually</h3> 1) Instal Adobe AIR beta 2. (See release notes if previous version was installed)<br/> <a href="">Download AIR for OSX</a> <a href="">Download AIR for Windows</a><br/> Learn more on <a href="">AIR</a> <br/> <br/> 2) Download and install <a href="RailsLogVisualizer0.7.air"></a> <p style="clear:both" /> For <a href="">time.onrails.org</a> the log file is currently 98Mb and is loaded and process in less than a minute. Here are the loading details: <pre> Loaded 98571986bytes in 28093 milliseconds. Parsing file. Please Wait this may take some time.... Parsing. Split 1639453entries in 1447 milliseconds. found:220767 in 1925 milliseconds. Aggregating data. aggregated:220767 in 13426 milliseconds. Aggregated:89135 aggregated String :4440464(bytes) in 2790 milliseconds. </pre> Then you can navigation through time and see how many request where processed and drill down in specific action and specific methods. For example, here we can quickly see that for October 99 people signed up, 869 did login, 22 forgot their password. <div style="text-align:center;"><img src="" alt="20071106_railslogvisualizer.jpg" border="0" width="480" height="373" /></div> Enjoy, Daniel. Sweet way to write Flex Unit tests for Rails 2007-11-05T00:00:00-08:00 <p>Using ActiveResources from Flex? Using FlexUnit? Here is a nice way to write your tests.</p> <typo:code <p>package tests<br /> {<br /> import flexunit.framework.*; <br /> import mx.rpc.AsyncToken;<br /> import mx.rpc.events.ResultEvent;<br /> import resources.Raffles;</p> <p>public class TestRaffles extends BaseTestCase<br /> { <br /> private var raffles:Raffles; <br /> public function TestRaffles(name : String = null)<br /> {<br /> super(name);<br /> fixtures([“raffles”]);<br /> raffles = new Raffles();<br /> } <br /> public function testRemoteFindRaffle():void<br /> {<br /> assertRemote(raffles.show(1));<br /> }<br /> public function assertRemote_testRemoteFindRaffle(data:Object):void<br /> {<br /> Assert.assertTrue(“Raffle show successfully called”, data is ResultEvent); <br /> assertEquals(“MyString”, data.result.name);<br /> }</p> <p>}<br /> }</p> </typo:code> <p>Note this code is not yet a plugin and is using code you can find here: <a href=""></a>. I was starting to use it on multiple projects so I thought it was to time find a home for it. Also it is using the org.onrails.rails.ActiveResourceClient Flex class. I would recommend that you use <a href="">Alex MacCaw’s ActvieResrouce for Actionscript</a>. I still need to talk with Alex and integrate this fixture loading code with his code.</p> <p <span class="caps">AMF</span> <em>addAsync</em> method, we just add the convenience assertRemote function to setup all the callbacks.</p> <p>To make this work for you Flex with Rails project. You need to fixtures_controller.rb to your controllers and setup the following routes:</p> <typo:code if RAILS_ENV == “test” map.resources :fixtures, :new => { :test_results => :post } map.crossdomain ‘/crossdomain.xml’, :controller => ‘fixtures’, :action => ‘crossdomain’ end </typo:code> <p>You need to extend your Flex TestCase from tests.BaseTestCase.</p> <p>Enjoy,<br /> Daniel.</p> Finding Balance. 2007-11-05T00:00:00-08:00 <p>Are you a Dad ? Are you thinking becoming one or about to become one? Many people I know in the software development field are Dads and still having fun doing software development, spending late night in front of the computer and getting woken up early by their kids…it’s time to play. My brother in law, RC, is not a software developer but a very successful business man, father of three, dedicates lots of time to his family, is coach on the team for his kids, and regularly manages to take week-ends of with his wife. How does it do all? Well, he even found time to write a book about this. So I offered him to talk about it on my blog as I believe it’s a good read. It’s not only a book about finding balance between your family and work life, but also the influence you can have on your children and children around you. He gave out two chapters of the book and I published them (formatting is not perfect) on <a href=""></a>/.</p> <p><span class="caps">TABLE</span> OF <span class="caps">CONTENTS</span><br> <a href="">Why This Book?</a><br> <a href="">Chapter 1 : Finding Balance</a><br> Chapter 2 : Be an Example; Be a Man<br> Chapter 3 : The Importance of Play<br> Chapter 4 : Where Do We Draw the Line?<br> Chapter 5 : Dads and Daughters<br> Chapter 6 : Teaching Kids about the Real World<br> Chapter 7 : Raising Independent Thinkers<br> Chapter 8 : Breaking the Cycle<br></p> Installing RMagick on Leopard (without MacPorts or Fink) 2007-11-03T00:00:00-07:00 <p <a href="">here</a>).</p> <p.</p> <p>So now, to get my development environment set up on the new machine… Leopard includes a fairly complete Rails stack out of the box, with a non-<a href="">broken</a> Ruby, readline support, and most of the commonly used gems. Read more <a href="">here<br /> </a>.</p> <p.</p> <p <a href="">article at hivelogic<:</p> <typo:code <p>#!/bin/sh<br /> wget<br /> tar xzvf freetype-2.3.5.tar.gz<br /> cd freetype-2.3.5<br /> ./configure —prefix=/usr/local<br /> make<br /> sudo make install<br /> cd ..</p> <p>wget<br /> tar jxvf libpng-1.2.22.tar.bz2<br /> cd libpng-1.2.22<br /> ./configure —prefix=/usr/local<br /> make<br /> sudo make install<br /> cd ..</p> <p>wget<br /> tar xzvf jpegsrc.v6b.tar.gz<br /> cd jpeg-6b<br /> ln -s `which glibtool` ./libtool<br /> export MACOSX_DEPLOYMENT_TARGET=10.5<br /> ./configure —enable-shared —prefix=/usr/local<br /> make<br /> sudo make install<br /> cd ..</p> <p>wget<br /> tar xzvf tiff-3.8.2.tar.gz<br /> cd tiff-3.8.2<br /> ./configure —prefix=/usr/local<br /> make<br /> sudo make install<br /> cd ..</p> <p>wget<br /> tar xzvf libwmf-0.2.8.4.tar.gz<br /> cd libwmf-0.2.8.4<br /> make clean<br /> ./configure<br /> make<br /> sudo make install<br /> cd ..</p> <p>wget<br /> tar xzvf lcms-1.17.tar.gz<br /> cd lcms-1.17<br /> make clean<br /> ./configure<br /> make<br /> sudo make install<br /> cd ..</p> <p>wget<span class="caps">GPL</span>/gs860/ghostscript-8.60.tar.gz<br /> tar zxvf ghostscript-8.60.tar.gz<br /> cd ghostscript-8.60/<br /> ./configure —prefix=/usr/local<br /> make<br /> sudo make install<br /> cd ..</p> <p>wget<span class="caps">GPL</span>/current/ghostscript-fonts-std-8.11.tar.gz<br /> tar zxvf ghostscript-fonts-std-8.11.tar.gz<br /> sudo mv fonts /usr/local/share/ghostscript</p> <p>wget<br /> tar xzvf ImageMagick-6.3.5-9.tar.gz<br /> cd ImageMagick-6.3<br /> make<br /> sudo make install<br /> cd ..</p> <p>sudo gem install RMagick</p> </typo:code> 17 store driven by Ruby On Rails are shutting down. 2007-11-02T00:00:00-07:00 <p>I usually prefer announcing good news but it seems that one of our former customer, Gatelys, is closing doors. We did some work for them last year to create an eCommerce platform in Ruby On Rails that was driving most of their website. From a technological point this was quite a success. The website was able to handle nicely quite some heavy traffic. It is unfortunate to see these sites disappear as I considered them to be a success for Ruby On Rails. But I understand that they had quite some business related issues. Even I was getting some emails from disgruntled customers, and even some of the writers on this blog where not fully paid for their work. I must admit that the people I worked with on the technical side were awesome and a real pleasure working with. I know they will be successful in whichever endeavor there will undertake.</p> <p>Here are the closed stores: Gatelys.com, Sleek Spaces, Home Fitness Club, Ray’s Golf Shop, Monster Bounce, Swingsets Direct, Back Relief Store, Futons Store, National Table Tennis, Wicker And Wine, Bedroom King, Planet Grind, Playful Rooms, Duffy’s Gameroom, Full House Poker Supply, Grill Gods, <span class="caps">MVP</span> Hoops.</p> <p><img src="" alt="20071101_GatelysStores.jpg" border="0" width="495" /></p> World Series Tickets Time line 2007-10-24T00:00:00-07:00 <p>As many, I tried to buy a couple of tickets to the World Series. Hey, it’s coming to Denver. Go Rockies! Well, yesterday the online ticket sales was quite a debacle. ‘They’ blame it on a vicious attack…hmmm…well…EC2 could have helped, I guess they just didn’t think that nearly everyone in the US would go on their website at 10am <span class="caps">MDT</span>, yesterday. Well, today things went well for them, and all the tickets sold in less than 3 hours. So what does this have to do with Rails? We are working on MySpyder.net, which allows to track changes on websites. So I create a watch on the “”">The Official Site of The Colorado Rockies</a>". I was hoping getting an advantage, find out before others that sell are back..Didn’t work out that way. I didn’t get tickets, but find here after how Myspyder.net saw the World Series Tickets online sales.MySpyder.net is not public yet as we need to ensure that we can handle the load :-)</p> <p>All times are in <span class="caps">UTC</span>. Ok, on to the events..as seen by Myspyder.net</p> <ul> <li>2007-10-23 03:30:17 Tickets go on sales tomorrow at 12pm</li> <li>2007-10-23 16:30:31 Oops, official press release announced regarding sales of Tickets.</li> <li>2007-10-23 18:00:17 Sales is back on!</li> <li>2007-10-23 20:30:22 27th Sold out, 26 Sold out.</li> <li>2007-10-23 21:01:07 Sold out :-(</li> <li>2007-10-23 21:30:46 Good news! Parking passes still available.</li> </ul> <p><img src="" alt="world_series_tickets.gif" border="0" width="495" height="1404" /></p> WebSnapshot 0.3 - a simple (and powerful) Adobe AIR application. 2007-10-20T00:00:00-07:00 <p>I finally got around an recompiled WebSnapshot for <span class="caps">AIR</span> beta 2. While doing this I’ve added some cool new features.</p> <p><img src="" alt="websnapshot_3.jpg" border="0" width="495" /></p> <p><a href="">Download Info</a></p> <p.</p> <p>I moved the project to the MySpyder.net website and you can <a href="">download</a> it and find more information <a href="">here</a>.</p> Rails Rocks! 2007-10-02T00:00:00-07:00 <p>I am trying so see the result of a change in a Java program….5 minutes compilation…5 minutes deployment. Arggggggggggg!</p> <p>Rails Rocks! Change + refresh = done!</p> <p>Short term memory is good, hopefully I will forget that experience soon.</p> <p>;-)</p> Total ADD! 2007-09-21T00:00:00-07:00 <p>As you may have noticed I really like Flex and Ruby On Rails. So my days job is to provide consulting services for Flex and Ruby On Rails. Currently I am working on a cool Ruby On Rails project for a customer in the online food ordering world. Man I get hungry when testing the application we write. I also work for another customer to create a Flex front-end for an online application in the insurance arena (First Notice of Injury, Certificate of Insurance, Payroll report and Web Payment).</p> <p>As if that wasn’t enough, I agreed to write a book together with a couple of other cool guys in the Flex and Ruby On Rails arena. That’s still far away, but we will provide some more information on this in the coming weeks. If that’s not enough I am creating two startups.</p> <p>So besides my consulting engagements my professional life looks this:</p> <div style="text-align:center;"><img src="" alt="20070921_add.gif" border="0" width="466" height="410" /></div> <p>Now if that doesn’t qualify as Attention Deficit Disorder.</p> <p>I am writing this more as a reflection to myself. At the beginning of the year <a href="">Pascal</a> commented on my blog that execution is everything to turn an idea into a business. We have been working hard on myspyder.net and it’s start to be looking really good. Digital-seed has the potential to become a really cool platform for eLearning and has the potential to turn into a big business. The “Book”, is more of a personal challenge and interest.</p> <p>So besides execution, focus and determination are required to turn an idea into a real business.</p> <p>So something will need to give. I still need to continue my consulting engagements in order to bring in money for the food. The “Book” will be a challenge from a writing point of view, but it will be a great learning and self improvement experience. The material for the book is what I have been “geeking” around for the past several years so it’s going to be a pleasure to write about it. Phase one for MySpyder is close to completion (still a couple of month). And phase two is really where the beef will be. So right now it looks like DigitalSeed is on the line for me. The contracts are not yet signed, so the door is open for me to pull out. This will hurt the people I started the endeavor with, and I really don’t like this. But I cannot stay on board some project unless I can dedicate enough resource to complete it. Let me chew on these thoughts over the week-end.</p> <p>In Spirit,<br /> Daniel.</p> Exceptional Slicehost support 2007-09-03T00:00:00-07:00 <p>Our server that hosts onrails.org and time.onrails.org died on Sunday. Before we could react <a href="">Slicehost</a> migrated us to new hardware and everything was up and running. Thanks guys, awesome support!</p> <p>The events where the following:</p> <ul> <li>[Slicehost] Sep 1, 2007 3:04 PM, Emergency Server Reboot and HW Migration – onrails</li> <li>[Montastic] Sep 1, 2007 3:20 PM, Website status: unreachable</li> <li>[Slicehost] Sep 1, 2007 3:44 PM, Emergency HW Migration #2 – onrails.</li> <li>[Montastic] Sep 1, 2007 4:12 PM, Website status: OK</li> </ul> <p>[Slicehost] indicates emails we received from Slicehost, and [Montastic] emails from the <a href="">monitoring</a> system we use. Slicehost warned us of the situation and action they are taking before our monitoring system found out that the service was down. Well, apparently they migrated us to new hardware that had another issue (bad memory) and they moved us a second time to different hardware. Well no data was lost, all our service are up and running and I didn’t have to cut short my <span class="caps">BBQ</span>. Thanks!</p> <p>Update1: Well something is wrong with the template of our blogs. I am not sure it’s related to the update of hardware as it was working last night. More to come.</p> Monitoring Rails Performance with Munin and a Mongrel 2007-08-31T00:00:00-07:00 <p>Rails makes things easy on developers—maybe <strong>too</strong>.</p> <p>Once your application is moved into production, it becomes important to keep an eye on performance over time in order to get a feel for trends and plan capacity intelligently. Numerous Rails <a href="">performance</a> <a href="">measuring</a> <a href="">tools</a> exist, but I find that it helps to correlate performance of your application with simultaneous lower-level performance metrics of your system (<span class="caps">CPU</span> and Memory usage, Load Average, etc). Besides that, hey! Pretty Graphs! Enter <a href="">munin</a>, an open-source, extensible monitoring tool with a number of out-of-the-box plugins that are useful to SysAdmin type folks. There’s a pretty decent (though brief) <a href="">writeup on howtoforge</a> that explains a bit more about how to go about getting your own munin. Go ahead and check it out — I’ll chill here until you’re back.</p> <center>…</center> <p.</p> <p>Well, knowing <span class="caps">CPU</span>.</p> <p:</p> <typo:code <p>class Accumulator<br /> def initialize<br /> @values = Array.new()<br /> @max = 0<br /> end</p> <p>end</p> </typo:code> <p>In the next section of the code, we build our accumulators, and begin tailing the logfile to extract performance numbers. This requires the <a href="">file-tail gem</a>, available from rubyforge. Note that in my setup, this file resides in a subdirectory under <code>lib</code> in <code>RAILS_ROOT</code>. <code>IGNORE_PATTERNS</code> regexp (earlier in the code). If the request matches a pattern we want to ignore, its statistics are not collected.</p> <typo:code <p><span class="caps">LOGFILE</span> = File.join(File.dirname(<i><span class="caps">FILE</span></i>), ‘..’, ‘..’, ‘log’, “#{RAILS_ENV}.log”)<br /> $response_data = { :total => Accumulator.new(),<br /> :rendering => Accumulator.new(),<br /> :db => Accumulator.new() }</p> <p>Thread.abort_on_exception = true<br /> logtail = Thread.new do<br /> File::Tail::Logfile.tail(<span class="caps">LOGFILE</span>) do |line|<br /> if line =~ /^Completed in /<br /> parts = line.split(/\s+\|\s+/)<br /> resp = parts.pop<br /> requested_url = resp[/http:\/\/[^\]]*/]<br /> next if requested_url =~ IGNORE_PATTERNS</p> parts.each do |part| part.gsub!(/Completed in/, “total”) type, time, pct = part.split(/\s+/) type = type.gsub(/:/,’’).downcase.to_sym $response_data[type].add(time.to_f) end end end <p>end</p> </typo:code> <p>So now we have a thread busy gathering our data—how can we expose the data to a munin plugin? There are multiple ways to do this, but I chose to use a small <span class="caps">HTTP</span> <span class="caps">HTTP</span> request handlers in Ruby: Mongrel. Here are a couple of pages about how to get started <a href="">writing</a> <a href="">Mongrel</a> <a href="">handlers</a> —it’s pretty straightforward. Here’s our handler:</p> <typo:code <p>class ResponseTimeHandler < Mongrel::HttpHandler<br /> def initialize(method)<br /> @method = method<br /> end</p> def process(request, response) response.start(200) do |head,out| debug = Mongrel::HttpRequest.query_parse(request.params[“QUERY_STRING”]).has_key? “debug” head[“Content-Type”] = “text/plain” output = $response_data.map do |k,v| value = v.send(@method, debug) formatted = value.nil? ? ‘U’ : sprintf(‘%.5f’, value) “#{k}.value #{formatted}” end.join(“\n”) output << “\n” out.write output end end <p>end</p> <p>h = Mongrel::HttpServer.new(“127.0.0.1”, <span class="caps">PORT</span>)<br /> h.register(“/avg_response_time”, ResponseTimeHandler.new(:average))<br /> h.register(“/max_response_time”, ResponseTimeHandler.new(:max))<br /> h.run.join</p> </typo:code> <p>The handler is generic so that it can call an arbitrary method on our collection of data arrays, so we can set up one <span class="caps">URI</span> for the average, and one for the maximum. With this in place, we can write a simple munin plugin script that uses <code>Net::HTTP</code> to query our Mongrel to get at the performance data.</p> <p <a href="">HowToWritePlugins munin wiki page</a>. And now, our plugin script:</p> <typo:code <p>#!/usr/bin/env ruby</p> <ol> <li>munin plugin to render rails response time graphs</li> <li>link to /etc/munin/plugins/avg_response_time and /etc/munin/plugins/max_response_time</li> </ol> <p>require ‘open-uri’<br /> <span class="caps">PORT</span> = <span class="caps">ENV</span>[‘<span class="caps">PORT</span>’] || “8888”</p> <p>def config<br /> title = File.basename($0).split(‘_’).map{|s| s.capitalize }.join(’ ’)<br /> config=<<<i>END_CONFIG</i><br /> graph_title #{title}<br /> graph_vlabel response time<br /> graph_category rails<br /> total.label total<br /> rendering.label rendering<br /> db.label db<br /> <i>END_CONFIG</i><br /> puts config<br /> end</p> <p>def get_data(read_only=false)<br /> qs = read_only ? ‘?debug’ : ’’<br /> puts open(“{PORT}/#{File.basename($0)}#{qs}”).read<br /> end</p> <p>case <span class="caps">ARGV</span>.first<br /> when ‘config’<br /> config<br /> when ‘debug’<br /> get_data(true)<br /> else<br /> get_data<br /> end</p> </typo:code> <p>The script will examine the name with which you linked it in to the munin plugins directory to determine which <span class="caps">URI</span> to query. I have also added a debug mode that will show you the current values, so you’re not consuming any data that munin needs to see for an accurate graph. The final piece is a small <a href="">Daemons</a> wrapper script to control the main log-tailing process, and you should be set. Make sure to restart munin-node so it will notice the new plugins, and after a while, you’ll see something like this:</p> <p><img src="/files/avg_response_time.png" alt="" /></p> .</p> <p>Download <a href="/files/rails_log_monitor.rb">rails_log_monitor.rb</a></p> <p>Download <a href="/files/rails_response_time">rails_response_time</a></p> Focus of the day. 2007-08-31T00:00:00-07:00 <p>I “<span class="caps">BOOK</span>” and Digital-Seed.</p> <p>For the book I should</p> <p>1) write a script to generate the whole model and controllers using generate scaffolding…that will let me rerun it a couple of times until we get it right. I.e. rake scaffold:migrate [<span class="caps">VERSION</span>=n] allowing to add and remove stuff…this should also take care of nested resource.</p> <p>2) Write some initial rSpecs to ensure that the model is right</p> <p>For DigitalSeed I need</p> <p>1) integrate the LayoutManager functionality into the base application</p> <p>2) Refine the Widget drap&drop to visually indicate where the dragged item will appear if dropped.</p> <p>The Book will be for tonight once the kids and wife are asleep…so let’s get started with Digital-Seed!</p> Unobtrusive Javascript with Lowpro and Ruby On Rails 2007-08-28T00:00:00-07:00 <p>Check out for more info on LowPro, a very elegant approach to do Unobtrusive Javascript with Ruby On Rails. Find hereafter a small example of how to add a custom behavior to link.</p> <p>The View<br /> <typo:code<br /> <%= javascript_include_tag ‘prototype’, ‘lowpro’, ‘remote’, ‘application’ <span>> <br /> <div id="result_list"><br /> <ul><br /> <</span> for watch_result in <code>watch_results %> <li> <%= link_to watch_result.created_at.to_s(:db), diff_watch_result_url(</code>watch, watch_result),<br /> {:id => dom_id(watch_result) }<br /> %></p> </li> <% end %> </ul> </div> </typo:code> <p>The Javascript<br /> <typo:code</p> <p>LoadWatchResult = Remote.Link({<br /> onLoading : function() {<br /> $(‘watch_result_difference’).innerHTML=‘’;<br /> $(’watch_result_difference’).addClassName(‘pleaseWait’); <br /> },<br /> onComplete : function(e) {<br /> var source = Event.element(e);<br /> $(‘watch_result_difference’).removeClassName(‘pleaseWait’);<br /> $$(‘div#result_list ul a.active’).each(function (e) {e.removeClassName(‘active’)}); <br /> source.addClassName(‘active’);<br /> }<br /> });</p> <p>Event.addBehavior({<br /> ‘#result_list ul li a’: LoadWatchResult<br /> });</p> </typo:code> <p>The ‘remote.js’ provides additional behaviors creatde by Dan Wedb as part of LowPro (). The LoadWatchResult behavior we created in this example transforms a ‘standard’ link_to to a link_to_remote with additional behavior on the onLoading and onComplete of the remote call. The view stays clean.</p> <p>Enjoy!<br /> Daniel</p> Flex Dynamic Scaffolding for Ruby on Rails. 2007-08-05T00:00:00-07:00 <p>No.</p> <p><img src="" border="0" width="500" alt="20070804_FlexScaffolding.jpg" align="" /><br /> In a first phase I have adapted <a href="">RaildRoad</a> Rails model class diagram generation tool to generate an xml definition that the UI would use to create it’s components. I generated an xml model for <a href="">Sports</a> a sample application provided with Streamlined and <a href="">Typo</a> a blog server.</p> <p>The UI generation from the typo model is quite cpu intensive. There is not lazy instanciation of components, when you select the model, all the Tabs, lists and forms are created.</p> <p>You can <a href="">run the application</a> and press view source from the context menu. Or you can see the source <a href="">here</a>. The generated xml can be seen <a href="">here</a> and <a href="">here</a></p> <p>In a second phase I created a Flex application that generates a UI from the given xml.</p> <p>I was writing this blog entry while coding, so if you are more curious about how all this works, keep on reading.</p> <h1>Getting the schema of your ActiveRecords</h1> <p.</p> <p>I will use the Streamlined Sports example database to experiment with. Later on we may have a look at Typo a blog server.</p> <p>Let’s use the community to see how to parse the ActiveRecord. I am now checking out <a href="">RailRoad (0.4.0)</a> a class diagram generator for Rails. Railroad has the ModelsDiagram class that gather the information we need and then uses the DiagramGraph class to generate a <em>dot</em> <i>to_dot</i> method as follows:</p> <typo:code <ol> <li><br /> module Enumerable<br /> def injecting(s)<br /> inject(s) do |k, i|<br /> yield(k, i); k<br /> end<br /> end<br /> end</li> </ol> <p>class DiagramGraph</p> def to_dot return definition.to_xml(:root => ‘active_records’, :dasherize => false) end #Let organize the data in a way closer to the xml we want to generate. def definition active_records = {} @nodes.each do |node| attributes = node<sup class="footnote" id="fnr2"><a href="#fn2">2</a></sup>.injecting({}) {|accumulator, value| k,v=value.split(" :"); accumulator[k] = v} class_name = node<sup class="footnote" id="fnr1"><a href="#fn1">1</a></sup> active_records[class_name] = { :name => class_name, :attributes => attributes, :relations => [] } end @edges.each do |edge| association_type = edge<sup class="footnote" id="fnr0"><a href="#fn0">0</a></sup> from_class_name = edge<sup class="footnote" id="fnr1"><a href="#fn1">1</a></sup> to_class_name = edge<sup class="footnote" id="fnr2"><a href="#fn2">2</a></sup> active_records[from_class_name][:relations] << {association_type.to_sym => to_class_name} end active_records end <p>end</p> </typo:code> <p>The <em>definition</em> method generates a hash map with the information of the model. The <em>to_xml</em> is all that is needed to get an <a href="">xml version</a> of the data that the map contains.</p> <typo:code <p>definition.to_xml(:root => ‘active_records’, :dasherize => false)</p> </typo:code> <h1>Dynamically Generate a Flex UI</h1> <p>Let looks at the model.</p> <pre> Player has_many Sponsor Coach has_many Sponsor Team has_one Coach has_many Player Sponsor has nobody! </pre> <p.</p> <p>You can <a href="">run the application</a> and <a href="">view the source</a>.</p> <p>The main application, FlexScaffolding, adds dynamically a ActiveRecordsView for each ActiveRecord in the model to the Tab navigator. That’s too many tabs for the Typo model…</p> <typo:code> private function generateView():void { for each (var activeRecord:<span class="caps">XML</span> in definition.children()) { var arView:ActiveRecordsView = new ActiveRecordsView(); arView.definition = activeRecord; mainView.addChild(arView); } } </typo:code> <p…</p> <p>That’s all for now. Enjoy!<br /> Daniel Wanja</p> Flex Automation Manager 2007-07-23T00:00:00-07:00 <p>At the beginning of the year I was investigating the new automation functionality Flex 2.0.1 brought to the table. So I looked into what it would take to implement a tool like QuickTest Pro and made some initial progress, but then got called back to reality and other projects. I mentioned this and several readers of this blog contacted me and asked If they could get the source code or if I could open source it. Well, the code is not in any stage where I could open source it or even show it. It doesn’t work under Flex 3 anymore. But as you asked for it, feel free to have a look at this “experiment”. This code is not an example on how to structure you code or the right way of doing things…it’s rather some dark side coding during a late night session. Be warned only check this out if you are really curious or asked for it :-) Use at your own risk, and don’t ask too many questions: <a href="">view source here</a>. They are many parts I haven’t even looked into it such as drag&drop, mouse movement emulation, text selection… so Good luck! Also note that Adobe removed from the source code the mx.automation.delegates folder in the Moxie release…These classes are required to make automation work, and I assumed they where part of the <span class="caps">SDK</span> and are an important part to understand how the automation is working. So I am not sure what the status on using these classes is.</p> On The (onAIR) Bus - Denvers stop live coverage! 2007-07-20T00:00:00-07:00 <p><img src="" border="0" height="321" width="490" alt="20070720_onairtour.png" align="" /></p> <p>Not really on the bus but at the onairbustour stop in Denver. Check out Flickr Tags (onairbustour and onair2007denver). Today’s agenda looks quite interested and there will lots of info regarding Adobe’s <span class="caps">AIR</span> technology. The Keynote by Ryan Stewart will start in 1 minutes. I’ll take some notes during the day…so check back!</p> <p><strong>Keynote</strong></p> <p>Ryan now shows <a href="">pownce</a> (I am still waiting for my invite…I tried to get one via <a href="">inviteshare</a> but no success yet!). He shows the nice <a href="">finetune</a> application that has a nice <span class="caps">AIR</span> application to complement their website. He demoes a word processor (buzzword) created in Flex and <span class="caps">AIR</span>, ask your preview <a href="">here</a>.</p> <p>Now Ryan shows the <span class="caps">AIR</span> Roadmap, next big steps is Max 2007. Beta 2 will be release around Max 2007 which will add functionality like Flash <span class="caps">AIR</span> Support. An <span class="caps">AIR</span> version support Linux appear in the <span class="caps">AIR</span> 1.x version.</p> <p>Now back to Mike Chambers that will provide a technical introduction on <span class="caps">AIR</span> and will create a Hello World application. At the end of the presentation Mike points to <a href=""></a> where the post the various applications they are building on the tour about the tour.</p> <p><strong>Kevin Hoyt – <span class="caps">AIR</span> application with javascript</strong></p> <p>What a slacker Kevin is…only two slides :-) No it’s pretty cool, Kevin is a hands on guys and is building some <span class="caps">AIR</span> javascript application live and shows some nice tricks.</p> <p>I won’t transcode all the code he show, but there is a tight integration between javascript and actionscript. He shows how to call directly actionscript methods from javascript.</p> <typo:code <p>function doSave() {<br /> var file = air.File.desktopDirectory.resolve(“denver.txt”)<br /> air.FileStream().open (…) // some code left out.<br /> }</p> </typo:code> <p>So this is javascript and the <em>air</em> object allows access to Actionscript. In this case he is saving some text entered in htm l to the file system. Cool.</p> <p>He presents Aptana and shows that they have some <span class="caps">AIR</span> integration. Check out Kevin’s <a href="">blog</a></p> <p><strong>Kevin Hoyt – Another session on script bridging.</strong></p> <p>Kevin now builds a web browser in <span class="caps">AIR</span>/Flex that uses the mx:<span class="caps">HTML</span> component.</p> <typo:code> <p>web.htmlControl.load(new URLRequest(address.text))<br /> <mx:HTML</p> </typo:code> <p>The following provides access to any public actionscript class described in library.swf to javascript.<br /> <typo:code><br /> <script src="library.swf" /></p> </typo:code> <p>Lunch!!!</p> <p>All right, I didn’t catch up the beginning of Daniel Dura’s talk…Sorry, I was <em>playing</em> with my <span class="caps">EVDO</span> card.</p> <p><strong>Daniel Dura – <span class="caps">AIR</span> <span class="caps">API</span> Overview</strong></p> <p>Daniel describes the various apis and shows lots of code. He starts showing the different options the Window <span class="caps">API</span> offers (transparent, system, dialog, lightweight). He shows the Drag and Drop <span class="caps">API</span> (<span class="caps">AIR</span> to <span class="caps">AIR</span>, <span class="caps">AIR</span> to OS, OS to <span class="caps">AIR</span>, Desktop to <span class="caps">AIR</span>). It’s pretty cool to see all these APIs in action. The Service Monitoring allows to detected network connection changes. <br /> Database Support: just added <span class="caps">SQL</span> integration to the new beta. Fully local database. Can be used to sync data with an online application. You can store data while being offline. He demonstrates an example written by <a href="">Christophe Conraets</a> show the SQLite integration (SQLQueue, SQLStatement).</p> <p><strong>Salesforce.com</strong></p> <p>Salesforce and Flex was used to improve the User Experience they where providing before.</p> <p><strong>Contest to give away schwag</strong></p> <p>Yea, Kevin Hoyt got taped at the back of bus…I rememberd that…answered Mike Chambers question..and won the following 7 books:<br /> <img src="" border="0" height="300" width="225" alt="20070720_onair_books.png" align="" /></p> <p><strong>Yahoo Media Innovation Group – Jason</strong></p> <p>Some demos of what Yahoo is doing with <span class="caps">AIR</span>. One application is <em>Minibar</em>, a Dashboard like widget.</p> <p><strong>Developing <span class="caps">AIR</span> Applications with Ajax Components – Andre Charland from Nitobi</strong></p> <p><strong>Why Ajax in <span class="caps">AIR</span>?</strong></p> <ul> <li>Code Reuse, Skills Reuse, <span class="caps">HTML</span> is <span class="caps">REALLY</span> good at some things, Maintain UI Patterns, Javascript is growing.</li> </ul></li> <li>What more can we do than the browser? <ul> <li>Files, Windows & Chrome, Drag&Drop, Copy&Paste, Offline, Background process, notifications, keyboard shortcuts.</li> </ul></li> <li>Demo <span class="caps">APP</span> <ul> <li>Ajax Fisheye Menu (mac like dock)</li> <li>Offline Sales Force</li> </ul><p><strong>eBay San Dimas – Sean Chirstmann from EffectiveUI</strong></p> <p>San Dimas is eBay on the Desktop build with <span class="caps">AIR</span>. Why? What’s the point? This is a big question for many <span class="caps">AIR</span> applications. New experience for customers and new functionality <span class="caps">AIR</span> provides. For example alerts, notifications and the live nature of Flash is a big deal to the user.</p> <ul> <li>Development Pattern <ul> <li>San Dimas is built on Cairngorm</li> <li>Assets externalized to allow for new skins</li> <li>String externalized for internationalization</li> </ul></li> <li>eBay <span class="caps">SDK</span> Overview* <ul> <li>AS3 classes generated from eBay <span class="caps">WSDL</span></li> <li>Objects in AS3 are serialized into <span class="caps">XML</span> and sent to server</li> <li><span class="caps">XML</span> received from server is assembled into corresponding AS3 objects</li> <li>Benefit from working with typed native objects that are bindable</li> </ul></li> <li>Upcoming Features <ul> <li>eBay: Browsing, Selling</li> <li><span class="caps">AIR</span>: <span class="caps">SQL</span> database integration for category/attribute info</li> <li>OS Alerts, System Tray</li> </ul></li> </ul> <p>see <a href=""></a></p> <p><strong>Transitioning to the Desktop – Lee from frog design</strong></p> <p>The presentation will mostly focus on design. Lee also likes Microsoft products, so he can provide some perspective.<br /> Lee did the bus wrap for the tour. Some interactive part of the onAir website. His blog is the <a href="">theflexblog.com</a></p> <p>Lee is actually showing some cool stuff done with <span class="caps">AIR</span> just to highlight animation and custom chrome performance. He will post these examples on his blog.</p> <p><strong>Buzzword</strong></p> <p><img src="" border="0" height="70" width="311" alt="20070720_onair_buzzword.jpg" align="" /></p> <p>Cool I just go my invite. Man just logged in and it’s refreshing to see such such a cool word processor. Hehe, bye-bye word! Well, I don’t use Word anymore anyhow.</p> <p><strong>The Schedule for the rest of the onAIR tour</strong></p> <p><img src="" border="0" height="299" width="400" alt="20070720_onair_thebus.png" align="" /></p> <p><strong>The bus in the bus!!!</strong></p> <p><img src="" border="0" height="240" width="320" alt="20070720_onair_businbus.png" align="" /></p> <p><strong>The Kevin in the bus!!!</strong></p> <p><img src="" border="0" height="320" width="240" alt="20070720_onair_viewfromthebug.png" align="" /></p> Updated: 2007-07-14T00:00:00-07:00 <p>Time.onrails.org – a simple time tracking application has been updated.</p> <ul> <li>Time shifting – Let’s assume you entered time from 08:00-12:00 13:00-17:00. Then you notice that you effectively took a longer lunch. Simply edit the 12:00 to 11:45, then tab to the next field and change 13:00 to 13:15 and press enter. In the same way, if you didn’t come back from lunch at all that day. Simply clear out the 13:00-17:00 field and press enter. This will delete this time slot.</li> </ul> <ul> <li>Running Timers – When a timer is running (i.e. 11:30- ), the time line (day) is highlighted in green. That way it’s easy to detect which timers are still running.</li> </ul> <ul> <li>IE6 Support. Time entry was pretty broken with IE. This should have been fixed. I haven’t installed IE7…so I assume it doesn’t work there.</li> </ul> <ul> <li>Rails Migration. Behind the scenes Rails was migrated from 1.1.6 to 1.2.3.</li> </ul> <p><img src="" border="0" height="234" width="534" alt="20070713_timeonrails.jpg" align="" /></p> <p>Please let me know if you find anything unusual.</p> <p>Enjoy!<br /> Daniel.</p> RailsLogVisualizer now for Windows. 2007-07-06T00:00:00-07:00 <p>I got around and fixed the Windows specific issue as <a href="">Philipp</a> pointed out. I also had to take into account the File.lineEnding in order to make sure the parsing works on <span class="caps">OSX</span> and Windows.</p> <p>If you haven’t yet, first <a href="">download the Adobe Integrated Runtime (<span class="caps">AIR</span>) <br /> </a></p> <p>Then download: <a href="">RailsLogVisualizer0.6.air</a></p> <p>After the log file is loaded the parsing takes some time and the UI doesn’t yet provide feedback for the progress. See be a little patient.</p> <p>Please let me know how the RailsLogVisualizer works for you!</p> <p>Enjoy!<br /> Daniel.</p> RailsLogVisualizer meets Adobe AIR 2007-07-03T00:00:00-07:00 <p>I recompiled the Log Visualizer with Adobe <span class="caps">AIR</span>. You can download it <a href="">here</a>.</p> <p><img src="" border="0" width="490" alt="20070702RailsLogVisualizer.jpg" align="left" /></p> <p>I tried it under Windows XP (Parallels) and it seems that the File.browseForOpen doesn’t fire the Event.<span class="caps">SELECT</span> event under Windows. So the bug is that you can open a file, but the application doesn’t know when you selected it. I was contacted by Logan today who wanted to know if there is a Windows version. So sorry for the Windows users out there for the moment. Note that the <a href="">Apollo version</a> of the Log Visualizer was working under windows.<br /> <br/> Download: <a href="">RailsLogVisualizer0.5.air</a></p> iPhone Web Development 2007-06-30T00:00:00-07:00 <p>I haven’t found much info on developing for the iPhone, but this <a href="">link</a> provides some good info. Here are some extracts:</p> <ul> <li>Safari User Agent for iphone:: Mozilla/5.0 (iPhone; U; <span class="caps">CPU</span> like Mac OS X; en) AppleWebKit/420+ (<span class="caps">KHTML</span>, like Gecko) Version/3.0 Mobile/1A538a Safari/419.3</li> <li>No Java, No Flash</li> <li>HTML5</li> <li>10MB max html size for web page</li> <li>Javascript limited to 5 seconds run time</li> <li>Javascript allocations limited to 10MB</li> <li>8 documents maximum loaded on the iPhone due to page view limitations</li> <li>Quicktime used for audio and video</li> <li>stylesheet device width:480px</li> <li>there are no scroll bars or resize knobs. the iphone will automatically expand the content</li> <li>new telephone links allows you to integrate phone calls directly from your webpage. remember this is only on safari.</li> <li>built in google maps client for integrated mapping from your website</li> <li>iPhone screen size 480×320</li> <li>encode movie size 480×360</li> <li>Links to movies on a web page will take users directly to video full screen playback</li> </ul> <p>I didn’t have to say in line to buy an iPhone, the Apple Store in Aspen Groove served everyone that was waiting in line in about 30 minutes, I just happened to go eat next to the Apple Store with my wife and kids ;-). So I just picked one up on the way to the Restaurant, zero wait. The store is open to midnight but there is not too much activity. I guess only geeks like me (or Sol) will try to pick one the first day, even while being fully aware of the limitations or the price. And this despite that I told everyone that in no way I will get one. Note, we have to test our different web applications on the new platform. <span class="caps">ATT</span> seems a little overwhelmed and iTunes provides me with a nice message that it will take a little longer and I will be notified by email when I can activate the phone. Note that I just received a follow-up email that telling me to that the phone will be activated by July 1st noon.</p> From Flex, to Spry, to Rails 2007-06-29T00:00:00-07:00 <p>For <a href="">Cairngorm</a> and I spent 10 days over several month developing the main functionality. I created a Flex <a href="">ActiveResourceClient</a> class (Actionscript) to access our RESTFul Rails server. I found a nice mechanism to display <a href="">Rails errors in Flex</a> <a href="">Adobe’s <span class="caps">SPRY</span> framework</a> that consumes <span class="caps">XML</span> to drive <span class="caps">HTML</span> generation in Javascript. And our Rails application returns <span class="caps">XML</span>..</p> <p>Lessons learned: keep it simple, don’t use technology for technology, don’t find a problem to your solution. Well, I got to enthusiastic about trying out new stuff, but now we are back on track.</p> <p.</p> Open For Business: eBay Desktop Beta - an Adobe AIR Application. 2007-06-21T00:00:00-07:00 <p>The invitations are going out! So, if you haven’t yet, go <a href="">signup</a> for the eBay Desktop beta (code name Project “San Dimas”“) at ”"></a>.</p> <p>The eBay Desktop is an Apollo Application, oops, Adobe <span class="caps">AIR</span> application, that is developed by our friends <a href="">Tony Hillerson</a> and <a href="">Sean Christmann</a> from EffetiveUI for eBay. As they had their hand full applying the finishing touch to the beta, they asked Lee and myself to help with the beta Signup program and administration site which is a Ruby on Rails application. How cool is that! Thanks guys for the opportunity to work on such a visible project…</p> <p>Now if you know Sean you will understand why using the eBay Desktop is fun. When Sean is not coding he is playing games, and he want’s any application to be fun and playful. Even when he gives talks he manages to <a href="">demonstrates</a> how to program a <span class="caps">WII</span> controller. It’s cool that <a href="">Alan Lewis</a> gave them the creative freedom to create some new user experience concepts on top of the existing eBay apis.</p> <p>Ken, my desk <em>neighbor</em> at one of my clients asked why would you need something like Adobe <span class="caps">AIR</span>? Well in the case of the eBay Desktop, you are provided with an immersive experience, having a dedicated application will encourage the user to stay within that application and not get (too) distracted. The desktop also allows to save custom searches and additional information locally, thus providing functionality that may not be available by the existing eBay apis. It could also allow for functionality like drag&drop of images and text from the file system to create online auctions, use a connected camera to snap pictures, scan bar codes to retrieve product information, and so on…</p> <p><img src="" border="0" width="450" alt="20070620_eBayDesktop.jpg" /></p> <p>PS: Hey Sean what’s your blog…or are you too busy coding?</p> Happy Birthday to Me! 2007-06-21T00:00:00-07:00 <p>42! No way, that’s twice the legal drinking ages in most of the US states, 2.625 times the Swiss legal drinking age. I have been a professional programmer half my life and I am still having fun. I am now the oldest coder on most of the projects I work on :-) Ruby and Ruby on Rails is inspiring me in trying to write elegant and better code. But it’s really working on awesome projects and working with awesome people that inspires me to continue developing software. This said I will be away from my computer today. I will go to the Zoo with the kids and then to the pool. Couldn’t be much better. Have fun!</p> Free Rails Training 2007-06-15T00:00:00-07:00 <p>From my perspective (as someone who has been doing <a href="">Rails</a> development full time for the past two years or so) it’s hard to believe, but there still are web developers who aren’t familiar with Rails. I was recently approached by an old friend about doing a training session on <a href="">Mono</a>. The last time we had been in close contact, I was exploring Mono and excited about the possibility of a .<span class="caps">NET</span> environment on Linux. Of course, that was before I discovered ActiveRecord and became a card-carrying Rails fan club member.</p> <p>I told him that while that would probably be fun, I’d rather talk about something I didn’t have to learn for the presentation, and by the way, had he ever considered having a session on Rails? Well, I’m just back from the first segment of the course, which consisted of installing a Rails development stack in an Xubuntu virtual machine. Due to bandwidth limitations and a delayed start, that was all we accomplished tonight, but the remainder of the course (actually learning about Rails) will be in two weeks. We will provide a ready-to-go virtual machine to anyone interested in an introduction to Rails, and there are a few seats still available.</p> <p>So if you or someone you know will be in the Denver area at 6:30 on June 28 (the day before the iPhone!), and have a couple of hours to be <del>indoctrinated</del> introduced to Rails, drop me a line [my gmail account is rubysolo].</p> WebSnapshot - a simple Adobe AIR application. 2007-06-13T00:00:00-07:00 <p><span class="caps">UPDATE</span>: new version can be found <a href="">here</a><br /> <p/><br /> I converted the <a href="">original Apollo WebSnapshot</a> Application to Adobe <span class="caps">AIR</span> using <a href="">FlexBuilder 3</a>. Now WebSnapshot works on <span class="caps">OSX</span> and Windows.</p> <p>The conversion was straight forward. I changed the root tag of the application from <br /> <pre><mx:ApolloApplication></pre> to <pre><mx:WindowedApplication></pre></p> <p>Then I used the new File.browseForSave method to show the save dialog when clicking on the thumbnail. No need anymore for the workaround that was required for this before. One thing I didn’t find out (yet) is how to set the file type and default filename in the save dialog. Any pointer is welcome!</p> <p>Download it now: <a href="">WebSnapshot0.2.air</a> (right click and ‘Download Linked File’)</p> <p><img src="" border="0" height="270" width="500" alt="20070613_websnapshot_osx.gif" /></p> <p><img src="" border="0" height="285" width="500" alt="20070613_websnapshot.gif" align="" /></p> <p>To run the application you need to <a href="">Adobe Integrated Runtime (<span class="caps">AIR</span>)</a>. Also uninstall Alpha 1 before installing Beta 1 if you had Apollo installed.</p> <p>To uninstall the runtime on Windows:</p> 1. In the Windows Start menu, select Settings > Control Panel. 2. Select the Add or Remove Programs control panel. 3. Select “Adobe Apollo 1.0 Alpha1” to uninstall the Apollo runtime. 4. Click the Change/Remove button. <p>To uninstall the runtime on Macintosh:</p> 1. Delete the /Library/Frameworks/Adobe Apollo.framework directory. 2. Delete the /Library/Receipts/Adobe Apollo.pkg file. 3. Empty the Trash. Scribbish Spam Comments in Typo 2007-05-24T00:00:00-07:00 We've been getting a bunch of comment spam lately and they are still displayed when correctly marked as spam in <a href="">Typo 4.0.3</a> with the <a href="">Scribbish 2.0</a> theme. I believe this is fixed in Scribbish 3.0, but I'm not sure if it's compatible with our version of Typo. Here's a small patch to the Scribbish theme that only displays published comments instead of all comments. <style type="text/css"> /* Stylesheet generated from TextMate theme * * All Hallow's Eve * * */ /* Mostly to improve view within the TextMate HTML viewer */ body { margin: 0; padding: 0; } pre.textmate-source { margin: 0; padding: 0 0 0 2px; font-family: Monaco, monospace; font-size: 16px; line-height: 1.3em; word-wrap: break-word; white-space: pre; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; } pre.textmate-source.all_hallow_s_eve { color: #FFFFFF; background-color: #000000; } pre.textmate-source .linenum { width: 75px; padding: 0.1em 1em 0.2em 0; color: #888; background-color: #eee; } pre.textmate-source.all_hallow_s_eve span { padding-top: 0.2em; padding-bottom: 0.1em; } pre.textmate-source.all_hallow_s_eve ::selection { background-color: rgba(115, 89, 126, 0.88); } /* Text base */ pre.textmate-source.all_hallow_s_eve .text { color: #FFFFFF; background-color: #434242; } /* Source base */ pre.textmate-source.all_hallow_s_eve .source { color: #FFFFFF; background-color: #000000; } /* Comment */ pre.textmate-source.all_hallow_s_eve .comment { color: #9933CC; } /* Constant */ pre.textmate-source.all_hallow_s_eve .constant { color: #3387CC; } /* Keyword */ pre.textmate-source.all_hallow_s_eve .keyword { color: #CC7833; } /* Pre-processor Line */ pre.textmate-source.all_hallow_s_eve .meta_preprocessor_c { color: #D0D0FF; } /* Pre-processor Directive */ pre.textmate-source.all_hallow_s_eve .keyword_control_import { } /* Function name */ pre.textmate-source.all_hallow_s_eve .entity_name_function { } /* Function argument */ pre.textmate-source.all_hallow_s_eve .variable_parameter { font-style: italic; } /* Block comment */ pre.textmate-source.all_hallow_s_eve .source .comment_block { color: #FFFFFF; background-color: #9B9B9B; } /* String */ pre.textmate-source.all_hallow_s_eve .string { color: #66CC33; } /* String escapes */ pre.textmate-source.all_hallow_s_eve .string .constant_character_escape { color: #AAAAAA; } /* String (executed) */ pre.textmate-source.all_hallow_s_eve .string_interpolated { color: #000000; background-color: #CCCC33; } /* Regular expression */ pre.textmate-source.all_hallow_s_eve .string_regexp { color: #CCCC33; } /* String (literal) */ pre.textmate-source.all_hallow_s_eve .string_literal { color: #CCCC33; } /* String escapes (executed) */ pre.textmate-source.all_hallow_s_eve .string_interpolated .constant_character_escape { color: #555555; } /* Type name */ pre.textmate-source.all_hallow_s_eve .entity_name_type { text-decoration: underline; } /* Class inheritance */ pre.textmate-source.all_hallow_s_eve .entity_other_inherited-class { font-style: italic; text-decoration: underline; } /* Tag name */ pre.textmate-source.all_hallow_s_eve .entity_name_tag { text-decoration: underline; } /* Tag attribute */ pre.textmate-source.all_hallow_s_eve .entity_other_attribute-name { } /* Support function */ pre.textmate-source.all_hallow_s_eve .support_function { color: #C83730; } </style> <pre class="textmate-source all_hallow_s_eve"> <span class="source source_diff"><span class="meta meta_diff meta_diff_header meta_diff_header_from-file"><span class="punctuation punctuation_definition punctuation_definition_from-file punctuation_definition_from-file_diff">---</span> themes/scribbish/views/articles/_comment.rhtml 2007-05-24 10:36:20.000000000 -0600 </span><span class="meta meta_diff meta_diff_header meta_diff_header_to-file"><span class="punctuation punctuation_definition punctuation_definition_to-file punctuation_definition_to-file_diff">+++</span> themes/scribbish/views/articles/_comment_no_spam.rhtml 2007-05-24 10:35:14.000000000 -0600 </span><span class="meta meta_diff meta_diff_range meta_diff_range_unified"><span class="punctuation punctuation_definition punctuation_definition_range punctuation_definition_range_diff">@@</span> <span class="meta meta_toc-list meta_toc-list_line-number meta_toc-list_line-number_diff">-1,5 +1,6</span> <span class="punctuation punctuation_definition punctuation_definition_range punctuation_definition_range_diff">@@</span> </span> <ol id="comments" class="comments"> <span class="markup markup_deleted markup_deleted_diff"><span class="punctuation punctuation_definition punctuation_definition_inserted punctuation_definition_inserted_diff">-</span> <% for comment in @article.comments -%> </span><span class="markup markup_inserted markup_inserted_diff"><span class="punctuation punctuation_definition punctuation_definition_inserted punctuation_definition_inserted_diff">+</span> <% if @article.published_comments.any? -%> </span><span class="markup markup_inserted markup_inserted_diff"><span class="punctuation punctuation_definition punctuation_definition_inserted punctuation_definition_inserted_diff">+</span> <% for comment in @article.published_comments -%> </span> <li class="comment" id="comment-<%= comment.id %>"> <div class="author"> <%= content_tag(:div, gravatar_tag(comment.email)) if config_value(:use_gravatar) and comment.email %> <span class="meta meta_diff meta_diff_range meta_diff_range_unified"><span class="punctuation punctuation_definition punctuation_definition_range punctuation_definition_range_diff">@@</span> <span class="meta meta_toc-list meta_toc-list_line-number meta_toc-list_line-number_diff">-10,5 +11,8</span> <span class="punctuation punctuation_definition punctuation_definition_range punctuation_definition_range_diff">@@</span> </span> <%= comment_html(comment) %> </div> </li> <span class="markup markup_inserted markup_inserted_diff"><span class="punctuation punctuation_definition punctuation_definition_inserted punctuation_definition_inserted_diff">+</span> <% end -%> </span><span class="markup markup_inserted markup_inserted_diff"><span class="punctuation punctuation_definition punctuation_definition_inserted punctuation_definition_inserted_diff">+</span> <% else -%> </span><span class="markup markup_inserted markup_inserted_diff"><span class="punctuation punctuation_definition punctuation_definition_inserted punctuation_definition_inserted_diff">+</span> <li class="dummy_comment" style="display:none">No comments</li> </span> <% end -%> </ol> </span> </pre> All Hallow's Eve Syntax Highlighting 2007-05-24T00:00:00-07:00 Our syntax highlighting is now closer to <a href="">Textmate's</a> "All Hallow's Eve" theme. This was taken from the latest version of <a href="">Scribbish 3.0</a>. Here's our version of <a href="/stylesheets/theme/syntax.css">syntax.css</a> <typo:code # Show off All Hallow's Eve theme module Theme class AllHallowsEve < Base def descriptionCSS</span> defined for Typo’s code blocks, so I stole them from <a href="">James Wilford’s post</a>. Thanks, James.</p> <p>Maybe we’ll tweak the colors some more later, but these will do for now.</p> <typo:code <p>class Scribbish < TypoTheme<br /> include JamesWilfordCSS<br /> end</p> </typo:code> Download RailsConf 2007 Presentations 2007-05-21T00:00:00-07:00 <p><strong>Updated: <a href="/articles/2007/05/21/bloated-railsconf-presentation-downloader">Now more bloated!</a></strong></p> Run this to get the <a href="">RailsConf 2007 presentations</a>: <typo:code #!/usr/bin/env ruby require 'rubygems' require 'hpricot' require 'open-uri' base = '' h = Hpricot(open("#{base}/pub/w/51/presentations.html")) h.search('div .presentation > a[@href^="/presentations/rails2007/"]').each do |a|Hpricot</a>. Bloated RailsConf Presentation Downloader 2007-05-21T00:00:00-07:00 <p>I’ve updated my downloader from <a href="/articles/2007/05/21/download-railsconf-2007-presentations">earlier</a> to include all sorts of fancy options. It no longer requires wget, it just uses open-uri. It can give the files a fancy name. It can be told where to download the files to. It will skip files that won’t download for some reason. It will even butter your toast if you can find the correct command line switch.</p> <p>It’s about 3 times bigger than the previous one. But maybe you can learn a little more about <a href="">optparse</a>, <a href="">hpricot</a>, file handling, and error handling along the way.</p> <p>Here it is:</p> <typo:code <p>#!/usr/bin/env ruby</p> <p>require ‘optparse’</p> <p><span class="caps">OPTIONS</span> = { :Verbose => false,<br /> :Force => false,<br /> :DownloadDir => ‘.’,<br /> :DescriptiveFilenames => true<br /> }<br /> OptionParser.new do |opts|<br /> opts.banner = “Usage: #{$0} [options]”</p> opts.on(“-v”, “<del>-[no</del>]verbose”, “Run verbosely, default #{OPTIONS[:Verbose]}”) do |verbose| <span class="caps">OPTIONS</span>[:Verbose] = verbose end opts.on(“-f”, “<del>-[no</del>]force”, “Force downloads, default #{OPTIONS[:Force]}”) do |force| <span class="caps">OPTIONS</span>[:Force] = force end opts.on(“-d”, “<del>-[no</del>]descriptive”, “Use long descriptive filenames, default #{OPTIONS[:DescriptiveFilenames]}”) do |long| <span class="caps">OPTIONS</span>[:DescriptiveFilenames] = long end opts.on(“-p”, “—path <span class="caps">PATH</span>”, “Path to download to, default #{OPTIONS[:DownloadDir]}”) do |path| <span class="caps">OPTIONS</span>[:DownloadDir] = path end opts.on_tail(“-h”, “—help”, “Print help message”) do |help| puts opts exit end <p>end.parse!</p> <p>require ‘rubygems’<br /> require ‘hpricot’<br /> require ‘open-uri’<br /> require ‘fileutils’</p> <p>BASE_URL = ‘’</p> <p>def log(str)<br /> puts str if <span class="caps">OPTIONS</span>[:Verbose]<br /> end</p> <p>def download(href, filename)<br /> url = “#{BASE_URL}#{URI.escape(href)}”<br /> download_file = File.join(<span class="caps">OPTIONS</span>[:DownloadDir], filename)<br /> if <span class="caps">OPTIONS</span>[:Force] || !File.exists?(download_file)<br /> log “downloading #{File.basename(href)}…”<br /> begin<br /> File.open(download_file, ‘w’) { |f| f.write(open(url).read)}<br /> log “\tsaved as #{download_file}”<br /> rescue Object => e<br /> FileUtils.rm(download_file)<br /> $stderr.puts “<span class="caps">ERROR</span> downloading #{url}: #{e.message}”<br /> end<br /> else<br /> log “skipping #{File.basename(href)}… already downloaded as #{download_file}”<br /> end<br /> end</p> <p>FileUtils.mkdir_p(<span class="caps">OPTIONS</span>[:DownloadDir])<br /> h = Hpricot(open(“#{BASE_URL}/pub/w/51/presentations.html”))<br /> h.search(‘div.presentation’).each do |presentation_node|<br /> href = presentation_node.at(‘a[@href^=“/presentations/rails2007/”]’)[:href]<br /> if <span class="caps">OPTIONS</span>[:DescriptiveFilenames]<br /> name = presentation_node.at(‘b a’).inner_text.strip<br /> text = presentation_node.inner_text<br /> speaker = text[/Speaker\(s\):\s+(.<strong>)\s</strong>$/, 1]<br /> date = Date.parse(text[/Presentation Date:\s+(.<strong>)\s</strong>$/, 1])<br /> filename = [speaker, date, name, File.basename(href)].compact.map { |s| s.to_s.strip.gsub(/[^\w\.]/, ‘_’).squeeze(‘_’) }.join(‘-’)<br /> else<br /> File.basename(href)<br /> end<br /> download(href, filename)<br /> end</p> </typo:code> RailsConf 2007 - Day 4 2007-05-20T00:00:00-07:00 <h2>The Rails Way Jamis Buck, Michael Koziarski</h2> <p>See the <a href=""></a></p> <p>#railsway on irc.freenode.net for questions at the end of the presentation.</p> <typo:code <p>class TheRailsWay < BLog<br /> authored_by :jamis<br /> authored_by :koz<br /> end</p> </typo:code> <p>Instead of teaching you how to build things in Rails, Jamis and Koz will show us they things <b>should</b> be built.</p> <ul> <li>The Fat controller (Anti-pattern). Use Skinny Controller instead . Move logic out of controller to Model (i.e total_invoice), easier to test, can use form_for, …</li> </ul> <ul> <li>With Scope. Is always abused. Step back and think “Is there a simpler way than using with_scope?”. I.e. implement an accessor to the attribute you need in your scope instead of using with_scope. I.e. current_organization. If the fix is worth than the initial desease don’t do it.</li> </ul> <typo:code <p>attr_read :current_organization.<br /> helper_method :current_organization.</p> </typo:code> <ul> <li>Use self commenting code. Use before ‘some_explicit_method_name’ instead of a before_create method. An example of transforming some code where the intend was not explicit into the following code using before_create.</li> </ul> <typo:code <p>class Expense < ActiveRecord::Base<br /> before_create :mate_created_now_if_created_today</p> protected def mate_created_now_if_created_today if self.created_at Time.now.beginning_of_day <p>self.create_at = Time.now<br /> end<br /> end<br /> end</p> </typo:code> <ul> <li>Associations.</li> </ul> <typo:code <p><code>john.documents #use this Document.find_all_by_user_id(</code>john.id) # instead of this</p> <p>@john.documents.find(:all, :conditions=>[“title like ?” “<span>koz</span>”] # use this<br /> Document.find(:all, …) # instead of</p> <p>#This becomes even easier to read when the search conditions become more elaborate, <br /> #i.e. Find all documents by john tagged with ‘cool’? <br /> #This should be coded as <br /> cool.documents.find_by_user_id(@john.id) <br /> Document.find(:all, …) #instead of using with now much more conditions .</p> <p>#Even better add a method explicating the association: <code>john.docouments.taged_with(</code>cool) <br /> #or <br /> <code>cool.documents_authored_by(</code>john). <br /> #But just use one, don’t repeat yourself. <br /> #You can get fancy you can use assosciation extensions: <code>john.documents.tagged_with(</code>cool).</p> </typo:code> <ul> <li>Cargo-cult. Don’t just copy-paste the re-factoring you find on the RailsWay, try to understand the principles behind it. Make sure the concept applies to your code.</li> </ul> <typo:code <ol> <li>Dont’ use of !!<br /> def account_code?<br /> !! @account_code.nil?<br /> end</li> </ol> <ol> <li>use. More intention revealing<br /> def account_code?<br /> @account_code ? true : false<br /> end<br /> </typo:code></li> </ol> <ul> <li>Share edit/new form. Don’t build the associations if required in the controller. Move it to a model class method.</li> </ul> <typo:code def self.build_with_associations <p>returning new do |billable|<br /> blillable.booking = Book.build_with_assocations<br /> end<br /> end</p> <ol> <li>some code omitted…man, the speakers are going to fast for my typing!<br /> </typo:code></li> </ol> <ul> <li>Simplifying non restfull routes. Use map.with_options. Also format and indent nicely your routes.</li> </ul> <p><b>Now onto some QA.</b></p> <p>Q: Is the code from the code gonna be posted?<br /> A: Yes, on the website.</p> <p>Q: In the Account code example, could you use @account_code.<br /> A: That would test something different as an empty string would return true. It depends on the requirement.</p> <p>Q: Guidelines or best practices for overriding to_param?<br /> A: If you want prettier Urls you can provide a to_param. Otherwise don’t bother.</p> <p>Q: returning?<br /> A: returning passes an object to a block and returns the object.</p> <p>Q: Cascading validations?<br /> A: Validations can be tricky in that case. They don’t have a best practices to present on that right at this moment. But don’t worry about that too much.</p> <p>Q: Koz. Can you clarify what’s the context key is (in the routes)?<br /> A: Forces a params[:context] = “www”</p> <p>Q: How long does it take to do a typical RailsWay articles<br /> A: 1 day or 2. But it depends.</p> <p>Q: has_many : through. What about multiple : through? I.e. A through B through C through D?<br /> A: I.e. A give me all yours Ds? If you really need it…add a custom method to the top.</p> <p>Q: Attributes on join tables and conditions? Multiple associations? I.e has_many and has_one_current (through)<br /> A: I.e. document has_many versions, current_version. Implementation doesn’t really matter, but if current_version has business meaning make it an explicit method.</p> <p>Q: What is your advice on keeping a database column private? I.e. a Model cannot access a column.<br /> A: We don’t see much value in that. Document this to not “touch” this. But try to find a solution. This can be difficult has private methods can be circumvented by send. Just make it explicit.</p> <p>Q: Final words of wisdom? <br /> A: The RailsWay has been a little quiet, but now that the conference has been wrapping up, we will dive back into it.</p> <p>Q: How do you answer questions that relate to deprecated features?<br /> A: We try to keep it to Rails 1.2.</p> <h2>JRuby on Rails: A Taste of Honey (for the Enterprise)</h2> <p>by Charles Nutter and Thomas Enebo JRuby Core Developer, Sun Microsystems.</p> <p>Enterprise can be “doing cool new things and cool new ways”.</p> <ul> <li>The talk will cover <ul> <li>JRuby 101</li> <li>Justifications</li> <li>JRuby on Rails</li> <li>Deployment Options</li> <li>Migrations</li> </ul></li> <li>They are Java developers (10+ year)</li> <li>Working to build out <span class="caps">JVM</span> dynlang support<br /> *JRuby 101. JRuby is: <ul> <li>Ruby (1.8ish)</li> <li>A non-Java language for the Java platform</li> <li>A new way to look at Ruby and the <span class="caps">JVM</span></li> <li>Helping to expand Ruby’s reach</li> <li>Helping the world better unstand Ruby</li> <li>Really Cool</li> </ul></li> <li>JRuby is <span class="caps">NOT</span>: <ul> <li>An attempts to pollute or fork Ruby</li> <li>An admission that Java sucks</li> <li>The answer to every problem with Ruby</li> <li>An attempt to alter Ruby or add incompatible features</li> <li>Slow</li> </ul></li> <li>But it’s Java, Too</li> </ul> <typo:code <p>include Java<br /> import java.lang.ArrayList<br /> list = ArrayList.new</p> </typo:code> <ul> <li>The rest you know <ul> <li>Obvious libraries pre-installed: Rubygems, Rake, Rspect</li> <li>Mongrel supports JRuby (no remote gem)</li> <li>Rails “just works”. Major orgs now investing in JRuby on Rails. Some folks where wondering if they “just” spawn a Ruby process.</li> </ul></li> <li>Justification or “Why would you do such a thing?” <ul> <li>Supporting the Status Quo (JRuby supports’ Ruby 1.8’s String)</li> <li>Supports ActiveSupport::MultiByte</li> <li>Exposing Java Unicode</li> <li>Ruby 2.0 String on the way…</li> </ul></li> <li>Threading <ul> <li>JRuby supports Ruby’s Thread <span class="caps">API</span></li> <li>JVMs are native-threaded (uses multiple cores)</li> <li>JRuby Supports thread pooling</li> </ul></li> <li>JRuby on Rails the basics <ul> <li>Many gems just work</li> <li>Rails commands just work. rails myapp, rake db:migreate</li> <li>jruby script/server #==> WEBBrick</li> </ul></li> <li>Some differences <ul> <li>MySQL driver works.</li> <li><span class="caps">JDBC</span>…different and faster. (database.yml needs url: and driver: com.mysql.jdbc.Driver)</li> <li><span class="caps">JNDI</span> for connection pooling (jndi: java:comp/env/jdbc/MyAppPool)</li> <li>Broad database support (DB2, Derby, <span class="caps">HSQLDB</span>, JavaDB, MS Access, Mimer <span class="caps">SQL</span>, MySQL, PostgreSQL,…and many more)</li> <li>ActiveRecord-<span class="caps">JDBC</span>: as no schema management <span class="caps">API</span>. MySQL pass 100% of tests, Derby and PostgreSQL have 17 failing tests out of 1000+ tests. Others at varying levels, but coming along. Oracle supports started recently and has less than 100 failed tests for now.</li> </ul></li> <li>Differentiation <ul> <li>No Native Extensions. Require ports. Mongrel done, Hpricot done, RMagick in progress. We’re looking for porters and recommendations</li> <li>Command-line Performance. Java is not slow…except at startup. It’s an issue for now. Don’t expect stella <span class="caps">CLI</span> performance.</li> </ul></li> <li>Demo <ul> <li>Building, running, and deploying a JRuby on Rails application</li> </ul></li> </ul> <typo:code <p>tar xzf jruby.tar.gz<br /> jruby_env<br /> jruby -v<br /> jruby -S gem rails -y<br /> jruby -S gem install gem_plugin<br /> jruby -S gem install mongrel<br /> jruby -S gem install activerecord-jdbc -y<br /> cp lib/mysql.jar jruby/lib<br /> jruby script/server<br /><br /> envirvonment.rb <br /> if RUBY_PLATFORM =! /java/<br /> require ‘jdbc_driver’ #I missed the proper code!<br /> end<br /> jruby script/generate migration entry<br /> jruby -S rake db:migrate<br /> # they continue to use the Rails generators and add standard Rails code</p> cp -rp ../goldspike vendor/plugins jruby -S rake war:standalone:create <p># Assemble a .war file that deploys your Rails application as a standard J2EE application.<br /> # Rails via J2EE</p> </typo:code> <ul> <li>Thanks You..but there is more. <ul> <li>There is a new option.</li> <li>jruby -S gem install GlassFish-10.0.0.0-java.gem —no-wrappers</li> <li>glashfish command. Command line to start J2EE server.</li> </ul></li> <li>Migration <ul> <li>It can be done!</li> <li>MySQL: works, Dearby/JavaDB: nearly 100%, others…depends.</li> <li>Fixtures: Usually bugs are <span class="caps">YAML</span> rather than DB</li> <li>Options: 1) use something else,. 2) Use an equivalent Java library 3) Port the library… 4)5)6) # I missed these</li> </ul></li> <li>Deployment <ul> <li>Mongrel</li> <li>More common approach is .war file</li> <li>A Grizzly/GlassFish v3 option.</li> </ul></li> <li>Demo: Calling Java libraries from JRuby</li> </ul> RailsConf 2007 - Day 3 2007-05-19T00:00:00-07:00 <h2>Bring Ruby to the Enterprise. Not the Other Way ’Round by Cyndi Mitchell (Thoughworks)</h2> <p>Enterprise used to mean “To boldly go where no one went before”. Now it means “loose time, things that add no value, bloat-ware, incompetency, and corruption”<br /> We now have to reclaim the enterprise. Many of the people in this room and RoR planting the seed for a paradigm shift. Many now saw the light and start using RoR in the enterprise. In any case they all need new systems to communicate with old systems. <br /> If we get involved we can show them a better way. Help the Enterprise climb the learning curve faster. Thoughworks announces RubyWorks a full fledged ready to deploy Rails environment. JRuby provide for many Enterprise to make good on their existing Java investments while starting with Ruby On Rails. Lot of indicators showing that we are in the position to reclaim the Enterprise with Ruby On Rails. The core team shows the way of a better way of developing software. There is now a gap in the market in showing the Enterprise the Ruby On Rails way. “We” should be bold enough to bring Ruby On Rails to Enterprise.</p> <p>Note: Thoughworks is a sponsor of RailsConf.</p> <h2>Keynote by Tim Bray (Sun)</h2> <p>Tim Bray, “Web Guy”. <br /> Tim starts to asks a few questions?</p> <ul> <li>“Who are you guys?” <ul> <li>Startup? 35%</li> <li>Not startups? 35%</li> <li>Service providers? 20%</li> </ul></li> </ul> <ul> <li>Very first web programming framework? 10 people.</li> <li>Which framework are you coming from? <ul> <li>Java? Many.</li> <li>Microsoft? Less</li> <li>Php? Lots.</li> </ul></li> </ul> <p>He did write lots of Ruby code that is in production, but hasn’t yet done lots with Rails.</p> <p>Sun can give server to “worthy” open source projects. Sun also sponsors conference like this…and “Ladies and Gentlemen’s your are watching a paid commercial”. But we are putting our Money where our mouth is. Growing the Rails eco-system is good for everyone.</p> <p>He is now showing NetBeans (pre-alpha release 6.0). You can run Rake Targets. Debugger running a .rhtml session.</p> <p>The most visible thing Sun has done is to hire the JRuby guys. Charles Nutter comes on stage. So Tim asks him “Why JRuby”. To bring Ruby in Enterprise where Ruby is not so well accepted, wast number of existing Java libraries, <span class="caps">JVM</span> good virtual machine. Another question Charles mentions is “When to use JRuby?”. At the end of the month will come a first release candidate for JRuby 1.0.</p> <p>He now asks Cindy from Thoughworks to explain why they use JRuby for Thoughworks Studio? She mentions that JRuby is not too disruptive for many of these Enterprises.</p> <p>Why is Sun doing this? For quite some years sun was saying “The answer is Java. What is your question?”. Tim mentions is their business to help developers by selling them servers, the Solaris OS, Netbeans, Big Computers (2TB ram) starting at only $535000.-, Identity Management Solutions. The problem they are trying to solve, is that Sun is good a selling big boxes to bank, but they need to grow their business, and growth comes from the developers…the CEOs will follow. That’s why we love you…because we are greedy.</p> <p>So how do we do money on free products? There is a three part mantra. 1) Adoption. If people don’t adopt your tools you won’t make money. Free removes friction to adoption. 2) Deployment. Once they have adopted you tools, they need to use it. Only once it’s deployed, customers see the value of your tools. 3) Monetization at the point of value. The hypothesis is that no serious business, will deploy any serious applications, and will not be ready to pay to support it. This will lead to greater prosperity down the road.</p> <p>Let’s assume Rails succeeds beyond our wildest dreams. Are all our problems over? In the best possible scenario…Java will never go away, .Net will never go away, <span class="caps">PHP</span> will never go away, Cobol will never go away. The number of applications written is growing. The Network is heterogeneous, and the systems we deploy will need to cooperate. <span class="caps">DEAL</span> <span class="caps">WITH</span> IT. It’s arguably an unsolved problem, it’s a tax on our creativity. There a couple of solutions. 1. Run ruby on the Java platform. 3. The Community.</p> <p>How do we get all these things talking to each other? The right answer is <a href=""><span class="caps">REST</span></a>.</p> <p>What’s said on Twitter during the keynote:<br /> <img src="" border="0" height="408" width="764" alt="20070519RailsConfTwitter.gif" align="" /></p> <h2>Custom Rails Helpers: Keeping Your Views <span class="caps">DRY</span> by Glenn Vanderburg</h2> <p>There are Rails APIs you never heard off unless you are writing helpers.</p> <p><b>Simple Helpers</b></p> <typo:code <p>def sort_header(field, label=field.titleize)<br /> content_tag(:th, :class => ‘sort_header’) do<br /> link_to label, :sort => field<br /> end<br /> end</p> </typo:code> <p>Good for small stuff. For larger amounts use strings <<<span class="caps">EOS</span>, %{}, StringIO. Or use Biulder:XmlMarkup. render:partial.</p> <p>Use <span class="caps">HTML</span> options<br /> <typo:code<br /> def sort_header(field, label=field.titleize, html_options={})<br /> options = {:class=> ‘sort_header’).merge(html_options)<br /> content_tag(:th, :class => ‘sort_header’) do<br /> link_to label, :sort => field<br /> end<br /> end</p> </typo:code> <p><b>Generating Javascript</b></p> <p>What about this?<br /> <typo:code<br /> def filter_select(name, select_options)<br /> field_id =“field_#{name}”<br /> select_tag(name, build_option_tags(select_options), <br /> {:id => field_id})<br /> observe_field(field_id, :on => ‘changed’,<br /> :function => “$(‘filter_form’).submit(); return false;”<br /> end</p> </typo:code> <p>Javascript Helpers</p> <ul> <li>Rails Recipes, Recipe 2.</li> <li>When other helpers generate javascript, use them</li> <li>application.js</li> </ul> <p>Learn Javascript, learn Prototype.</p> <typo:code <p>def filter_select(name, select_options)<br /> field_id =“field_#{name}”<br /> select_tag(name, build_option_tags(select_options), <br /> {:id => field_id})<br /> observe_field(field_id, :on => ‘changed’,<br /> :function => “MyApp.change_filter();”<br /> end</p> </typo:code> <p><b>Form Builders</b></p> <p>form_for, field_for</p> <typo:code <p>class TaggedBuilder < ActionView::Helpers::FormBuilder<br /> def text_field(label, *args)<br /> end<br /> end</p> </typo:code> <p>Glenn will put the slides <a href="">online</a>.</p> <h2>Date Warehouses with ActiveWarehouse by Anthony Eden</h2> <p>The talk is in line with the tutorial on</p> <ul> <li><a href=""></a> and on</li> <li><a href=""></a></li> </ul> <ul> <li>ActiveWarehouse::Dimension</li> <li>ActiveWarehouse::Fact</li> <li>ActiveWarehouse::Cube</li> </ul> <typo:code <p>class RevisionReportsController < ApplicationController<br /> def index<br /> <code>report = ActiveWarehouse::Report::TableReport.new( :title => "Sales by Region", :cube_name => :sales, :column_dimension_name => :date, :row_dimension_name => :store ) render_report(</code>report)<br /> end<br /> end</p> </typo:code> <p><b>Dimension Mixin</b></p> <p>acts_as_hierarchy_dimension<br /> acts_as_slowly_changing_dimension</p> <p><b>Data Builders</b></p> <p>rake warehouse:build_date_dimension<br /> rake warehouse:build_random_data # for testing</p> <p><b>Role-Playing Dimensions</b></p> <p>This uses views. ActiveRecord was extended to use views. Added migrations to views.</p> <p>script/generate dimension_view creation_date_view</p> <p><b>ActiveWarehouse <span class="caps">ETL</span></b></p> <p><span class="caps">ETL</span>=Extract, Transform, Load. Or how to get data into the datawarehouse. This is a separate project installed as a gem.</p> <p>Foreign Key Lookup Transform, Decode Transform, Type Transform, SHA1 Transform, String to Date Transform, Date to String Transform, Default Value Transform, Ordinal Transform, Custom Transform, Row Level Transform.</p> <p>Loading. Write to multiple output, truncate tables with preprocessor, bulk load through adapters (that support it).</p> <p><b>Who is using ActiveWarehouse</b></p> <ul> <li>blurb. 16 Dimension Tables, 8 Fact Tbles, Orders, User Registration, Uploads.</li> <li>rubyforemmmultiworks.</li> <li>Department of Defense. Used for portions of a safety data warehouse. Provided the initial genesis of the ActiveWarehouse plugin.</li> </ul> <p><b>What’s Next?</b></p> <ul> <li>Improvement in the Aggregation and Querying systems</li> <li>Efficient Construction and Storage of Aggregates</li> <li>Support for <span class="caps">MDX</span> for querying</li> </ul> <p><b>Resources</b></p> <p>Anthony recommends the following book which highlights many of the principals applied in ActiveWarehouse:</p> <p><a href="">The Data Warehouse Toolkit: The Complete Guide to Dimensional Modeling</a></p> <h2>Open Mic</h2> <p>(Let me know if I’ve got your names wrong!).</p> <p><b><a href="">MasterView Template Plugin/Gem</a></b></p> <p>By Jeff Barczewski and Deb Lewis<br /> <a href=""></a><br /> <a href=""></a></p> <p>Generates a template and partials from an existing html design by simply adding some tags.</p> <p><span class="caps">WYSIWYG</span> + Designer Friendly<br /> Has a plugin in and is documented</p> <p><b><a href="">YikeSite</a></b></p> <p>Jeff Warrick from Canada<br /> Simple Content Management.<br /> A different approach to content management. 99% his client need to make edit at one small thing on a site. Adds an Admin and Edit button on a page and allows simply to change the content, wording, and formatting. Uses liquid template. The Admin interface allows to add, edit, and remove pages and organize them hierarchically.</p> <p><b><a href="">revolutionhealth</a></b></p> <p>by Eric Battin.<br /> Health portal. You can create a page from any content of the portal, or create new content. Eric shows the clipping functionality. Pretty slick. Then he shows the edit mode of a page.</p> <p>See <a href="revolutiononrails.blogspot.com">revolutiononrails.blogspot.com</a></p> <p><b>cnu config</b></p> <p>Allows to overlay yaml files and access the configuration through a “dot” syntax.</p> <p>CnuConfig.config.ConfigDemo(“url”)<br /> CnuConfig.config.moch_object.moch_method(“IL”, “Chicago”)<br /> CnuConfig.confi.RailsConf.year</p> <p>Will be packaged as a gem and will be on Rubyforge next week.</p> <p><b><a href="">CruiseControl.rb</a></b><br /> by Alexey Verkhovsky</p> <p>This are the step required to install and use cruisecontrol rb.</p> <p>Download cruisecontrolrb-1.1.0<br /> cruise add MyProject —url<br /> cruise start<br /></p> <p><b><a href="">Group Discussion Tool</a></b><br /> By Bryan Alan. <br /> He wrote the openid plugin. The Group Discussion Tool is build around openid.<br /> <a href=""></a><br /> OpenId is pretty awesome.</p> <p><b><a href="">divinecaroline</a></b><br /> A content management system. They wrote a plugin to do distributed page caching.<br /> Only works on Mac and Linux. <br /> (I didn’t get the name of the plugin)</p> <p><b>mywaves</b></p> <p>Share, watch, and publish video to mobile phones. Lot’s of video channels, i.e. RailsConf. You can put a channel on your blog or myspace page.</p> <p><img src="" border="0" height="145" width="300" alt="20070519_mywaves.jpg" align="" /></p> <p><b><a href="">The Mole Plugin</a></b></p> <p>Fernand Galiana<br /> liquidrail.com</p> <p>Awesome plugin allowing to determine how your application is <span class="caps">REALLY</span> used.</p> <p><img src="" style="width:450px;height:350px;"/></p> <p><b><a href="">Statisfy.net</a></b></p> <p>Last year he tried to demonstrate something (valuesource) but his computer didn’t work. Now he works on BountySource</p> <p><a href="">Statisfy.net</a> real time status usage of your site. Where people come to your application visualized on google maps.</p> Java == Poo # => true? 2007-05-19T00:00:00-07:00 <p>At Tim Bray’s RailsConf keynote, he said, “Java is a 3-legged stool.” Does that mean Java is a pile of crap with three legs? I’m not sure. I’m pretty sure it’s not what he meant, but I bet some people might agree or think it has even more legs.</p> Will Marcel Molina Steal Matz's Ruby Super Powers 2007-05-18T00:00:00-07:00 <p>I didn’t start watching <a href="">Heroes</a> until after I heard <a href="">Rich Kilmer</a> and <a href="">Marcel Molina</a> talking about it while putting the badges together for RubyConf 2006 in Denver. Had I watched it before maybe I would have been a little scared of Marcel (<a href="">Sylar</a>), but he was very nice and didn’t <i>seem</i> like a threat to the Ruby world at all.</p> <p>So, why be scared of Mr. Molina? You be the judge.</p> <typo:code <p>class MarcelMolina<br /> include Heroes</p> def <=>(other_hero) other_hero.name == ‘Sylar’ ? 0 : 1 end <p>end</p> </typo:code> <p><img src="/files/180px-Sylar3.jpg" width="92" height="116" /> == <img src="/files/marcel.jpg" width="92" height="116" /> # => true</p> RailsConf 2007 - Day 2 2007-05-18T00:00:00-07:00 <p>Note: Check out the RailsConf Wiki and the <a href="">presentation page</a></p> <p>Chad Fowler is starting the keynote introduction. 1600 developers are at the keynote. He makes a passionate speech about how Rails is changing how we think about software and how Rails impacted the industry. An now Rich Kilmer introduces the person that introduced him to Textmate: <span class="caps">DHH</span>.</p> <h2>A peek at Rails 2.0</h2> <p>Celebrating what we have</p> <ul> <li>> 1 million downloads</li> <li>Hundreds of plugins</li> <li>~10k people on rubyonrails-talk</li> <li>He asks who is getting paid in one form or another using Rails and a large part the participants raise their hands.<br /> ( Books: many Rails books in many languages. Surpassed <span class="caps">PHP</span>, Perl and Python (source O’Reilly Radar).</li> <li> indicates over 100 countries where people do Rails.</li> <li><span class="caps">IDE</span>: CodeGear, Textmate, NetBeans, JetBrains, Aptana</li> </ul> <p>Rails 2.0</p> <ul> <li>It’s not gonna change everything you know, it’s gonna be humble.</li> <li>No new ‘great’ idea.</li> <li>The experiment worked! (RESTFul resource)</li> <li>The world of resources is a better, greener place.</li> <li>Rails 2.0 will focus more on the <span class="caps">REST</span> convention</li> <li>Routes</li> </ul> <typo:code <p>map.namespace(:admin) do |admin<br /> admin.resources :products,<br /> :collection => {:inventory => :get},<br /> :member => {:duplicte => :post},<br /> :has_many => [:tags, :images, :variants],<br /> :has_one => :seller<br /> end</p> </typo:code> <ul> <li>David now demos the new scaffolding that use the resource approach of working with things.</li> </ul> <p>./script/generate scaffold persone name:string create_at:time</p> <ul> <li>He adds new format format.csv to support exporting as comma separated text.<br /> You can easily connect to this services:<br /> <typo:code<br /> require ‘active_resource’<br /> class Person < ActiveResource::Base<br /> self.site = “”<br /> end<br /> p = Person.find 1<br /> </typo:code></li> </ul> <ul> <li>Beyond <span class="caps">CRUD</span> you can custom methods, Person.find :all, :params => {:name => ’d’}</li> <li>This all works today.</li> <li>Action Web Service is no longer service with Rails 2.0. ActiveResource is.</li> <li>Friends and allies: Ajax, <span class="caps">REST</span>, Atom, OpenID</li> </ul> <p><b>9 other things I like about rails 2: </b></p> <p>1) Breakpoints are back (ruby_debug)</p> <p>2) <span class="caps">HTTP</span> Performance</p> <typo:code <p><!-- :cache => true gzips all javascript and stylesheet in one file i.e. prototype, css get zipped down to 35K from 200k --><br /> <%= javascript_include_tag :all, :cache => true <span>> <br /> <</span>= stylesheet_link_tag :all, :cache => true %></p> </typo:code> <p>3) Query cache. <span class="caps">DHH</span> loves free performance</p> <p>4) action.mime_type.renderer</p> </typo:code> <typo:code <p>people/index.html.erb<br /> people/index.xml.builder<br /> people/index.rss.erb<br /> people/index.atom.builder<br /> def index<br /> respond_to do |format|<br /> format.html<br /> format.xml<br /> format.rss<br /> format.atom<br /> end<br /> end</p> </typo:code> <p>5) config/initializers. One file per configuration in initializers folder</p> <p>6) Sexy migrations (just nicer)<br /> <typo:code<br /> create_table :people do |t|<br /> t.integer :account_id<br /> t.string :first_name, :last_name<br /> end</p> </typo:code> <p>7) <span class="caps">HTTP</span> Authentication. authenticate_or_request_with_http_basic</p> <p>8) The <span class="caps">MIT</span> assumption. ./script/generate plugin now generates a default <span class="caps">MIT</span> license file.</p> <p>9) Spring cleaning. Deprecated features of 1.2 will be removed. In-place editor will be moved to plugins.</p> <p>That’s pretty much it. Thank you.</p> <h2>Building Community Focused Apps with Rails by Dan Benjamin</h2> <p>Rails is the ideal platform for Web 2.0. Fast prototyping and proof of concept. Prototype becomes the product. Conducive to collaboration with developers and designers. Dan is going to talk about <a href="">Cork’d</a>. Currently 20000 users.</p> <p>Make a Plan.</p> <ul> <li>Treat your application like a product and your idea like a business. Just because it’s a good idea doesn’t mean it’s gonna be automatically successful.</li> <li>Stay Agile. Resist big infrastructure.</li> <li>Build the Right Team. Keep it light.</li> <li>Determine Ownership.</li> <li>Have a Revenue Stream (ads don’t count)</li> <li>Focus on Simplicity. Don’t build features just because you think they are cool.</li> <li>Don’t Release a Public Beta. They had two private betas. They learned from a handful set of people rather than from a large group.</li> <li>Know Your Audience. Be your Audience</li> </ul> <p>Build the App.</p> <ul> <li>Think Like a Designer.</li> <li>Consider the Fold.</li> <li>Avoid Big Migrations. User entered data can be challenging.</li> <li>Collaborate.</li> <li>The Rails Layouts Makes Designers Happy.</li> <li>Common Rails Collaboration Tools. Subversion, Capistrano, Campfire, Basecamp, Lighthouse.</li> <li>Don’t Repeat Yourself: Use Plugins. acts_as_authenticated, attachment_fu, acts_as_taggable, exception_notification, open_id_authentication, ymlr4r geocode</li> <li>Take “Code Vacations”</li> </ul> <p>Get Noticed</p> <ul> <li>“It’s Google’s World, We Just Live in It.”</li> <li>Use Smart URLs. /wine/view/5748, /authors/danbenjamn</li> <li>Leverage Markup. Google reads metatags.</li> </ul> <p>Recruit Members</p> <ul> <li>Make It Obvious and Easy to Signup</li> <li>Ask Only for What’s Truly Necessary</li> <li>Ask for Everything but Require (Almost) Nothing</li> <li>Limit Non-Members</li> </ul> <p>Keep Them Coming Back for More</p> <ul> <li>Make Frequent Improvements</li> <li>Respond Positively to Your Members</li> <li>Create A Developer Network</li> <li>Share Your <span class="caps">API</span></li> <li>Find Good Partners</li> <li>“If You Do Things Right, People Won’t Know You’ve Done Anything At All.”</li> <li>Just Ship It</li> </ul> <h2>How We Used Apollo and Rails to (start to) Build an Agile Project Management App by Christopher Haupt and Chris Balley</h2> <p>They are part of Adobe’s Consumer Hosted Applications and Online Services group. They use whatever technology is right for the job, Flex, Rails and dozens of other technologies. They use Scrum and are geographically dispersed teams, in Germany, India, US.</p> <p>Why Did We Choose Apollo and Rails?</p> <ul> <li>Learning Exercise</li> <li>Offline Support</li> <li>Maturing Tools</li> <li>Leverage our Rails Experience</li> <li>Cross Platform</li> <li>Installers</li> </ul> <p>Why not <span class="caps">AJAX</span>?</p> <ul> <li>Offline and Partially Connected</li> <li>File System Access</li> <li>Drag and Drop with Native OS</li> </ul> <p>Now they are demoing Maptacular, an Apollo applications.</p> <p>Combining Apollo and Rails: Communication</p> <ul> <li>Flash Side <ul> <li><span class="caps">AMF</span></li> <li><span class="caps">SOAP</span></li> <li><span class="caps">REST</span> <== they used that</li> </ul></li> <li><span class="caps">HTML</span> Side <ul> <li><span class="caps">AJAX</span> techniques</li> </ul></li> <li>Hybrid <ul> <li>Ue <span class="caps">DOM</span> bridge to use the one you are comfortable with.</li> </ul></li> </ul> <p>Combining Apollo and Rails: Quirks</p> <ul> <li>Flex’isms</li> <li><span class="caps">RESET</span> can be a pain <ul> <li>Use _method hacks for <span class="caps">PUT</span>, <span class="caps">DELETE</span>, <span class="caps">HEAD</span></li> <li>Pass a body on everything other than <span class="caps">GET</span></li> </ul></li> <li>Some <span class="caps">HTTP</span> headers can’t be used, or problematic on a <span class="caps">GET</span></li> <li><span class="caps">HTTP</span> Status codes not accessible <ul> <li>Use URLoader to get <span class="caps">HTTP</span> Status Codes</li> </ul></li> <li>dasherize-is-unhealthy-to-your-actionscript-code</li> <li>Migrating to newer Apollo Builds <ul> <li>ApolloApplication .vs. Application (for transparency)</li> </ul></li> </ul> <p>Now they move on to Code Snippets. The sample code can be found on the Apollo Labs.</p> <ul> <li>Online/Offline (Event.NETWORK_CHANGE). Notifies if network change but doesn’t tell if network is up or not. Solution: use URLoader to ping the network (they ping google.com)</li> <li>Video Capture, File IO, Doing your own Chrome</li> </ul> <p>Chris now demonstrate some community create applications.</p> RailsConf 2007 - Day 1 2007-05-17T00:00:00-07:00 <p>Here we go, RailsConf 2007, has started. It’s bigger than ever, more tracks, more sessions. This is the first day where they provide full or half-day tutorials sessions. I will try to cover the different sessions I will attend so stay tuned.</p> <p>Today I will attend: “Scaling a Rails Application from the Bottom Up.” and “Harnessing Capistrano.”</p> <h2><b>Scaling a Rails Application from the Bottom Up. by Jason Hoffman</b></h2> <p>Jason Hoffman, <span class="caps">CTO</span> of Joyent. Did also form Textdrive.</p> <p>Six part presentation:</p> <p>I. Introduction and foundation<br /> II. Where do I put stuff<br /> <span class="caps">III</span>. What stuff?<br /> IV. What do I run on this tuf?<br /> V. What are the patterns of deployment?<br /> VI. Lessons learned</p> <p>His presentation will answer the following questions:</p> <ul> <li>What is a “scalalble” application?</li> <li>What are some hardware layout?</li> <li>Where do you get the hardware?</li> <li>How do you pay for it?</li> <li>Where do you put?</li> <li>Who runs it?</li> <li>How do you watch it?</li> <li>What do you need relative to an application?</li> <li>What are the commonalities of scalable web architectures?</li> <li>What are the unique bottlenecks for Ruby on Rails applications?</li> <li>What’s the best way to start so you make sure everything scales?</li> <li>what are to common mistakes?</li> </ul> <p>Maybe it’s a little early, or I am not awake, but the talk seems a little slow. But Jason seems to do a good job at describing how the different people (developer, sysadmin, …) see scalability.</p> <p>Ease of management is on log scale. It’s not just a Rails issue. A $5000 Dell 1850 costs $1850 to power over 3 year.</p> <p>This is a really good presentation from a point of view of what is involved to build data center. I should have read better the <a href="">description</a> of the presentation.</p> <p>So I am going to move over to Thomas Fuchs presentation:</p> <h2><b>Is JavaScript Overrated? Or: How I Stopped Worrying and Put Prototype and script.aculo.us to Full Use by Thomas Fuchs</b></h2> <p>I am just tuning in to his presentation and he is showing of how to use selectors with Prototype.</p> <p><span class="caps">DOM</span> traversal: <br /> <typo:code<br /> $(‘blech’).previous(‘ul’).down(‘.somesuch’,2)<br /> $(‘homo-sapiens’).descendantOf(‘australopothecus’)</p> </typo:code> <p>Element methods:<br /> <typo:code<br /> $(‘a_div’).update(‘blah’).show().setStyle({opacity:0.5});<br /> $(‘myform’).focusFirstElement();<br /> $(‘person-example’).serialize();<br /> Element.addMethods(‘form’) {<br /> valid: function(element) {<br /> // code to valid form<br /> }<br /> }</p> </typo:code> <p>What’s new in Prototype 1.5.1:</p> <ul> <li>speedier $$</li> <li><span class="caps">CSS</span> 3 Selectors</li> <li>$(‘form’).request()</li> <li>String .includes .times .toPaddedString(8,2)</li> <li><span class="caps">JSON</span> support i.e. new Date().toJSON();</li> <li>$(‘blah’).firstDescendent()</li> <li>throw $continue deprecated use “return” instead</li> <li>Safari issues fixed</li> <li><span class="caps">YAML</span> compatible</li> </ul> <p><span class="caps">DOM</span>, Events, Forms, Position:</p> <ul> <li>new Element(tagName, attributes);</li> <li>$(‘blech’).insert(html|object, position)</li> <li>$(‘blech’).wrap(‘span’);</li> <li>$(‘country’).setValue(‘AT’);</li> </ul> <p>Function.prototype: curry(), wrap(), defer(), delay()<br /> Q: When is the next release of Prototype? <br /> A: When it’s ready.</p> <p>A 10 minute break now, the Thomas is going to present Scriptaculous Effects.</p> <p><b><a href="">script.aculo.us</a></b> adds advanced User Interface interaction to the <span class="caps">DOM</span>. Extracted from Real-World applications. Started with Fluxiom. The two main parts are Visual effects and Drag&Drop. Today we will only look at the Visual Effects. They are other parts such as Autocompleter, In-Place Editor, Slider control, <span class="caps">DOM</span> Builder, and Unit testing. They won’t be more advanced components.</p> <p>Effects engine: the ideas behind the engine is timeline based animations.</p> <p>Core Effects:</p> <ul> <li>Effect.Move</li> <li>Effect.Opacity</li> <li>Effect.Highlight</li> <li>Effect.ScrollTo</li> <li>Effect.Morph // 1.7+</li> <li>Effect.Parallel</li> </ul> <p>Based on the Effect.Base.prototype class.<br /> Effect life cycle: intialize(), setup(), update(), finish(). Each frame calls update().</p> <typo:code <p>Effect.DefaultOptions = {<br /> transition: Effect.Transitions.sinoidal,<br /> duration: 1.0,<br /> fps: 100,<br /> sync: false,<br /> from: 0.0,<br /> to: 1.0,<br /> delay: 0.0,<br /> queue: ‘parallel’<br /> }</p> </typo:code> <p>Morphing: came out with Scriptaculous 1.7.</p> <typo:code <p>$(‘mydiv’).morph(‘font-size:20px; color:“#abcdef”);<br /> $(’mydiv’).morph(‘warning’); //limited to top level classname</p> </typo:code> <p>TimeLines: <br /> <typo:code<br /> new Effect.Blah(‘element_2’)<br /> new Effect.Blah(‘element_2’, {duration:0.6, delay:0.3});</p> </typo:code> <p>You have to be careful with effects created that will run in parallel as the javascript engine are not multi-thread. Better solutions is to use queues:<br /> <typo:code<br /> new Effect.Blah(‘element_1’, {queue:’end’});<br /> new Effect.Blah(‘element_2’, {queue:’front’});</p> </typo:code> <p>and use scope:<br /> <typo:code<br /> new Effect.Blah(‘element_1’, {queue:{scope:’blech’}});<br /> new Effect.Blah(‘element_2’, {queue:{scope:‘blech’, position:’end’}});<br /> new Effect.Blah(‘element_3’, {queue:’front’});</p> </typo:code> <p>Utilities:<br /> <typo:code<br /> Element.toggle(‘element’, ‘blind’);<br /> Element.tagifyText(element);<br /> Element.multiple(‘element’, Effect.Fade, {speed:0.05});</p> </typo:code> <p>Do it yourself: Thomas now shows how to create an Effect programatically.</p> <p>Future features:</p> <ul> <li>Sound without Flash (it’s already in the beta release). Sound.paly(‘sword.mp3’). It uses native sound implementation with Quicktime as fallback.</li> <li>Adjust to new Prototype features. $(‘blech’).fade(); $(‘blech’).slowlyReveal();</li> </ul> <p><b>Part IV: Testing</b></p> <p>Thomas is flying through testing…</p> <ul> <li>assert(true)</li> <li>assertEqual(expected, actual)</li> <li>assertEnumEqual(expected, actual)</li> <li>assertNotEqual(expected, actual)</li> <li>assertMatch</li> <li>assertIdentical</li> <li>assertNotIdentical</li> <li>assertType</li> <li>assertRaise</li> <li>assertRespondTo</li> <li>assertVisible(element)</li> <li>assertNotVisible(element)</li> <li>info(message)</li> </ul> <p>Mostly unit testing, but some functional testing is available.<br /> Most assert take a message. I.e. assertXYZ(params, message)</p> <ul> <li>wait(milliseconds, method) // should be last statement in test, but can be nested.</li> <li>rake test:javascripts (browser will popup). Done with the javascript_test plugin. Launches the web server (WEBrick), then controls the browsers (Safari, Firefox, IE), the browser then calls the web server, and list the results (<span class="caps">SUCCESS</span>, <span class="caps">FAILURE</span>, and <span class="caps">ERROR</span>)</li> </ul> <p>Resources:</p> <ul> <li><a href=""></a></li> <li><a href="">wiki.script.aculo.us/scriptaculous/</a></li> <li><a href="">Book: Prototype and script.aculo.us by Pragmatic Programmer</a></li> <li><a href="">Book: Prototype and Scriptaculous in Action by Manning</a></li> <li><a href="">Book: Ajax on Rails by O’Reilly</a></li> </ul> <h2><b>JRuby talk by Charles Nutter and Thomas Enebo</b></h2> <p>(note taken by Robert Hall, thanks man!)</p> <ul> <li>1.8ish—based on Ruby 1.8.5</li> <li>Gems 0.9.1 is pre-installed</li> <li>Partially compiled—about 80% of Ruby code compiles…rest is run in <span class="caps">JIT</span> mode</li> <li>Ruby 1.8 strings supported. Works with ActiveSupport::MultiByte</li> <li>Ruby 2.0 String support coming</li> <li>Most Ruby apps should work on JRuby <br /> —most gems just work<br /> —Red Cloth, Blue Cloth<br /> —Hpricot</li> <li>Typical Rails commands just work</li> <li>ports: Mongrel ported, Hpricot ported, RMajick in progress</li> <li>Ruby thread <span class="caps">API</span> supported<br /> <del>- native-threaded 1 JRuby thread=1 system thread <br /> -</del> supports thread pooling</li> <li>performance comparable to C Ruby impl<br /> —Rdoc has issues<br /> —<span class="caps">CLI</span> performance slow</li> <li><span class="caps">JDBC</span> support strong<br /> —mySQL support strong<br /> —some postgres issues<br /> —some Oracle users <br /> —many others</li> <li>ActiveRecord <span class="caps">JDBC</span></li> <li>No native extension support</li> <li>Goldspike—JRuby deployment tool<br /> —Rails plugin for building <span class="caps">WAR</span> files<br /> —app server agnostic <br /> —Can be deployed to Java app server as <span class="caps">WAR</span> file</li> <li>Deployment— MOngrel supported..some issues (forking, process management doesn’t work)</li> <li>Access to Java EE features (<span class="caps">JMS</span>, <span class="caps">JPA</span>, <span class="caps">JTA</span>)</li> <li>Java libraries can be wrapped</li> <li>Coming soon<br /> —A Grizzly/GlassFish V3 option <br /> —Lightweight, gem-installable like Mongrel<br /> —Concurrency, pooling mulit-app like <span class="caps">WAR</span></li> <li>Mephisto demo</li> <li>Main idea—- Ruby as the programming language, Java for the platform and libraries</li> <li>Best of all worlds <br /> <del>-Ruby or Rails as the appl layer<br /> —Java libraries alone or as ported/wrapped gems<br /> —Java based services</del>-legacy app integration<br /> —The <span class="caps">JVM</span></li> <li>Acceptable to today’s enterprise<br /> —Java to ‘them’, Ruby to you</li> <li>Calling Java from Rails demo<br /> —<span class="caps">RSS</span> reader demo..calling Java library from Rails code</li> <li>Tools—<br /> Textmate, Emacs, Vi(m), notepad<br /> <del>- missing some features<br /> -</del> code competion?<br /> <del>- jump to declaration? <br /> -</del> rename variables?<br /> — popup Rdoc?</li> <li>Presenters claim Best Ruby <span class="caps">IDE</span> Available is NetBeans (milestone 9)<br /> <del>- code completion <br /> -</del> smart syntax highlightings (for Ruby code, <span class="caps">RHTML</span> files, etc)<br /> — Rdoc support</li> <li>Demoed a cool Ruby shell like <span class="caps">IRB</span> implemented in Swing..built into NetBeans</li> <li>Jruby 1.0 almost ready</li> </ul> <p><span class="caps">LUNCH</span>: will be back at 1:30pm</p> <h2><b>Harnessing Capistrano by <a href="">Jamis Buck</a></b></h2> <p>Jamis will focus Capistrano 2.0 today. Some things will not be backward compatible with Capistrano 1.0.</p> <p>His slides are online at <a href=""></a>.</p> The New SearchCoders Apollo Dashboard 2007-05-15T00:00:00-07:00 <p><img src="" border="0" height="172" width="497" alt="20070514_searchcodersicons.jpg" align="" /></p> <p>The new version of SearchCoders is not just a pretty face, Tom and Robert also worked hard adding quite some neat and useful functionality like chatroom, notes and favorites. Searching is faster than ever. The new Searchcoders.com <a href="">Dashboard</a> is Still the best way to find useful Flex related information on the net.</p> <p><img src="" border="0" height="332" width="320" alt="20070514_searchcoders.jpg" align="" /></p> RubyKagi2007 (日本 Ruby 会議 2007) 2007-05-15T00:00:00-07:00 <p><img src="" border="0" height="93" width="445" alt="20070515_rubykaigilogo.gif" align="" /></p> <p>I would love to go once to Japan to attend the (now) RubyKaigi conference. This year won’t work for me…hey Lee, what about next year?</p> <p>Find more info <a href="">here (in Japanese)</a> and <a href="">here (in Google translated English)</a></p> Sol's RailsConf 2007 picks 2007-05-10T00:00:00-07:00 <p>are <a href="">here</a>. See you in Portland.</p> RailsConf 2007 - Here we come! 2007-05-09T00:00:00-07:00 <p>I just completed a first pass at setting my schedule for RailsConf. <br /> <a href="">Check it out</a> at MyConfPlan. In any case go check out MyConfPlan which is a pretty cool Rails application.<br /> As usual I am looking forward meeting many of the people I have met last year. Also if you are from Switzerland and doing Rails work, try to hunt me down, I would love to talk to you. It’s also fun that we are going to meet <a href="">Kirk</a> again, and “old” mate from Denver that is now leaving in Portland.</p> Lee's RailsConfPlan at MyConfPlan 2007-05-09T00:00:00-07:00 <p>Following <a href="">Daniel’s</a> lead, here are the <a href="">talks</a>.<br /><br /><a href="">Chris</a>, <a href="">Sol</a> and <a href="">Nick</a>… tag… your turn.<br /></p> Forgot Password? 2007-05-09T00:00:00-07:00 <p>I did it again…forgot my password. Now if everyone could offer an openid login like <a href="">Highrise</a>. This time it happened on <a href="">myconfplan</a>, while I was organizing my schedule for next weeks RailsConf. As I didn’t find a link to reset the password on myconfplan, I send an email to their support. <a href="">Dr Nic</a> replied promptly and said he didn’t implement this yet on this wedsite, but he could manually reset the password. Well, recently I implemented that feature for MySpyder.net (one of our forthcoming web applications). So I send him some code snippets. Not sure if <a href="">Dr Nic</a> will use them, but maybe some of our blog readers may be interested, so here we go.</p> <p>They are several ways to implement a "Forgot Password? This time we choose to send out a “reset password” link that is valid for 24 hours. This link lets the user login, bypassing the standard login, and showing the change password screen.</p> <h3>First lets add a migration.</h3> <typo:code <p>class ForgotPassword < ActiveRecord::Migration<br /> def self.up<br /> add_column :users, :reset_password_code, :string<br /> add_column :users, :reset_password_code_until, :datetime<br /> end</p> def self.down remove_column :users, :reset_password_code remove_column :users, :reset_password_code_until end <p>end</p> </typo:code> <h3>“Forgot password” form.</h3> <p>Then add a “forgot password” form, allowing the user to submit the email to which the “reset password” link will be emailed. When the form is submitted, the controller creates a ‘reset password code’ that is valid for one day, and sends an email to the user.</p> <typo:code def forgot_password user = User.find_by_email(params[:email]) if (user) user.reset_password_code_until = 1.day.from_now user.reset_password_code = Digest::SHA1.hexdigest( “#{user.email}#{Time.now.to_s.split(//).sort_by {rand}.join}” ) user.save! UserNotifier.deliver_forgot_password(user) render :xml => “<errors><info>Reset Password link emailed to #{user.email}.</info></errors>” else render :xml => “<errors><error>User not found: #{params[:email]}</error></errors>” end end </typo:code> <h3>Send email with the ‘reset password’ link.</h3> <p>When the user receives the “reset password” email and clicks the link to reset the password, the reset_password method is invoked on the controller. The user associated with the “reset_code” is found, and if the the reset_code is not yet expired the user is automatically logged-in and redirected to the account page where he can change his password. Note that by adding an expiration attribute for the code, we don’t need to run a cleanup batch process to invalidate these codes. Not in the following code we redirect to a “.swf” file. This was an early experiment where the user interface of the application was written in Flex. We are currently rewriting it to use a more traditional html and css approach.</p> <typo:code def reset_password user = User.find_by_reset_password_code(params[:reset_code]) self.current_user = user if user && user.reset_password_code_until && Time.now < user.reset_password_code_until redirect_to logged_in? ? “/MySpyder.swf?a=account” : “/MySpyder.swf?a=login” end </typo:code> <p>The email is simply send using the following ActionMailer.</p> <typo:code <p>class UserNotifier < ActionMailer::Base<br /> def forgot_password(user)<br /> setup_email(user)<br /> @subject += ‘MySpyder.net – Reset Password’ <br /> @body[:url] = “{user.reset_password_code}”<br /> end</p> protected def setup_email(user) @recipients = “#{user.email}” <code> <p><%= @user.email %>,</p> <p>You can reset your password by using the following link <%= @url %></p> <p>Thank your for using MySpyder.net</p> </typo:code> TextMate filetype detection for script/runner Rails scripts 2007-04-20T00:00:00-07:00 <p>So you’re building some righteous automation for your killer web 2.0 app, placing scripts in <code>RAILS_ROOT/script</code> that you can call from cron for nightly maintenance, etc. To bootstrap your rails environment, you decide to use the shebang feature of script/runner, available since <a href="">changeset 5189</a>. When you start to edit the script in TextMate (you <strong>are</strong> using TextMate, aren’t you?) there is no syntax highlighting to be found! It’s all plain text with no colors, and none of your ever-so-helpful keyboard macros work! Frightful. Well, take a deep breath, because together, we’re going to get the filetype detection magic working for you.</p> <p>Before we get started, it’s helpful to know how filetype detection works. TextMate does a couple of different types of filetype detection — the first is based off of the extension, so if you named your script with a <code>.rb</code> extension, you are probably wondering what in the world I’m rambling about. Dude. It just works.</p> <p>However, if you followed the rails convention for scripts, and did not use an extension with your filename, keep reading. The second type of detection works by scanning the so called “shebang” line at the top of the script which tells the shell (and in this case TextMate) which interpreter to use to evaluate your script — this is how we will tell TextMate that script/runner really means ruby.</p> <p>First of all, you’ll need to fire up the Bundle Editor and select “Languages” from the drop-down filter. Expand the “Rails” node, and then select the “Ruby on Rails” language. On the right side, you should see the definition being used by TextMate to detect the Ruby on Rails scope. If you have not modified your bundle, you’ll probably see that it is using a <code>fileTypes</code> to look for <code>.rxml</code> files. This is where we want to insert the following line:</p> <p>@ firstLineMatch = ‘^#!.*(script/runner)’;@</p> <p>Here’s a screenshot of what it should look like when you are done:<br /> <img src="" alt="" /></p> <p>Now go back to your script and enjoy all the colorized, scope-aware editing goodness that is TextMate!</p> Updated Rake Command Completion 2007-04-11T00:00:00-07:00 <p>Here’s another update to a <a href="">previous post</a>.<br /><br /><ol><li>A bug was fixed that caused the first task to be omitted from the task list.</li><li>A new feature was added to allow rake not to be the first command on the command line. Now you get completion for both rakes in the following command: <typo:code>rake db:migrate <span class="caps">VERSION</span>=0 && rake db:migrate</typo:code><br /></li><li>Another feature for quicker rake command completion development, <sarcasm>a feature everyone has been waiting for</sarcasm>. This feature just adds the rake completion script itself to the cache dependency list, so the cache will be refreshed while you are playing with the command completion script. This should make tweaking the script much easier in the future.</li></ol>As always, <a href="">enjoy</a>.<br /></p> Web Snapshot - a simple Apollo Application. 2007-04-05T00:00:00-07:00 <p>This simple Apollo Application takes 200×150 thumbnails of a Web page.</p> <p><b><a href=""><span class="caps">UPDATE</span>: See Web Snapshot – a simple Adobe <span class="caps">AIR</span> application</a><b/><br /> <div style="overflow:hidden"><br /> <img src="" border="0" height="268" width="586" alt="20070404_WebSnapshot.jpg" /></p> </div> <p>1) Enter the <span class="caps">URL</span> of the page you want to “Snap”.<br /> 2) Click the Thumbnail <br /> 3) A file dialog opens and asks for the File to save.</p> <p>Download it now: <a href="">WebSnapshot0.1.air</a> (right click and ‘Download Linked File’)</p> <p>It uses the new HTMLControl that Apollo provides, which behind the scene is a full fledged web browser based on <span class="caps">KTHML</span>. Check out an extract of the source code:</p> <typo:code> <p>//1. Load the page (asynchronously)<br /> var html:HTMLControl = new HTMLControl();<br /> html.width = 400;<br /> html.height = 300;<br /> html.load(new URLRequest(url));</p> <p>//2. Draw and scale the rendered html into a bitmap<br /> var snapshot:BitmapData = new BitmapData(200, 150); <br /> var matrix:Matrix = new Matrix();<br /> var scaleX:Number = 0.5;<br /> var scaleY:Number = 0.5;<br /> matrix.scale(scaleX, scaleY);<br /> snapshot.draw(htmlContent, matrix);</p> <p>//3. Save as <span class="caps">JPEG</span><br /> var jpegEnc:JPEGEncoder = new JPEGEncoder(75); <br /> var jpegData:ByteArray = jpegEnc.encode(snapshot); <br /> var stream:FileStream = new FileStream() <br /> stream.open(file, FileMode.<span class="caps">WRITE</span>); <br /> stream.writeBytes(jpegData);<br /> stream.close();</p> </typo:code> <p>I found the JPEGEncoder <a href="See">here</a>.</p> <p>And Daniel Dura had a <a href="">trick</a> to use a native save windows.</p> <p>Note I need to try this application on Windows…I’ll do that tomorrow.</p> <p>Enjoy!<br /> Daniel</p> <p><b>Update:</b>I quickly tried on Windows XP and the save doesn’t seem to work. Let me know how it works for you. Thanks.</p> <p><b><a href=""><span class="caps">UPDATE</span>: See Web Snapshot – a simple Adobe <span class="caps">AIR</span> application</a><b/></p> RailsLogVisualizer meets Apollo. 2007-03-29T00:00:00-07:00 <p><img src="" border="0" height="80" width="79" alt="20070328RailsLogVisualizerLogo.gif" align="right" />It’s not complete yet, but for the curious out there, here is a first and “ruff” version of the RailsLogVisualizer as a pure Apollo application. The previous version was an <span class="caps">OSX</span>.</p> <p>Things that broke during the port:</p> <ul> <li>Hourly breakdown of daily request.</li> <li>Breakdown ofHttp methods (Get, post, delete, head).</li> </ul> <p>Things I’ll need to add next:</p> <ul> <li>Improve progress indicator during file load and data parsing.</li> <li>Refactor interaction to allow keyboard support (basically rewrite using Cairngorm).</li> <li>Improve the File Browser.</li> <li>Support for RESTFull controllers (detect <em>method parameters (i.e. ?</em>method=put)).</li> <li>Add chart of action over time.</li> </ul> <p>How to install:</p> <p>1) If you haven’t yet downloaded the Apollo Runtime, get it here: <a href="">Apollo runtime (8Mb)</a>.</p> <p>2) Download the Rails Log Visualizer:<br /> <a href="">RailsLogVisualizer0.4.air (480Kb)</a> (right click and ‘Download Linked File’). On a side note don’t click directly as the mime type on this server for .air files is not yet set. For more info see Mike Chambers <a href="">entry</a> on the subject.</p> <p>3) Follow the installation steps that Apollo provides. It’s a little strange at first as they have a custom installer.</p> Apple TV on my TV 2007-03-24T00:00:00-07:00 <p>I picked up my Apple TV today from Fedex since I wasn’t expecting the delivery a day early. It is quite a good looking device, both physically and what it puts on the screen. The little remote might bother me a little as I’ve come to expect more from remotes since I got my Logitech Harmony remote. I wonder if Apple has included discrete codes in the device, so I can setup a macro on my remote that will turn on my receiver and start shuffling through my music. I don’t want to have to turn on my TV every time I want to listen to music.<br /><br />Anyway, time to play with it will have to wait since the Sweet 16 is on.<br /><br /><b>Update:</b> Well, 2 things I was hoping to do with the Apple TV don’t seem possible. I wanted to be able to control my music playing on the Apple TV from my laptop from anywhere in the house. The 2 ways I was thinking that would work would be by having it show up as remote speakers in iTunes for playing my local iTunes stuff, a la AirTunes, or by actually selecting the media that are on the Apple TV from the iTunes devices interface. Neither of these work. Is this a deal-breaker for me? I’m not sure yet, but playing music through my stereo without the TV on was one of the things I was expecting from the Apple TV.<br /> <br /><br /><b>Update 2:</b> So far I’ve mainly been using it for listening to music and it sounds fine, I just shut the TV off once the music starts. I don’t think it sounds better than my Archos Recorder v1 from 2002 running <a href="">Rockbox</a> through S/<span class="caps">PDIF</span>, but the UI is nicer looking. The only video I’ve watched so far was from <a href="">The Merlin Show</a> in hi-res, and it looked ok, better than SD but not as good as HD. I was able to hook up my Harmony remote to work reasonably well, but still discrete codes for playlists or something would make things better. These <a href="">instructions</a> helped get things setup with the remote. The slide shows are nice and look great, I think they are my wife’s favorite feature so far.<br /></p> Searchcoders.com - the fastest way to search the Flexcoders group. 2007-03-22T00:00:00-07:00 <p>Tom and Robert just announced that <a href="">Searchcoders.com</a> went live. I had the chance to have met Tom and Robert at the 360flex conference and they gave me access to the beta of searchcoders.com. I have used google, the yahoo groups and several other means before to search through all the messages of the <a href="">flexcoders group</a>, and searchcoders.com just works the best for me. This group just has so much great content and is the fastest way to solve many of the issues you may <br /> encounter once you start pushing what Flex has to offer. Thank to the community of sharing all this info and thanks to Searchcoders to make it more valuable and more accessible.</p> Best way to reset a form using Cairngorm? 2007-03-16T00:00:00-07:00 <p>I just implemented some code that doesn’t feel quite right, but works and would like your input on the matter. A Payment Entry form will be used by the user several times in the life of a Flex application to enter different type of payments. So every time the user wants to pay, the form needs to cleared. I can see these different ways:</p> <p>1. Ask the form to clear all it’s fields</p> <p>2. Bind the fields to a model, and reset the model with the default fields values</p> <p>3. Create a new instance of the form.</p> <p>It’s a rather complex form with multiple steps (tabs) and the user can quit the form at any moment. So option 1 and 2 needs to reset not only the fields but also the state of each component used on the form. Therefore I opted for approach three which goes as follows:</p> <p>The view contains following code that replaces the form with a new instance:</p> <typo:code> <p>public function clearPaymentInformation():void {<br /> var index:Number = content.getChildIndex(enterPaymentView);<br /> content.removeChild(enterPaymentView);<br /> enterPaymentView = new EnterPaymentInformation()<br /> content.addChildAt(enterPaymentView, index);<br /> }</p> </typo:code> <p>Now we have a PayInvoiceCommand that needs to invoke this function. That’s where what doesn’t feel right as the command has to know the view. With the newer version of Cairngorm the command gets information using a delegate, then updates the model. The view is bound to the model. But the command shouldn’t have to know the view. But for option 3 I didn’t find another way around. So I use an adapted version of the ViewLocator (as my view are not ViewHelpers) to which I register the view upon creation. Then in the command I use <br /> <typo:code><br /> WebComponentsViewLocator.getInstance().getView(“paymentView”).clearPaymentInformation();<br /> model.paymentViewState = WebComponentsModelLocator.PAYMENT_VIEW_STATE_ENTER_PAYMENT;</p> </typo:code> <p>Is there anyone out there that uses the same approach. If no, thats maybe a good answer that I am on the wrong track. Maybe I should issue an event from the command and have the view listen to the event. This would decouple both, but still doesn’t feel quite right. Maybe I just had a too long day. So any insight is welcome on how you deal with “reseting” forms in your Cairgorm applications. Thanks in advance.</p> <p>Time for MotorStorm!</p> Apple TV ships March 20th? 2007-03-09T00:00:00-08:00 <p>I just checked my order for an Apple TV that was placed on January 10th. It now says “Ships by: Mar 20” and “Delivers by: Mar 26”<br /></p> FlexBook 2007-03-07T00:00:00-08:00 <p><img src="" border="0" height="160" width="246" alt="20070306_FlexBook1.jpg" /><br /> <img src="" border="0" height="249" width="310" alt="20070306_FlexBook2.jpg" align="right" /></p> <p>This:</p> <p><br /></p> <p>Ely also showed some Apollo application that implements paged browsing…Like Firefox on steroids!!.</p> 360Flex - Day three 2007-03-07T00:00:00-08:00 <p>08:30am <strong>Last day’s Keynote by Ted Patrick</strong></p> <p>Tom Hobbs from the Experience Design group of Adobe presents how they developed the <a href="">Tour Tracker</a>.</p> <p><img src="" border="0" height="152" width="206" alt="20070307_TourTracker.gif" /></p> <p>And now Ted Patrick on the <strong>“Next Flex”</strong>. <strong>Fireworks</strong> image. FW implements scale 9. Is building a UI in Fireworks. In FW he can changes the properties of a Flex components. The he can export the image a <span class="caps">MXML</span> and images. Now a designer can prototype a Flex application without using Flex right from Fireworks. The next piece of the puzzle is <strong>“Borneo”</strong>, the next version of the Flex Data Services. Integrates with LifeCycle. The team has rewritten the mx:WebService to support better <span class="caps">SOAP</span>. <strong>Moxie</strong> is the next version of the Flex <span class="caps">SDK</span>. <strong>Flex and Apollo</strong> They are working on a Apollo plugin for Eclipse. Will be release at Apollo camp on March 16th. FlexBuilder will host an Apollo Project. <strong>Flex Ecosystem</strong> Flex is more than Adobe. It’s fantastic. He now shows some examples. <span class="caps">ESRI</span>, the world is not flat! <span class="caps">ESRI</span> <span class="caps">MIT</span> license on google code. They also created a whole environment to allow the community to contribute. They have put a demo out at.</p> <p><img src="" border="0" height="152" width="206" alt="20070307_Flexlib.jpg" /></p> <p>Last thing is <strong>Yahoo</strong>. Yahoo provides open apis to allow 3rd party developers to make their site better. At this conference Yahoo provided the AS3 apis to their different services. <strong>Flex <span class="caps">API</span> Posters</strong> Everyone on the 360Flex mailing list (at the conference or on the waiting list) will get an email and will get the Flex <span class="caps">API</span> poster. <strong>Next 360Flex</strong>.</p> <p>11:00am <strong>Model-Driven Integration Strategies by Joe Berkovitz</strong></p> <p>Modeling: describing software abstractly<br/> Integration: hooking up disparate components<br/> Strategy: an overarching approach to a problem<br/> Model-Driven Integration Strategy: An approach that uses abstract descriptions of drive the hookup of disparate components.<br/></p> <p>He will mostly talk about transformation tools: Axis, xdoclet, xdoclets2, <span class="caps">XSLT</span>. He will not talk about these tools directly but about <a href="">Hamachi</a>, a generator generator. Hamachi can generate Value Object, and Cairngorm classes. Hamachi use a language neutral <span class="caps">XML</span> format. All right…I am out of this talk. If I need Hamachi I will look it up, but some guys from Adobe are about to publish a FlexBuilder plugin for Cairngorm, that’s all I would need for now.</p> <p!</p> Mapping Rails Errors to Flex Fields. 2007-03-06T00:00:00-08:00 <p><img src="" border="0" height="164" width="528" alt="20070306_signup_errors.jpg" align="center" /></p> <p>We extended the <a href="wheelerstreet">com.wheelerstreet.utils.ValidatorForm</a></p> <typo:code> <p>class UsersController < ApplicationController<br /> def create<br /> @user = User.new(params[:user])<br /> respond_to do |format|<br /> if @user.save<br /> self.current_user = @user<br /> format.xml { head :created }<br /> else<br /> format.xml { render :xml => @user.errors.to_xml(:dasherize => false) } end<br /> end<br /> end<br /> end</p> </typo:code> <p>If saving the user fails then Rails return the xml version of the errors:</p> <typo:code> <p>@user.errors.to_xml(:dasherize => false)</p> </typo:code> <p</p> <typo:code> <p>var errors:RailsErrors = new RailsErrors(data.result as <span class="caps">XML</span>);<br /> MySpyderModelLocator.getInstance().signupErrors = errors;</p> </typo:code> <p>The signup.mxml page contains the following signup form</p> <typo:code> > </typo:code> <p>The RailsErrorBox just displays the text of all error messages and is only visible if there are any Rails errors.</p> <p>Now all the magic happens in the org.onrails.rails.RailsValidationForm railsErrors setter.</p> <typo:code> <p>public function set railsErrors(errors:RailsErrors):void {<br /> <em>railsErrors = errors;<br /> if (_railsErrors==null || !</em>railsErrors.hasErrors()) {<br /> resetErrors();<br /> } else {<br /> for each (var field:String in <em>railsErrors.fields) {<br /> if (</em>fieldMap[field]) <br /> _fieldMap[field].errorString = field + ’ ’ + _railsErrors.getFieldErrors(field).join(’, ’);<br /> } <br /> }<br /> }</p> </typo:code> <p>The key is to associate the Rails error message with the field is simply to set the errorString on the field.</p> <p.</p> 360Flex - Day two 2007-03-06T00:00:00-08:00 <p>All right, here we go again.</p> <p>08:30am <strong>Flex Data Services by Jason Williams</strong> <span class="caps">FDS</span> is a J2EE Application that provides data synchronization between a client and a server. Provides Messaging, <span class="caps">RPC</span> Services and Data Management. All these services use service adapters on the server to get the job done. All the other services are build on top of Messaging. Jason goes through the various ways to configure these services, way to much data to blog about. Jason will post his slides online. I will point to them as soon as I gound out.</p> <p>10:00am <strong>Flex Builder Secrets by David Zuckerman</strong> Change in plan, I won’t attend the Modules presentation as I played with Module last week and it works pretty well. So Let’s see if there are some good FlexBuilder secrets out there. If not that will give me some time to play with handling Rails Errors from Flex. I’ll blog about that shortly. David will briefly show some editing features, the will dive into hacking FlexBuilder, hacking the property inspector and use the APIs exposed by FlexBuilder. David is part of the FlexBuilder development team and is currently working on ‘Find all references’ and Refactoring support.</p> <table> <tr> <td>apple-shirt-t </td> <td> Open Type</td> </tr> <tr> <td>apple </td> <td> Turns an identifier into a ‘navigate to’ link</td> </tr> <tr> <td>ctrl-o </td> <td> Outline view </td> </tr> </table> <p>David mentions’ that everything he shows now is at our risks and can damage the installation. He shows or the color syntax settings can be modified. There are defined in the Colors.xml file inside of a .jar file that is part of an eclipse plugin. Note sure that I want to mess with that stuff. Graphical Property Inspector. You can create your own customer common property inspector. This inspector is defined by by an xml file. David nows describe how to extend FlexBuilder using java. I guess that these notes won’t be to useful, so hopefully he will provide his slides.</p> <p>01:00pm <strong><span class="caps">MXML</span> vs. AS3 by Ted Patrick</strong> His goal is that we understand <span class="caps">MXML</span> as a medium to write applications. Apparently I am the trouble maker for the bad sound with the mikes that the presenters experienced since the beginning of the conference..as my <span class="caps">EDVO</span> card may interferer with their microphones. So I will start taking notes offline and post them here after the talks are over. <span class="caps">MXML</span> gets translated to AS3, so it’s the same. <span class="caps">MXML</span> Tags are instances of AS3 classes. 100% compatible, 100% the same. To see how the translation work use the compiler flag -keep-generated-actionscript. Best way to understand inner workings and what’s going behind the scenes.</p> <p>02:30pm <strong>E4X by Danny Patterson</strong> Danny co-authored the ActionScript 3 with Design Patterns book. He described the new <span class="caps">XML</span> related classes and showed examples for each of them: . <span class="caps">XML</span>, XMLList, QName, Namespace.</p> <p>Filtering:</p> <p>catalog.product.(price < 50).name,</p> <p>or using a variable</p> <p>var findPrice =50;<br /> catalog.product.(price < findPrice).name</p> <p>Chained Filter:</p> <p>catalog.product..(name.toString().length >0).(price < 50).name</p> <p>Namespaces</p> <typo:code> <p>//xmlns<br /> var envelop = <soap:envelop xmlns:<br /> envelop.body = </p> </typo:code> <p>04:00pm <strong>Flex and Flash Together by Jesse Warden</strong> Jesse goes fast through lots of material. <strong>Call Flash from Flex directly</strong> But he shows how to load a swf file using the SWFLoader into flex, cast the loader.content to the interface you would to use, then then Flex can call the methods you want on the Flash movie.. You can do that today with the Actionscript 3 plugin for Flash 8. <strong>addFrameScript</strong> addFrameScript(39, stop)…show a way to load dynamically code inside you application by using Embed…he uses this to build a nice Flash components that can be used straight from Flex. He makes a compelling case of using Flex and Flash together.</p> 360Flex - Day one. 2007-03-05T00:00:00-08:00 <p>08.</p> <p>I am currently making up my mind as to which talk to attend here after is a first pass at my list.</p> <p>08:10 All right I am at the conference. Pretty well organized the facilities and the conference room is pretty impressive…and they have Starbucks coffee. The room is mostly already full.</p> <p><strong>Day 1</strong></p> <p>08:30am <strong>Keynote: The Magic of Flex by Mark Anders</strong> <br /> 1st Flex specific conference. Mark asks how many are Flash developers in the audience. It’s the minority, about 30 hands raised. Flex is the way to create Flash stuff in a developer friendly way. <strong><span class="caps">MXML</span></strong> Mark shows some <span class="caps">SVG</span> components and demonstrates how <span class="caps">MXML</span> ties in with Actionscript classes. <strong>Databinding</strong> He demonstrates databinding to change the gradients of an svg components without coding using. His Microsoft ghost is chasing him…his Mac froze and is now rebooting. He blames it on Powerpoint that runs Rosetta. <strong>Composition</strong> New controls can be build by composing other controls. Mark show several components that different people created such as the <a href="">fisheye</a> component and an <a href="">cool RSSReader</a> that smokes. <strong>States</strong> allowing to build liquid interface declaratively. He demonstrate in FlexBuilder how to create a little Flickr Browser that has two states, the search state that just shows the search box and the result state that also displays the results. <strong>It’s Flash!</strong> Flex is powerful thanks to the underlying Flash engine. He demonstrates some Flex application that use the full power of Flash: <a href="">Picnik</a> and Buzzword from Virtual Ubiquity. <strong>ActionScript 3</strong> He now starts the new version of the Flash <span class="caps">IDE</span> and show a “Ring of Fire” rendering application and compares the AS3 and AS3 application…the crowd claps as it shows off fast AS3 is. <strong>An Exciting Future<. <strong>Flex 3</strong>!</p> <p>08:55am <strong>Apollo APIs by Christian Cantrell</strong>. <strong>NativeWindow</strong> allows to use native OS windows with Flash, Flesh or <span class="caps">HTML</span>. <strong>File System APIs</strong> File extends FileReference. File objects are pointers to files and directories. File APIs can be Synchronous and Asynchronous. Threading is not accessible to the developers. <strong><span class="caps">URL</span> Schemes</strong> file:, app-resource, app-storage:. Two more demos. FileBrowser, that supports full drag and drop file operations. FileComponentTest that allows to view folders in Tree, List or Grid view and is written in 47 lines of <span class="caps">MXML</span> code. <strong>HTMLControl</strong> is a display object than can display <span class="caps">HTML</span>, it’s an embedded browser (without chrome) build using Khtml (WebKit). Has loadString function to load content, adds to the URLRequest class. <strong>Script Bridging</strong> allows scripting between Actionscript and Javascript. References to object can be passed between the two environments. I.e. an Actionscript event can be attached to a Dom object. <strong>The Flex <span class="caps">HTML</span> Components</strong>. <strong>Shell</strong> provides access to shell or runtime facilities. I.e. when all the windows applications close then developers can decide if the application closes. Or find out which window has the focus, or close the application. <strong>Network Detection</strong> <span class="caps">OCD</span> application that uses the ServiceDetector class to listens to the ServiceEvent.SERVICE_AVAILABLE and ServiceEvent.SERVICE_UNAVAILABLE events. <strong>InvokeEvent</strong>. <strong>Application Update <span class="caps">API</span></strong>. <strong>Managing Multiple Displays</strong> currently doesn’t work in the latest build. Screen class. Screen.screens returns an array of Screen objects. Screen.mainScreen returns the primary screen. Screen.visibleBounds allows to properly align the screens. <strong>URLRequest changes</strong> support for arbitrary methods: <span class="caps">GET</span>, <span class="caps">POST</span>, <span class="caps">HEAD</span>, <span class="caps">PUT</span>, etc. Allows more <span class="caps">HTTP</span> header flexibility. <strong>Security</strong>. <br /> <strong>Icons</strong> Apollo handle platform independent icon conversion. The minimum is 128×128. <strong>Installation</strong> You need to install the Apollo runtime to deploy an application. So an application cannot be deployed without the run time. <strong>Future Apollo APIs</strong> Menus, Drag&Drop, File extension registration, System notifications. That’s it!. <strong>Q&A</strong> Q:When will it be available? A: Pretty soon. (Someone in the room mentions before the 16th).</p> <p>02:05pm <strong>Flex loves Flash? Embed and Beyond by <a href="Building Apollo Apps">Grant Skinner</a></strong> He will show us know where we are and let us make the call if Flex loves Flash. The workflow is not well integrated at the tool level for now. <strong>Embed</strong> metatag [Embed(source=…)], compiler directive “@Embed”, style directive upSkin:Embed(source=…). The Flex compiler doesn’t do a great job bringing in <span class="caps">SVG</span>. <strong>Challenge 1</strong> –. <strong>Challenge 2</strong>. <strong>Challenge 3</strong>). <strong>Challenge 4</strong>. <strong>Challenge 5</strong>). <strong>Challenge 6</strong> <a href="">blog</a> and <a href="">talk page</a> for more info.</p> <p>03:30pm <strong>Introduction to Apollo by Mike Chambers</strong>.).</p> <p>04:00pm <strong>Flex Apps Faster with WebORB</strong> –, <span class="caps">PHP</span>, and later on Rub y On Rails.</p> XML Filtering Predicate 2007-02-27T00:00:00-08:00 <p>I need to filter some <span class="caps">XML</span> data based on several conditions. I found the following article “”">E4X: Predicate Filtering with Regular Expressions</a>" from Darron that provides a nice overview of filtering using e4x. I haven’t found any more detailed information on using predicates so I checked out the <a href="">ECMAScript for <span class="caps">XML</span> <br /> (E4X) Specification 2nd edition</a>. See page 52 for details. But in short the filter can be an expression and use && and ||, the logical and and or.</p> <typo:code> <p>filtered = list.item.( /^4567.<strong>/.test( number ) || /^D.</strong>/.test( name ) ); </typo:code></p> <p>Here is the full test case:</p> <typo:code> <p>package tests.actionscript<br /> {</p> <p>import flexunit.framework.*;</p> <p>public class TestXml extends TestCase<br /> {</p> <p>public function testXMLFiltering():void {<br /> var list:<span class="caps">XML</span> = <list> <br /> <item><br /> <name>Kamesh</name><br /> <number>12345</number></p> </item> <item> <name>Daniel</name> <number>12345</number> </item> <item> <name>Robin</name> <number>12345</number> </item> <item> <name>George</name> <number>4567</number> </item> <item> <name>Adam</name> <number>4567</number> </item> <item> <name>Dean</name> <number>4567</number> <policy>yes</policy> </item> </list> <p>var filtered:XMLList = list.item.( /^D.<strong>/.test( name ) ); Assert.assertEquals(2, new XMLListCollection(filtered).length);<br /> filtered = list.item.( /^4567.</strong>/.test( number ) ); <br /> Assert.assertEquals(3, new XMLListCollection(filtered).length);</p> <p>filtered = list.item.( /^4567.<strong>/.test( number ) && /^D.</strong>/.test( name ) ); <br /> Assert.assertEquals(1, new XMLListCollection(filtered).length);</p> <p>filtered = list.item.( /^4567.<strong>/.test( number ) || /^D.</strong>/.test( name ) ); <br /> Assert.assertEquals(4, new XMLListCollection(filtered).length);</p> <p>}</p> <p>} // class</p> <p>} // package</p> </typo:code> Flex introspection API: describeType(value:*):XML 2007-02-24T00:00:00-08:00 <p>I am playing with the mx.automation framework provided by Flex. For that I need to associate each control with it’s automation implementation. More on that on a subsequent blog entry. But it some case I need to find the super class of a class</p> <p>Let’s take the following three classes:</p> <typo:code> <p>class A {}<br /> class B extends A {}<br /> class Tab extends Button {}</p> </typo:code> <p>Now we can create the following function:</p> <typo:code> <p>import flash.utils.describeType;<br /> private function superClass(clazz:Class):String {<br /> return describeType(clazz).factory.extendsClass<sup class="footnote" id="fnr0"><a href="#fn0">0</a></sup>.@type;<br /> }</p> </typo:code> <p>Let run the following code</p> <typo:code> <p>trace(“A super class:”<ins>superClass(A));<br /> trace(“B super class:”</ins>superClass(B));<br /> trace(“Tab super class:”+superClass(Tab));</p> </typo:code> <p>And we get the following output:</p> <typo:code> <p>A super class:Object<br /> B super class:com.nouvelles_solutions::A<br /> Tab super class:mx.controls::Button</p> </typo:code> <p>Let me know if there is an easier way.</p> <p>The build in <a href="">describeType</a> function takes a class as parameter and return an <span class="caps">XML</span> definition of a class. For example describeType(B) returns the following:</p> <typo:code> <type name="com.nouvelles_solutions::B" base="Class" isDynamic="true" isFinal="true" isStatic="true"> <extendsClass type="Class"/> <extendsClass type="Object"/> <accessor name="prototype" access="readonly" type="*" declaredBy="Class"/> <factory type="com.nouvelles_solutions::B"> <extendsClass type="com.nouvelles_solutions::A"/> <extendsClass type="Object"/> <method name="a" declaredBy="com.nouvelles_solutions::B" returnType="void"> <parameter index="1" type="String" optional="false"/> </method> </factory> </type> </typo:code> <p>Pretty cool.</p> Cairngorm Generators 2007-02-21T00:00:00-08:00 <p>I looked into <a href="">Cairngorm</a> <a href=""></a>. So yesterday introduced Cairgorm on two Flex projects I am working on.</p> <span class="caps">PHP</span> application:</p> <block> <p><a href="">Cairngen</a></p> </block> <p><br/> It targets currently only Cairngorm 2.0 and not the newer Cairngorm 2.1. So after generate the supporting classes I had to manually do some changes. But thanks for this tool.</p> <p>The second project is a smaller Flex application backed by a Ruby on Rails server. And I found the following Ruby on Rails Cairngorm generators at</p> <p>Simply copy the generators to your “/vendor/generators” folder, the generators folder will then contain the following generators:</p> <typo:code> <p>cairngorm<br /> command<br /> delegate<br /> event<br /> vo<br /> worbservice</p> </typo:code> <p>Note there are several places in Rails you can set generators, but that did the trick for me. The I created a “src” folder in my Rails root folder and issues the following commands:</p> <p>Then you can use these different generator commands to build the structure you require, the events, commands, delegates and more.<br /> <typo:code><br /> ./script/generate cairngorm org/onrails/myspyder <br /> ./script/generate delegate org/onrails/myspyder server<br /> ./script/generate command org/onrails/myspyder show_page_watch server<br /> ./script/generate event org/onrails/myspyder show_page_watch</p> </typo:code> <p>I issued the generate script for each of the commands that application needs to support. The main controller now looks as follows (still very early in the development phase)</p> <typo:code> <p>package org.onrails.myspyder.control<br /> {<br /> import com.adobe.cairngorm.control.FrontController;<br /> import com.adobe.cairngorm.control.CairngormEventDispatcher;<br /> import org.onrails.myspyder.control.<strong>;<br /> import org.onrails.myspyder.command.</strong>;</p> <p>public class MySpyderController extends FrontController<br /> {<br /> public function MySpyderController()<br /> {<br /> initialiseCommands();<br /> }</p> <p>public function initialiseCommands() : void<br /> {<br /> // Application Tabs<br /> addCommand( ShowAccountEvent.EVENT_SHOW_ACCOUNT, ShowAccountCommand );<br /> addCommand( ShowPagesEvent.EVENT_SHOW_PAGES, ShowPagesCommand );<br /> addCommand( ShowSettingsEvent.EVENT_SHOW_SETTINGS, ShowSettingsCommand );</p> <p>// Page List<br /> addCommand( ReloadPagesEvent.EVENT_RELOAD_PAGES, ReloadPagesCommand );<br /> addCommand( AddPageEvent.EVENT_ADD_PAGE, AddPageCommand );<br /> addCommand( ReloadPageEvent.EVENT_RELOAD_PAGE, ReloadPageCommand );<br /> addCommand( RemovePageEvent.EVENT_REMOVE_PAGE, RemovePageCommand );<br /> addCommand( SavePageEvent.EVENT_SAVE_PAGE, SavePageCommand );</p> <p>// Page Details<br /> addCommand( ShowPageWatchEvent.EVENT_SHOW_PAGE_WATCH, ShowPageWatchCommand );<br /> addCommand( ShowPageWatchResultEvent.EVENT_SHOW_PAGE_WATCH_RESULT, ShowPageWatchResultCommand );</p> <p>// Html Section<br /> addCommand( ShowOriginalPageEvent.EVENT_SHOW_ORIGINAL_PAGE, ShowOriginalPageCommand );<br /> addCommand( ShowPageSectionEvent.EVENT_SHOW_PAGE_SECTION, ShowPageSectionCommand );<br /> addCommand( SelectPageSectionEvent.EVENT_SELECT_PAGE_SECTION, SelectPageSectionCommand );</p> <p>}</p> <p>}</p> <p>}</p> </typo:code> <p>Let me know your experience with Flex and Cairngorm.</p> RESTFul Rails from Flex. 2007-02-10T00:00:00-08:00 <p>As part of the “MySpyder” project I am currently working on we want a Flex front-end to access a RESTFul Ruby on Rails service. You can read more on RESTFul and ActiveResource on <a href="">David’s blog</a>, on the <a href="">“release notes”</a> of Rails 1.2, PeepCode as an excellent <a href="">screencast</a> (not free) on the subject, and many other places.<br /> <p/><br /> In short using the RESTFul approach allows to expose and manipulate a Rails model via a predefined set of standard Http requests. For example we have an ActiveRecord named Watch which can be manipulated via the following requests:</p> <table> <tr> <th> command </th> <th> url </th> </tr> <tr> <td> index </td> <td># <span class="caps">GET</span> /watches.xml</td> </tr> <tr> <td> show </td> <td># <span class="caps">GET</span> /watches/1.xml</td> </tr> <tr> <td> new </td> <td># <span class="caps">GET</span> /watches/new</td> </tr> <tr> <td> create </td> <td># <span class="caps">POST</span> /watches.xml</td> </tr> <tr> <td> update </td> <td># <span class="caps">PUT</span> /watches/1.xml</td> </tr> <tr> <td> delete </td> <td># <span class="caps">DELETE</span> /watches/1.xml</td> </tr> </table> <p/> <p/> <p>This allows for standard <span class="caps">CRUD</span> operations. Note rest supports also custom operations and <span class="caps">CRUD</span> operations on nested resources (such as a has_many relationship). We won’t address them in the article, but I will certainly need them later in the project.<br /> <p/> <br /> The Rails application can determined what format to return based on the content type or the extension of the url. We are only interested in xml for the moment.<br /> <p/> <br /> Some of the advantages of a RESTFul Rails application are that it provides a standard way to organize your controllers, as you will see just in a moment because the controllers are standard most of the code can easily be generated, and because the <span class="caps">URL</span> <span class="caps">API</span> for your application nearly for free. This is the main reason we went down that direction.<br /> <p/><br /> Assuming we have an ActiveRecord named Watch we can now generate a RESTFul Ruby on Rails controller issuing the following command<br /> <typo:code><br /> ./script/generate scaffold_resource watch</p> </typo:code> <p>Our server now supports RESTFul http requests.<br /> <p/><br /> Now wouldn’t it be nice if we could access the server data from Flex in the following manner:<br /> <typo:code><br /> import mx.rpc.AsyncToken;<br /> import org.onrails.ActiveResourceClient;</p> <p>var watches:ActiveResourceClient = new ActiveResourceClient();<br /> watches.defineResource(“”, “watches”, resultHandler, faultHandler);</p> <p>// Note that all the calls are performed in parallel and asynchronously.<br /> watches.list()<br /> watches.show(8)</p> <p>// create <br /> var data:<span class="caps">XML</span> = <watch><br /> <url></url><br /> <xpath></xpath><br /> <frequency>10080</frequency></p> </watch> <p>watches.create(data)</p> <p>// update <br /> data = <watch><br /> <id>8</id><br /> <frequency>10080</frequency></p> </watch> <p>data.frequency = 1440;<br /> watches.update(data)</p> <p>// delete<br /> watches.deleteItem(8)</p> </typo:code> <p.<br /> <p/><br />.<br /> <p/><br /> Download: <a href="">ActiveResourceClient.mxml</a> (renamed file to ActiveResourceClient.mxml)<br /> <p/><br /> Enjoy,<br /> Daniel Wanja.</p> Welcome to MXNA readers. 2007-02-08T00:00:00-08:00 <a href="">OnRails.org</a> has been added to Adobe's xml news aggregator. You may wonder why a Ruby on Rails blog on Adobe's aggregator and what my involvement with Flex is. Read my <a href="">previous</a> post to see why I believe Flex and Rails are a great match. <p/> I used Flex since it was called Royale and develop 2 Flex application for customers that are currently in production. I am also currently working on three new projects that involve Flex, two off them are using Ruby on Rails as back end and one uses java. The java project is still using Flex 1.5. One is for <a href="">Digital Seed</a> and another is code named "MySpyder" for now and is just in it's infancy. <p/> I used to have a blog call f2ee.com (I gave away the domain name a while ago) named Flex+Flash Enterprise Edition which was solely focus on Flex. The only reminiscence left is on the <a href="">wayback machine</a> and two compiled demos, one <a href="">PortfolioReader</a> and some <a href="">Scafolding Demo</a> using Flex. I don't even think I know where the source code of these demos is. Early 2005, I have also created with Lee <a href="">Flex::OnRails</a> (don't use it, use WebORB) a framework to integrate Flex (and Flash) with Ruby using AMF4R. <p/> More recently I open sourced the <a href="">RailsLogVisualizer</a> on rubyforge. This is a Flex a desktop application for OSX (I wish <a href="">Apollo</a> was out) with a embedded Ruby server (not Rails). <p/> On this blog I wrote several entries related to Flash and Flex, like <a href="">Integrating Flash with Ruby on Rails</a> and <a href="">Using WebORB to access ActiveRecords from a Flex application</a>. <p/> Next month I'll be going to the <a href="ttp://360flex.org">360flex</a> conference and I'll be blogging on the Flex Data Services related presentations. Welcome! Daniel Wanja. Sneak Peek: Digital Seed: - an eLearning Application build Ruby on Rails and Flex. 2007-02-07T00:00:00-08:00 Last year Sean and Greg asked us to join one of their venture as Ruby on Rails developers. <a href="">Dolores</a> joined as designer. Like Sean <a href="">describes it</a> "Digital Seed is a Flash and Ruby on Rails application that has been designed to allow learning and training companies to more easily deliver their “soft skills” training (leadership, management, communications, etc.) in a multimedia-rich online learning environment.". This is a really fun project to work on. Sean put up a 10 minute <a href="">screencast</a>. <p/> <p/> <img src="" border="0" alt="20070206-digital-seed.png" align="right" /> <p/> Certified Flex 2.0 Developer. 2007-02-07T00:00:00-08:00 Last week I passed Adobe's Flex 2 Developer Exam. Now what's that got to with Rails. Like you may have seen in my <a href="">previous post</a> I like both technologies, Flex and Ruby on Rails, and I see the strength of both coming together and allowing to build some really cool applications. Now <a href="">WebORB for Ruby on Rails</a> will play a big element in tying both together. WebORB is not the only way to build a Flex app on top of a Ruby on Rails server, but it provides an efficient mechanism to transfer data between the UI and the server. Beginning of 2005 with Lee we wrote <a href="">Flex::OnRails</a>, a now "deprecated" (as in don't even try to use it) framework, that was build on top of AMF4R. At that time combining Flex and Rails was an odd match, due to the pure enterprise nature of Flex with it's very high price sticker. Now that Flex is free, I can see many projects benefiting from integrating both. It is true that many web sites don't need a Rich User interfaces that go beyond what can be achieve with javascript. There are many javascript based websites that are incredible. See <a href=""></a> or <a href=""></a> as two refined examples. However with Flex it's often faster to build an application than with html and javascript, the applications often perform better, are easier to skin for a developer, the code is more readable and can support very large projects. Don't take me wrong, I love the <a href="">Prototype</a> library and <a href="">Scriptaculous</a> is really cool, and I will do many more "pure" Ruby on Rails projects, but at least now there is a serious alternative that I will consider in many scenarios. <p/> Now before you ask why did I even bother doing a certification, let me answer it. The first reason is that it forces me to read and study material that I would never have the patience to read otherwise as there is always too many cool things to try out. Now everyone has it's own style of learning. I started Rails by reading all the rdoc that was available and I also love to read the source code. The second reasons is marketing, and this worked really well for me in the past and opened several doors. Personally, I wouldn't value a developer by it's certification but rather by the projects he worked on, the code he writes and it's personality. <p/> I haven't found much information out there on the Flex certification which is pretty new . The <a href="">Exam Preparation Guide</a> by Adobe provides an overview and there is a more <a href="">detailed version</a> on the net which is not the official one. I found lot's of information in <a href="">Adobe's online documentation</a> and in the <a href="">Flex 2, Training from the source</a> book. <p/> So be ready to hear a little more on Flex and Rails on this blog. RailsConf 2007 registration is open! 2007-02-02T00:00:00-08:00 UPDATED: <a href="">REGISTER NOW!</a> I just received notification that my proposal for a talk at RailsConf was declined. The subject was of course, "Flex On Rails - Enterprise Data Manipulation.". I hope that my friend <a href="">Tony</a> which made a proposal on a similar subject has been accepted. He is an excellent teacher. In addition the notification indicated that the registration starts tomorrow. So get ready! Slicehost made us rich! 2007-02-01T00:00:00-08:00 Actually, I guess they made us less poor. Last month a bunch of our referrals finally paid off, saving us 70% of our usual monthly fee! Thanks go to Kevin, Richard, Marty, John, Christopher, Brandon, Zachary, Piotr, and Jesse!<br /><br />Why haven't we written much about <a href="">Slicehost</a> in the 6 months we've been hosting on them? Because it just works. We just set up our apps and let them run.<br /><br />If you'd like to be in our next thank you note, use this <a href="">link</a> when signing up for your slice.<br /><br />Thanks again, referrals and Slicehost.<br /> RailsConf registration starts 1st week of Februrary. So get ready! 2007-02-01T00:00:00-08:00 The conference Wiki <a href="">indicates</a> that the registration starts the first week of February. Chad just <a href="">notified</a> the community that it's coming soon. I speculate the registration opens tomorrow, February 1st. Rumored to be around $800.- and having more seats than the 700 of last year, it may take a little longer to sell the conference out this time. Let's see. In any case get ready! New Rails Group in Seattle 2007-02-01T00:00:00-08:00 For those in or near Seattle you might want to check out the new <a href="">Rails group</a> that is starting this month. It is sponsored by <a href="">Engine Yard</a> and my friend's company, <a href="">Biego</a>. The first meeting is February 13th at 6pm at the Greenlake Public Library. Too bad it wasn't last week when I was in Seattle for a few days, I would have liked to seen what the Ruby community is like there.<br /> Does a good idea make a good business? 2007-02-01T00:00:00-08:00 <p>On top of our Ruby on Rails consulting work we would like to create a small internet “service” business. Something like <a href="">time.onrails.org</a> but more fleshed out and supporting paying customers. We are bringing on board Solomon White, which is an awesome Ruby on Rails developers, to help out. So the other day we met and threw out some ideas of project we would consider doing. I think we came with a bunch of great ideas that each on their own could support a nice business or at least would be fun to develop. Often the feeling is that sharing these ideas would give away the “magic” ingredients that would make the new venture a success, that competition would outrun us and they will be first and take the whole market. I don’t believe so. A very close friend created a spectacular Java/.Net integration framework. He is adamant about not revealing too much on how he created it or even that he created it. The result is that potential customers don’t “just” find him as they don’t know that a solution to their problem is out there, and he must convince them really hard that he has the solution, and sometimes that they have a problem. In other scenarios a ‘surprise’ announcement, like Apple masters so well, has certainly a great impact as that creates lot’s of buzz on the net and in the news. The reality is that we don’t have Apples audience and no one is expecting a ‘surprise’ from us. I don’t think that they are not many great ideas worth keeping secret Rather find a problem or need and make sure you create an awesome solution addressing it. While you create it, talk about it, spread the word, gather feedback, talk about the technical challenges you encounter, feel the interest that’s out there. Then deliver. And deliver something exceptional …sounds familiar? Well that concept is not invented here, but if we shine at taking one of “our” ideas, and providing an exceptional implementation I believe we can attract many users and create a nice business out of it.</p> <p>So the steps in the process becomes something like this:</p> <p>1. Investigate ideas (that’s where we are at)<br /> 2. Choose idea.<br /> 3. Define project<br /> 4. Implement and spread the word.<br /> 6. Go live<br /> 7. Adapt and Improve</p> <p>Currently we are in the “investigation” phase for several of these ideas. In other words we are coding and having fun and testing out different things. So here is the list of our killers ideas (in no specific order):</p> <p><b>RailsLogVisualer plug-in</b>: Realtime and aggregated log visualization of your Rails application. At the end of last year I wrote an offline <a href="">Rails Log Visualizer</a>. It’s pretty basic but provides some interesting information about the different applications we have in production. While writing it I realized that it would not be too difficult to have a plugin that would collect and aggregate request data and be able to provide information on the specific controllers and actions of the application. Of course it would require to support clusters of Rails applications. This plugin would provide a nice drill-down approach to the log data analysis which differs from a more traditional log analysis approach. For now, check out <a href="">Geoffrey’s article</a> on how to add Rails support to <a href="">Mint</a> for a nice way to analyze your log data on a deployed server.</p> <p><b>ScrumPlan</b>: An Agile Project management tool. I still do tons of enterprise work, and I really like how Scrum brings teams together. Scrum is very simple and a spreadsheet can be sufficient to get started, but I see the need for a simple dedicated tool to support the different activities that is simpler, more efficient and elegant than the existing tools out there. Lee is not too hot on this idea as we don’t use Scrum on our small projects.</p> <p><b>FlexTester</b>: An automation/regression tool for Flex. A large part of this testing tools would be in Flex, but the tool would have a server side part that is written in Ruby on Rails to keeps track of tests runs, to drive continuous integration and so forth. Flex is not directly related to Rails but I also do a lot of Flex work. I just think it’s a very nice way to create an UI, although in many case <span class="caps">RJS</span> does the trick as nicely and is “more” conventional. Flex is appropriate for enterprise applications (with many screens, many developers, lots’ of functionality) and Adobe just added some framework level way to record and playback user events (see the <a href="">mx.automation package</a>). There is currently one very expensive tool out there to create regression tests for Flex. Another more affordable one would be welcome. I started playing with the mx.automation framework and I am evaluating the effort implementing such a tool.</p> <p><b>TimeOnRails 2</b>: We have several hundred registered users (858 today) for time on rails and many use it on a daily basis. We received great feedback and also improvement requests. We use it our-selves on a daily basis and see many ways we want to improve and make it even more useful, especially on projects with multiple team members. Rather than just fixing the current code based which was implemented during the pre-RESTFull area, we want to rewrite it from the ground up. Note if we don’t select that idea, I will need to fix promptly several small issues on time.onrails.org.</p> <p><b>RailsCloud</b>: Rails hosting on a cloud. Ways to deploy or scale you Rails environment at the click of a button…This would leverage <a href="aws.amazon.com/ec2">Amazon’s EC2</a>.</p> <p><b>S3Backup</b>: Backup to S3 with a twist!</p> <p><b>MySyder</b>: The last year we worked in the eCommerce field. It’s pretty amazing what’s going on in this field, and there is the need to provide better tools for vendor and online stores. As part of “investigating” this idea we defined a subset of functionality related to “watching specific html pages” that we can turn into an online service or product by it’s self.</p> <p>As you see we’ve got many ideas. I like Solomon’s way of looking at these ideas…“Which one we do first?” … More on that in the future.</p> Rails 1.2.1 released? - Answer: yes 2007-01-18T00:00:00-08:00 It looks like Rails 1.2.1 is out, but I haven't seen an announcement yet (nor one for 1.2.0). Changeset <a href="">5990</a> created a tag for 1.2.1 and the gem is on rubyforge already. Maybe it's a good time to freeze those apps to a release version instead of riding on edge all the time.<br /><br />Happy Railing!<br /><br /><b>Update:</b> The <a href="">announcement</a> came not too long after my post.<br /> Onrails.org moved to Slicehost. 2007-01-13T00:00:00-08:00 I wanted to move this blog to Mediatemple as I liked their concept of a Ruby on Rails Container. After signing up and following the instructions I realized that Lee did such a good job of setting up time.onrails.org on Slicehost, and we are really impressed with the performance of the servers, that it was even easier for us to just move this blog to slicehost. Some nice aspect of Mediatemple are that they provide an https connection included with their base price, but I didn't like that the default Ruby version was 1.8.2. and not 1.8.4 and MySQL was 4.1.11 and no 5. Happy New Year! 2006-12-27T00:00:00-08:00 A bit early? Just a couple of days. I just wanted to wish to all the readers of onrails.org and all the users of time.onrails.org and very nice holiday. Having some out of town friends and family over, I won't be checking too much my email nor doing too much development the next few days. I'll be heading up the mountains and do some snowboarding. What a Rails year it was! Thank you for my main customer Gatelys and specially their technical director Solomon White that allowed us to write some kick-ass Rails application during 2006, that was a fun ride. So what's in store for 2007? Nothing is finalized yet, so stay tuned for the first half of January as we may start reporting on some new projects. Also with Lee, we will tackle a new 'side' project using Rails. We will drive it further and build a viable business around it. Like for time.onrails.org we will report our progress on this blog. I will also continue investigating using Flex with Rails as it's a pretty powerful match and opens doors to some really cool applications. I will checkout deeper the Streamlined framework. And of course I will attend a couple of conferences like <a href="">360flex</a>, <a href="">RailsConf</a> and <a href="">RubyConf</a>. We will try out other hosting services (I just signed up with MediaTemple). We will continue to closely follow the evolution of Edge Rails, specially the ActiveResources. So, stay tuned and see you next year for some more Ruby On Rails. Blizzard `06 - Day 2 2006-12-21T00:00:00-08:00 I think we have about 2 feet of snow now. The neighborhood has been out in full force shoveling driveways and sidewalks so the dogs can all play together.<br /><br />The big dogs came out:<br /><img src="" /><br /><br />And the small ones, too:<br /><img src="" /><br /><img src="" /><br /><br />Our beagle even had to pull me out of a drift:<br /><img src="" /><br /><br />Time for lunch and some hot chocolate.<br /> Rails on Snow 2006-12-20T00:00:00-08:00 In case you haven't heard, we're getting a "little" snow today in Colorado. We have 3-4 foot drifts in the middle of our back yard. Most flights out of the Denver Internation Airport have been cancelled, but the Rails coding never stops.<br /><br /><img src="" /><br /><br />It's not too cold, but the wind blew snow in through our dog door. Our poor beagle is having a hard time trying to find a place to do his business.<br /><br /><img src="" /><br /><br />Anyway... back to unit tests.<br /> RailsLogVisualizer: now open source and 6 x faster. 2006-11-29T00:00:00-08:00 I moved the RailsLogAnalyzer to RubyForge and as there was already a project on RubyForge with the same name, so I renamed it to <a href="">RailsLogVisualizer</a>. So <b>RailsLogVisualizer</b> it is. Version 0.3 provide a drastic speed improvement over version 0.2. If you are curious or adventurous you can browse the <a href="">source code</a> on RubyForge. <br/> The Project Home Page is <a href=""></a><br/> The project is at <a href=""></a><br/> Enjoy! The Rails Edge Conference in Denver - Day 3 2006-11-18T00:00:00-08:00 <p>I am a bit late (20minutes) to the conference as I had an iChat with my nieces that turned 3 today. <br/></p> <p><b><span class="caps">THE</span> <span class="caps">RAILS</span> <span class="caps">TIMES</span> by Mike Clark and Bruce Williams</b><br /></p> <p>So I seems I haven’t missed to much so far. Mike Clark and Bruce Williams are presenting what’s new in Rails. They call it it “<span class="caps">THE</span> <span class="caps">RAILS</span> <span class="caps">TIMES</span>”, and the first slide is a news paper front page. <br /> <ul><br /> <li><span class="caps">HABTM</span> Ousted in favor of Rich Models using has_many :through. </li><br /> <li>Many deprecations telling you how to prepare for Rails 2.0. </li><br /> <li>Routes get named.</li><br /> <li>Extra: Ruby generates javascript. <i> page[:tags].reload # reload <em>tags.rhtml partial.</i></li><br /> <li>Serial(ization) Killers At Large: <span class="caps">YARML</span>, <span class="caps">XML</span>, <span class="caps">JSON</span></li><br /> <li><span class="caps">RSS</span> is the next big thing: <i>render_rss_feed_for(@people, options)</i></li><br /> <li>The future is <span class="caps">CRUD</span>: <i>ruby script/generate scaffold_resource article</i>. <i>map.resources :articles</i></li><br /> <li>Conventions Flourish: see simply_helpful. <i>form_for @person do end </i></li><br /> <li><span class="caps">BULLTIN</span>: Apps respond-to Clients: <i>respond_to do |format| format.html, format.js, format.xml, format.yaml</i>. Custom format can also be added.</li><br /> <li><span class="caps">CORBA</span>? <span class="caps">RMI</span>? No, ActiveResource!: <i>class Person < ActiveResource::Base</i></li><br /> <li>Security Alert! Parameter Filtering – <i>filter_parameter</em>logging :password, :login, :user</i></li> <br /> <li>Installation Typo Triggers Global App Meltdown:<i> rake rails:freeze:gems</i></li><br /> <li>Manking Attacked by Mongrel: <i>gem install mongrel</i></li><br /> <li>Tomorrow’s Edition? : Rails 2.0? <span class="caps">REST</span>? </li></p> </ul> <p/> <p><b>The Meaning of <span class="caps">CRUD</span> by Chad Fowler</b><br /></p> <p>This is an awsome talk where Chad is going into the impact that a RESTFul approach has on your development and how to write your application using the new named routes and RESTfull controllers.</p> <p/> <p><b><a href="">Streamlined</a> by Justin Gehtland</b><br /> Justin goes through many of the options on how to manipulate declaratively a Streamlined driven UI.</p> <p>Road map:</p> <ul> <li>0.0.6 new look (soon)</li> <li>0.0.7 control types for fields</li> <li>0.0.8 plugin instead of generator</li> <li>0.1 99% rcov, compatibility</li> </ul> <p>Features to look for</p> <ul> <li>visual configuration</li> <li>declarative tabbed ui 0.0.8?</li> <li>generated columns sortable</li> <li>context specific ui (different for list, show , edit…)</li> <li>rich text editor (TinyMCE)</li> </ul> <p/> <p><b>Deployment by James Duncan Davidson</b><br /></p> <p><b>Start Early</b> deploying your applications. Find all the “interesting” deployment problems up front. You’ll know how to do it when the times comes. You’ll get into the deployment rhythm.</p> <p><b>How to do it:</b> not using WEBrick, <span class="caps">CGI</span>, FastCGI…but proxy to Mongrel (ya-huh!). Front End use Apache, Lighttpd, Pound, Pen, or hardware load balancer. Use Capistrano. <b>The Golden Path</b> assumes Capistrano, Unix (<span class="caps">NOT</span>.</p> <p/> <p><b><span class="caps">CONFERENCE</span> <span class="caps">CONCLUSION</span>!</b><br/> Awesome conference, well worth the money. Not only was it well organized but the talks where just loaded of useful information. Thanks to all the presenters!</p> The Rails Edge Conference in Denver - Day 2 2006-11-17T00:00:00-08:00 He we go again, day 2 is starting. <p/> <b>Rails the right tool for the job? by Mike Clark.</b><br/> Mike will address the following aspects of Rails:Sweet spots, Honey Pots, Tar Pits. Rails is a full-stack web framework, no need to choose the different parts of the stack it's ready to go from the start. It's Quick and Clean, like Martin Fowler would say. Mike adds quicker than J2EE and cleaner than PHP. <b>The sweet spot</b>: database backed web applications, green-field development, open-minded team, following the rails way. <b>Honey Pots</b> is when you get into Rails because it's sweet, but then you get stuck. In other words the not so sweet spots: Legacy, Internationalization, messaging systems, heavy use of threading.<b>Tar Pits</b> two phase commits, off the shelf components, obfuscation, client installations, corporate standards. <p/> <b>Active Record Demystified by Marcel Molina Jr.</b><br /> An in-depth tour of connection adapters, ActiveRecord::Base#save, and ActiveRecord::Base.find. <br/> <p/> <b>Building UI Frameworks by Bruce Williams.</b><br /> Bruce worked on a large system with many views. Views are tedious and are time consuming to develop and took a large portion of the development of the 90000 Ruby code application they wrote. I will not talk about components, engines, markaby. Bruce will shares some of his frustrations and challenges. Views are hard to read, are hard to learn (ruby, rails, html, css, javascript+prototype). He extensively explain the difficulties that are faced when doing view development and mentions that it's all about <b>Pain Management.</b>. He continues by showing some examples and concepts to ease that pain by using simply_helpful plugin, DSL for controllers, and block helpers than render partials. <p/> <b>Rake Your Secret Weapon by Jim Weirich.</b><br /> <p/> <b>Burried Treasure by Dave Thomas</b><br /> Tips and Tricks for Ruby & Rails Development. Dave goes through these following Rails goodies: <ul> <li>with_scope</li> <li>with_options</li> <li>returning</li> <li>&:xx - The Blockinator %w{ cat dog }(&:upcase) or users.map(&:name)</li> <li>Lookup Constants</li> <li>Formatting dates and number</li> <li>Enumerable extensions (i.e. group_by)</li> <li>Arrays: in_groups_of, to_sentence</li> <li>Strings: at, from , to, first, last, each_char</li> <li>Subversion integration: script/generate model mymodel <b>--svn</b> (adds it automatically to subversion)</li> <li>The Console: app.get, app.response, helper, irb for default object, ActiveRecord::Base.logger = Logger.new STDOUT</li> <li>Routing: >>irb ActionController::Routing::Routes; puts routes</li> <li>TextMate: ctrl-h on a method to shows the rdoc. ctrl-shift-apple-s on an ActiveRecord shows the schema information. Code Completion. </li> </ul> Rake Command Completion Using Rake 2006-11-17T00:00:00-08:00 <p>This is an update of a <a href="">previous</a> post.</p> <p>I just watched <a href="">Jim Weirich's</a> talk on <a href="">Rake</a> at the <a href="">Rails Edge Studio</a> and decided to update the command completion script to use Rake itself for caching the tasks. <a href="">Err the Blog</a> </typo:code> <p><strong>Update:</strong> I fixed the bug that <a href="">janfri</a> pointed out. The bug caused the first task to be missed. I also changed it so it won't abort if rake isn't the first command on the command line. This will allow stringing multiple commands together. For instance:</p> <typo:code> rake db:migrate VERSION=0 && rake db:migrate </typo:code> <p><a href="">Enjoy</a></p> The Rails Edge Conference in Denver - Day 1 2006-11-16T00:00:00-08:00 The <a href="">conference</a> just started 30 minutes ago. I will write down some notes as it moves ahead. On a side note, Chad has a cool t-shirt saying "<strike>Rails</strike> Ruby - Programmer Friendly, Enterprise Ready"...way to go, enterprise here we come. <p/> <b>Meta Programming Ruby by Dave Thomas.</b><br/> Extending Ruby for Fun and Profit.<br/> Meta programming allows to extend the language by writing code that writes code. This talk is about understanding how it works, but mostly it's to allow us (the attendees) to start writing our own extensions. Dave goes through these four aspects of Ruby that enable meta programming: classes are open, definitions are active, all method calls have a receiver, classes are objects. <p/> <b>Ruby Idioms for Rails Programmers by Stuart Halloway</b><br /> Implicit vs. Explicit - Stuart takes a Java/Struts example and refactors it to a Rails example showing along the way the explicit parts that should be implicit as they don't have anything to do with the business logic you are trying to implement. Basically he moves a 20 lines java method down to 1 lines of ruby. This was very revealing, but let's not start a java .vs. rails debate here ;-) <br /> Add Context to Instances - Ruby allows to modify objects to represent context. For instance active records contain the errors context that are triggered during saves, also active record contains wether it's a new record. So breaking apart from a "pure" object model, in Rails these contexts are injected into the objects, this simplifies greatly the development concepts. For example you have on instance of Person that is valid and not new. In java these concepts are broken down in separate concepts but you end up with DAOs, validators, business object, which all need to be tied together. In short Rails is less "pure" but simpler.<br /> Personalized Object Model - Augmentations by methods on demand (method_missing). sample platter (Symbol#to_proc, Object#with_options, and hundreds more). Domain-Specific Encapsulation - Stuart now describes how Rails provides some domain specific encapsulation to hide some of the internals of your application, i.e. hide_action, add_variables_to_assigns.<br /> Stuart warns us that he feels strongly about the topics he will cover now, but they may be controversial. Poor Composition Disrupts Flow - Stuart refers to the Smalltalk best practice book (p22, Kent Beck) which states "...keep all the operations at the same level of abstractions...". He diggs through some method examples form Edge Rails that could be 'improved'. <br /> His presentation can be found at codecite.com <p/> <b>Rails Reflection by Chad Fowler</b><br/> Chad is presenting some of the findings of the project he workd for at Naviance. He started showing of a movie of a tool they (him and Bruce Williams) wrote to dynamically and visually create ActiveRecords and add data to it, then be able to export the fixtures. Why use Rails reflection? learn how rails work, simplify maintenance, make Rails do that Rails doesn't do well.<br /> Chad will go throught some of the reflection possibilities that Rails offer that allowed him to build the tool he just demonstrated.<br /> Active Record Reflection - schema, relationships, callback and errors. Some ActiveRecord reflection examples: <pre> ActiveRecord::Base.connection.tables.length User.column_names User.reflections.keys </pre> Some nifty trick to run migration code from irb is when you execute the following from irb: <pre> >>irb ActiveRecord::Base.connection </pre> Now the receiver class (in irb) is the connection which supports migration calls like add_column, drop_table, and so on. <p/> Action Controller Reflection - Requests, Filters, Routes. <br/> <pre> self.class.before_filters self.class.after_filters self.class.included_actions self.class.excluded_actions ActionController:Routing::Routes.routes </pre> Chad concludes with the fact that these technique should be used only where appropriate and that many applications don't need such a level of programming. <p/> <p/> <b>Ruby Design Patterns by Jim Weirich</b><br/> A design pattern is a solution to a problem in a context.<br /> Jim goes in detail through some Ruby implementation of these standard patterns: Template Method Pattern, Strategy Pattern, Singleton Pattern. He also presents the Blank Slate Pattern he used while creating the XmlBuilder library.<br /> The ruby way:<br/> <pre> Singleton Pattern => include Singleton Observer Pattern => include Observable Iterator Pattern => include Enumerable Factory Pattern => ClassName.new Proxy Pattern => method_missing Visitor Pattern => Open classes </pre> Jim refers to a paper from Peter Norvig from 1996 where he categorize patterns as being Invisible, Formal, and Informal for different languages and mentions that some dynamic languages have fewer restrictions and often don't require explicit patterns or have simpler implementations. <p/> <p/> <b>ActionPack Demystified by Marcel Molina Jr.</b><br/> ActionPack = ActionController + ActionView<br/> Marcel is going through the internals of ActionPack and will cover lot's of code. So I am not sure how much I will be able to write down...I may try to follow his talk :-). Looking at the internals are useful to understand the larger story of what's going with your application and Rails is a good example of how to write Ruby code or is a good help how to extend Rails.<br/> Yes, he really presents lots of interesting stuff, so I'll better sit back and follow. Right now he is explaining the compilation of the templates and going through the implementation of compile_and_render_template. Marcel want's to see how he feels about presenting this and looks for motivation to re-implement it. <p/> <p/> <b>Ajax on Rails by Justin Gehtland.</b><br/> This talk is about Ajax or the cool crap you can actually see. No meta programming. Justin will walk us through Prototype support in Rails, Scriptaculous Helpers, and Javascript generation. <p/> That concludes the talks for the day. After dinner there will application presentations by the attendees. <p/> <b>The evening presentations where really cool</b><br/> <a href="">Rails Log Analyzer</a> by Daniel Wanja. Yes, I presented the new version of the log analyzer. <br/> <a href="">Time.onrails.org</a> by Lee Marlow. A time management application Lee and I worked on.<br/> <a href="mediapulse.com">iDeal</a> by Brian Spaid from mediapulse.com. A tool to quickly create websites and track user activity. This tool is used by them internally and not yet public.<br/> <a href="">RFID Tracking Software</a> by Steve Mui. A cool rails application that allows real time asset tracking. The demo Steve presented was for an hospital that is tracking assets worth over $5000 (i.e. artificial knee) and Hospital workers. The software can track if the assets are in stock, see for specific rooms (i.e. operation room) when assets enter/leave the room. They have rfid scanners that track rfids and log their presence every couple of seconds to a Postgress database. The rails application then summarize and visualize all this data.<br/> <a href=""></a> by Martin May. A topic based notification application. You can register to a topic and be notified whenever the topic maintainer notifies you of a change. Notification is by rss, email, text message. You can create your own topics. Besides be nicely designed I believe that this is going to be a pretty popular application. It's not open to the public yet, but the demo was impressive.<br/> <a href="showerinabox.com">showerinabox.com</a> by Leslie A Hensley. A funny application allowing to plan a bridal shower and print out some customized bridal shower games. All in Ruby on Rails, using PDFWriter.<br/> Ruby binding 2006-11-16T00:00:00-08:00 What is <code>binding</code>? It basically holds the current state of the application... it knows what <code>self</code> is (or was when <code>binding</code> was invoked). What else does it know? I'm not sure, it's something I'd like to investigate further. Can the binding be interrogated? Can it be manipulated? Let me know if you have good pointers to info about it. I'll check Pickaxe when I get home. Module Tidbits 2006-11-16T00:00:00-08:00 I always forget what including versus extending a Module, so here's a little reminder for myself. <typo:code> module UsefulMethods def some_cool_thing 1 + 1 == 0 end end class IncludeUsefulInstanceMethods include UsefulMethods end class IncludeUsefullClassMethods extend UsefulMethods end puts IncludeUsefulInstanceMethods.new.some_cool_thing # => false puts IncludeUsefullClassMethods.some_cool_thing # => false </typo:code> So, including a module basically shoves the module's methods into the class as instance methods, while extending a module puts them in as class methods. That's it. By the way, this was inspired by Dave Thomas' metaprogramming talk at the Rails Edge Studio in Denver. RailsLogAnalyzer v0.2 for OSX - Faster, Better 2006-11-15T00:00:00-08:00 Version 0.2 of the RailsLogAnalyzer is still a development version but a great improvement over my first prototype. This version has been rewritten from the ground up and doesn't use a database to store intermediate log file aggreation. <img src="" border="0" height="396" width="564" alt="RailsLogAnalyzerActionView.gif" align="right" /> <p/> <b>Analyzing your log file data.</b> Once the log file is loaded you will see a breakdown of your requests by year, month, and day. Click on the year, month, or day to see the controllers invocations during that period. Click on the controller in the chart to see the method invocations during the selected period. The method are further broken down based on their http methods (get, post, delete, ...). Note: loading a 10Mb production log file with 30000 requests takes about 10 seconds on my MacBook Pro. loading a 250Mb production log file with 530000 requests takes about 2 minutes. loading a 4.5Gb production log file with 11 million request takes about 45 minutes. The data is loaded in memory and must be reloaded once the application is closed. Download it here <a href="">RailsLogAnalyzer_0.2.dmg (487KB)</a> and let me know your findings at daniel@onrails.org Part 1: Using WebORB to access ActiveRecords from a Flex application. 2006-10-29T00:00:00-07:00 <p>On Friday I started for a customer an investigation in providing a Flex front-end for an Ruby on Rails backend using WebORB. In parallel I will push this investigation further for myself in order to find a nice mechanisms to support <span class="caps">CRUD</span> operations with relationship support using WebORB. Over the next couple of weeks I will write some of my findings on this blog. So this week-end I started to put in place an environment where I can unit test the interaction between Flex and Ruby on Rails using WebORB. In this first part I will show how to extend WebORB to perform a deep find, how to write a Flex unit test to test asynchronous remote calls, and how to use Ruby on Rails fixtures for the Flex unit tests.<br /> <p/><br /> This is an extract of the ‘final’ version of the Flex unit test (as of Part 1 of the article). The full version is at the end of the article. <br /> <typo:code><br /> public function testGetFirstCustomer():void {<br /> var activeRecordService:RemoteObject = getActiveRecordService(onGetFirstCustomerResult); <br /> create_fixtures([“customers”, “addresses”, “orders”, “items”], doGetCustomerFirstCustomer, activeRecordService);<br /> } <br /> private function doGetCustomerFirstCustomer(activeRecordService:Object):void {<br /> var options:Object = {’include’:[‘bill_to_address’, {’orders’:’items’}]};<br /> activeRecordService.get(“Customer”, 1, options); <br /> }<br /> private function onGetFirstCustomerResult(event:Event, token:Object=null):void <br /> {<br /> assertTrue(event.toString(), event is ResultEvent); // First param is message.<br /> var customer:Object = ResultEvent(event).result;<br /> assertEquals(“Daniel”, customer.name);<br /> assertEquals(“Littleton”, customer.bill_to_address.city);<br /> assertEquals(2, customer.orders.length); // 2 order<br /> assertEquals(3, customer.orders<sup class="footnote" id="fnr0"><a href="#fn0">0</a></sup>.items.length); // the first has 3 items<br /> assertEquals(“Remote Control”, customer.orders<sup class="footnote" id="fnr0"><a href="#fn0">0</a></sup>.items<sup class="footnote" id="fnr2"><a href="#fn2">2</a></sup>.product); <br /> }</p> </typo:code> RubyConf 2006 - Day 3 2006-10-22T00:00:00-07:00 Here we go again. Let's how long my battery is going to last today. <table> <tr><td><a href="">Bruce Williams </a>posted the cool RubyConf 2006 logo on his <a href="">blog</a>. </td></tr> <tr><td><img src="" border="0" height="85" width="140" alt="rubyconf2006-140x85.png" align="center" /> </td></tr> <tr><td>9am: Streamlined, Justin Gehtland</td></tr> <tr><td>Why Streamlined? Remove repetitiveness in web development mostly for back-end type of application. Streamlined is build on top of Ruby on Rails. Build from their needs to build client applications. Goal to bring declarative goodness of ActiveRecord to the view layer. Streamlines is not a code generator like scaffolding. He now moves on to demo an application build with the framework. Streamlined support nicely relationship management. By default a new <i>streamlined</i> folder is add at the same level than the controllers, views, and models level. The streamline folder contains StreamlinedUI class allowing the modify declaratively the default behavior and representation of the views. Note that Justing presents the new css look and feel that Streamlined supports, named 'grail', which looks way better than the prior default look and feel. The default behavior uses Ajax, this can be turned off. No views are generate by default, they are dynamically rendered. For customization that goes beyond the features provided by Streamlined, a view can be generated and customized at will and will then be used instead of the generic view. Supports the acts_as_authenticated plugin, and provides user preferences. Justin now shows some upcoming features, like model specific behavior, layer specific field, tabbed views, multiple windowing toolkits, visual configuration. </td></tr> <tr><td>YARV: on Rails? by Koichi SASADA </td></tr> <tr><td>He starts with a tour on how Ruby activities in Japaon, from the RubyConf, to books and magazines. Japanese are very enthusiastic about Ruby. He mentions the <a href="">Rubyist magazine</a> (this is the link to the google translated version). He now moves on to YARV (Yet Another Ruby Vm). Which is going to be the new interpreter, which will have several advantages and optimizations. The demo continues buy showing a Rails application running on Yarv. YARV passes most of tests, but make 'test/test-all' still reports some errors. He demystifies some of the myth related to yard and mentions that Yarv is not a Silver Bullet. It doesn't make all programs 50 times faster, nor makes you slim and rich. The whole presentation is pretty funny. </td></tr> <tr><td>You got your Ruby in my CLR!, by John Lam</td></tr> <tr><td>no comments for that one...I was heads down coding...</td></tr> <tr><td>USS Ruby</td></tr> <tr><td>Where Star Treck joins Ruby. A one man act, somebody is taping this...I gotta find that link, it's too funny.</td></tr> <tr><td>Summer of Code 2006 - Google & Ruby Central, Inc.</td></tr> <tr><td>Austin Zigler was one mentor of the summer of code. He presents the principles of the Summer of code. 17 volunteers reviewed 96 applications for projects. 84 projects where eligible. 25 found a mentor, and google accepted 10. 3 of projects will be presented here. Ariel, A Ruby Information Extraction Library, train a program how to scan web pages. Root Port, Makerf, .....<br/> <strong>1.</strong> Gregory Brown presents his project, Ruby Reports (<a href="">ruport</a>). Plays also nice with Rails via acts_as_reportable. Gregory is not a Rails programmer, but wanted to get a plugin out there and let it grow. <pre> class ChunkyBacon < ActiveRecord::Base acts_as_reportable end class MyReport < Ruport::Report prepare do @table = ChunkyBacon.report_table(:all) end generate do @table.to_s end end </pre> There are many features like graph generation, pdf support for Ruport, so check it out.<br/> <strong>2.</strong> Rockin' the Pcoket - Ruby on Phones, by Jeff Hughes. He is just another Ruby Hacker that likes phones. He went with Symbian, Nokia mostly. Based on Python for Symbian open source project. Perl did it too. His motivation where that the phone is the ideal platform, every body has one, it's always connected, but where is Ruby. 2 weeks just to get it to compile. Another 2 weeks for linking. He is new to Ruby internal, in one summer he came out with a working prototype. Today, the core interpreter, a simple and basic file io. Future development: GUI, Symbian modules (socket, bluetooth, messaging). Matz is very excited about this project. See<a href=""></a> <br/> <strong>3.</strong> Jason Morisson - <a href="soc.jayunit.net">Type inference & Code Completion for RDT</a> Well, I didn't follow this talk as I was talking with Laurent Sansonetti about RubyOSA as I am waiting eagerly for the WebKit bindings. </td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> <strong>That's all Folks. Another great Ruby conference is under wrap.</strong> RubyConf 2006 - Day 2 2006-10-21T00:00:00-07:00 <table> <tr><td>9am - Open Classes, Open Companies,by Nathaniel Talbott </td></tr> <tr><td> In this talk Nathaniel reflects upon how features of the Ruby language that make it so efficient can be applied to business. Duck Typing, Interpreted language, Flexibility, Succinctness, Reflection, Open classes. It's a great way to present business concepts to a bunch of Ruby developers. Obie also wrote down some <a href="">notes</a>. </td></tr> <tr><td>10am - Mac OS X and Ruby, by Laurent Sansonetti</td></tr> <tr><td>Laurent is from Apple. Author of 5 Ruby libraries and maintains Ruby inside of OSX. For OSX Leopard, Ruby will be bundled as an OSX framework (Ruby.framework). Support 64bit, universal binary. IRB history support and line editing. Bundle gems (Rake, Rails, Mongrel, Capistrano, Libxml2, SQLit3, DNSDD,...). Ruby can control scriptable applications. <pre> 1. RubyAEOSA: app = OSX:AEDesc.application('iTunes') 2. Applescript using RubyAEOSA: result = OSX.do_osascript "tel application 'iTunes'... 3. RubyOSA: new project since June 2006. puts OSA.app('iTunes').current_track.name </pre> RubyOSA is the successor of RubyAEOSA, and is simpler to use and still efficient. <pre> require 'rbosa' itunes = OSA.app('iTunes') itunes.play # Let increase the volume... 100.times { |i| itunes.sound_volume = i; sleep 0.1 } </pre> He will release version 0.1.0 today, it will be available as a gem.<br/> Now onto Cocoa. RubyCocoa, is not Cocoa specific can be used to bridge Ruby with Objective-C code. Is widely used in free and commercials products. Laurent now demos a small Cocoa application written using XCode, in Ruby, to select and control songs in iTunes. </td></tr> <tr><td>Rinda in the real world, by Glenn Vanderbug</td></tr> <tr><td>Rinda is based on Linda, a distributed coordination system. Similar to JavaSpaces. Communication based on Drb.</td></tr> <tr><td>Lightning Talks</td></tr> <tr><td>Josh Susser having the flu, his session has been replaced by 9 x 5 minutes presentations.<br/> 1. kylemaxwell.com - I missed this presentation.<br/> 2. Ara T. Howard - ruby queue. Ruby based linux clustering solution used at NORA. nfs priority queue sqlite ruby.<br/> 3. Ben Bleything Shell-Style history for irb (in 75 lines). See at <a href="">blog.bleything.net</a><br/> 4. Andre Louis - wifi.earthcode.com. A community Wifi Cafe Listings allowing to enter cafes and ratings for working condition. Great site for the Rails developer on the go. Currently listing more than 1000 entries. With a open source zoom control for google maps.<br/> 5. Ryan Davis - Hoe. A tool to compliment rake.<br/> 6. Daniel Burger - Win32Util project. Memory Mapped IO on Windows with Ruby.<br/> 7. Aaron Patterson, <a href=""></a> (despite the site url, can be viewed at work). The presentation is named "I saw the sign" - Control a electrical sign panel from Ruby.<br/> 8. Charles Nutter - JRuby - presents the functionality of JRuby (0.9.1)<br/> 9. Charles Queen, James Grey - Heartbeat. Deploy your application from a web page. Using Capistrano and Rake tasks. see <a href=""></a><br/> 10.Bryan Takita - <a href="">FJSON</a>, Fast JSON.<br/> </td></tr> <tr><td>Web 2.0 Beyond the Browser, by Rich Kilmer</td></tr> <tr><td>Rich is presenting a Ruby based desktop runtime with a Rails based central service, named Indi. The UI is build in Flash.</td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> Lot's of good information can be found on these blogs: <ul> <li><a href=""></a></li> <li><a href=""></a></li> </ul> RubyConf 2006 - Day 1 2006-10-20T00:00:00-07:00 <table> <tr><td>Thursday night the crew (Chad, Rich, ..) preparing the name tags.</td></tr> <tr><td><img src="" border="0" height="166" width="208" alt="nametags.jpg" align="right" /> <img src="" border="0" height="166" width="208" alt="nametags2.jpg" align="right" /></td></tr> <tr><td>It's starting stay tunned.</td></tr> <tr><td><img src="" border="0" height="102" width="153" alt="RubyConfDenverLogo.jpg" align="right" /></td></tr> <tr><td>8:57am The room is pretty full.</td></tr> <tr><td><img src="" border="0" height="180" width="240" alt="starting.jpg" align="right" /></td></tr> <tr><td>RubyConf T-Shirt && Lee</td></tr> <tr><td><img src="" border="0" height="180" width="240" alt="lee.jpg" align="right" /><br/>T-Shirt design by Bruce Williams.</td></tr> <tr><td>Erlang: The Movie</td></tr> <tr><td>We are in advance on the schedule, so Rich Kilmer decided to show a video on scripting languages that is in the same vain as DHH's webcast that really brought TextMate and Ruby on Rails into limelight. You can see it on youtube <a href="">here</a>. Erlang is 10x more productive, 7x shorter programs. :-)</td></tr> <tr><td>10am: The History of Ruby, by Masayoshi Takahashi</td></tr> <tr><td>Why is Takahashi presenting The History of Ruby and not "matz"? Because Matz loves the Ruby, not the history of Ruby. By the way Masayoshi is the inventor of the <a href=""> Takahashi "Method"</a><br/> This presentation is a detailed and well informed recollection of how the Ruby community was created and spread from Japan to the rest of the world. Here are Lee's notes that will give you an idea but don't give justice to the presentation it self:<br/> <pre> History of Ruby - Masayoshi Takahashi (from the Takahashi Method) - 5 periods of Ruby history - Pre-history - Feburary 24, 1993 - "Ruby" name proposed by Keiju - Ancient Age - Ruby 0.95 released December 21, 1995 - "Rubyist" first used August 9, 1996 - Middle Age - Ruby spread in Japan since all the developers spoke Japanese, developers could learn English (for other languages) or learn Ruby - Modern Age - Ruby outside Japan - 2/16/2002 - English ML volume overtook Japanese ML - Contemporary Age (Rails Age) - RoR - The killer application on Ruby </pre> </td></tr> <tr><td>11am: Sydney & Rubinius - An experiment in improving, by Evan Phoenix (a.k.a Evan Webb)</td></tr> <tr><td> <pre> - Current interpreter: dump truck - reliable, sometimes slow, can throw everything in it - YARV: fire engine - shiny and fast - Rubinius: Dune buggy - fun but you'll get sand in your eyes - Simple == Powerful - Sydney - What was it? - giant patch to 1.8.2 - reentrant and threadsafe - Hit dead end - Rubinius - Prototype A - ported most of Smalltalk blue book to Ruby - worked but slow - Prototype B - implemented bytecode interpreter and compiler - Prototype S - hand translation of proto-B into C code - Evan has a nice conversational style to his talk - SegfaultProtection - protects extensions from crashing - turns a segfault into a raised exception - Bytecode interpreter architected via TDD </pre> </td></tr> <tr><td>1:30pm Programming Graphics with Ruby, by Geoffrey Grosenbach</td></tr> <tr><td>The presentation went through many visual examples, showed the code behind some of them. The presenter mentioned the following libraries: Scruffy - generates SVG, gnuplot, mrplot, asset_compiler from Jeremy Voorhis - Rake tasks for image manipulation, and his own library Gruff (which is pretty cool), sparkline. He went on showing how the different screencast headers on peopcode.com are generated using RMagick.</td></tr> <tr><td>2pm: Life After mkmf, Kevin Clark</td></tr> <tr><td>Iron Mongrel: Fuzzing, Auditing, Thrashing, Risk and The Ways Of Mongrel Destruction, Zed Shaw</td></tr> <tr><td>More notes to come, my neighbor at the conference and former colleague Tom is taking good notes...I will point to his blog as soon as he gets a network connection. Also check out <a href="">Nick Blogs</a>. We gave him so much crap after RailsConf where he was bragging about how much he would blog on it and didn't do any writing that he is currently trying to prove us wrong, but provides some good information.</td></tr> <tr><td>7:30pm - Yukihiro "matz" Matsumoto Roundtable</td></tr> <tr><td></td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> Note that as you notice the picture are taken with a phone or photobooth. From RubyConf 2005 to RubyConf 2006 2006-10-18T00:00:00-07:00 RubyConf is a great point in time to have a retrospective on the past year. And what at year it was. <p> <style> .timeline table { _border:none; padding: 5px; } .timeline td { border-left: 1px solid #dcdcdc; } .timeline th { text-align: right; vertical-align: top; white-space:nowrap; } </style> <table class="timeline" > <tr> <th>2005 October</th> <td>Started my first paid Ruby On Rails consulting gig to create an eCommerce platform for <strong>Gatelys</strong>. </td> </tr> <tr> <th>October 14th-16th</th> <td><strong>RubyConf 2005</strong> in San Diego, very technical. The creator and some of the key players in making Ruby were there: Yukihiro "<strong>matz</strong>" Matsumoto, Akira Tanaka, Koichi Sasada... While at the conference I started implementing <strong>time.onrails.org</strong> and started using it internally to log all my consulting time.</td> </tr> <tr> <th>October 19th</th> <td>Lee and I launched <strong>AutumnRidersTees.com</strong>, our first Ruby on Rails online eCommerce website, created for Lee's dad.</td> </tr> <tr> <th>2006</th> <td> </td> </tr> <tr> <th>March</th> <td>Gatelys deploys internally the order fulfillment section of their eCommerce Platform.</td> </tr> <tr> <th>April</th> <td>Based on the success off the first part of the eCommerce platform at Gatelys they asked me to work full time on their project. <strong>27th of April: </strong>deployed, the first public facing part of the application went life. Since October I also had spend about 50 development hours on time.onrails.org and thought it was getting pretty usable. So on the <strong>13th of April</strong>, I launched time.onrails.org.</td> </tr> <tr> <th>June</th> <td>Started working on <strong><a href="">Maestro</a></strong>, a new kind of multimedia-based learning platform written in Ruby on Rails. At that point I was over committed with all the different gigs I said yes to. Hopefully I learned a lesson from that. However Maestro was fun and invigorating to work on and you saw it in the results. We spend about 30 hours each in June with Lee and where able to put together an impressive Application under the lead of Sean Voisen. Rails really rocks. <strong>June 21th</strong>: my birthday and <strong>RailsConf 2006</strong>. It was impressive to see how positive the spirit of everyone was at that conference. More than 700 people attended, the rooms where packed, the presentations where just awesome.</td> </tr> <tr> <th>September</th> <td>Integrated time.onrails.org with <strong>Blinksale</strong> using their <strong>RESTFull</strong> API.</td> </tr> <tr> <th>October</th> <td><p><strong>Time.onrails.org</strong>. <strong>Gatelys</strong> deploys Gatelys.com, their flagship store using the eCommerce platform. More than 13 of their high volume stores are now powered by Ruby on Rails. I can tell you, Rails scales. <strong>RubyConf 2006</strong> is in just two days. I hope I'll see you there...I am the other Denver Ruby on Rails developer with a French accent. Swiss-French accent to be more precise. </p> <p align="center"><strong>See you at RubyConf! </strong></p></td> </tr> </table> Time.onrails.org now with Blinksale integration. 2006-10-05T00:00:00-07:00 <p>Blinksale is the easiest way to send invoices online. Now time.onrails.org is the easiest way to create Blinksale invoices. Check <a href=""></a> for more details.</p> Blinksale API 2006-10-02T00:00:00-07:00 <p>Today Blinksale published it’s data <span class="caps">API</span>. See <a href=""></a> for the details.</p> <p>It’s good news for time.onrails.org as now we can use the api to generate a draft Blinksale invoice with one click. I have started coding the integration and expect to release it once I have completed extensive testing.</p> <p>In short, time.onrails.org interacts in the following way with Blinksale:</p> <ol> <li>get list of client names</li> <li>get highest invoice number</li> <li>create invoice</li> </ol> <p>Let’s have a peek at how this is implemented.</p> <p><strong>Accessing Blinksale</strong></p> <p>A <em>Blinksale</em> class is provided to interact with your Blinksale data. You need to provide your blinksale id, username, and password.</p> <typo:code> <p>@blinksale = Blinksale.new ‘blinksaleid’, ‘username’, ‘password’</p> </typo:code> <p>In time.onrails.org we will let you define your Blinksale credentials once to avoid having to retype them each time you create an invoice. Storing the password is optional, and if not provided it will be prompted each time. A <em>use_ssl</em> flag can also be specified if you have a paid Blinksale subscription. This is of course recommended for security reasons.</p> <p><strong>Get the list of clients</strong></p> <typo:code> <p>clients = @blinksale.clients<br /> names = clients.collect { |c| c.name }</p> </typo:code> <p><strong>Get the highest invoice number</strong></p> <typo:code> <p>invoices = @blinksale.invoices<br /> invoices.collect{|invoice| invoice.number}.max</p> </typo:code> <p><strong>Create An Invoice</strong></p> <typo:code> <p>invoice_data = BlinksaleGenerator.to_xml(<span class="caps">INVOICE</span>)<br /> new_invoice = @blinksale.invoices.new invoice_data<br /> new_invoice.save</p> </typo:code> <p>BlinksaleGenerator is a time.onrails.org class that helps creating the following ‘invoice’ xml.</p> <pre> <?xml version="1.0" encoding="UTF-8"?> <invoice> <client>{blinksaleid}.blinksale.com/clients/#{@client_id}</client> <number>34</number> <date>2006-09-27</date> <terms>30</terms> <currency>USD</currency> <lines> <line> <name>Consulting</name> <quantity>2.0</quantity> <kind>Hours</kind> <unit_price>150.00</unit_price> <taxed>false</taxed> </line> </lines> </invoice> </pre> <p>The integration is pretty straight forward. Don’t you think? Thanks Scott and your team for this cool application. To find out more on the blinksale api see the online documentation at <a href=""></a></p> UPDATED: time.onrails.org - new features, fast server. 2006-09-05T00:00:00-07:00 Time.onrails.org, the simplest and most efficient time tracking application out there, just got better! <br/> <br/> <b>Speed:</b> We moved it to a new server. The application is now really responsive!<br/> <b>More Projects:</b> We also took the opportunity to extend the number of projects you can manage from 4 to 12 projects and sections from 12 to 52.<br/> <b>Sorting and Filtering:</b> Added new functionality like project reordering and filtering.<br/> <b>Project Sharing:</b> You can now share a read-only view of your projects for your customers or coworkers.<br/> <br/> So, no time to loose, <a href="">go try it out</a> and let us know what you think. Contract to hire UI Designer for Rails Project 2006-09-02T00:00:00-07:00 No we are not turning into a job board or "placement" company. We are just lucky to work with some pretty brilliant people on some pretty cool Rails project that are taking off. So, one of my customers is looking for a UI and Flash Designer. You can find more info regarding the position here (). You can also find some background and insight on this project here () and here (). In brief, it's a pretty cool eLearning project that will really shine through it's content that will be amplified by a discreet and powerful web presence. All that driven and based on Ruby on Rails. <p/> So if you are exceptional UI designer send your resume and portfolio to sean (- at -) eluminate (- dot -) net. Namespaces and Rake Command Completion 2006-08-30T00:00:00-07:00 <strong>Update:</strong> <a href="">Now using rake and caching</a> <p>I got some basic rake command line completion working today using Jon Baer’s <a href="">comment</a>. Very simple, very easy:</p> <typo:code> complete -W '`rake—silent—tasks | cut -d ††-f 2`' -o default rake </typo:code> <p>However this didn’t work for the namespaced tasks in a rails app like <code>rake test:units</code>. Searching a little further I found a reference to some code <a href="">Nicholas Seckar</a> wrote on <a href="">project.ioni.st</a>. This used ruby to find the possible tasks for command completion. This looked promising, but it still didn’t work for namespaced tasks. A little more googling led me to what looked like the perfect link: <a href="">Rake-completion script that handles namespaces</a>. Alas, it only handled one level of namespacing. It worked nicely for <code>rake test:units</code>, but <code>rake tmp:ses<TAB></code> would complete to <code>rake tmp:clear</code> instead of <code>rake tmp:sessions:clear</code>. Also, <code>rake test:units <TAB></code> would complete to <code>rake test:units units</code> instead of giving me all the tasks again, just in case you want to run multiple tasks form the command line.</p> <p>So, now what? Stand on the shoulders of others, naturally. Here is what I’m using now that handles multiple namespaces and multiple tasks per command line:<')) exit 0 unless /^rake\b/ =~ ENV["COMP_LINE"] after_match = $' task_match = (after_match.empty? || after_match =~ /\s$/) ? nil : after_match.split.last tasks = `rake --silent --tasks`.split("\n")[1..-1].collect {|line| line.split[1]} tasks = tasks.select {|t| /^#{Regexp.escape task_match}/ =~ t} if task_match # handle namespaces if task_match =~ /^([-\w:]+:)/ upto_last_colon = $1 after_match = $' tasks = tasks.collect { |t| (t =~ /^#{Regexp.escape upto_last_colon}([-\w:]+)$/) ? "#{$1}" : t } end puts tasks exit 0 </typo:code> <p><a href="">Enjoy</a></p> Full time Ruby On Rails Job in Denver. 2006-08-18T00:00:00-07:00 <p>One of my customers in Denver is looking for an experienced full-time Rails developer. The company is called , Gatelys/Etail Source. You will be part of a small, experienced, and agile development team that has developed three pretty cool Rails eCommerce applications. This is the posting they published on the job board of 37signals ():</p> <p class="meta"> <p><b>Description</b><br /> 
Small (but quickly growing) eCommerce startup seeks enthusiastic full-time senior-level Rails developer / system engineer. Special focus on performance optimization and tuning. Denver area resident preferred, but not mandatory. Salary will be competitive, depending on qualifications.<br/> <b>To apply</b><br /> 
Send resume and salary requirements to jobs@gatelys.com, attention Solomon.</p> </p> Short circuiting partials 2006-08-15T00:00:00-07:00 I tend to think of partials as mini-components. I don't like it when the page using the partial "knows" too much about what's in the partial. For instance, if your partial displays a collection of things but shouldn't display anything if the collection is empty, then you'll usually see something like this: <typo:code> outer page stuff... <% unless some_object.has_many_things.empty? %> <h3>My collection of stuff</h3> <%= render :partial => 'my_partial', :locals => { :collection_of_stuff => some_object.has_many_things } %> <% end %> more outer page stuff... </typo:code> The outer page has to know which collection of things the partial is going to use and performs some display logic around that. Shouldn't this all be contained in the partial? The outer page should just know that it is going to use a partial and that's it. So our outer page will look like this: <typo:code> outer page stuff... <%= render :partial => 'my_partial', :locals => { :some_object => some_object } %> more outer page stuff... </typo:code> Now it looks like a self-contained component. Good. Of course, we now have to put that outer display logic in the partial. <typo:code> <% unless some_object.has_many_things.empty? %> <h3>My collection of stuff</h3> <% some_object.has_many_things.each do |o| %> do some stuff with <%= o %> <% end %> <% end %> </typo:code> Now the messy part is the big <code>unless</code> block around the whole partial. I'd like to just short circuit the whole page if there's nothing to display, similar to what I do in normal methods: <typo:code> def do_something(some_arg) return nil unless some_arg do_something_cool_with_some_arg end </typo:code> Can it be as simple as putting a <code>return</code> statement in our partial? It turns out, yes, it is that easy. <typo:code> <% return if some_object.has_many_things.empty? %> <h3>My collection of stuff</h3> <% some_object.has_many_things.each do |o| %> do some stuff with <%= o %> <% end %> </typo:code> Wow! One whole line shorter. It doesn't look like much in this small contrived example, but I think it makes the purpose of the partial clearer and doesn't clutter up the calling page. Give it a shot. Dreamhost out, Slicehost in. 2006-08-04T00:00:00-07:00 <p>I must say I like Dreamhost but we had too much downtime recently. Even if we offer time.onrails.org for free it must be up and running when the users need it. This is especially true for a time management application. When you are done with your workday, one click and go home. Lee and I are using time.onrails.org daily for all of our customer projects and recently it has been down once too many time. In addition it’s getting really slow, but then again with a $9 a month shared host plan, I must admit we went already a long way. So time to move on and find a better solution.</p> <p>We went the last two days on the search for a new hosting provider that would provide dedicated or virtual private servers. There is lots of offerings out there and good information. Lee stumble upon slicehost.com and liked the idea of a small hosting company, that diggs Ruby on Rails, and is about to be launched. They are small and hopefully will work hard to make it. I was not too convinced so we decided to contact them, and had a nice chat with them over their campfire support room. See the <a href="" >campfire transcript</a>. I gave them a hard-time, but they provided us with lots of good information. Check them out if you want to find out what’s going on at <a href="">slicehost</a></p> <p>Transcript: <a href=""></a></p> <p>So time.onrails.org users, thank for your patience. In the next month we will move over our application to a way faster environment.</p> <p><strong>Update:</strong> time.onrails.org has been moved. If you sign up with slicehost because of us, feel free to say we referred you. :) Just use this <a href="">referrel link</a>.</p> RailsLogAnalyzer – help wanted 2006-08-03T00:00:00-07:00-–-help-wanted <p>I need some Mac users to test and give feed back on a very early version of the RailsLogAnalyzer. This app is an <span class="caps">OSX</span> app and not deployed on a server, so I would like to find out the obvious bug that may occur on different Macs. I tried it on my own MacBook Pro, G5 server, and on an old PowerBook G4. But then again the people most likely to use it are Rails developers that may have differences in their environment.</p> <p>So if you like to take risks :-), understand the basic structure of a Rails app, have a production.log you want to analyze, and are not afraid of some scary bugs then read on…</p> RailsAnalyzer - visualize your Ruby on Rails production log 2006-08-03T00:00:00-07:00 Download Application:<br/> <a href="" target="_blank">User Guide</a> Two new eCommerce sites driven by Ruby on Rails. 2006-07-27T00:00:00-07:00 While I was zipping a drink at the pool in Spain and visiting friends and family in Switzerland, the team at Gatelys.com was busy designing and configuring two new ecommerce stores using the Rails eCommerce platform I worked on while a Gatelys. And they have many more ecommerce sites to come.<p/> <a href="" ></a> and <a href="" ></a> <p/> Rails is open for some serious business. <p/> Note that most of the logos, graphics and layouts are done by Lomax which is the best graphic designer I know. Now if only I could find a way to hire him away :-) <p/> <a href="" > <img src="/files/20060727_sleekspaces.com.gif" /></a> <a href="" ><img src="/files/20060727_raygolfshop.jpg" /></a> <p/><p/> This complements that was launched a couple of months ago:<p/> <a href="" ><img src="/files/20060727_ntt.gif" /></a> Fowler on RubyGems 2006-07-20T00:00:00-07:00 <p>Since Daniel came back from Europe, I figured I’d finally pick up his slack and write an entry. :)</p> <hr /> <p>Last night I went to the <a href="">Boulder-Denver Ruby Group</a> where Chad Fowler spoke about all things <a href="">RubyGems</a>. It was a laid back talk with a recap of gems past, present and future. Pre-RubyConf 2003 the ruby-talk list would get peppered with questions like <quote>“Where is Ruby’s <span class="caps">CPAN</span>?”</quote> <p>At RubyConf 2003, when put on the spot by <a href="">David A. Black</a> about the topic, <a href="">Matz</a> basically said <quote>"if you build it, it will be included in ruby core.</quote> That led <a href="">Jim Weirich</a>, <a href="">Rich Kilmer</a>, Black, and Fowler to spend the next night coding what would become the RubyGems. They even demo-ed it at the conference. It has grown quite a bit since then and now could be called the de facto standard for library distribution in Ruby.</p> </p> <p>The latest version of RubyGems is 0.9.0, which has some not so minor scalability improvements. To get the latest version simple run <code>gem update --system</code>. Since RubyGems isn’t in core yet, you still need to <code>require 'rubygems'</code> or set your <code>RUBYOPT</code> environment variable to <code>rubygems</code>. There is another way when starting ruby you can pass it the <code>-rubygems</code> argument. <quote>“But you said it wasn’t in <em>core</em>… if it’s not in core, why does it have it’s own argument for the ruby interpreter?”"</quote> <p>It’s true, it’s not in core. This is actually just a little trick by Chad et al to make it look it is part of ruby. The <code>-r</code> argument tell ruby to require whatever parameter follows, so the gem crowd made an <code>ubygems.rb</code> file that only has one line of code in it … <typo:coderequire ‘rubygems’</typo:code> … and from that comes <code>ruby -rubygems</code>.</p> </p> <p>Bundled with gems is its own <code>gem_server</code>. Firing this up starts up a WebBrick server on port 8808 by default. Going to <a href=""></a> will then display all of the gems you have installed and even link to the rdoc installed locally if it exists and to the docs on the web. It also can serve gems if you wish. This means other machines could point to your gem_server and install any of the gems that you have installed. You do this with the <code>--source</code> argument. Others could search what gems you have by running <code>gem search -r --source search_string</code>. There is even a tool <code>index_gem_repository.rb</code> that will create a directory that can be served by apache as a gem server, in case you want something a little beefier than webrick.</p> <p>One interesting idea that Chad mentioned was making a meta-gem for your projects. All the gem would declare is its dependencies on the other gems that your project needs. That way when setting up a new machine you can just install your meta-gem from your gem_server and then it will automatically install all the necessary gems. <strong>Pretty cool.</strong></p> <p>Chad did a good job of describing how gems came to be and guiding us through some of the code with some nice anecdotes along the way.</p> <hr /> <p>P.S. The coolest part of the night was I’m going to be a volunteer at RubyConf `06! Chad was quick to warn me that there is no glamour involved. Oh well, I’m excited anyway.</p> Pickin' up the slack 2006-06-28T00:00:00-07:00 I guess I'll have to try to pick up the slack while Daniel's trekking around Europe. In case you don't know, I'm the guy named Lee that Daniel mentions from time to time. Hopefully, I'll be able to fill some space here with some useful tidbits about Rails, Ferret, and whatever else looks interesting. Have a great vacation, Daniel. We'll leave the light on for ya. June - Rails Month 2006-06-28T00:00:00-07:00 June was one of these 'Rails' month...With Lee we took on a new Rails project in the e-learning arena for some people with some really cool ideas. They wanted a html prototype at the end of the month, and overly optimistic as I am, I said why just a prototype, let's build the real thing. And we did. Now there is more to the application before it can go life than what we just build, but we managed to go from concept to a real working front-end in an extremely short time. Wired frame UI, intense object modeling discussions, html prototype, then build it with Rails. Rails just get's out of your way and let's you build a web application as fast as your brain allows :-) We where really surprised how fast a great application can be build. This was only part time, as my main project is working on gatelys.com new ecommerce platform. An astonishing Rails application. I also worked a little on RailsLogAnalyzer, a 'Rails production log' visualization application using Rails and Flex on OSX. But for that one I will wait that the Flash Player 9 is out for OSX Intel. Then RailsConf 2006. That was awesome, meeting 700 Rails enthusiasts, the Rails core team, and many Rails developers from the Denver area. I can just say: "Rails has a bright future!". But now is time for me to sit back, relax. I'll be on vacations for most of July. So see you then! Streamlined - Will ROCK the Rails World 2006-06-24T00:00:00-07:00 <a href="">Streamlined</a> is an open source framework for quickly creating data-centric applications with Ruby on Rails. Today Justin Gehtland announced during his 'Ajax on Rails' talk that Streamlined will be released at OSCON in July. I can best describe Streamlined as 'dynamic scaffolding' done right. Streamlined is a model driven way of generating data centric UI's. Justin demoed how to create and modify a data entry application. It provides search, crud functionality, support relationship between model, and way more. The framework adheres to the convention over configuration approach and provides a default behavior of the application than can easily be refined and enhanced. As opposed to scaffolding it doesn't generate code for the controller but provides a basic behavior. This will <strong>ROCK</strong> the software development world and accelerate many projects. <p/> <strong>From the Streamlined website:</strong> <br/> In the Abendsen release, Streamlined has been focused on solving the problems of our customers and our internal projects. Right now, Streamlined is focused on: <ul> <li>Generator for churning out the initial views and configuration</li> <li>A declarative DSL for managing views, including relationship management, field selection, etc.</li> <li>Full Ajax-enabled management views with sorting, paging and live search (with configurable field-inclusion)</li> <li>A criteria query extension to Active Record</li> <li>Context-sensitive help</li> <li>An extensible component system for representing relationships at runtime</li> <li>Export to xml/csv</li> <li>REST-ful web service layer around all models</li> <li>Atom support</li> <li>Auto user-management and inclusion of declarative role-based authorization</li> <li>Choice of layouts (Yahoo Grids or CSS Framework)</li> <li>Theme support</li> <li>Includes Javawin for in-browser windowing</li> </ul> <br/> This is the feature set we'll release at OSCON in July. RailsConf 2006 - Here we come! 2006-06-20T00:00:00-07:00 Looking forward meeting you all in Chicago! There will be tons of great presentations, here is my selection: <p/> <table> <tr><th>Friday </th></tr> <tr><td> 10:45 </td><td> Introduction to Capistrano </td></tr> <tr><td/><td> Mike Clark is just a great presenter </td></tr> <tr><td> 13:15 </td><td> ?? </td></tr> <tr><td/><td> Not sure yet </td></tr> <tr><td> 14:30 </td><td> Monitoring Rails Applications in Production Environments </td></tr> <tr><td/><td> Too important to skim that one </td></tr> <tr><td> 15:45 </td><td> Sneaking Rails into the (legacy) system </td></tr> <tr><td/><td> or Goeffrey's Rails Deployment on Shared Hosts</td></tr> <tr><th> Saturday </th></tr> <tr><td> 09:00 </td><td> Ajax on Rails </td></tr> <tr><td/><td> Let's see what the 'man' has to say </td></tr> <tr><td> 10:15 </td><td> Lessons from Blinksale and IconBuffet </td></tr> <tr><td/><td> I am eagerly waiting for some information on the Blinksale API </td></tr> <tr><td> 11:30 </td><td> Lucene Eye for the Ruby Guy </td></tr> <tr><td/><td> We are using successfully Ferret, but Lee did all the programming, so it's time I do some catching up </td></tr> <tr><td> 14:45 </td><td> Testing Migrations </td></tr> <tr><td/><td> I hesitate between this and the two other talks, but I got bit a couple of time with migrations. So any good advice is welcome. </td></tr> <tr><th> Sunday </th></tr> <tr><td> 9:00 </td><td> Beyond DHTML: Introducing Laszlo on Rails </td></tr> <tr><td/><td> I am big fan of Flex and Laszlo, now that Laszlo can generate DHTML, let's see what Mike has to say. </td></tr> <tr><td> 10:15 </td><td> Just the Facts (and Dimensions) -- using Rails with your OLAP data model </td> </tr> <tr><td/><td> I had the chance of beeing part of a team that pionered the field before it was called that (back in 1987). And now I need to do some more data analysis for the soon to be releases OSX RailsLogAnalyser application (Flex+Rails). Looking forward to this talk. </td></tr> <tr><td> 11:30 </td><td> Rails Takes on the Enterprise with SOA </td></tr> <tr><td/><td> Rails is a tuff sell to the enterprise. They invested to much into Java and .Net, so even if Rails is often a good fit, it's not even considered. So any additional ammunition to enter existing enterprises is welcome</td></tr> </table> Derailed - Denver Ruby On Rails User Group. June 15th. 2006-06-15T00:00:00-07:00 19:15 Doug Fales presentation: <strong>Rails by the Waypoints: Integrating a GPS Unit and a Digital Camera in the Era of the Mashup</strong>. <p> Doug will present this talk at RubyConf next week, so this is kind of a dry run for him in front of 25 people at the Derailed (Denver Ruby On Rails User Group) before the big event. About 5 other people from the attendance will also attend RailsConf. Cool, Denver is in force. Doug explained how he came to Rails and integrating it with GPS data, Flicker and Google maps...that's what happens when you got the crazy idea of running long distances in the middle of no where. Check out <a href=""></a> in the next month as he will release a first public version of his application. In short, you can map your walking track recorded by a gps onto a google map and also upload and link your photos to the track based on the photos time-stamps. Doug now moves onto the "What I learned" writing this application. Site note: the funny thing is that besides Ara, everyone in the attendance uses a Mac. Ok, back to the presentation. Doug sees Ruby on Rails as the glue between the data and the client-side of the application. Another challenge was writing the GPS data mangling libraries. He describes how Ruby helped writing different blocks of functionalities (Search using the Ferret gem and acts_as_ferret, the data models, tagging, ...). He then describes the cost of development, where Rails offers you lots for free. Finally, he concludes with comments on how rails allows for creativity by solving lots of mundane problems for you and allowing for to keep your momentum. <p> 20:15 Now onto to Ara Howard's presentation: <strong>Meta Programming</strong> <p> Ara is usually more involved with the Boulder Ruby User Group. He is a Ruby person first, then a Rails person. He got into Ruby about six years ago, and works in all manner of application domains and is specialized in data mangling (not directly his words). He defines Meta-programming as being code that writes code. That can be at compile time or a run time. You can have reflexive meta programming where a language can be used to generate output in the same language. Ruby is a very good meta-programming language and Rails makes heavy use of meta-programming. Rather than going paraphrasing Ara, I would certainly be incorrect as he is covering lot's of ground, check out his <a href="">slides</a> (this link is to his desktop, you can also find the slides at <a href=""></a>). Note that just the slides won't provide enough background as the narration Ara provides and the code examples augments greatly these slides. So try to catch one of his talks if you can. The nice part of his presentation is that he is presenting advanced aspects of Ruby, the languages, that may be more obscures to people like me that dived into Ruby via Rails. Ruby provides lots of hooks for meta programming like module_eval, class_eval, instance_eval, define_method, eval (being evil). <p> <p> Two excellent presentations. Thank guys! Now onto Rock Bottom for a beer. Geoip data 2006-06-01T00:00:00-07:00 As part of the Rails Log Analyzer I want to show where, geographically speaking, the different users come from. The following 'ingredients' were required to achieve this: <ul> <li>The geoip gem by Clifford Heat</li> <li>The GeoLiteCity.dat file download from</li> <li>A vectorial world map in Flash from</li> <li>And the Flex mx:BubbleChart component</li> </ul> The result is the following <p> <img src="" border="0" height="254" width="398" alt="20060601_geoip.gif" /> </p> <p> Note. <p> So now lets look at some code extracts. <p> <strong>Getting the geoip information [ruby]</strong> <p> When parsing the log we retrieve the city information related to an ip address <typo:code require 'geoip' geo_ip = GeoIP.new("#{RAILS_ROOT}/data/GeoLiteCity.dat") parser.items.each_with_index do |item, index| geo_info = geo_ip.city(item['ip']) ... end </typo:code> The _city_ method returns the following array <pre> [ ] </pre> <p> <strong>Generating the geo data series [ruby]</strong> The log file data is stored in sqlite database for ease of querying and aggregation. <i>This will also allow to wrap the application as a packaged OSX application with the database embedded in the application.</i> The following called is invoked by the controller that simply return the result of the query to the Flex application. <typo:code </typo:code> <p> <strong>Rendering the series [flex]</strong> <p>) <typo:code <local:BubbleSerieChart </typo:code> <typo:code <?xml version="1.0" encoding="utf-8"?> <mx:Panel xmlns: <mx:Script> <![CDATA[ import mx.controls.Alert; [Bindable] public var time_serie:Object; [Bindable] public var serie_name:String; private function getLabel(item:Object, field:String, index:uint, percentValue:Number):String { return item.key; } ]]> </mx:Script> <mx:BubbleChart <mx:backgroundElements> <mx:Array> <mx:Image </mx:Array> </mx:backgroundElements> <mx:horizontalAxis> <mx:LinearAxis </mx:horizontalAxis> <mx:verticalAxis> <mx:LinearAxis </mx:verticalAxis> <mx:series> <mx:Array> <mx:BubbleSeries </mx:Array> </mx:series> </mx:BubbleChart> </mx:Panel> </typo:code> Rails Log Analyzer - Rails and Flex with JSON 2006-05-15T00:00:00-07:00 <img src="/files/20060515_railsloganalyzer.gif" alt="" /> <p>I started to write a small Rails Log Analyzer that provides some insight on how a given application is used. I’ve just spent three hours so far, so not too much to show, but I have found the integration of Flex with Rails for read-only purpose of the different time series pretty straight forward.</p> <h2>In two words…</h2> <p><span class="caps">RAILS</span>: data.to_json</p> <p><span class="caps">FLEX</span>: <span class="caps">JSON</span>.decode(String(srv.lastResult));</p> <h2>On the Rails side</h2> <p>The controller simply transforms the Hash return by the model into a json textual representation.</p> <typo:code <p>class DataController < ApplicationController</p> def overview render :text => Hit.overview_data.to_json end <p>end</p> </typo:code> <p>This is an extract of the method that returns a Hash that contains the time series in an Array.</p> <typo:code <p>def Hit.overview_data<br /> result = {}<br /> result[:header] = {:period => {:start => Hit.minimum(:time).to_s(:db), :end => Hit.maximum(:time).to_s(:db)}}<br /> result[:sessions_series] =<br /> {:by_day => Hit.data_serie(Hit.count(:session, :group => :day, :conditions => ‘controller <> “HeartbeatController”’), “sessions by day”) }<br /> result<br /> end</p> </typo:code> <h2>On the Flex side</h2> <typo:code import com.macromedia.serialization.json.*; private function resultHandler(event:ResultEvent) : void { status = “Loaded. Parsing data…”; var result:Object = <span class="caps">JSON</span>.decode(String(srv.lastResult)); header = result.header; ts = getSerie(result.sessions_series.by_day.data); } <mx:HTTPService </typo:code> <p>The service is invoked by the following actionscript call</p> <typo:code <p>srv.send()</p> </typo:code> <p><span class="caps">JSON</span> doesn’t support Date objects out of the box, but it’s a nice way to exchange complex data such a Hash and Map between Rails and Flex.</p> Update: time.onrails.org. Add Notes to your time entries! 2006-05-08T00:00:00-07:00 <style> .new { background-color: yellow; color: rgb(0, 0, 0); <p>}</p> </style> <p><span class="new" >Updated</span> time.onrails.org</p> <p>The new functionality is <br /> <ul><br /> <li>Add notes to your time entries. You can now add notes from the Dashboard or your project pages.</li> <br /> <li>Improved <span class="caps">CSV</span> export.</li></p> </ul> <p>Some functionality I am considering next:<br /> <ul><br /> <li>fixing the rendering in Internet Explorer. I just saw this bug since I installed Parallels on my MacBook pro. </li><br /> <li>Blinksale integration, I started to write the UI to submit a time section to generate an invoice via Blinksale, but I am still waiting to get access to the api. Unfortunatly I didn’t make to the beta of the <span class="caps">API</span>. I even tried to convince Josh Williams from Firewheel Design, to let me in on it, but without success. Thanks Josh for the quick response anyhow!</li></p> </ul> remote_function :with 2006-05-01T00:00:00-07:00 <typo:code <p><%= select_tag “content_type”, options_for_select(content_type_options),<br /> { :onchange => <br /> remote_function(<br /> :url => {:action => ’filter_by_content’}, <br /> :with => ‘Form.Element.serialize(this)’) } %></p> </typo:code> <p>The above code allows to submit via javascript the selected value of a combo box. The remote call is triggered via the <em>onchange</em> event handler of the select tag. Notice the parameters to the remote function call <strong>:url</strong>, as usual, but also the <strong>:with</strong> parameter. The <strong>:with</strong> option can be very useful if you need more control on what data needs to be sent to the server. In this case we use Form.Element.serialize that url encodes all the parameters found in a given div (doesn’t need to be a form). In this case the <em>content_type=snippet</em> is passed to the server.</p> An eCommerce platform in Ruby on Rails 2006-04-27T00:00:00-07:00 <p>I have the chance to be part of an amazing team since last October that created a new generation of eCommerce platform using Ruby on Rails that will power hundreds of high profile ecommerce websites. The first website powered by this platform is</p> <p><a href=""></a></p> <p>Gately’s, the company behind this development had the foresight one year ago to start the development from scratch of the three major applications forming the platform…using Ruby on Rails. This decision was driven by their technical director, Solomon White, who saw the potential of Rails that not many realized at that time and decided to form a top notch team. The three applications are order management, store builder, and the storefront engine. The storefront engine can drive multiple stores. You can get an idea of what such a store looks a like at <a href=""></a>. However most of the development went into the two back-end applications, that not only look amazing, but offers possibilities that will make news in the future.</p> <p>Each of the three components of the platform consist of a large application by it-self. The storefront and the store builder are new applications and the order management replaces an older php applications. Together these applications have well over one hundred model classes. This is just to give an idea of the scale of the applications.</p> <p>Now, the question is how well is Ruby On Rails adapted for larger scale development with a team of 5 developers and 1 designer?</p> <p>Ruby On Rails kicks ass.</p> <p>The many decisions that the Rails environment takes for you allows you to concentrate on what is important, like business logic, user interaction, quality. You spend very little time in the plumming of the application asking yourself where things should go or what artifacts should be used. Rails did these descisions for you. In addition, the different ways you have to exercise immediately a code change without any delay, by the console, through unit tests, or via a page refresh provides a dynamism to the development cycle that cannot be described in words but needs to be experienced. You can perform a quantity of changes in an hour that cannot be done in other environments like java. Not only code changes, but with the database migrations you can go back and forth between different data model structures, just to experiment. You start not just coding the first thing you decided on, but you start going in a “Oh, let’s try this” mode. Not all is shiny however. We had some difficulties sharing code between the three systems that had common model, views, and controllers. This was for the access rights. For some mysterious reasons I didn’t feel using the Plugins Engine that specifically addresses this problem. So I started to role-my-own, lighter version of a plugin engine, which works but is still causing some headaches from time to time. On the other hand, using the plugin architecture to share common code that doesn’t rely on views, is a simple and great solution. Furthermore to integrate the three applications we used secured, RESTfull http requests. This approach is so much simpler than webservices and with Rails you can modify the two applications that needs interaction in parallel, refining the interaction protocol, again seeing the results of any change immediately.</p> <p>There is way more to describe, but as a former Java Enterprise developer and a former Microsoft Solution Developer, I can say that Ruby On Rails just kicks ass and leaves these other environments in the shadow.</p> <p>If you are starting a new enterprise or web development project, you got to consider Ruby on Rails!</p> Update: time.onrails.org. Capistrano Rocks! 2006-04-19T00:00:00-07:00 <style> .new { background-color: yellow; color: rgb(0, 0, 0); <p>}</p> </style> <p><span class="new" >Updated</span> time.onrails.org</p> <p>The new functionality is <br /> <ul><br /> <li>A first version of data export to text, csv, and xml. See the export icons in the bottom right of the projects and dashboard page.</li><br /> <li>A mini system message board. So we can leave you a message, i.e. for planned system maintenance downtime, or to announce new functionality.</li><br /> <li>The latest version of the <a href="">Gruff Graphs</a></li></p> </ul> <p>I realized that data export needs some more work as in Safari the xml doesn’t appear unless you do a view source and the csv doesn’t load Microsoft Excel directly nor adds a default .csv extension to the generated data.</p> <p>We will deploy new functionality or fixes issues once a week if possible. Note that we are going to keep this application simple, but any suggestion is welcome. Contact us at <a href="mailto:time@onrails.org">time@onrails.org</a>.</p> <p>I deployed the application using Capistrano. It is pretty stressless and consists of the following steps:<br /> <pre><br /> rake remote:disable_web<br /> rake remote:deploy_with_migrations<br /> rake remote:enable_web<br /> </pre></p> <p>In this case we had a database migration, the new ‘messages’ table.</p> <p>The only issue that persists is that the application doesn’t start right away after the deployment and seems to hang for about 10 minutes before comming back to life. The application is hosted on Dreamhost and we don’t have full control on how the displatch.fcgi processes are launched.</p> <p>It’s now up and running, so enjoy!</p> render :update to |page| 2006-04-18T00:00:00-07:00 <p>In the following test I was checkeing out of the javascript that is generated using the render :update call. Note that using a functional test is also a nice way to explore some of the prototype_helper functionality.</p> <pre> page.call 'mycall', 'a', 2, 3 # --> mycall("a", 2, 3);' page.my_class.my_method 'a', 12 # --> MyClass.myMethod("a", 12); </pre> <p>Now one issue I had was figuring out how to pass a javascript variable to a javascript call. I.e. mycall(p1, p2). The only way I found it so to use the page << method. After a little hacking I managed to pass javascript variables to a method using the page.call. See the use of the JsArugmentList class here after. Note it does get’s a little cluttered and the page << remains easier to read. Please let me know if you find a more elegant way to achieve this.</p> <typo:code <p>require File.dirname(<i><span class="caps">FILE</span></i>) + ‘/../test_helper’</p> <ol> <li>Little hack to allow passing javascript variables as argument to page.call<br /> class JsArgumentList<br /> def initialize(*arguments)<br /> @arguments = arguments<br /> end<br /> def to_json<br /> @arguments.join ’, ’<br /> end<br /> end</li> </ol> <p>class RjsController < ActionController::Base<br /> def rescue_action(e) raise e end;</p> <ol> <li>See prototype_helper.rb for implementation of the ‘page’ methods.<br /> def page_call<br /> render :update do |page|<br /> page.call ‘mycall’, ‘a’, 2, 3<br /> page.assign ‘p1’, ‘str1’<br /> page << ‘mycall(p1, p2);’ <br /> page.call ‘mycall’, JsArgumentList.new(:p1,:p2) #equivalent to previous line<br /> page.my_class.my_method ‘a’, 12 <br /> end<br /> end<br /> end</li> </ol> <p>class RjsControllerTest < Test::Unit::TestCase<br /> def setup<br /> @controller = RjsController.new<br /> @request = ActionController::TestRequest.new<br /> @response = ActionController::TestResponse.new<br /> end<br /> def test_page_call<br /> get :page_call<br /> javascript = @response.body.split(“\n”)<br /> assert_equal ‘mycall(“a”, 2, 3);’, javascript<sup class="footnote" id="fnr0"><a href="#fn0">0</a></sup><br /> assert_equal ‘p1 = “str1”;’, javascript<sup class="footnote" id="fnr1"><a href="#fn1">1</a></sup><br /> assert_equal ‘mycall(p1, p2);’, javascript<sup class="footnote" id="fnr2"><a href="#fn2">2</a></sup><br /> assert_equal ‘mycall(p1, p2);’, javascript<sup class="footnote" id="fnr3"><a href="#fn3">3</a></sup><br /> assert_equal ‘MyClass.myMethod(“a”, 12);’, javascript<sup class="footnote" id="fnr4"><a href="#fn4">4</a></sup><br /> end<br /> end</p> </typo:code> Graphs with Gruff (followup) 2006-04-14T00:00:00-07:00 <p><a href="">The solution from the source</a> ;-) I checked it out and it now works as advertised, just add g.minimum_value = 0 to the Gruff::Bar before rendering it (g.to_blob).</p> <p>Note that axis starting at zero.</p> <table> <tr> <td> Without the minimum_value </td> <td> With the minimum_value set to zero </td> </tr> <tr> <td> <img src="/files/20060414_gruff_before_sm.gif" alt="" /> </td> <td> <img src="/files/20060414_gruff_after_sm.gif" alt="" /> </td> </tr> </table> LAUNCH time.onrails.org, time tracking made simple! 2006-04-13T00:00:00-07:00 <p><img src="/files/launch_timeonrails.gif" alt="" /></p> <p>We call it <a href="">time.onrails.org</a>. It’s a new <span class="caps">FREE</span> online time tracking product for the consultant and programmer that bills by the hour or works on multiple projects.</p> <p>We (Lee and I) have been using it for awhile now to track our Rails consulting work. It’s really the fastest way to count your hours across multiple projects. And we tried many of the solutions out there.</p> <p>See <a href="">time.onrails.org</a> for an overview or go straight to <a href="">signup</a> and be up and running in 5 seconds.</p> <p>Let us know what you think at time@onrails.org.</p> <p>Enjoy! <br /> Daniel</p> CSS Transparent Rollovers 2006-04-10T00:00:00-07:00 <p>I was trying to implement some rollover effects when I stumbled over this article at <a href="">mandarindesign</a>. I wrapped this functionality in the helper here after</p> <typo:code <style type="text/css"> <p><!-- div.transOFF {width: 100%; background-color: silver; border:1px solid black;} div.transON {width: 100%; background-color: silver;opacity:.50;filter: alpha(opacity=50); -moz-opacity: 0.5; } --></p> </style> </typo:code> <typo:code <table width="200" border="0" style="border:1px solid black;"> <tr> <td>Project</td> <td>Dashboard</td> <td>Charts</td> </tr> <tr> <td><%= rollover_image(‘/images/index/project_icon.png’, true) %></td> <td><%= rollover_image(‘/images/index/dashboard_icon.png’) %></td> <td><%= rollover_image(‘/images/index/graph_icon.png’) %></td> </tr> </table> </typo:code> <typo:code def rollover_image(src, over=false) transON, transOFF = over ? [‘transOFF’, ‘transON’] : [‘transON’, ‘transOFF’] content_tag “div”, image_tag(src, :onmouseover => “this.className=‘#{transOFF}’”, :onmouseout => “this.className=‘#{transON}’” ), :class => transON, :onmouseover => “this.className=‘#{transOFF}’”, :onmouseout => “this.className=‘#{transON}’” end </typo:code> <style type="text/css"> <p><!-- div.transOFF {width: 100%; background-color: silver; border:1px solid black;} div.transON {width: 100%; background-color: silver;opacity:.50;filter: alpha(opacity=50); -moz-opacity: 0.5; } --></p> </style> <table width="200" border="0" style="border: 1px solid black;"> <tbody> <tr> <td style=""> <p>Project</p> </td> <td style=""> <p>Dashboard</p> </td> <td> <p>Charts</p> </td> </tr> <tr> <td style=""> <div onmouseover="this.Javascript function test</h1> <p><%= link_to_function(‘Add’, ‘add_item()’ ) -%> | <br /> <%= link_to_function(‘Clear’, ‘clear_list()’) <span>><br /> <ul id='list' /><br /> <script type='text/javascript'><br /> <</span>= render :partial => ‘functions’, :type => ‘rjs’ <span>><br /> </script><br /> <script type='text/javascript'><br /> <</span>= # Note: following javascript is run when the page is loaded.<br /> update_page do |page|<br /> 3.times { page.call ‘add_item’ }<br /> end<br /> %><br /> </script></p> </body> </html> </typo:code> <p>The <em>rjs</em> method in the <em>PlaygroundController</em> set’s the content-type as we perform a render of an rjs from within a .rhtml and this seems to change the content-type, so we need to reset it.</p> <p><strong>_function.rjs</strong><br /> <typo:code<br /> page << ‘function add_item() {’<br /> page.insert_html :bottom, ‘list’, content_tag(‘li’, ‘item’, :id => ‘list_item’ )<br /> page.visual_effect :highlight, ‘list’, :duration => 3<br /> page << ‘}’</p> <p>page << ‘function clear_list() {’<br /> page.replace_html :list, ""<br /> page.visual_effect :highlight, ‘list’, :duration => 3<br /> page << ‘}’</p> </typo:code> <p>In the partial <em>function.rjs we insert the function declaration before writing to the page object. This allows us to invoke the add</em>item _ and clear_list _ methods using the link_to_function _ from in the .rhtml file. Note also in the .rhtml file we invoke directly the update_page method to insert three calls to add_item().</p> <p><strong>The generated html files looks like this</strong></p> <typo:code <html> <head> <script src="/javascripts/prototype.js" type="text/javascript"></script> <script src="/javascripts/effects.js" type="text/javascript"></script><script src="/javascripts/dragdrop.js" type="text/javascript"></script><script src="/javascripts/controls.js" type="text/javascript"></script><p></p> </head> <body> <h1 id='header'>Javascript function test</h1> <p><a href="#" onclick="add_item(); return false;">Add</a> | <br /> <a href="#" onclick="clear_list(); return false;">Clear</a><br /> <ul id='list' /><br /> <script type='text/javascript'> function add_item() { new Insertion.Bottom("list", "<li id=\"list_item\">item</li>"); new Effect.Highlight('list',{duration:3}); } function clear_list() { Element.update("list", ""); new Effect.Highlight('list',{duration:3}); } </script> <script type='text/javascript'> add_item(); add_item(); add_item(); </script></p> </body> </html> </typo:code> Xml Builder 2006-01-10T00:00:00-08:00 <p>I created the new <em>Playground</em> category on this blog to expose various aspects regarding Ruby On Rails that I am exploring. It may raise more questions than provide answers, but in any case don’t hesitate to jump in and add your 2 cents.</p> <p>The <em>xml_builder</em> method here after uses the <em>render_to_string method to create some xml structure. The xml</em>string could as well have been in a separate .rxml file and and a simple <em>render</em> statement instead of <em>render_as_string</em> could have saved one line of code. But hey, that’s what the playground is for!</p> <typo:code <p>class PlaygroundController < ApplicationController</p> def xml_builder xml_string = <<-XML_END xml.test do xml.language(name) xml.description(“Rocks!”) end XML_END result = render_to_string(:inline => xml_string, :locals => { :name => ’Ruby’}, :type => :rxml) render_text result end <p>end</p> </typo:code> <p>The output: <br /> <typo:code<br /> <test><br /> <language>Ruby</language><br /> <description>Rocks!</description></p> </test> </typo:code> Flex vs. ROR 2006-01-09T00:00:00-08:00 <p><strong>Ed just asked me:</strong> "Why, ultimately would you say <span class="caps">ROR</span> is better than Flex? There’s a great debate at the moment.</p> <p><strong>My <em>swiss</em> style answer:</strong> "This is a very interresting question. I effectively use<br /> both technologies with different customers on different projects. And<br /> I like both, they have different strength. Flex 1.5 answers only the<br /> UI question and doesn’t help with the persistence side of a project.<br /> Flex 2.0 will provides some answers to the persistence integration<br /> with their Enterprise Services. Flex is really awesome to build a<br /> custom UI. Rails on the other hand provides lots of power if you have<br /> control on the database schema and is a full “web” stack. It provides<br /> a nice framework to build the views and provides some pretty powerfull<br /> ways to create dynamic html pages. Rails can we very productive. So in<br /> other words, I don’t prefer one over the other. It really depends on<br /> the specifics of the problem to be solved, the technical expertise of<br /> a customer and the future direction a customer wants to go to define<br /> if one technology is more appropriate than another."</p> I'd rather be on RAILS. 2005-12-09T00:00:00-08:00 <p>This statement is pretty true right now, Rails is just a pleasant development environment. Mike Clark left this sticker at my desk at one of the places I am currently doing a Rails project at.</p> <p><img src="" alt="" /></p> <p>For another client I am doing a Flex project and work with many great java developers. I thought I would put the sticker in a visible spot and see their reactions. Well, it didn’t fail, some of the comments where pretty funny. Here they go:</p> <ul> <li>That’s a big statement.</li> <li>We’ll run you out on a rail.</li> <li>So you would rather be on rails, hein?</li> <li>HuHan!</li> <li>You really are a geek.</li> <li>Where did you get it? You didn’t get one for me?</li> <li>He’s a convert.</li> <li>You are pushing the Ruby stuff today!</li> <li>It looks like it should have a Lenin on it.</li> <li>I’d rather be fishing.</li> </ul> <p>The “Lenin” one I didn’t totally get, even after a long discussion, but I sounded pretty funny to me. As you see, give me a sticker and will say good things about you. No, that’s not the case, I just think Mike Clark and Dave Thomas are putting a very compelling training together, and with these two guys you will learn more in three days than you would ever in any other places. Check out <a href=""></a> and their new Rails Studio, coming to Denver in January.</p> An on-line store build with Ruby on Rails 2005-12-03T00:00:00-08:00 <p>In this non-technical article I wanted to share my impressions of writing an online store with Ruby on Rails. <a href=""></a></p> <h2>Background</h2> <p>On September 9th Lee’s dad mentioned that he would receive a stock of new quality designer T-shirts with funny bikers logos on September the 22nd and asked Lee if he could setup an on-line store. Lee asked me if I could help out writing it in Ruby on Rails and if I thought it was feasible. Hey, I just finished “Agile Web Development with Rails”, how hard could it be, the book contains everything we need. So “heck, yea, we can do it”. So Lee told his dad: “Sure, we’ll do”. Well, it took us just a little longer, not much thought, considering we just met once a week for a month, and two weekends. But considering that Lee just started a new Rails gig, me just being father for the second time and a little sleep depraved, we manage to go-life on October the 16th at RubyConf 2005. First Ruby and Rails is really cool, Dave Thomas books are invaluable in many aspects, not the least being that the most of the order processing part of the application is taken straight from book.</p> RubyConf 2005 and RubyWeek 2005-10-16T00:00:00-07:00 <p>RubyConf 2005 and RubyWeek</p> <p>What a Ruby Week. I am on the plane back to Denver from the Ruby Conference 2005 that just finished in San Diego. On the beginning of the week I started a new part-time job working on a Ruby on Rails application. On Thursday I flew to San Diego for the conference. <em>Later</em> that evening, with Lee we fleshed out the latest bug of our first on-line Rails application, and put it in production. If you are a Biker and like funny shirts, check out <a href="">AutumnRidersTees.com</a>. It’s a <em>very</em> small on-line shirt Store. Thank you Dave Thomas for your book on Rails, it was also a nice kick-start for our application, especially the non-public/administrative side of the site. On Friday the conference started, and what a conference, about two hundreds geeks and Ruby fans, inclusive many of the key players that create Ruby, Rails, and many of the awesome frameworks we are using everyday. It’s funny to put a face on who is behind these frameworks. For more info on the speakers checkout the <a href="">agenda</a>. Matz,the creator of Ruby, and ko1, the writer of the upcoming RubyVM, presented their views on the future of Ruby. I am not sure if this comes from the Japanese culture, but the elegance, simplicity and power, that radiates from the existing and forthcoming releases, made me want to to study this country. About 15 of the attendees came from Japan. It’s interesting how the community still feels small and is so open (and fun) when attending the conference especially when you realize the potential of Ruby and the power meta programming provides by creating domain specific languages. Rails is an example of that puts that power to good use. Speaking of Rails, David Heinemeier Hannsson, provided a nice <em>state of the union</em> for Rails and a hands-on workshop (he worked, we watched) of the forthcoming Rails 1.0 functionality. Rails was the trigger for me to dive into Ruby, and what is coming out will impress many java shops. SwitchTower to deploy applications from a single server to large clusters. Gauge to monitor your application and see what’s going on, live, on your servers. So many other improvements that are just <em>practical</em>. <a href="">Tom</a> took quite some notes of that presentation. Before the Rails talks I also enjoyed an interesting talk of domain specific languages in general by Jim Weirich followed by a Karlin Fox’s talk on how to create a user oriented specification and testing languages using “english” thus allowing a non-programmer user or business analyst to express the expected behavior of the application. The amazing part is that this domain specific language is implemented using Ruby and results in runnable unit test that excerse the user interface.</p> <p>A great conference and a great Ruby week.</p> dvds.onrails.org - Integrating Flash and Ruby On Rails 2005-10-09T00:00:00-07:00 <h1>dvds.onrails.org</h1> <style> pre {font-family:"Courier New", Courier, Arial; font-size: 12px;} .operator {color: #000000;} .keyword {color: #993300;} .identifier {color: #000087;} .properties {color: #000087;} .identifier2 {color : #000087;} .linecomment, .blockcomment {color: #808080;} .string {color: #0000FF;} </style> <style type="text/css"> <!-- p.MsoNormal { margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:Times; } --> </style> The purpose of the DvdReleases demo application is to investigate some of the possibilities to integrate a Flash Component with a Ruby On Rails application.</p> <p>The application is quite simple and provides a list of dvd releases allowing to rate from 1 to 5 the individual dvds. The data has been downloaded from <a href=""></a>. As this is only a demo, you can vote several times. So, which is your favorites Dvd title?</p> <h2>Enabling flash and javascript integration for you Ruby on Rails application. </h2> <p>Macromedia provided the <a href="">Flash/Javascript Integration Kit </a>a javascript library to embeded Flash with an .rhtml and javascript page.</p> <ol> <li><a href="">download</a> the integration kit.</li> <li>copy <em>JavaScriptFlashGateway.js</em> to rails <em>public/javascript</em> folder.</li> <li>copy <em>JavaScriptFlashGateway.swf</em> to the <em>public</em> folder of your rails app.</li> <li>copy your component, <em>RateMovie.swf </em>in our case, to the <em>public</em> folder of your rails app. </li> </ol> <p>Then in your .rhtml view (list.rhtml in our example) add to the <head> section the following line to enable the Flash Javascript gateway: </p> <blockquote> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> <%= javascript_include_tag </span><span style="font-family:Monaco;font-size:10.0pt;color:#891315;">"JavaScriptFlashGateway"</span><span style="font-family:Monaco;font-size:10.0pt;color:black;"> %></span><span style="font-size:10.0pt;"></span></p> </blockquote> <h2>Embedding the FlashTag in the .rhtml file</h2> <p>Then declare the following javascript code to the list.rhtml file. </p> <blockquote> <p><span style="font-family:Monaco;font-size:10.0pt;color:#891315;"> <script type="text/javascript"></span><span style="font-family:Monaco;font-size:10.0pt;color:black;"></span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> var uid = new Date().getTime(); // uniq</span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> </span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> function insertFlashComponent(dvd_id, vote, average) { </span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> var tag = new FlashTag('../RateMovie.swf', </span><span style="font-family:Monaco;font-size:10.0pt;color:blue;">137</span><span style="font-family:Monaco;font-size:10.0pt;color:black;">, </span><span style="font-family:Monaco;font-size:10.0pt;color:blue;">50</span><span style="font-family:Monaco;font-size:10.0pt;color:black;">); // last two arguments are height and width</span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> tag.setFlashvars('lcId='+uid+'</span><span style="font-family:Monaco;font-size:10.0pt;color:blue;">&"Sending vote..."</span> setState(WaitStateClass); <span class="keyword">var</span> voteCall = <span class="keyword">new</span> RubyCall(<span class="identifier">this</span>, voteResult); <strong>voteCall.<span class="identifier2">execute</span>(<span class='string'>"/admin/vote_for_dvd/"</span>+dvdId+<span class='string'>"?public</span> <span class="keyword">function</span> voteResult(<span class="identifier2">result</span>) { <span class="keyword">if</span> (<span class="identifier2">result</span>.success) { <span class="identifier2">message</span> = <span class="identifier">null</span>; votes = <span class="identifier2">result</span>.<span class="identifier2">data</span>.votes; average = <span class="identifier2">result</span>.<span class="identifier2">data</span>.average; getUrl(<span class='string'>"javascript:hightlightVote('"</span>+dvdId+<span class='string'>"')"</span>); } <span class="keyword">else</span> { <span class="identifier2">message</span> = <span class='string'>"Send Error!"</span>; } setState(ShowVoteStateClass); } } </pre> </blockquote> <p>To invoke the ActionController we simply use the standard Flash LoadVar class that issues a HttpRequest. We did wrap the LoadVar in the following class:</p> <blockquote> <pre><span class="keyword">import</span> <span class="identifier2">mx</span>.utils.Delegate; <span class="keyword">class</span> RubyCall { <span class="keyword">var</span> callback:<span class="identifier">Function</span>; <span class="keyword">function</span> RubyCall(obj, func) { callback = Delegate.create(obj, func); } <span class="keyword">function</span> <span class="identifier2">execute</span>(<span class="identifier">url</span>:<span class="identifier">String</span>) { <span class="keyword">var</span> result_lv:<span class="identifier">LoadVars</span> = <span class="keyword">new</span> <span class="identifier">LoadVars</span>(); result_lv.delegate = <span class="identifier">this</span>; result_lv.<span class="identifier2">onLoad</span> = <span class="keyword">function</span>(success:<span class="identifier">Boolean</span>) { <span class="identifier">this</span>.delegate.<span class="identifier2">onResult</span>(success, <span class="identifier">this</span>); }; <span class="keyword">var</span> send_lv:<span class="identifier">LoadVars</span> = <span class="keyword">new</span> <span class="identifier">LoadVars</span>(); send_lv.<span class="identifier">sendAndLoad</span>(<span class="identifier">url</span>, result_lv, <span class='string'>"POST"</span>); } <span class="keyword">function</span> <span class="identifier2">onResult</span>(success:<span class="identifier">Boolean</span>, lv:<span class="identifier">LoadVars</span>) { callback({success:success, <span class="identifier2">data</span>:lv}); } } </pre> </blockquote> <p>The following call invokes the controller and pass the dvdId and rank. </p> <blockquote> <pre>voteCall.<span class="identifier2">execute</span>(<span class='string'>"/admin/vote_for_dvd/"</span>+dvdId+<span class='string'>"?<span style="font-family:Monaco;font-size:10.0pt;color:black;"> </span><span style="font-family:Monaco;font-size:10.0pt;color:#760F50;">def</span><span style="font-family:Monaco;font-size:10.0pt;color:black;"> vote_for_dvd</span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> @dvd = Dvd.find(@params[:id], :</span><span style="font-family:Monaco;font-size:10.0pt;color:#760F50;">include</span><span style="font-family:Monaco;font-size:10.0pt;color:black;"> => :vote)</span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> rank = @params[:rank].to_i</span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> vote = @dvd.vote</span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> vote.votes += </span><span style="font-family:Monaco;font-size:10.0pt;color:blue;">1</span><span style="font-family:Monaco;font-size:10.0pt;color:black;"></span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> vote.average += (rank/vote.votes) </span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> @dvd.save</span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> render(:layout => </span><span style="font-family:Monaco;font-size:10.0pt;color:#760F50;">false</span><span style="font-family:Monaco;font-size:10.0pt;color:black;">, :action => </span><span style="font-family:Monaco;font-size:10.0pt;color:#891315;">'submit_vote'</span><span style="font-family:Monaco;font-size:10.0pt;color:black;">) </span></p> <p class="MsoNormal"><span style="font-family:Monaco;font-size:10.0pt;color:black;"> </span><span style="font-family:Monaco;font-size:10.0pt;color:#760F50;">end</span></p> </blockquote> <h2>Calling a javascript function from a Flash component.</h2> <p>Finally we call javascript from the Flash component just to demonstrate that it can be done. </p> <blockquote> <pre>getUrl(<span class='string'>"javascript:hightlightVote('"</span>+dvdId+<span class='string'>"')"</span>); </pre> </blockquote> <h2>Conclusion</h2> <p>In this demo we just scratched the surface on how Flash and Ruby on Rails can be integrated. The same example we showed can easily be written in plain Javascript. However on many projects you could use these techniques to add richer components like charts and other graphical representations of data. </p> <p>There are some nice opensource frameworks that allow to generate Flash component directly from a Ruby application, there is the AMF4R library that enable passing typed objects between Ruby and Flash, there is the Flash Player 8 comming out with a new External Interface that opens great new possiblities. So this is just the start!</p> <p>Enjoy!<br/>Daniel and Lee.</p> <p> </p> Applications 2005-10-09T00:00:00-07:00 <h1>The future projects we are going to present:</h1> <ul> <li> – a small Rails application allowing to search dvd titles, rate and comment them. This project will demonstrate some Flash/Ajax and Rails integration.</li> <li> – Amf interation with ActiveRecord, allowing to build data-driven Rich Internet Applications.</li> <li> – a nice time record service for every Rails Consultant or software developer that needs to keep track of his time.</li> </ul> dvds.onrails.org - integrating Flash with Ruby on Rails 2005-07-31T00:00:00-07:00 <p>The purpose of the DvdReleases demo application is to investigate some of the possibilities to integrate a Flash Component with a Ruby On Rails application. <br />>“Keep Reading>>”:/pages/applications/dvds</p> <p>“Click here to Try it!>>”:</p> RubyConf is on the radar. 2005-06-09T00:00:00-07:00 Lee, Tom, and I just booked for the RubyConf 2005 in San Diego that will take place October 14th-16th. So hope to meet you there... No fluff just stuff 2005-05-14T00:00:00-07:00 <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> I spent most of my week-end learning new stuff, and I also attended the Wedding of Marla and Lee. It has been pretty busy and pretty fun. <br> </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ; font-weight: bold;"> Day 1. </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> <br> It all started on Friday the 13th. Good day to start a seminar with four "Dave Thomas" sessions that where pretty impressive, especially that I just read two of his "pragmatic" series book, namely </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ; color: rgb(54, 84, 131);"> <u> The Pragmatic Programmer </u> </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> and </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ; color: rgb(54, 84, 131);"> <u> Programming Ruby (2nd. Ed.) </u> </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> . The talks are 1. OpenSource Ecosystems 2. Ruby for Java Programmers 3. Ruby on Rails 4. and the Keynote du jour. His first talk "OpenSource Ecosystems" highlights the principles behind successful open-source projects and how it could be applied to your enterprise projects. His keynote presentation on Friday draws analogies between the art in engineering and software development. Of course his two Ruby talks where as entertaining as instructive. Ruby is really worth taking a look at... <br> </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ; font-weight: bold;"> Day 2. </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> <br> Herding Racehorses and Racing Sheep by Dave Thomas. He did it again, an excellent non technical people oriented presentation, investigating learning/teaching and knowledge mechanism based on the level of people (from beginner to expert) based on experiences extracted from other professions. (That description doesn't give justice to his presentation :-) The next talk was NakedObjects by Eitan Suez. Model driven UI's...just what I was looking into for Flex. Foolowing was, </span> <span style="font-family: Trebuchet,Verdana,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> <em> AJAX </em> </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> by Justin Gehtland as a presentation going behind the buzzword and showing many of the javascript techniques used to make google-maps and other dynamic websites. <br> </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ; font-weight: bold;"> Day 3. </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> <br> </span> <span style="font-family: Trebuchet,Verdana,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> <em> Hibernate and J2EE Transaction Integration </em> </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> by Mark Richards. Mark showed ways to make it work and presented several gotcha's to be aware of. Better to use Hibernate just with Spring if possible. I attended three presentations by Bruce Tate, </span> <span style="font-family: Trebuchet,Verdana,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> <em> Beyond Java and Ruby persistence </em> </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> , </span> <span style="font-family: Trebuchet,Verdana,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> <em> Introduction to Spring </em> </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> , and </span> <span style="font-family: Trebuchet,Verdana,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> <em> Beyond Java </em> </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> . The Spring and Java talks where really interesting and informative, his last talk on Ruby persistence, as Bruce warned us, was the first time he presented it and still a little refinement is needed. Other than that Bruce is an excellent speaker worthwhile listening too... <br> </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ; font-weight: bold;"> Reflecting on The conference </span> <span style="font-family: 'Lucida Grande',LucidaGrande,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: ;"> <br> First, you should attend one, it's just a great way to learn some of the latest stuff and interact with some off the leaders and experts in the field. <br> I get really energized when attending these conferences, so much to try out, so many new thoughts, so many new projects I now want to do, but mostly they confirmed a reflection and phase I started a couple of months ago. A "Back to basics" phase. My goals was to stop trying out everything and not finishing really anything. Energy and simplicity are not contradictory. I will just spend more time doing less, and more energy simplyfing what I do. I just read several of the pragmatic series books (automated build, subversion) and have a few more to read (JUnit). Although I use these approaches during my day job, I didn't do it on my midnight projects. Why? Well not 100% sure why, but it would have saved me time and headaches. Most likely I believe that outside of the constraint of work, I used to like to get more creative and less organized, but that is changing and I get a lot of satisfaction trying to do less and more carefully.. So last month I first purged many of my obsolete projects (the WebObjets ones, the older java ones, the Cocoa ones) and one by one decided what I wanted to keep based on what I wanted to achieve...well I ended up with no old projects...and just one new one. Yea, that felt good. Then I moved the rest of my stuff into subversion. After a little issues with French characters in some of my documents I got everything working. Now I can trace back everychange in my source even for my midnight projects. On osx I use SnvX and the merge tool provided by the osx dev tools. Pretty slick!! <br> So my only new midnight project is integrating Flex and RubyOnRails. I will be working hard at ensuring that it contains the minimal amount of code to achieve the integration, that's it is fully unit tested, and integrated with an automated build tool. During my day job I use cruisecontrol, I am still debating if I will use DamageControl (a Ruby one)...I am currently inclined going the Ruby way. <br> Well as you see these conferences get me going... </span>
http://onrails.org/atom.xml
CC-MAIN-2018-47
refinedweb
93,284
57.06
2018 TCO Algorithm Round 2B Editorials This is the second and last opportunity for competitors to earn a chance to advance to round 3 and win a T-shirt. The writer of the problems and editorial of this round is [lg5293] SubarrayAverages In this problem, we are given an array, and we can replace any subarray with the average of the subarray values. We can do this operation arbitrarily many times, and want the final array to be as lexicographically small as possible. A common way to start a problem that asks for lexicographically smallest is to minimize the first element, then minimize the second element, and so on… So, let’s see if we can first solve the problem of trying to minimize the first element. To do this, we will show that it is optimal to do an operation on a prefix of the array once. Of course, if there is a sequence of operations, only the last one that touches the first element matters, so we can assume the last operation is a prefix of the array. Also, if there is more than one operation, we can assume the second to last operation intersects with the last operation, and doesn’t touch the first element (otherwise, we could just ignore that second to last operation) So, the final two steps looks like choosing subarray [a,b], then choosing the subarray [0,c], with 0 < a <= c. In addition, we can also assume c < b, otherwise, we can ignore the operation [a,b]. If this was optimal, we can show that replacing these two operations with [0,b] is a better choice. This is true since all elements in [a,b] are now the same, so if including the elements [a,c] in our prefix [0,c] is good, then, it wouldn’t hurt to also include the elements [c+1,b] as well in our prefix. Thus, we’ve shown that we can minimize the first element just by finding the best prefix. We can then do this approach for each element in sequence in the array, leading to an O(n^2) algorithm. Java code below: import java.util.Arrays; public class SubarrayAverages { public double[] findBest(int[] arr) { int start = 0; double[] ret = new double[arr.length]; while (start < arr.length) { long a1 = arr[start], a2 = 1; long s1 = 0, s2 = 0; int id = start; for (int j = start; j < arr.length; j++) { s2++; s1 += arr[j]; if (s1 * a2 < a1 * s2) { a1 = s1; a2 = s2; id = j; } } for (int k = start; k <= id; k++) { ret[k] = a1 / (double)a2; } start = id+1; } return ret; } } LineColoring In this problem, we have to color our a row of houses such that no two adjacent houses have the same color, and the cost of the coloring is minimized. Here, the cost of the coloring is equal to the sum of the maximum value of a house of each color used. This problem suggests a dp approach, but there is seemingly no limit on the number of colors we can use. In addition, we also need to keep track of the maxima of each color, which could potentially be very intractable easily. First, a key observation is that we never require more than three colors. This is true since each house is neighbors with at most two other houses, so we can only ever be locked out from using at most two different colors, so three colors is sufficient. Next, another observation is that the maximum value house must have some color, so without loss of generality, let it be color 0. Now, we can fix the maximum value that color 1 will get, and we can do dp to get the minimum maximum value for color 2. Each dp takes O(n) time, and there are O(n) values of the max value that color 1 will get, so the overall runtime is O(n^2) Be careful with the case of only 1 house! (luckily, there is a sample for it) Code in java: import java.util.Arrays; public class LineColoring { public int minCost(int[] x) { if (x.length == 1) return x[0]; int max = 0; for (int y : x) max = Math.max(y, max); int min = 1 << 25; for (int second_max : x) { int[] dp = new int[3]; for (int i = 0; i < x.length; i++) { int[] ndp = new int[3]; Arrays.fill(ndp, 1 << 25); for (int prev = 0; prev < 3; prev++) { if (x[i] <= max && prev != 0) { ndp[0] = Math.min(ndp[0], dp[prev]); } if (x[i] <= second_max && prev != 1) { ndp[1] = Math.min(ndp[1], dp[prev]); } if (prev != 2) { ndp[2] = Math.min(ndp[2], dp[prev]); } } ndp[2] = Math.max(ndp[2], x[i]); dp = ndp; } for (int w : dp) min = Math.min(min, w + second_max); } return min + max; } } SquareFreeSet In this problem, we are given a set of numbers, and we want to make this set square-free, that is, no two elements in this set have a product that is a perfect square. First, two numbers x*y form a perfect square if there is an even number of each prime factor. Thus, for each number, it suffices to only know the parity of each prime factor. Let f(x) be product of all prime factors of x that appear an odd number of times. Another equivalent definition is that f(x) is the minimum number such that x/f(x) is a perfect square. We can show two numbers x,y form a perfect square if and only if f(x) = f(y). Thus, this problem reduces to give a set of numbers, make all of their f values distinct. This reduces to a minimum cost maximum matching problem on a bipartite graph, which can then be solved with min cost max flow. The number of nodes we may need to add may seem large at first, but we can notice we only care about the closest n+1 distinct values of f(x) from x, so this can help us limit the number of nodes. There are n nodes on the left, and at most n^2 nodes on the right with n^2 total edges, and the runtime of mincost maxflow is about O(n^3 * log n) (for example, using this implementation:). You can see a tutorial for mincost maxflow here: Java code below: import java.util.*; public class SquareFreeSet { public HashMap<Integer, Integer> id; public int idx; public int[] f; public boolean insert(int q) { if (q <= 0) return false; q = f[q]; if (id.containsKey(q)) return false; id.put(q, idx++); return true; } public int findCost(int[] x) { f = new int[1111111]; for (int i = 0; i < f.length; i++) { f[i] = i; } for (int r = 2; r * r <= f.length; r++) { int num = r * r; for (int j = num; j < f.length; j += num) { f[j] = f[j/num]; } } id = new HashMap<>(); for (int p : x) { int off = 0; HashSet seen = new HashSet<>(); while (seen.size() <= x.length+1) { seen.add(get(p+off)); seen.add(get(p-off)); off++; } } int nnodes = x.length + id.size() + 2; List[] graph = new List[nnodes]; for (int i = 0; i < nnodes; i++) graph[i] = new ArrayList<>(); for (int i = 0; i < x.length; i++) { int off = 0; HashSet seen = new HashSet<>(); while (seen.size() <= x.length+1) { int n1 = get(x[i]+off); int n2 = get(x[i]-off); if (n1 >= 0) addEdge(graph, i, n1+x.length, 1, off); if (n2 >= 0) addEdge(graph, i, n2+x.length, 1, off); seen.add(n1); seen.add(n2); off++; } } for (int i = 0; i < x.length; i++) addEdge(graph, nnodes-1, i, 1, 0); for (int i = 0; i < id.size(); i++) addEdge(graph, i+x.length, nnodes-2, 1, 0); return minCostFlow(graph, nnodes-1, nnodes-2, x.length)[1]; } public static void addEdge(List[] graph, int s, int t, int cap, int cost) { graph[s].add(new Edge(t, cap, cost, graph[t].size())); graph[t].add(new Edge(s, 0, -cost, graph[s].size() - 1)); } public static int[] minCostFlow(List[] graph, int s, int t, int maxf) { int n = graph.length; int[] prio = new int[n]; int[] curflow = new int[n]; int[] prevedge = new int[n]; int[] prevnode = new int[n]; int[] pot = new int[n]; int flow = 0; int flowCost = 0; while (flow < maxf) { PriorityQueue q = new PriorityQueue<>(); q.add((long) s); Arrays.fill(prio, Integer.MAX_VALUE); prio[s] = 0; boolean[] finished = new boolean[n]; curflow[s] = Integer.MAX_VALUE; while (!finished[t] && !q.isEmpty()) { long cur = q.remove(); int u = (int) (cur & 0xFFFF_FFFFL); int priou = (int) (cur >>> 32); if (priou != prio[u]) continue; finished[u] = true; for (int i = 0; i < graph[u].size(); i++) { Edge e = graph[u].get(i); if (e.f >= e.cap) continue; int v = e.to; int nprio = prio[u] + e.cost + pot[u] - pot[v]; if (prio[v] > nprio) { prio[v] = nprio; q.add(((long) nprio << 32) + v); prevnode[v] = u; prevedge[v] = i; curflow[v] = Math.min(curflow[u], e.cap - e.f); } } } if (prio[t] == Integer.MAX_VALUE) break; for (int i = 0; i < n; i++) if (finished[i]) pot[i] += prio[i] - prio[t]; int df = Math.min(curflow[t], maxf - flow); flow += df; for (int v = t; v != s; v = prevnode[v]) { Edge e = graph[prevnode[v]].get(prevedge[v]); e.f += df; graph[v].get(e.rev).f -= df; flowCost += df * e.cost; } } return new int[]{flow, flowCost}; } public static class Edge { public int to, f, cap, cost, rev; Edge(int to, int cap, int cost, int rev) { this.to = to; this.cap = cap; this.cost = cost; this.rev = rev; } } }
https://www.topcoder.com/blog/2018-tco-algorithm-round-2b-editorials/
CC-MAIN-2019-09
refinedweb
1,619
72.97
a previous article, I demonstrated Intellisense Support and Improved Easier Configuration in Windows Communication Foundation (WCF) 4.5. In this article, we will see how we can implement Asynchronous Logic in our WCF Service as well as how we can access the WCF methods Asynchronously by generating proxy code. WCF 4.5 has introduced a new way of implementing asynchronous logic in our WCF Services using Task based programming model. To demonstrate examples, I am using Windows 7 and Visual Studio 2012. Step 1: Create a blank solution with the name WCFAsyncProgramming as shown below - Step 2: Now add a class library with the name "SimpleWCFAsyncService" in our solution as shown below - Step 3: Let's add the reference to a library "System.ServiceModel.dll" as shown below - Step 4: Add an Interface with the name "IHelloService" in our class library, import the namespace System.ServiceModel and add the code as shown below - The above operation contract does not return "String" but is returning Task<string>. This is a new way of implementing Task-based Asynchronous Programming Model. Step 5: Add some code to this service where we will implement the above service contract . Rename the "Class1" to "HelloService" and add the following code in our class - Step 6: Now let's add a Console Application in our solution which will host our service with name "Host". Also add a reference to our WCF Service as well as to the System.ServiceModel.dll - Step 7: Import a namespace System.ServiceModel and write the following code to host our service - Step 8: Now it's time to configure our service. Let's configure the service with Basic Http Binding as shown below [Add this code into existing App.Config file of our Console Application]- Hit "F5" and test your Host application. It should show the following output - Let's add a Windows Forms Application to test our service and all the service method asynchronously - Step 9: Add a Win Form application with the name "Client1". Now add a service reference into our client1 application and use the service. Step 10: To add a service reference, copy the base address from host application configuration file and add a service reference with the name "HelloProxySercice" as shown below - [Before adding a service reference make sure your host application is running.] Step 11: Now add a List Box with the name lstLoop, a Label with the name lblServiceResult and add two buttons with the text property as "Run Local Loop" and "Call Service" as shown below - Step 12: Add proxy code into our win form application as shown below - On button "Call Service" click event, we will first write some code which will call the service method synchronously. When this method is executing, we will test if we are able to do some action on our UI like click the button "Run Local Loop"? The answer is NO. Because it is obvious that we are calling the service method synchronously. Let's Test - Till the service method does not send the output, you cannot click button "Run Local Loop". The UI becomes completely unresponsive. Now let's add the following code that calls our service method asynchronously and makes our UI responsive. For Asynchronous call, we will have to write the service method call in a separate method which will be "async" Method. Make a note that "Run Local Loop" button code will remain the same. Now test the code like you did earlier and you will see that your "Run Local Loop" button is now responsive and clicking it will fill up the list box before the service returns its output to our UI - Before Service Method returns the output - After Service Method returns the output - We can now make our service calls on a background thread which leaves our UI responsive to do other actions. Awesome!! In this article, we have seen how we can implement Asynchronous Logic in our WCF 4.5 Service and how we can access the WCF methods Asynchronously by generating proxy code using Task-based Programming model. Download the entire source code here (Github)!
https://www.dotnetcurry.com/wcf/849/async-methods-wcf-45
CC-MAIN-2020-10
refinedweb
687
58.11
how to add color in the quasar at run time? - s.molinari last edited by Color to what or of what? Scott As there is primary, secondary, I would like to create mine like cor1, cor2, cor3. I know I can put them in the sass file, but I would like to create them dynamically Explained here : Create some classes in CSS (or SASS) with a default value : $col1 = #123456 :root --q-color-col1 $col1 .text-col1 color: $col1 !important color: var(--q-color-col1) !important .bg-col1 background: $col1 !important background: var(--q-color-col1) !important Then, you can use setBrandhelper import { colors } from 'quasar' const { setBrand } = colors setBrand ('col1', '#FF0000')
https://forum.quasar-framework.org/topic/5509/add-color
CC-MAIN-2021-21
refinedweb
112
68.57
I am trying to learn Java by reading and doing examples out of a textbook I found online. I was able to do an example in the book fairly easily but want to take it one step further. When I wrote the code for a program called 'concentric circles' I noticed that my circles didn't scale to the size of the window and I think it looks horrible (If I make the window too small the circles don't scale and you only see a piece of the circles. I tweaked my code and it seems to scale a little bit but looks terrible when I make my window too small or too large. I would like my 12 circles to fit the window size no matter the size of the window. I feel like I am so close but just can't seem to wrap my head around it. Any and all help is much appreciated, thanks in advance! import java.awt.Graphics; import javax.swing.JPanel; public class Circles extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); int width = getWidth(); int height = getHeight(); int x = width / 12; int y = height / 12; int buffersize = 0; for (int i = 0; i < 12; i++) { g.drawOval(width / 2 - buffersize, height / 2 - buffersize, x + buffersize * 2, y + buffersize * 2); buffersize += 10; } } } import javax.swing.JFrame; import javax.swing.JOptionPane; /** * * @author */ public class ConcentricCirclesTest { public static void main(String[] args) { //create a panel that will contain our drawing Circles panel = new Circles(); //create a new frame to house the panel JFrame application = new JFrame(); //set the frame to exit when closed application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); application.add(panel); application.setSize(350, 350); application.setVisible(true); } } If you want your circles to be circular (not elliptical) then first off you need to know which is narrower, the width or the height. Using the syntax shortcut for if...else you'd want something like: int smallest = width < height ? width : height; Next you need to think about how far apart your circles will be. It's no good trying to draw 12 circles that get bigger (or smaller) by 10 pixels if you only have 100 pixels to draw them in. Likewise if you've 500 pixels of space. So something like: float spacing = smallest / 12f; Note that you can get unexpected results dividing one int with another. Then in your for loop: g.drawOval(0 + ((spacing / 2) * i), 0 + ((spacing / 2) * i), smallest - ((spacing / 2) * i), smallest - ((spacing / 2) * i)); I hope thus is clear. Basically,the bounding rectangle (or square) gets smaller by spacing for each iteration. OK, this is going to need tweeking so it doesn't draw in the bottom left and I think the last circle would be 0 by 0 but I hope this is of some help. And good luck!
https://codedump.io/share/jrucaDaa8C7w/1/java---creating-basic-2d-shapes-that-scale-to-window-size
CC-MAIN-2017-30
refinedweb
474
71.24
This case study presents a Web application in which a user logs into a secure Web site to view a list of publications by an author of the user's choosing. The application consists of several ASPX files. Section 21.8.1 presents the working application and explains the purpose of each of its Web pages. Section 21.8.2 provides step-by-step instructions to guide you through building the application and presents the markup in the ASPX files as they are created. 21.8.1. Examining the Completed Secure Books Database Application This example uses a technique known as forms authentication to protect a page so that only users known to the Web site can access it. Such users are known as the site's members. Authentication is a crucial tool for sites that allow only members to enter the site or a portion of the site. In this application, Web site visitors must log in before they are allowed to view the publications in the Books database. The first page that a user would typically request is Login.aspx (Fig. 21.42). You will soon learn to create this page using a Login control, one of several ASP.NET login controls that help create secure applications using authentication. These controls are found in the Login section of the Toolbox. Figure 21.42. Login.aspx page of the secure books database application. The Login.aspx page allows a site visitor to enter an existing user name and password to log into the Web site. A first-time visitor must click the link below the Log In button to create a new user before attempting to log in. Doing so redirects the visitor to CreateNewUser.aspx (Fig. 21.43), which contains a CreateUserWizard control that presents the visitor with a user registration form. We discuss the CreateUserWizard control in detail in Section 21.8.2. In Fig. 21.43, we use the password pa$$word for testing purposesas you will learn, the CreateUserWizard requires that the password contain special characters for security purposes. Clicking Create User establishes a new user account. Once the new user account is created, the user is automatically logged in and shown a success message (Fig. 21.44). Figure 21.43. CreateNewUser.aspx page of the secure book database application. Figure 21.44. Message displayed to indicate that a user account was created successfully. Clicking the Continue button on the confirmation page sends the user to Books.aspx (Fig. 21.45), which provides a drop-down list of authors and a table containing the ISBNs, titles, edition numbers and copyright years of books in the database. By default, all the books by Harvey Deitel are displayed. Links appear at the bottom of the table that allow you to access additional pages of data. When the user chooses an author, a postback occurs, and the page is updated to display information about books written by the selected author (Fig. 21.46). Figure 21.45. Books.aspx displaying books by Harvey Deitel (by default). Figure 21.46. Books.aspx displaying books by Andrew Goldberg. (This item is displayed on page 1125 in the print version) Note that once the user creates an account and is logged in, Books.aspx displays a welcome message customized for the particular logged-in user. As you will soon see, a LoginName control provides this functionality. After you add this control to the page, ASP.NET handles the details of determining the user name. Clicking the Click here to log out link logs the user out, then sends the user back to Login.aspx (Fig. 21.47). As you will learn, this link is created by a LoginStatus control, which handles the details of logging the user out of the page. To view the book listing again, the user must log in through Login.aspx. The Login control on this page receives the user name and password entered by a visitor. ASP.NET then compares these values with user names and passwords stored in a database on the server. If there is a match, the visitor is authenticated (i.e., the user's identity is confirmed). We explain the authentication process in detail in Section 21.8.2. When an existing user is successfully authenticated, Login.aspx redirects the user to Books.aspx (Fig. 21.45). If the user's login attempt fails, an appropriate error message is displayed (Fig. 21.48). Figure 21.47. Logging in using the Login control. Figure 21.48. Error message displayed for an unsuccessful login attempt using the Login control. (This item is displayed on page 1126 in the print version) Notice that Login.aspx, CreateNewUser.aspx and Books.aspx share the same page header containing the Bug2Bug logo image. Instead of placing this image at the top of each page, we use a master page to achieve this. As we demonstrate shortly, a master page defines common GUI elements that are inherited by each page in a set of content pages. Just as C# classes can inherit instance variables and methods from existing classes, content pages inherit elements from master pagesthis is known as visual inheritance. 21.8.2. Creating the Secure Books Database Application Now that you are familiar with how this application behaves, we demonstrate how to create it from scratch. Thanks to the rich set of login and data controls provided by ASP.NET, you will not have to write any code to create this application. In fact, the application does not contain any code-behind files. All of the functionality is specified through properties of controls, many of which are set through wizards and other visual programming tools. ASP.NET hides the details of authenticating users against a database of user names and passwords, displaying appropriate success or error messages and redirecting the user to the correct page based on the authentication results. We now discuss the steps you must perform to create the secure books database application. Step 1: Creating the Web Site Create a new ASP.NET Web Site at as described previously. We will explicitly create each of the ASPX files that we need in this application, so delete the IDE-generated Default.aspx file (and its corresponding code-behind file) by selecting Default.aspx in the Solution Explorer and pressing the Delete key. Click OK in the confirmation dialog to delete these files. Step 2: Setting Up the Web Site's Folders Before building any of the pages in the Web site, we create folders to organize its contents. First, create an Images folder and add the bug2bug.png file to it. This image can be found in the examples directory for this chapter. Next, add the Books.mdf database file (which can also be found in the examples directory) to the project's App_Data folder. We show how to retrieve data from this database later in the section. Step 3: Configuring the Application's Security Settings In this application, we want to ensure that only authenticated users are allowed to access Books.aspx (created in Step 9 and Step 10) to view the information in the database. Previously, we created all of our ASPX pages in the Web application's root directory (e.g.,). By default, any Web site visitor (regardless of whether the visitor is authenticated) can view pages in the root directory. ASP.NET allows you to restrict access to particular folders of a Web site. We do not want to restrict access to the root of the Web site, however, because all users must be able to view Login.aspx and CreateNewUser.aspx to log in and create user accounts, respectively. Thus, if we want to restrict access to Books.aspx, it must reside in a directory other than the root directory. Create a folder named Secure. Later in the section, we will create Books.aspx in this folder. First, let's enable forms authentication in our application and configure the Secure folder to restrict access to authenticated users only. Select Website > ASP.NET Configuration to open the Web Site Administration Tool in a Web browser (Fig. 21.49). This tool allows you to configure various options that determine how your application behaves. Click either the Security link or the Security tab to open a Web page in which you can set security options (Fig. 21.50), such as the type of authentication the application should use. In the Users column, click Select authentication type. On the resulting page (Fig. 21.51), select the radio button next to From the internet to indicate that users will log in via a form on the Web site in which the user can enter a username and password (i.e., the application will use forms authentication). The default settingFrom a local networkrelies on users' Windows user names and passwords for authentication purposes. Click the Done button to save this change. Figure 21.49. Web Site Administration Tool for configuring a Web application. Figure 21.50. Security page of the Web Site Administration Tool. (This item is displayed on page 1128 in the print version) Figure 21.51. Choosing the type of authentication used by an ASP.NET Web application. (This item is displayed on page 1128 in the print version) Now that forms authentication is enabled, the Users column on the main page of the Web Site Administration Tool (Fig. 21.52) provides links to create and manage users. As you saw in Section 21.8.1, our application provides the CreateNewUser.aspx page in which users can create their own accounts. Thus, while it is possible to create users through the Web Site Administration Tool, we do not do so here. Figure 21.52. Main page of the Web Site Administration Tool after enabling forms authentication. (This item is displayed on page 1129 in the print version) Even though no users exist at the moment, we configure the Secure folder to grant access only to authenticated users (i.e., deny access to all unauthenticated users). Click the Create access rules link in the Access Rules column of the Web Site Administration Tool (Fig. 21.52) to view the Add New Access Rule page (Fig. 21.53). This page is used to create an access rulea rule that grants or denies access to a particular Web application directory for a specific user or group of users. Click the Secure directory in the left column of the page to identify the directory to which our access rule applies. In the middle column, select the radio button marked Anonymous users to specify that the rule applies to users who have not been authenticated. Finally, select Deny in the right column, labeled Permission, then click OK. This rule indicates that anonymous users (i.e., users who have not identified themselves by logging in) should be denied access to any pages in the Secure directory (e.g., Books.aspx). By default, anonymous users who attempt to load a page in the Secure directory are redirected to the Login.aspx page so that they can identify themselves. Note that because we did not set up any access rules for the Bug2Bug root directory, anonymous users may still access pages there (e.g., Login.aspx, CreateNewUser.aspx). We create these pages momentarily. Figure 21.53. Add New Access Rule page used to configure directory access. (This item is displayed on page 1130 in the print version) Step 4: Examining the Auto-Generated Web.config Files We have now configured the application to use forms authentication and created an access rule to ensure that only authenticated users can access the Secure folder. Before creating the Web site's content, we examine how the changes made through the Web Site Administration Tool appear in the IDE. Recall that Web.config is an XML file used for application configuration, such as enabling debugging or storing database connection strings. Visual Web Developer generates two Web.config files in response to our actions using the Web Site Administration Toolone in the application's root directory and one in the Secure folder. [Note: You may need to click the Refresh button in the Solution Explorer to see these files.] In an ASP.NET application, a page's configuration settings are determined by the current directory's Web.config file. The settings in this file take precedence over the settings in the root directory's Web.config file. After setting the authentication type for the Web application, the IDE generates a Web.config file at, which contains an authentication element "Forms" /> This element appears in the root directory's Web.config file, so the setting applies to the entire Web site. The value "Forms" of the mode attribute specifies that we want to use forms authentication. Had we left the authentication type set to From a local network in the Web Site Administration Tool, the mode attribute would be set to "Windows". Note that "Forms" is the default mode in a Web.config file generated for another purpose, such as saving a connection string. After creating the access rule for the Secure folder, the IDE generates a second Web.config file in that folder. This file contains an authorization element that indicates who is; and who is not, authorized to access this folder over the Web. In this application, we want to allow only authenticated users to access the contents of the Secure folder, so the authorization element appears as "?" /> Rather than grant permission to each individual authenticated user, we deny access to those who are not authenticated (i.e., those who have not logged in). The deny element inside the authorization element specifies the users to whom we wish to deny access. When the users attribute's value is set to "?", all anonymous (i.e., unauthenticated) users are denied access to the folder. Thus, an unauthenticated user will not be able to load. Instead, such a user will be redirected to the Login.aspx pagewhen a user is denied access to a part of a site, ASP.NET by default sends the user to a page named Login.aspx in the application's root directory. Step 5: Creating a Master Page Now that you have established the application's security settings, you can create the application's Web pages. We begin with the master page, which defines the elements we want to appear on each page. A master page is like a base class in a visual inheritance hierarchy, and content pages are like derived classes. The master page contains placeholders for custom content created in each content page. The content pages visually inherit the master page's content, then add content in place of the master page's placeholders. For example, you might want to include a navigation bar (i.e., a series of buttons for navigating a Web site) on every page of a site. If the site encompasses a large number of pages, adding markup to create the navigation bar for each page can be time consuming. Moreover, if you subsequently modify the navigation bar, every page on the site that uses it must be updated. By creating a master page, you can specify the navigation bar markup in one file and have it appear on all the content pages, with only a few lines of markup. If the navigation bar changes, only the master page changesany content pages that use it are updated the next time the page is requested. In this example, we want the Bug2Bug logo to appear as a header at the top of every page, so we will place an Image control in the master page. Each subsequent page we create will be a content page based on this master page and thus will include the header. To create a master page, right click the location of the Web site in the Solution Explorer and select Add New Item.... In the Add New Item dialog, select Master Page from the template list and specify Bug2Bug.master as the filename. Master pages have the filename extension .master and, like Web Forms, can optionally use a code-behind file to define additional functionality. In this example, we do not need to specify any code for the master page, so leave the box labeled Place code in a separate file unchecked. Click Add to create the page. The IDE opens the master page in Source mode (Fig. 21.54) when the file is first created. [Note: We added a line break in the DOCTYPE element for presentation purposes.] The markup for a master page is almost identical to that of a Web Form. One difference is that a master page contains a Master directive (line 1 in Fig. 21.54), which specifies that this file defines a master page using the indicated Language for any code. Because we chose not to use a code-behind file, the master page also contains a script element (lines 68). Code that would usually be placed in a code-behind file can be placed in a script element. Figure 21.54. Master page in Source mode. However, we remove the script element from this page, because we do not need to write any additional code. After deleting this block of markup, set the title of the page to Bug2Bug. Finally, notice that the master page contains a ContentPlaceHolder control in lines 1718. This control serves as a placeholder for content that will be defined by a content page. You will see how to define content to replace the ContentPlaceHolder shortly. At this point, you can edit the master page in Design mode (Fig. 21.55) as if it were an ASPX file. Notice that the ContentPlaceHolder control appears as a large rectangle with a gray bar indicating the control's type and ID. Using the Properties window, change the ID of this control to bodyContent. Figure 21.55. Master page in Design mode. To create a header in the master page that will appear at the top of each content page, we insert a table into the master page. Place the cursor to the left of the ContentPlaceHolder and select Layout > Insert Table. In the Insert Table dialog, click the Template radio button, then select Header from the drop-down list of available table templates. Click OK to create a table that fills the page and contains two rows. Drag and drop the ContentPlaceHolder into the bottom table cell. Change the valign property of this cell to top, so the ContentPlaceHolder vertically aligns with the top of the cell. Next, set the Height of the top table cell to 130. Add to this cell an Image control named headerImage with its ImageUrl property set to the bug2bug.png file in the project's Images folder. (You can also simply drag the image from the Solution Explorer into the top cell.) Figure 21.56 shows the markup and Design view of the completed master page. As you will see in Step 6, a content page based on this master page displays the logo image defined here, as well as the content designed for that specific page (in place of the ContentPlaceHolder). Figure 21.56. Bug2Bug.master page that defines a logo image header for all pages in the secure book database application. Step 6: Creating a Content Page We now create a content page based on Bug2Bug.master. We begin by building CreateNewUser.aspx. To create this file, right click the master page in the Solution Explorer and select Add Content Page. This action causes a Default.aspx file, configured to use the master page, to be added to the project. Rename this file CreateNewUser.aspx, then open it in Source mode (Fig. 21.57). Note that this file contains a Page directive with a Language property, a MasterPageFile property and a Title property. The Page directive indicates the MasterPageFile on which the content page builds. In this case, the MasterPageFile property is set to "~/Bug2Bug.master" to indicate that the current file builds on the master page we just created. The Title property specifies the title that will be displayed in the Web browser's title bar when the content page is loaded. This value, which we set to Create a New User, replaces the value (i.e., Bug2Bug) set in the title element of the master page. Figure 21.57. Content page CreateNewUser.aspx in Source mode. Because CreateNewUser.aspx's Page directive specifies Bug2Bug.master as the page's MasterPageFile, the content page implicitly contains the contents of the master page, such as the DOCTYPE, html and body elements. The content page file does not duplicate the XHTML elements found in the master page. Instead, the content page contains a Content control (lines 46 in Fig. 21.57), in which we will place page-specific content that will replace the master page's ContentPlaceHolder when the content page is requested. The ContentPlaceHolderID property of the Content control identifies the ContentPlaceHolder in the master page that the control should replacein this case, bodyContent. The relationship between a content page and its master page is more evident in Design mode (Fig. 21.58). The shaded region contains the contents of the master page Bug2Bug.master as they will appear in CreateNewUser.aspx when rendered in a Web browser. The only editable part of this page is the Content control, which appears in place of the master page's ContentPlaceHolder. Figure 21.58. Content page CreateNewUser.aspx in Design mode. Step 7: Adding a CreateUserWizard Control to a Content Page Recall from Section 21.8.1 that CreateNewUser.aspx is the page in our Web site that allows first-time visitors to create user accounts. To provide this functionality, we use a CreateUserWizard control. Place the cursor inside the Content control in Design mode and double click CreateUserWizard in the Login section of the Toolbox to add it to the page at the current cursor position. You can also drag-and-drop the control onto the page. To change the CreateUserWizard's appearance, open the CreateUserWizard Tasks smart tag menu, and click Auto Format. Select the Professional color scheme. As discussed previously, a CreateUserWizard provides a registration form that site visitors can use to create a user account. ASP.NET handles the details of creating a SQL Server database (named ASPNETDB.MDF and located in the App_Data folder) to store the user names, passwords and other account information of the application's users. ASP.NET also enforces a default set of requirements for filling out the form. Each field on the form is required, the password must contain at least seven characters, including at least one nonalphanumeric character, and the two passwords entered must match. The form also asks for a security question and answer that can be used to identify a user in case the account's password needs to be reset or recovered. After the user fills in the form's fields and clicks the Create User button to submit the account information, ASP.NET verifies that all the form's requirements were fulfilled and attempts to create the user account. If an error occurs (e.g., the user name already exists), the CreateUserWizard displays a message below the form. If the account is created successfully, the form is replaced by a confirmation message and a button that allows the user to continue. You can view this confirmation message in Design mode by selecting Complete from the Step drop-down list in the CreateUserWizard Tasks smart tag menu. When a user account is created, ASP.NET automatically logs the user into the site (we say more about the login process shortly). At this point, the user is authenticated and allowed to access the Secure folder. After we create Books.aspx later in this section, we set the CreateUserWizard's ContinueDestinationPageUrl property to ~/Secure/Books.aspx to indicate that the user should be redirected to Books.aspx after clicking the Continue button on the confirmation page. Figure 21.59 presents the completed CreateNewUser.aspx file (reformatted for readability). Inside the Content control, the CreateUserWizard control is defined by the markup in lines 940. The start tag (lines 912) contains several properties that specify formatting styles for the control, as well as the ContinueDestinationPageUrl property, which you will set later in the chapter. Lines 1432 contain elements that define additional styles used to format specific parts of the control. Finally, lines 3439 specify the wizard's two stepsCreateUserWizardStep and CompleteWizardStepin a WizardSteps element. CreateUserWizardStep and CompleteWizardStep are classes that encapsulate the details of creating a user and issuing a confirmation message. Figure 21.59. CreateNewUser.aspx content page that provides a user registration form. The sample outputs in Fig. 21.59(a) and Fig. 21.59(b) demonstrate successfully creating a user account with CreateNewUser.aspx. We use the password pa$$word for testing purposes. This password satisfies the minimum length and special character requirement imposed by ASP.NET, but in a real application, you should use a password that is more difficult for someone to guess. Figure 21.59(c) illustrates the error message that appears when you attempt to create a second user account with the same user nameASP.NET requires that each user name be unique. Step 8: Creating a Login Page Recall from Section 21.8.1 that Login.aspx is the page in our Web site that allows returning visitors to log into their user accounts. To create this functionality, add another content page named Login.aspx and set its title to Login. In Design mode, drag a Login control (located in the Login section of the Toolbox) to the page's Content control. Open the Auto Format dialog from the Login Tasks smart tag menu and set the control's color scheme to Professional. Next, configure the Login control to display a link to the page for creating new users. Set the Login control's CreateUserUrl property to CreateNewUser.aspx by clicking the ellipsis button to the right of this property and selecting the CreateNewUser.aspx file in the resulting dialog. Then set the CreateUserText property to Click here to create a newuser. These property values cause a link to appear in the Login control. Finally, we change the value of the Login control's DisplayRememberMe property to False. By default, the control displays a checkbox and the text Remember me next time. This can be used to allow a user to remain authenticated beyond a single browser session on the user's current computer. However, we want to require that users log in each time they visit the site, so we disable this option. The Login control encapsulates the details of logging a user into a Web application (i.e., authenticating a user). When a user enters a user name and password, then clicks the Log In button, ASP.NET determines whether the information provided match those of an account in the membership database (i.e., ASPNETDB.MDF created by ASP.NET). If they match, the user is authenticated (i.e., the user's identity is confirmed), and the browser is redirected to the page specified by the Login control's DestinationPageUrl property. We set this property to the Books.aspx page after creating it in the next section. If the user's identity cannot be confirmed (i.e., the user is not authenticated), the Login control displays an error message (see Fig. 21.60), and the user can attempt to log in again. Figure 21.60. Login.aspx content page using a Login control. Figure 21.60 presents the completed Login.aspx file. Note that, as in CreateNewUser.aspx, the Page directive indicates that this content page inherits content from Bug2Bug.master. In the Content control that replaces the master page's ContentPlaceHolder with ID bodyContent, lines 822 create a Login control. Note the CreateUserText and CreateUserUrl properties (lines 1011) that we set using the Properties window. Line 12 in the start tag for the Login control contains the DestinationPageUrl (you will set this property in the next step) and the DisplayRememberMe property, which we set to False. The elements in lines 1521 define various formatting styles applied to parts of the control. Note that all of the functionality related to actually logging the user in or displaying error messages is completely hidden from you. When a user enters the user name and password of an existing user account, ASP.NET authenticates the user and writes to the client an encrypted cookie containing information about the authenticated user. Encrypted data is data translated into a code that only the sender and receiver can understandthereby keeping it private. The encrypted cookie contains a string user name and a bool value that specifies whether this cookie should persist (i.e., remain on the client's computer) beyond the current session. Our application authenticates the user only for the current session. Step 9: Creating a Content Page That Only Authenticated Users Can Access A user who has been authenticated will be redirected to Books.aspx. We now create the Books.aspx file in the Secure folderthe folder for which we set an access rule denying access to anonymous users. If an unauthenticated user requests this file, the user will be redirected to Login.aspx. From there, the user can either log in or a create a new account, both of which will authenticate the user, thus allowing the user to return to Books.aspx. To create Books.aspx, right click the Secure folder in the Solution Explorer and select Add New Item.... In the resulting dialog, select Web Form and specify the file name Books.aspx. Check the box Select Master Page to indicate that this Web Form should be created as a content page that references a master page, then click Add. In the Select a Master Page dialog, select Bug2Bug.master and click OK. The IDE creates the file and opens it in Source mode. Change the Title property of the Page directive to Book Information. Step 10: Customizing the Secure Page To customize the Books.aspx page for a particular user, we add a welcome message containing a LoginName control, which displays the current authenticated user name. Open Books.aspx in Design mode. In the Content control, type Welcome followed by a comma and a space. Then drag a LoginName control from the Toolbox onto the page. When this page executes on the server, the text [UserName] that appears in this control in Design mode will be replaced by the current user name. In Source mode, type an exclamation point (!) directly after the LoginName control (with no spaces in between). [Note: If you add the exclamation point in Design mode, the IDE may insert extra spaces or a line break between this character and the preceding control. Entering the ! in Source mode ensures that it appears adjacent to the user's name.] Next, we add a LoginStatus control, which will allow the user to log out of the Web site when finished viewing the listing of books in the database. A LoginStatus control renders on a Web page in one of two waysby default, if the user is not authenticated, the control displays a hyperlink with the text Login; if the user is authenticated, the control displays a hyperlink with the text Logout. Each link performs the stated action. Add a LoginStatus control to the page by dragging it from the Toolbox onto the page. In this example, any user who reaches this page must already be authenticated, so the control will always render as a Logout link. The LoginStatus Tasks smart tag menu allows you switch between the control's Views. Select the Logged In view to see the Logout link. To change the actual text of this link, modify the control's LogoutText property to Click here to log out. Next, set the LogoutAction property to RedirectToLoginPage. Step 11: Connecting the CreateUserWizard and Login Controls to the Secure Page Now that we have created Books.aspx, we can specify that this is the page to which the CreateUserWizard and Login controls redirect users after they are authenticated. Open CreateNewUser.aspx in Design mode and set the CreateUserWizard control's ContinueDestinationPageUrl property to Books.aspx. Next, open Login.aspx and select Books.aspx as the DestinationPageUrl of the Login control. At this point, you can run the Web application by selecting Debug > Start Without Debugging. First, create a user account on CreateNewUser.aspx, then notice how the LoginName and LoginStatus controls appear on Books.aspx. Next, log out of the site and log back in using Login.aspx. Step 12: Generating a DataSet Based on the Books.mdf Database We now begin to add the content (i.e., book information) to the secure page Books.aspx. This page will provide a DropDownList containing authors' names and a GridView displaying information about books written by the author selected in the DropDownList. A user will select an author from the DropDownList to cause the GridView to display information about only the books written by the selected author. As you will see, we create this functionality entirely in Design mode without writing any code. To work with the Books database, we use an approach slightly different than in the preceding case study in which we accessed the Guestbook database using a SqlDataSource control. Here we use an ObjectDataSource control, which encapsulates an object that provides access to a data source. Recall that in Chapter 20, we accessed the Books database in a Windows application using TableAdapters configured to communicate with the database file. These TableAdapters placed a cached copy of the database's data in a DataSet, which the application then accessed. We use a similar approach in this example. An ObjectDataSource can encapsulate a TableAdapter and use its methods to access the data in the database. This helps separate the data-access logic from the presentation logic. As you will see shortly, the SQL statements used to retrieve data do not appear in the ASPX page when using an ObjectDataSource. The first step in accessing data using an ObjectDataSource is to create a DataSet that contains the data from the Books database required by the application. In Visual C# 2005 Express, this occurs automatically when you add a data source to a project. In Visual Web Developer, however, you must explicitly generate the DataSet. Right click the project's location in the Solution Explorer and select Add New Item.... In the resulting dialog, select DataSet and specify BooksDataSet.xsd as the file name, then click Add. A dialog will appear that asks you whether the DataSet should be placed in an App_Code foldera folder whose contents are compiled and made available to all parts of the project. Click Yes for the IDE to create this folder to store BooksDataSet.xsd. Step 13: Creating and Configuring an AuthorsTableAdapter Once the DataSet is added, the Dataset Designer will appear, and the TableAdapter Configuration Wizard will open. Recall from Chapter 20 that this wizard allows you to configure a TableAdapter for filling a DataTable in a DataSet with data from a database. The Books.aspx page requires two sets of dataa list of authors that will be displayed in the page's DropDownList (created shortly) and a list of books written by a specific author. We focus on the first set of data herethe authors. Thus, we use the TableAdapter Configuration Wizard first to configure an AuthorsTableAdapter. In the next step, we will configure a TitlesTableAdapter. In the TableAdapter Configuration Wizard, select Books.mdf from the drop-down list. Then click Next > twice to save the connection string in the application's Web.config file and move to the Choose a Command Type screen. In the wizard's Choose a Command Type screen, select Use SQL statements and click Next >. The next screen allows you to enter a SELECT statement for retrieving data from the database, which will then be placed in an Authors DataTable within the BooksDataSet. Enter the SQL statement SELECT AuthorID, FirstName + ' ' + LastName AS Name FROM Authors in the text box on the Enter a SQL Statement screen. This query selects the AuthorID of each row. This query's result will also contain a column named Name that is created by concatenating each row's FirstName and LastName, separated by a space. The AS SQL keyword allows you to generate a column in a query resultcalled an aliasthat contains the result of a SQL expression (e.g., FirstName + ' ' + LastName). You will soon see how we use the result of this query to populate the DropDownList with items containing the authors' full names. After entering the SQL statement, click the Advanced Options... button and uncheck Generate Insert, Update and Delete statements, since this application does not need to modify the database's contents. Click OK to close the Advanced Options dialog. Click Next > to advance to the Choose Methods to Generate screen. Leave the default names and click Finish. Notice that the DataSet Designer (Fig. 21.61) now displays a DataTable named Authors with AuthorID and Name members, and Fill and GeTData methods. Figure 21.61. Authors DataTable in the Dataset Designer. Step 14: Creating and Configuring a TitlesTableAdapter Books.aspx needs to access a list of books by a specific author and a list of authors. Thus we must create a TitlesTableAdapter that will retrieve the desired information from the database's Titles table. Right click the Dataset Designer and from the menu that appears, select Add > TableAdapter... to launch the TableAdapter Configuration Wizard. Make sure the BooksConnectionString is selected as the connection in the wizard's first screen, then click Next >. Choose Use SQL statements and click Next >. In the Enter a SQL Statement screen, open the Advanced Options dialog and uncheck Generate Insert, Update and Delete statements, then click OK. Our application allows users to filter the books displayed by the author's name, so we need to build a query that takes an AuthorID as a parameter and returns the rows in the Titles table for books written by that author. To build this complex query, click the Query Builder... button. In the Add Table dialog that appears, select AuthorISBN and click Add. Then Add the Titles table, too. Our query will require access to data in both of these tables. Click Close to exit the Add Table dialog. In the top pane of the Query Builder window (Fig. 21.62), check the box marked * (All Columns) in the Titles table. Next, in the middle pane, add a row with Column set to AuthorISBN.AuthorID. Uncheck the Output box, because we do not want the AuthorID to appear in our query result. Add an @authorID parameter in the Filter column of the newly added row. The SQL statement generated by these actions retrieves information about all books written by the author specified by parameter @authorID. The statement first merges the data from the AuthorISBN and Titles tables. The INNER JOIN clause specifies that the ISBN columns of each table are compared to determine which rows are merged. The INNER JOIN results in a temporary table containing the columns of both tables. The outer portion of the SQL statement selects the book information from this temporary table for a specific author (i.e., all rows in which the AuthorID column is equal to @authorID). Figure 21.62. Query Builder for designing a query that selects books written by a particular author. Click OK to exit the Query Builder, then in the TableAdapter Configuration Wizard, click Next >. On the Choose Methods to Generate screen, enter FillByAuthorID and GetdataByAuthorID as the names of the two methods to be generated for the TitlesTableAdapter. Click Finish to exit the wizard. You should now see a Titles DataTable in the Dataset Designer (Fig. 21.63). Figure 21.63. Dataset Designer after adding the TitlesTableAdapter. Step 15: Adding a DropDownList Containing Authors' First and Last Names Now that we have created a BooksDataSet and configured the necessary TableAdapters, we add controls to Books.aspx that will display the data on the Web page. We first add the DropDownList from which users can select an author. Open Books.aspx in Design mode, then add the text Author: and a DropDownList control named authorsDropDownList in the page's Content control, below the existing content. The DropDownList initially displays the text [Unbound]. We now bind the list to a data source, so the list displays the author information placed in the BooksDataSet by the AuthorsTableAdapter. In the DropDownList Tasks smart tag menu, click Choose Data Source... to start the Data Source Configuration Wizard. Select from the Select a data source dropdown list in the first screen of the wizard. Doing so opens the Choose a Data Source Type screen. Select Object and set the ID to authorsObjectDataSource, then click OK. An ObjectDataSource accesses data through another object, often called a business object. Recall from Section 21.3 that the middle tier of a three-tier application contains business logic that controls the way an application's top tier user interface (in this case, Books.aspx) accesses the bottom tier's data (in this case, the Books.mdf database file). Thus, a business object represents the middle tier of an application and mediates interactions between the other two tiers. In an ASP.NET Web application, a TableAdapter typically serves as the business object that retrieves the data from the bottom-tier database and makes it available to the top-tier user interface through a DataSet. In the Choose a Business Object screen of the Configure Data Source wizard (Fig. 21.64), select BooksDataSetTableAdapters.AuthorsTableAdapter. [Note: You may need to save the project to see the AuthorsTableAdapter.] BooksDataSetTableAdapters is a namespace declared by the IDE when you create BooksDataSet. Click Next > to continue. Figure 21.64. Choosing a business object for an ObjectDataSource. (This item is displayed on page 1145 in the print version) The Define Data Methods screen (Fig. 21.65) allows you to specify which method of the business object (in this case, AuthorsTableAdapter) should be used to obtain the data accessed through the ObjectDataSource. You can choose only methods that return data, so the only choice provided is the Getdata method, which returns an AuthorsDataTable. Click Finish to close the Configure Data Source wizard and return to the Data Source Configuration Wizard for the DropDownList (Fig. 21.66). The newly created data source (i.e., authorsObjectDataSource) should be selected in the top drop-down list. The other two drop-down lists on this screen allow you to configure how the DropDownList control uses the data from the data source. Set Name as the data field to display and AuthorID as the data field to use as the value. Thus, when authorsDropDownList is rendered in a Web browser, the list items will display the names of the authors, but the underlying values associated with each item will be the AuthorIDs of the authors. Finally, click OK to bind the DropDownList to the specified data. Figure 21.65. Choosing a data method of a business object for use with an ObjectDataSource. Figure 21.66. Choosing a data source for a DropDownList. (This item is displayed on page 1146 in the print version) The last step in configuring the DropDownList on Books.aspx is to set the control's AutoPostBack property to true. This property indicates that a postback occurs each time the user selects an item in the DropDownList. As you will see shortly, this causes the page's GridView (created in the next step) to display new data. Step 16: Creating a GridView to Display the Selected Author's Books We now add a GridView to Books.aspx for displaying the book information by the author selected in the authorsDropDownList. Add a GridView named titlesGridView below the other controls in the page's Content control. To bind the GridView to data from the Books database, select from the Choose Data Source drop-down list in the GridView Tasks smart tag menu. When the Data Source Configuration Wizard opens, select Object and set the ID of the data source to titlesObjectDataSource, then click OK. In the Choose a Business Object screen, select the BooksDataSetTableAdapters.TitlesTableAdapter from the drop-down list to indicate the object that will be used to access the data. Click Next >. In the Define Data Methods screen, leave the default selection of GetdataByAuthorID as the method that will be invoked to obtain the data for display in the GridView. Click Next >. Recall that TitlesTableAdapter method GeTDataByAuthorID requires a parameter to indicate the AuthorID for which data should be retrieved. The Define Parameters screen (Fig. 21.67) allows you to specify where to obtain the value of the @authorID parameter in the SQL statement executed by GeTDataByAuthorID. Select Control from the Parameter source drop-down list. Select authorsDropDownList as the ControlID (i.e., the ID of the parameter source control). Next, enter 1 as the DefaultValue, so books by Harvey Deitel (who has AuthorID 1 in the database) display when the page first loads (i.e., before the user has made any selections using the authorsDropDownList). Finally, click Finish to exit the wizard. The GridView is now configured to display the data retrieved by TitlesTableAdapter.GetDataByAuthorID, using the value of the current selection in authorsDropDownList as the parameter. Thus, when the user selects a new author and a postback occurs, the GridView displays a new set of data. Figure 21.67. Choosing the data source for a parameter in a business object's data method. (This item is displayed on page 1147 in the print version) Now that the GridView is tied to a data source, we modify several of the control's properties to adjust its appearance and behavior. Set the GridView's CellPadding property to 5, set the BackColor of the AlternatingRowStyle to LightYellow, and set the BackColor of the HeaderStyle to LightGreen. Change the Width of the control to 600px to accommodate long data values. Next, in the GridView Tasks smart tag menu, check Enable Sorting. This causes the column headings in the GridView to turn into hyperlinks that allow users to sort the data in the GridView. For example, clicking the Titles heading in the Web browser will cause the displayed data to appear sorted in alphabetical order. Clicking this heading a second time will cause the data to be sorted in reverse alphabetical order. ASP.NET hides from you the details required to achieve this functionality. Finally, in the GridView Tasks smart tag menu, check Enable Paging. This causes the GridView to split across multiple pages. The user can click the numbered links at the bottom of the GridView control to display a different page of data. GridView's PageSize property determines the number of entries per page. Set the PageSize property to 4 using the Properties window so that the GridView displays only four books per page. This technique for displaying data makes the site more readable and enables pages to load more quickly (because less data is displayed at one time). Note that, as with sorting data in a GridView, you do not need to add any code to achieve paging functionality. Fig. 21.68 displays the completed Books.aspx file in Design mode. Figure 21.68. Completed Books.aspx in Design mode. (This item is displayed on page 1148 in the print version) Step 17: Examining the Markup in Books.aspx Figure 21.69 presents the markup in Books.aspx (reformatted for readability). Aside from the exclamation point in line 9, which we added manually in Source mode, all the remaining markup was generated by the IDE in response to the actions we performed in Design mode. The Content control (lines 655) defines page-specific content that will replace the ContentPlaceHolder named bodyContent. Recall that this control is located in the master page specified in line 3. Line 9 creates the LoginName control, which displays the authenticated user's name when the page is requested and viewed in a browser. Lines 1012 create the LoginStatus control. Recall that this control is configured to redirect the user to the login page after logging out (i.e., clicking the hyperlink with the LogoutText). Figure 21.69. Markup for the completed Books.aspx file. (This item is displayed on pages 1149 - 1151 in the print version) Lines 1518 define the DropDownList that displays the names of the authors in the Books database. Line 16 contains the control's AutoPostBack property, which indicates that changing the selected item in the list causes a postback to occur. The DataSourceID property in line 16 specifies that the DropDownList's items are created based on the data obtained through the authorsObjectDataSource (defined in lines 2023). Line 21 specifies that this ObjectDataSource accesses the Books database by calling method GeTData of the BooksDataSet's AuthorsTableAdapter (line 22). Lines 2543 create the GridView that displays information about the books written by the selected author. The start tag (lines 2528) indicates that paging (with a page size of 4) and sorting are enabled in the GridView. The AutoGenerateColumns property indicates whether the columns in the GridView are generated at runtime based on the fields in the data source. This property is set to False, because the IDE-generated Columns element (lines 3039) already specifies the columns for the GridView using BoundFields. Lines 4554 define the ObjectDataSource used to fill the GridView with data. Recall that we configured titlesObjectDataSource to use method GetdataByAuthorID of the BooksDataSet's TitlesTableAdapter for this purpose. The ControlParameter in lines 5052 specifies that the value of method GetdataByAuthorID's parameter comes from the SelectedValue property of the authorsDropDownList. Figure 21.69(a) depicts the default appearance of Books.aspx in a Web browser. Because the DefaultValue property (line 51) of the ControlParameter for the titlesObjectDataSource is set to 1, books by the author with AuthorID 1 (i.e., Harvey Deitel) are displayed when the page first loads. Note that the GridView displays paging links below the data, because the number of rows of data returned by GeTDataByAuthorID is greater than the page size. Figure 21.69(b) shows the GridView after clicking the 2 link to view the second page of data. Figure 21.69(c) presents Books.aspx after the user selects a different author from the authorsDropDownList. The data fits on one page, so the GridView does not display paging
https://flylib.com/books/en/2.255.1/case_study_secure_books_database_application.html
CC-MAIN-2020-34
refinedweb
8,407
56.86
Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java programming articles and tips. Please take your copy here. Take your copy of free "Java Technology Screensaver"!. JavaFAQ Home » Story by Dr. Kabutz 2001-05-10 The Java Specialists' Newsletter [Issue 019] Welcome to the 19th issue of "The Java(tm) Specialists' Newsletter". This newsletter is my contribution to advancing Java skills, and is meant as an informative, advanced newsletter that hopefully will tell you things you won't find in your average newsletter. Please let me know when my content becomes too ordinary or my style too stolid. Thanks to all those of you who responded to last week's question, there were some interesting opinions flying around, seems like the real reasons why people go/come/stay in places is because of relationships and friendships, with money, technology, etc. only being secondary. With apologies to my readers from the erstwhile Soviet Union, it seems that was quite a well-known fact to the Politburo, but perhaps I've read too many spy stories. Something that I have encountered in some almost-complete projects, were dialogs that were not bound to frames. When you construct a dialog, you should specify who the owner is, which is either a frame or another dialog. It is, however, also possible to specify "null" as the owner, which causes very irritating problems. In MS Windows, if a modal dialog does not have an owner, and you have moved away from it, for example if you quickly switched to Outlook while waiting for it to start up, the only way to get back to the dialog is by using ALT+Tab. If you click on the frame icon on the toolbar, you will get just the frame, not the dialog. Clicking on the frame will cause a beep and that's all. A few months ago, I asked myself the question: Is there a way in which we can find a frame that has already been created? One of my first newsletters showed a GlobalHotkeyManager that allowed you to install your own event queue into the AWT, letting you catch any events that occur, before ANY other components get hold of them. Why don't we use the concept to catch Window events and then use those events to remember which frames are available? The problem with the GlobalHotkeyManager, was that it only allowed exactly one event catcher to be present at a time. It is therefore only safe to use if none of the libraries you use link in a similar event queue. An alternative, suggested by F.S., was to register ourselves as a listener to the main AWT event system by calling Toolkit.getDefaultToolkit().addAWTEventListener(). Each time a window is activated, we grap the handle and add it to our list of frames that we know about. We can then write a method called "lookupFrame(String title)" which goes through the list and returns the first frame that we find with the specified title. //: FrameLookup.java import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class FrameLookup { private final Collection frames = new LinkedList(); // Singleton Pattern private static final FrameLookup instance = new FrameLookup(); public static FrameLookup getInstance() { return instance; } private FrameLookup() { Toolkit.getDefaultToolkit().addAWTEventListener( new AWTEventListener() { public void eventDispatched(AWTEvent event) { System.out.println("Event Dispatched : " + event); if (event.getID() == WindowEvent.WINDOW_ACTIVATED) { if (event.getSource() instanceof Frame) { synchronized(frames) { frames.add(event.getSource()); } } } } }, AWTEvent.WINDOW_EVENT_MASK); } public Frame lookupFrame(String title) { synchronized(frames) { Iterator it = frames.iterator(); while(it.hasNext()) { Frame frame = (Frame)it.next(); if (frame.getTitle().equals(title)) return frame; } } return null; } } I can now write a test program that creates a frame, forgets the handle, and then creates a dialog and uses the FrameLookup class to find the correct frame to use as owner: //: FrameLookupTest.java import javax.swing.*; import java.awt.*; public class FrameLookupTest { private static final String SWING_FRAME_TITLE = "Swing Frame"; private static final String AWT_FRAME_TITLE = "AWT Frame"; private static final String SWING_DIALOG_TITLE = "Swing Dialog"; public static void main(String[] args) { FrameLookup framer = FrameLookup.getInstance(); makeFrame(); // we can find visible frame by using our FrameLookup utility System.out.println("Frame is " + FrameLookup.getInstance().lookupFrame(SWING_FRAME_TITLE)); makeDialog(); } private static void makeFrame() { JFrame frame = new JFrame(SWING_FRAME_TITLE); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 300); frame.show(); } private static void makeDialog() { // we can bind our JDialog to the Frame JDialog dialog = new JDialog( FrameLookup.getInstance().lookupFrame(SWING_FRAME_TITLE), SWING_DIALOG_TITLE, true); dialog.setSize(400, 100); dialog.show(); } } This is great; we can discover the correct frame as owner, just by knowing its title! There are some minor problems, such as the fact that there is a racing condition involved. It can happen that we request to find the frame before it has been activated or shown, thereby our lookupFrame() method would return "null". Big Oooops. Our situation is now worse than before, as such intermittent failings are MUCH harder to find. Let's also not forget that the title of a frame does not have to be unique. When I was preparing this newsletter, I got distracted in that I tried to reproduce the Swing dealock problem (which I didn't manage . While I was looking through the source code of JFrame/Frame/Window/Container/Component, I happened upon the method Frame[] java.awt.Frame.getFrames(), which Sun added in the JDK 1.2, according to the @version tag. Is it just me, or have I been reading the wrong publications, that don't tell me about these features? Please, if you have heard of Frame.getFrames(), send me an email. Anyway, with my newly acquired knowledge, I ran off and wrote a second version of the FrameLookup class that looks like this, and sorts out the racing condition problem: //: FrameLookup.java take 2 import java.awt.*; public class FrameLookup { // Singleton Pattern private static final FrameLookup instance = new FrameLookup(); public static FrameLookup getInstance() { return instance; } private FrameLookup() { } public Frame lookupFrame(String title) { Frame[] frames = Frame.getFrames(); for (int i=0; iif (frames[i].getTitle().equals(title)) return frames[i]; } return null; } } We still have the problem that titles alone could be ambigious, but the getFrames() method is definitely the correct way to find a Frame if you need to. Until next week, and please remember that the more people read this newsletter each week, the more corporate time I can waste collectively, currently I'm wasting about 2 man-months of your development time each week. i.e. please keep on forwarding these newsletters to friends and colleagues who use Java Heinz RSS feed Java FAQ News
http://javafaq.nu/java-article730.html
CC-MAIN-2018-09
refinedweb
1,105
63.9
map map() will map the specified sequence according to the provided function. The first parameter function calls the function function with each element in the parameter sequence and returns a new list containing the return value of each function function. Return the list in Python 2 and the iterator in Python 3. def square(x): return x ** 2 print(list(map(square, [1, 2, 3, 4]))) --------------------- 1 4 9 16 #Use anonymous functions print(list(map(lambda x:x**2, [1, 2, 3, 4]))) ------------- 1 4 9 16 # Two lists are provided to add the list data at the same location print(lambda x, y: x + y, [1, 3, 5, 7, 9], [2, 4, 6, 8, 10]) ------------- [3, 7, 11, 15, 19] filter The filter() function is used to filter the sequence, filter out the elements that do not meet the conditions, and return a new list composed of qualified elements. The receives two parameters. The first is a function and the second is a sequence. Each element of the sequence is passed to the function as a parameter for judgment, and then returns True or False. Finally, the element that returns True is placed in the new list. List is returned in python2 and iterator is returned in python3 def is_odd(n): return n % 2 == 1 newlist = filter(is_odd, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) print(list(newlist)) --------------- [1, 3, 5, 7, 9] zip The zip() function is used to take the iteratable object as a parameter, package the corresponding elements in the object into tuples, and then return a list composed of these tuples. If the number of elements of each iterator is inconsistent, the length of the returned list is the same as that of the shortest object. The tuple can be decompressed into a list by using the * operator. Learn about the difference between the zip method in Python 2 and python 3: in Python 3 To reduce memory in X, zip() returns an object. To display the list, you need to manually convert the list(). a = [1, 2, 3] b = [4, 5, 6] c = [7,8,9,10] res1 = zip(a, b) res2 = zip(a, c) print(list(res1)) print(list(res2)) ---------------- [(1, 4), (2, 5), (3, 6)] [(1, 7), (2, 8), (3, 9)] next() returns the next item of the iterator. The next() function is used with the iter() function that generates the iterator. # First get the Iterator object: it = iter([1, 2, 3, 4, 5]) # Cycle: while True: try: # Get the next value: x = next(it) print(x) except StopIteration: # Exit the loop when StopIteration is encountered break Understanding: if the second parameter is passed in, after obtaining the last element, the next time will return the default value without throwing StopIteration: it = iter([1, 2, 5, 4, 3]) while True: x = next(it, 'a') # You can set a final default value when next print(x) if x == 'a': break ------------------------ 1 2 5 4 3 a hash hash() is used to get the hash value of an object (string or value, etc.). The hash() function can be applied to numbers, strings and objects, not directly to list s, set s and dictionaries. When hash() is used on an object, the result is related not only to the content of the object, but also to the id() of the object, that is, the memory address. hash('test') # character string ---------- 2314058222102390712 hash(1) # number -------- 1 hash(str([1,2,3])) # aggregate ------------------ 1335416675971793195 hash(str(sorted({'1':1}))) # Dictionaries --------------- 7666464346782421378 The help() function is used to view a detailed description of the purpose of a function or module >>>help('sys') # View help for sys module ......Show help >>>help('str') # View help for str data types ......Show help >>>a = [1,2,3] >>>help(a) # View list help information ......Show help >>>help(a.append) # Displays help for the append method of the list ......Show help id The id() function returns the unique identifier of the object. The identifier is an integer. The id() function in CPython is used to get the memory address of the object. name = 'yang' print(id(name)) --------------- 2541526569288 enumerate The enumerate() function is used to combine a traversable data object (such as list, tuple or string) into an index sequence, and list the data and data subscripts at the same time. It is generally used in the for loop. list1 = iter([1,2,3,4,5]) for index,value in enumerate(list1): print(index,value) ----------------------- 0 1 1 2 2 3 3 4 4 5 reduce The reduce() function accumulates the elements in the parameter sequence. The function performs the following operations on all data in a data set (linked list, tuple, etc.): first operate the first and second elements in the set with the function (with two parameters) passed to reduce, and then operate with the third data with the function function, and finally get a result. Just look at the following example from functools import reduce print(reduce(lambda x, y: x + y, [1, 2, 3, 4, 5])) --------------------- 15 eval The eval() function executes a string expression and returns the value of the expression. The dictionary format string stored in the file can also be converted by Eval, but it is generally not used, because we can use json or pickle module x = 3 print(eval('10-x')) ------ 7
https://algorithm.zone/blogs/python-common-built-in-functions.html
CC-MAIN-2022-21
refinedweb
891
54.46