「adapter」を含む日記 RSS

はてなキーワード: adapterとは

2018-08-14

adapterとadopterは別の意味を持つ単語

前者は広くアダプターと呼ばれてるんだから

後者をアドプターとするのはしごく当然ではないのか

2013-08-26

初めてのRailsサイト作った人が使ったGemリスト一覧

ども。

以前、はてな匿名ダイアリー日記を書いた者です。

【Ruby on Rails勉強】 xvideosまとめサイトっておいしいの?

上の記事でも書いていますが、Railsはおろか、Rubyを初めて触った人間ゼロからWebサービスリリースするために利用しているGemを公開したいと思います

作ったサービス

サイトonalife(オナライフ)
URLhttp://www.onalife.com
説明xvideos動画の共有・ユーザー参加型のまとめサイト

使っているGem

sqlite3

developmentモードで起動する際のデータベースsqlite3を使うようにしています

コーディングサーバー起動→動作確認→コーディング…という流れになりますが、サーバーを起動する際に、

$ rails s

と実行するだけでサーバーが起動できるため大変手軽です。

サーバー起動後はブラウザhttp://localhost:3000/アクセスすれば開発用のサイトを確認できます

mysql2

productionモード(本番環境)で利用するのはMySQLを使うようにしています

理由は他のWebサイトで推奨されていたため。

sqlite場合だと、単純にDBデータファイルとして扱っており、同時に複数アクセスがあった際、最初アクセス中にファイルロックされてしま仕様との記事をどこかで見たため、MySQLを使うようにしています

developmentとproductionで動作を分けるには、 config/database.ymlで分けることができます

development:

adapter: sqlite3

database: db/development.sqlite3

pool: 5

timeout: 5000

production:

adapter: mysql2

database: production.mysql

encoding: utf8

pool: 5

username: <yourname>

password: <password>

timeout: 5000

kaminari

pagenation系のド定番ですね。

よくWebサービスのページ下にある [1][2]・・・[X]といったリンクが表示されている、あれです。

http://memo.yomukaku.net/entries/238

https://github.com/amatsuda/kaminari

unicorn

Unicorn + Nginx + Rails で構築しています

効果の違いなどはGoogle先生質問すると大量に返答がありますのでこちらでは割愛

体感的にもかなり違います

nokogiri

スクレイピングするのに使っています

ONALIFE(オナライフ)では、xvideosの動画URL画像パスを抜き出す為に、こちらのGemを使っています

HTMLブロック単位で抜き出せるため大変重宝しました。

http://himaratsu.hatenablog.com/entry/2013/04/27/002249

http://nokogiri.org/

acts-as-taggable-on

タグ機能を簡単に実装するためのGem

これは捗る。超絶オススメ

サイトタグ機能はこちらで一瞬のうちに導入できました。

自作するとなるとかなり労力使いますから…こういったところは極力他の人が作ってくれたものを流用してもバチはあたらんでしょう。

https://github.com/mbleigh/acts-as-taggable-on

typus

管理画面を一瞬で作ってくれるGem

通常だと管理画面も rails g xxx とかやって controller 作って、 view 作って…とかやらないといけませんが、こちらのGemを使うと一瞬で終わります

素晴らしい!!

サイトでは、投稿していただいたxvideosの動画が不適切な場合などに消去する必要があるため、どうしても管理者向けの画面が欲しかったのでこちらを使いました。

データベースを直接操作して delete とかできちゃいます

http://www.func09.com/wordpress/archives/1136

google-analytics-rails

Webサイトを作る上でアクセス解析というのは必須です。

自分サイトアクセス傾向を解析して、どうすればアクセスが伸ばせるか、ということを考察するのに必要不可欠な機能です。

通常、Google Analyticsサイトを登録すると、Javascriptコードが生成されるので、それをWebサービスに貼り付けるだけで完了ですが、こちらのGemを使うと、Google Analytics で生成されるID番号のみを登録するだけで自動的に挿入されるようになります

コードがごちゃごちゃしなくなるので可読性が上がります

最後

まだONALIFE(オナライフ)は発展途上のサービスです。

機能拡張していくうえで、先人たちのありがたいGemをどんどんこれから活用していければ、と思っています

みなさんもこれは便利!というお勧めGemがあれば是非教えて頂ければと思います

