Friday, 15 June 2012

Azure Worker Role data volatility -



Azure Worker Role data volatility -

i create application holds big amount of volatile info in memory. little part of info needs persisted when host machine shuts down, or in case of maintenance. outages should rare, in memory info needs accessible of time, rare restrats of service bearable.

if have been developing server, create windowsservice, runs reliably while machine up, , persist fraction of info in onstop() method.

i'm thinking of moving whole thing cloud. question if worker role similiar windows service point of view? run of time rare outages, or recycled / restarted time time or when idle?

like windows service, worker role meant processing background tasks. 1 thing need maintain in mind worker role can go downwards time. may because of hardware failure or software updates. can't assume highly available. that's why windows azure recommends deploying multiple instances of application.

what have multiple instances of worker role running , of them sharing mutual cache set volatile data. take @ windows azure caching (http://msdn.microsoft.com/en-us/library/windowsazure/gg278356.aspx) either dedicate memory of vm (i.e. instance) caching purpose or have total vm dedicated caching. way you'll have volatile info somewhere outside of worker roles , making available instances.

azure

graphics - Absolute Aspect Ratios in Mathematica -



graphics - Absolute Aspect Ratios in Mathematica -

suppose plot[1000 x,{x,0,1}]. options utilize forcefulness resulting graphic image have 10,000 pixels in y-direction , 10 pixels in x-direction, i.e., want x , y axes scaled identically (in pixels).

well, illustration of 1000x, it's bit hard see because slope vertical. let's utilize gentler slope ease of display---perhaps slope of 10. then, do:

plot[10 x, {x, 0, 10}, aspectratio -> automatic]

graphics options aspect-ratio

ruby on rails - User model: username format method -



ruby on rails - User model: username format method -

ok, in user model have created get_username in effort format username.

the thought able use

theuser.get_username

and correctly format username based on user level (admin). test created this:

def get_username fname = '<span style="color:red">john</span>' fname end

however, displayed value literally code showing..

how able plug username in display correctly

you can utilize html_safe.

def get_username fname = '<span style="color:red">john</span>' fname.html_safe end

to user_name use:

def get_username fname = "<span style='color:red'>#{user_name}</span>" fname.html_safe end

note bad code, not abusing seperation of responsibilty of mvc may introduce security vulernabilities.

code should in view or helper.

ruby-on-rails ruby format username

Python MySQLdb not inserting data -



Python MySQLdb not inserting data -

ubuntu version: 12.10 mysql server version: 5.5.29-0 python version: 2.7

i trying utilize mysqldb insert info localhost mysql server. don't errors when run script info isn't come in table. view tables phpmyadmin.

i tried going basics , next tutorial same result. weird thing can create , delete tables not come in data.

the code tutorial reports 4 rows inserted. preventing info beingness entered table when script reports fine??

cursor = conn.cursor () cursor.execute ("drop table if exists animal") cursor.execute (""" create table animal ( name char(40), category char(40) ) """) cursor.execute (""" insert animal (name, category) values ('snake', 'reptile'), ('frog', 'amphibian'), ('tuna', 'fish'), ('racoon', 'mammal') """) print "%d rows inserted" % cursor.rowcount

add :

conn.commit()

after bottom of script.

on side note, have @ next : http://mysql-python.sourceforge.net/mysqldb.html

python-2.7 mysql-python ubuntu-12.10

c++ - Tesseract setVariable whitelist for another language -



c++ - Tesseract setVariable whitelist for another language -

tesseract setvariable whitelist works ok english language language illustration utilize recognize digits , letters image (excluding special characters &*^%! etc)

myocr->setvariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");

but can't same thing russian language

myocr->setvariable("tessedit_char_whitelist", "0123456789абвгдежзийклмнопрстуфхцчшщъыьэюяАБВГДЕЖЗИЙКЛМОПРСТУФХЦЧШЩЭЮЯ");

is there different principle? because don't work. instead of determined characters recieve digits in output, tesseract ignores russian letters set whitelist. blacklist didn't work too. there way rid it? thanks.

so reply utilize symbols unicode codes in whitelist, don't know how exactly

c++ ocr tesseract

ios - How to use terminal for working with xCode Command Line Tools? -



ios - How to use terminal for working with xCode Command Line Tools? -

context: have installed command line tools separately conventional method of "xcode->preferences->downloads->components->command line tools->install" didn't work me.

purpose: need implement internationalization/localization on application , want utilize genstrings creating localizable.strings files.

problem: when seek utilize terminal , type command like

$ find . -name *.m | xargs genstrings -o en.lproj

i get:

couldn't connect output directory en.lproj

how should specify path directory? also, might need specify path *.m files well.

note: suggested read genstrings manual not sure how work particular xcode project while using terminal.

two things need taken care of:

1) after entering terminal, first go folder in targeted .m files present. use:

cd "path"

2) while using genstrings code, specify finish path of output directory. e.g.:

genstrings -o /users/kushalashok/desktop/projectnname/en.lproj *.m

after running code, new file named "localizable.strings" created in specified output folder.

ios xcode localization terminal genstrings

WMIC error: desciption = exception occured when searching for hotfix -



WMIC error: desciption = exception occured when searching for hotfix -

i have wmic command want run query list of machines , homecoming csv file if hotfix installed. in case hotfix id 2617858. starts process , comes after 20 seconds: error: desciption = exception occured . works when there few machines in file need run against 40 computers.

any suggestions ? thanks

code:

wmic /failfast:on /node:@"c:\users\username\desktop\servers.txt" qfe | find "2617858" > \\computername\c$\users\username\desktop\hotfix.csv

for it's worth, might easier inquire wmic filter rather piping wmic through find. this:

wmic /node:@"c:\users\username\desktop\servers.txt" qfe hotfixid="kb983590" csname /format:list >>hotfix.txt

or if problem wmic can't handle many servers in servers.txt, seek looping through list batch for loop.

@echo off setlocal /f "usebackq delims=" %%i in ("c:\users\username\desktop\servers.txt") ( set /p "=checking %%i... " wmic /node:%%i qfe hotfixid="kb983590" csname /format:list >>hotfix.txt 2>>failures.txt echo done. ) echo unable query next computers: type failures.txt

as alternative, can perform same action using powershell.

powershell -command "$pcs = get-content c:\users\username\desktop\servers.txt; foreach ($pc in $pcs) { get-wmiobject -computername $pc win32_quickfixengineering | where-object {$_.hotfixid -eq 'kb980232'} | select-object csname }" >>hotfix.txt

... although if wmi unresponsive on server wmic, won't have much improve luck using powershell.

wmic