トラックバックコメントとかでも大歓迎です!

以上、ONALIFE(オナライフ)で利用しているGem一覧の紹介でした。

参考サイト

http://anond.hatelabo.jp/20101206224349

http://anond.hatelabo.jp/20101203150748

http://anond.hatelabo.jp/20120914214121

http://anond.hatelabo.jp/20130120190550

じゃあの。

2012-01-06

Article 14 the mobile phone will know the battery skills

If users want to prolong battery the efficient use of the time, in addition to the quality of the charger to have the guarantee, the right skills and charging is essential, because of low quality charger or wrong charging methods would affect battery time and life cycle, the following is about to charge skills:

1. The battery before they leave the factory, manufacturers were activated processing, and the charge, so the battery are more electricity, my friends say battery charging adjustment period in accordance with the time, standby still seriously insufficient, assuming that the battery is really quality goods battery of words, this kind of circumstance should extend the setting and then 3 ~ 5 times fully charge and discharge.

2. If new phone is lithium ion battery, so before 3 ~ 5 times charging commonly known as adjustment period, should be charged more than 14 hours, in order to ensure that the fully activate lithium ion activity. The lithium ion battery no memory effects, but have very strong sui sex, should give full activated PANASONIC CGR-D220 Battery, to guarantee the use of after can reach the right performance.

3. Some automation intelligent quick charger when instructions lights change, said only full of 90%. The charger will automatically change with slow charge will batteries. Best will use after batteries, otherwise, it will shorten use time.

4. Before charging and discharging lithium battery does not need special, but will not discharge damage to the battery. As far as possible when charging at the slow ChongChongDian, reduce the way quick charge; Time don't more than 24 hours. The battery after three to five times fully recharge cycles of internal after chemical will be all "activate" to achieve the best use effect.

5. Please use the original or the reputation of the good brand charger, li-ion battery to lithium battery charger with special, and follow the instructions, otherwise, it will damage to the battery, and even dangerous.

6. Have many users often in charge still leave her cell phone, actually such will be very easy to PANASONIC CGA-S101E/1B Battery damage the service life of the mobile phone, because in charge of the process, the circuit boards of mobile phone can calorific, if this time more exotic phone, may produce instant backflow current, internal parts to mobile phone damage.

7. The battery life depends on the number repeatedly charging and discharging, so should try to avoid more battery electric charge when, this will shorten battery life. Cell phone time more than 7 days, supposed to completely discharge the cell phone battery, enough electricity before use.

8. The cell phone battery have self-discharge, need not when the nimh batteries will press the residual capacity every day, about 1% of the discharge, lithium battery every day to 0.2% ~ 0.3% discharge. In for the battery, try to use the special socket, don't will the home appliance such as the Shared and the TV charger socket.

9. Though the phones in the network coverage area, but in the cell phone charge, cell phones have been unable to accept and call. At this time, can use of the mobile phone is not transfer function, will be transferred to the mobile phone side of fixed telephone in order to prevent calls lost, this kind of method for mobile phone is not in the network coverage of the area or weak signal and temporarily unable to the applicable also.

10. Don't will be exposed to high temperature or cold PANASONIC DMW-BCG10E Battery , as the dog, should not put the phone on the car, and the sun blazed through the; Or get air conditioning room, in air conditioning to be blown continuously place. When charging, the battery is a little heat is normal, but can't let it what the high temperature "suffer". In order to avoid the happening of this kind of circumstance, had better be in charge at room temperature, and don't cover anything on the mobile phone.

11. Nickel cadmium (N iCd) before the battery must ensure that the batteries are no electricity, recharging the battery must ensure that sufficient electricity after.

12. If the cell phone battery placed too long and not use, the best maintenance department to cell phones to the application for a live processing, also can use a constant dc voltage is the voltage adjustment for 5 ~ 6 V, current 500 ~ 600 mA reverse connect battery. Note that a touch namely release, the most repeated three times can, through such treatment after another, with the original adapter to "adaptation" charge.

13. Charge is not as long as possible, to no protection circuit batteries that should stop after charging, or the battery will with fever or overheating impact performance.

14. Lithium ion battery must choose special charger, otherwise may not reach the saturated state, affect their performance. Charging completes, should avoid to place in charger on more than 12 hours or more, long-term need not when should make a battery and cell phone separation.

2011-12-29

Portable electronic equipment battery technology

1, about the trickle charge, rapid charging and stable battery charging algorithm

According to the energy requirements of the final application, a battery may contain up to 4 lithium ion or lithium polymer battery core, its configuration will have a variety of change, at the same time with a mainstream power adapter: direct adapter, USB interface or car charger. Remove the core quantity, core configuration or power adapter type difference, the battery has the same charge characteristics. So they charge algorithm. Lithium ion and li-ion polymer battery best charging algorithm can divided into three phases: trickle charge, rapid charging and stable charge.

trickle charge. For depth discharge core to charge. When core voltage in less than about 2.8 V, use a constant 0.1 C of the current charging for it.

fast charging. Core voltage trickle charge more than the threshold, improve the charging current rapid charging. Fast charging current should be lower than 1.0 C.

stable voltage. In the fast charging process, once the core 4.2 V voltage, stable voltage phase began. This is through the minimum charge current or timer or of the two joint to interrupt charge. When the minimum current below about 0.07 C, can interrupt charge. The timer is to rely on a default to trigger the timer interrupt.

Advanced battery charger with additional security function normally. For example, if the core temperature exceeds the given window, usually 0 ℃-45 ℃, charge will be suspended.

Remove some very low-end equipment, now on the market/li-ion polymer lithium ion battery solutions are integrated with the outer components or, in accordance with the characteristics of the charging to charge, this is not just to get better effect charge, but also for safety.

lithium ion/polymer battery charge is an example of applications-double input 1.2 A lithium battery charger LTC4097

LTC4097 can be used to exchange adapter or USB power supply for single quarter/polymer lithium ion battery. Figure 1 for double input 1.2 A lithium battery charger LTC4097 schemes. It USES constant current/constant voltage algorithm charging, from exchange adapter power charge, programmable filling up to 1.2 electric current A, and with USB power can be as high as 1 A, at the same time, automatic detection in each input voltage whether there. This device also provide USB the current limit. Applications include PDA, MP3 players, digital camera, light portable medical and test equipment and big color cellular phone. The performance characteristics: no external micro controller charging termination; The input power automatic detection and choice; Through the resistance from the exchange of charging adapter input can be as high as 1.2 A programming charge current; The resistance of programmable USB charging current is up to 1 A; 100% or 20% USB charging current set; The input power output and existing bias NTC (VNTC) pin as a 120 mA drive ability; NTC thermistors input (NTC) pin for temperature qualified charged; Pre-settings battery voltage with floating plus or minus 0.6% accuracy; Thermal regulation maximize charge rate and free hot air LTC4097 can be used to exchange adapter or USB power supply for single quarter/polymer lithium ion battery. The use of constant current/constant voltage algorithm charging, from exchange adapter power charge, programmable filling up to 1.2 electric current A, and with USB power can be as high as 1 A, at the same time, automatic detection in each input voltage whether there. This device also provide USB the current limit. Applications include PDA, MP3 players, digital camera, light portable medical and test equipment and big color cellular phone.

2, lithium ion/polymer battery scheme

Lithium ion/polymer battery charge scheme for different number of core, core configuration, and power types are different. At present mainly have three main charging scheme: linear, Buck (step-down) switch and SEPIC (booster and step-down) switch.

2.1 linear scheme

When the input voltage in big with the charger with sufficient clearance of core after opening voltage, it is linear scheme, especially 1.0 C fast charging current than 1 A big too much. For example, MP3 players usually only one core, capacity from 700 to 1500 mAh differ, full charge voltage is open 4.2 V. MP3 player power is usually the AC/DC adapter or USB interface, the output is the rule of 5 V; At this time, the linear scheme is the most simple, most charger of the efficiency of the scheme. Figure 2 shows for lithium ion/polymer battery solution linear scheme, basic structure and linear voltage neat device.

linear scheme charger application examples-double input Li + charger and intelligent power source selector MAX8677A

MAX8677A is double input USB/AC adapter linear charger, built-in Smart Power Selector, used for rechargeable single quarter by Li + batteries portable devices. The charger integration of the battery and the external power source and load switch charging all the power switch, so that no external MOSFET. MAX8677A ideal used in portable devices, such as smart phones, PDA, portable media players, GPS navigation equipment, digital camera, and digital cameras.

MAX8677A can work in independent USB and the power input AC adapter or two input either one of the input. When connecting external power supply, intelligent power source selector allows the system not connect battery or can and depth discharge battery connection. Intelligent power source selector will automatically switch to the battery system load, use the system did not use the input power supply parts for battery, make full use of limited USB and adapter power supply input. All the needed electric current detection circuit, including the integration of the power switch, all integration in the piece. DC input current highest limit can be adjusted to 2 A and DC and USB input all can support 100 mA, 500 mA, and USB hung mode. Charge current can be adjusted to as high as 1.5 A, thus support wide range of battery capacitive. Other features include MAX8677A thermal regulation, over-voltage protection, charging status and fault output, power supply good surveillance, battery thermistors surveillance, and charging timer. MAX8677A using save a space, hot enhanced, 4 mm x 4 mm, 24 of the pins TQFN encapsulation, regulations, work in exceptional temperature range (40 ~ + 85 ℃).

2.2 Buck (step-down) switch scheme

When A 1.0 C of the charging current more than 1 A, or the input voltage of the core than with high voltage open many, Buck or step-down plan is A better choice. For example, based on the hard drive in the PMP, often use single core lithium ion battery, the full of open is 4.2 V voltage, capacity from 1200 to 2400 mAh range. And now PMP is usually use the car kit to charge, its output voltage in a 9 V to 16 between V. In the input voltage and battery voltage is the voltage difference between high (minimum 4.8 V) will make linear scheme lowers efficiency. This kind of low efficiency, plus more than 1.2 A 1 C fast charging electric current, have serious heat dissipation problems. To avoid this kind of situation, will the Buck scheme. Figure 3 for lithium ion/polymer battery charger scheme Buck diagram, basic structure with Buck (step-down) switching voltage regulators completely the same.

2.3 SEPIC (booster and step-down) switch scheme

In some use of three or four lithium ion/polymer core series equipments, charger of the input voltage is not always greater than the battery voltage. For example, laptop computers use 3 core lithium ion battery, full charge voltage is open 12.6 V (4.2 V x3), capacity is 1800 mAh to 3600 mAh from. Power supply input or output voltage is 1 6 V AC/DC adapter, or is car kit, the output voltage in a 9 V to 16 between V. Apparently, the linear and Buck solutions are not for this group of batteries. This is about to use SEPIC scheme, it can in the output voltage is higher than when the battery voltage, can be in the output voltage less than when the battery.

3, and power detection algorithm is proposed

Many portable products use voltage measurements to estimate the remaining battery power, but the battery voltage and surplus power relationship but will with the discharge rate, temperature and battery aging degree of change, make this kind of method can top 50% margin of error. The market for longer to use product demand unceasingly strengthens, so the system design personnel need more accurate solution. Use capacity check plan come to measure battery or consumption of electricity, will be in a wide range of application power to provide more accurate estimate of the battery power.

3.1 power detection algorithm is one of the examples of application, function complete list, double the battery portable battery application design

power detection principle. Good capacity check plan at least to have battery voltage, temperature and battery electric current, measuring method; A micro 9 a; And a set of and the verification of the punishment power detection algorithm is proposed. Bq2650x and bq27x00 is full capacity check program function, with a measuring voltage and temperature of the digital converter (ADC) and a measuring electric current and charging sensor the asp. These capacity check plan also has a microprocessor, is responsible for the implementation of the Texas instruments power detection algorithm is proposed. The algorithm can compensate the lithium ion battery life.low self-discharge, aging, the temperature and discharge rate, and other factors. Chip embedded microprocessor as host system processor save these calculation burden. Capacity check program can provide remaining power state information, bq27x00 series products also offer surplus can Run Time (Run Time to Empty) host may at any Time to capacity check plan these information query, then LED indicator light through or displays will inform the user battery. Capacity check meter is very easy to use, the system processor need only configuration 12 C or HDQ communication drive can.

The battery circuit description. Figure 4 (a) can be used for identification of IC functions with typical application circuit batteries. According to the use of IC testing program is different, the battery needs to have at least three to four outside the terminal.

VCC and BAT pins will even to the battery voltage, so that for, C power and the battery voltage measurement. The battery is connected a grounding resistance smaller detection resistors, let capacity check meter high impedance SRP and SRN input can monitor sensor resistance on both ends of the voltage. Through testing the current flows through a resistor can be used to judge the battery or release the amount of electricity. Designers choose detection resistance value must be considered when resistance on both ends of the voltage can't more than 100 mV, low resistance may be more hours in current errors. Circuit board layout must ensure that SRP and SRN to testing from as close as possible to the connection of the resistor sensor resistance end; In other words, they should be the Kelvin attachment.

HDQ pin need external and resistors, this resistance should be located the host or the main application, such capacity check plan to the battery and portable devices when sleep function enable connection broken. Advice and resistance choose 10 k Ω.

battery identification. A low cost WeiMao batteries are getting more and more serious, these cells may not contain OEM requirements of security protection circuit. So, genuine battery may contain figure 4 (a) shows the appraisal circuit. When to identify the battery, the host to contain IC (bq26150, the function is cyclic redundancy check (CRC)) issued the battery packs a ask value (challenge), the CRC will contain battery according to this inquiry value and, in the building of the IC in CRC polynomial calculation the CRC value. CRC is based on the host of command and IC secret in the query of the definition of the CRC polynomial completed, the host in CRC values calculated with the calculation result of well battery comparison to identify the appraisal success.

Once the battery through the appraisal, bq26150 will issue commands to ensure that the host and quantity test plan of material lines between normal communication. When the battery connection interruption or to connect, the whole the identification process will be repeated again.

double the battery application. Figure 4 (b) for use bq26500 support double the typical application of lithium ion battery circuit. In order to support more battery, and this circuit is adding a adjustable regulators. Capacity check millions of BAT pin and the bottom of a battery anode linked to complete the variable voltage measurement of the battery.

Host to be able to read capacity check plan of variable voltage measurement battery, to make sure the end of discharging threshold and charging terminate threshold. As for the remaining state power (RemainingStateofCapacity), do not need to read can use directly.

The above bq2650x and bq27x00 etc capacity check plan provides the battery manufacturer a simple to use options, this scheme L [just measuring battery voltage to be precise, so these capacity check plan can be applied to various battery framework, and can support the battery identification and double the battery application '

3.2 power detection algorithm is an example of applications another, can apply to all kinds of general voltmeter new IC.

Today's many manufacturers can provide a variety of voltmeter IC,, the user can choose the suitable function device, to optimize the product price. Use voltmeter measurement of storage battery parameters, the separate architecture allows users in the host custom power measurement algorithm within. Eliminating embedded processor battery cost. On this to Dallase semicconductor company called cases of DS2762 chip for typical analysis. A new separate voltmeter IC, its structure see chart 5 (a) below.

DS2762 application characteristics

DS2762 is a single quarter of lithium battery voltmeter and protection circuit, integrated into a tiny 2.46 mm x 2.74 mm inversion of packaging. Due to internal integration for power detection of high precise resistance, this device is very save a space. It is the small size and incomparable high level of integration, for mobile phone battery and other similar handheld products, such as PDA, etc, are all very ideal. Integrated protection circuit continuously monitoring the battery voltage, over voltage and flow fault (charging or discharge period). Different from the independent protection IC, DS2762 allow main processor surveillance/control protection FET conduction state, such, can DS2762 through the protection of the power system and the control circuit implementation. DS2762 can also charge a battery consumption has depth, when the battery voltage within three V, provide a limit of the charging current recovery path.

DS2762 accurate monitoring battery current, voltage and temperature, the dynamic range and resolution of common satisfy any mobile communication product testing standards. The measurement of current for internally generated when the integral, realize the power measurement. Through the real-time, continuous automatic disorders correct, the precision of power measurement can be increased. The built-in measuring resistance due to eliminate manufacturing process and temperature and cause resistance change, further improve the precision of the voltmeter. Important data stored in 32 bytes, can add the lock EEPROM; 16 bytes of SRAM are used to keep dynamic data. And DS2762 all communication all through the 1-Wire, more communication interface node, minimize the battery and the connection to the host. Its main features for; Single quarter of lithium battery protector; High precision current (power measurement), voltage and temperature measurement; Optional integrated 25 m Ω measuring resistance, each DS2762 after fine-tuning alone; 0 V battery restore charge; 32 bytes can lock EEPROM, 16 bytes SRAM, 64 a ROM;

1-Wire, node, digital communication interface; Support more battery power management, and through the protection system control FET power; Dormancy mode power supply current only 2 µ A (most); Work mode power supply current for 90 µ A (most); 2.46 mm x 2.74 mm inversion of packaging or 16 feet SSOP package led, and both are can choose with or without detection resistance; After has with e

2010-04-22

Redmine 0.9.3をTomcat 6で実行する方法

結構苦労したので健忘録として。。

環境は以下のとおり

JDK, Tomcat, JRubyインストール済み

MySQLインストール
yum install mysql-server
MySQLの起動
/etc/init.d/mysqld start
MySQLの設定

rootパスワードなどを設定する

mysql_secure_installation
Rubyモジュールインストール

RubyGemsモジュールインストールする

jruby -S gem install rails
jruby -S gem install warbler
jruby -S gem install activerecord-jdbc-adapter
jruby -S gem install activerecord-jdbcmysql-adapter
jruby -S gem install jdbc-mysql
MySQLRedmineデータベースを作成
mysql -u root -p
mysql> create database redmine character set utf8;
mysql> grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'redmine';
mysql> exit

(ここでは、パスワードredmineしているが自由に)

RedmineDB設定

(任意の場所にRedmine解凍して、解凍先のディレクトリに移動した後)

cp config/database.yml.example config/database.yml
vi config/database.yml

database.yml

production:
  adapter: jdbcmysql
  database: redmine
  host: localhost
  username: redmine
  password: redmine
  encoding: utf8

#development:
#
#
#test:
#
#

後のwarbleでのエラーを防ぐため、developmentとtestコメントアウト

DBへのデータ投入
jruby -S rake generate_session_store
jruby -S rake db:migrate RAILS_ENV=production
jruby -S rake load_default_data RAILS_ENV=production
起動確認

script/serverで起動し、http://localhost:3000 にアクセスして正常に動作するか確認する

jruby script/server -e production
production.rbの修正

Tomcatで動かしたときにログ出力するための設定をする

vi config/environments/production.rb
config.logger = Logger.new(config.log_path)
config.logger.level = Logger::INFO
warblerの設定

warble.rbを生成

jruby -S warble config

warble.rbを修正

vi config/warble.rb
  config.dirs = %w(app config lib log vendor tmp extra files lang)
  config.gems = ["jdbc-mysql", "activerecord-jdbcmysql-adapter", "activerecord-jdbc-adapter"]
  config.gems["rails"] = "2.3.5"
  config.gems["rack"] = "1.0.1"
  config.webxml.rails.env = "production"

warファイルを作成

jruby -S warble

できたwarファイルTomcatに配置して、Tomcatを起動する

mv redmine-0.9.3.war /usr/local/tomcat/webapps/redmine.war
/usr/local/tomcat/bin/startup.sh

warblerのバグ(?)でwarに入らないファイルコピーして入れる

cp vendor/gems/rubytree-0.5.2/.specification /usr/local/tomcat/webapps/redmine/WEB-INF/vendor/gems/rubytree-0.5.2

http://localhost:8080/redmine/ にアクセスしてインストールできたか確認して完了!

2008-11-14

VMware server2.0windows NT4.0がゲストOSの時に、ネットにつながらない!

今日仕事中に↑がわからなくてめっちゃ困った。

VMware Tools入れただけで何とかなると思ったら全然だめなんだもの。

Googleで引っかからなかったのは検索方法が悪かったのか…?

どうにか解明したので日本語化しとく

ネットワークに繋がらない場合は以下の方法をおためしあれ。

1. ゲストOS(=NT4.0)上でネットワークアダプタを全部削除

2. ゲストOSシャットダウン

3. VMware上でゲストOSハードウェア設定からネットワークアダプタを全部削除

4. ゲストOS起動

5. ゲストOSシャットダウン

6. VMware上でゲストOSハードウェア設定にネットワークアダプタを追加

7. ゲストOS起動

8. ゲストOS上でネットワークアダプタAMD PCNET Family Ethernet Adapter]をNTCD(i386の中)から入れる

9. ゲストOS再起動

これで使えるはずー

 
アーカイブ ヘルプ
ログイン ユーザー登録
ようこそ ゲスト さん