Posts

Showing posts from June, 2012

substring from bash variable starting from character position -

simple question, sed command not working :( echo "some_class" | sed -e 's/.+\_\(.+\)/\1/' i want happens after _ character. please, how can fix code work? thank you. in case, "class" right answer. you don't need sed ; can use parameter expansion return substring beginning first _ : foo=some_class echo "${foo#*_}"

Perl error when using Tkx package -

i have problem tkx package. use perl 5.14.2 on centos, , know version of perl contains tkx package. when try version of tkx (with following code snipet) perl -mtkx -e 'print tkx::info("patchlevel");' and following error message: couldn't load file "/tmp/tclpwvq4s": libxss.so.1: cannot open shared object file: no such file or directory @ -e line 0. compilation failed in require. begin failed--compilation aborted. i searched sollution didn't find answer it. can tell me what's going on here?

java - Import and edit excel file in browser -

i want improt excel file desktop in browser , want edit excel in browser , save. also clicking on export save file on desktop. here want use spring, hibernate , mysql db. please suggest code example or best way have need use. note:- have googled many times nothing found suitable. thanks in advance

c# - What's the best way to target multiple versions of the .NET framework? -

i'm building class library , deploy nuget package, lets me choose different assemblies added references based on .net framework version of project it's added to. nice feature, i'm wondering whether possible have single class library project, , build against mulitple versions of .net framework? i'd rather avoid having: mylibrary40.dll , mylibrary45.dll if possible, because 2 projects have share lot of code. 4.5 version offering async functions, 4.5 feature. does know best approach is? can use multiple build configurations? or must go down separate project route? if working in c++ i'd use multiple configurations , #if blocks around functions supported in 1 configuration, worry lead me having 2 assemblies same name different things. thanks in advance! you @ least need 1 visualstudio solution 2 projects (one .net 4 , 1 .net 4.5). add codefiles .net 4-project , in other project add code files link (use "add existing item..." -dialo...

Any way to do this on a Makefile? -

i have list of strings such x y z , want transform a/liba.lib b/libb.a c/libc.a any ideas? ( $(input:%=%/lib%.a) yields a/lib%.lib b/lib%.a c/lib%.a , don't bother trying one). input := x y z output := $(foreach x,${input},${x}/lib${x}.lib) $(info input=${input}) $(info output=${output}) outputs: input=x y z output=x/libx.lib y/liby.lib z/libz.lib

Python temporarily change letter to lower case -

i have list looks this: separate=[['i','wnet','to','the','mal,'],['and','bouht','a','new','shirt.'],['what','did','you','do','todya?']] i'm going run through program identify misspelled words , replace them correct word list of words in webster dictionary using uses lowercase letters. can temporarily change of letters lowercase in end return original upper , lower case words? i know str.upper() , str.lower() , set.capitalize . it seems want use str.capwords() inversely... want split list words(already done) , make capital letters lower case. just use str.lower . return new string lower letter , keep original string unchanged. when loop through list such if string.lower() in adict: , use lower case compare , original string unchanged. >>> = 'abc' >>> a.lower() 'abc' >>> 'abc'

Openfire xmpp server and Spectrum 2 IM Solaris and Linux -

i wondering if possible run openfire , spectrum 2 im on solaris machine . have not been able compile code spectrum wanted know if knew if running spectrum im on solaris 10 feasible. if cannot run on solaris, possible run openfire on solaris server , have spectrum im run on separate linux server? i'm having slight problems downloading spectrum im on linux vm. added deb http://repo.spectrum.im $dist main to /etc/apt/sources.list says here . , ran sudo apt-get install spectrum2 spectrum2-backend-libpurple and got output e: unable locate package spectrum2 e: unable loacate package spectrum2-backend-libpurple thanks i think figured out. $dist supposed actual dist of linux box. i'll juts take lap now.

ruby - Rails server exiting immediately after starting -

i'm new rails , downloaded repo github i'm trying work on. when try start rails s happen, same thing happens rails c: => booting webrick => rails 3.2.12 application starting in development on http://0.0.0.0:3000 => call -d detach => ctrl-c shutdown server exiting /users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application/configuration.rb:115:in `read': no such file or directory - /users/falk/desktop/parkbuddy/config/database.yml (errno::enoent) /users/falk/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application/configuration.rb:115:in `database_configuration' /users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.12/lib/active_record/railtie.rb:78:in `block (2 levels) in <class:railtie>' /users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' /users/falk/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active...

asp.net - Do I have to set up applicationHost.config manually? -

there file 'applicationhost.config' in "c:\windows\system32\inetsrv\config\applicationhost.config". i found piece of code <sites> <site name="default web site" id="1"> <application path="/"> <virtualdirectory path="/" physicalpath="%systemdrive%\inetpub\wwwroot" /> </application> <application path="/orionservices" applicationpool="asp.net v4.0 integrated"> <virtualdirectory path="/" physicalpath="c:\source\webadminorion\orionservices" /> </application> <application path="/vendorservices" applicationpool="asp.net v4.0 integrated"> <virtualdirectory path="/" physicalpath="c:\source\webadminorion\vendorservices" /> </application> ...

c# 4.0 - Get all objects loaded in Current Session -

i want persistent object loaded in current session. i know persistent context caches associated session, contains dictionary of objects loaded in current session. can 1 tell me way know object loaded in ipersistencecontext cache? // create our nhibernate session factory var sessionfactory = createsessionfactory(); using (var session = sessionfactory.opensession()) { employee emp; // populate database using (var transaction = session.begintransaction()) { emp = session.query<employee>().where(x => x.name == "bargin basin").firstordefault(); var entries = session.getsessionimplementation().persistencecontext.entityentries; foreach (var item in entries) { var entityentry = entries[item]; //i want objects of type like.. //employee persistedemp = entityentry employee; ...

asp.net mvc - HttpContext.Request.RawUrl and localhost -

i have authorizeattribute checks user logged in, , if not, redirects user login page. i want include returnurl while redirecting login page. currently, use filtercontext.httpcontext.request.rawurl obtain current url. the problem when host app on iis, example http://localhost/testapp1 , try access it, within authorizeattribute, filtercontext.httpcontext.request.rawurl return /testapp1 instead of / , incorrect. is there solution obtain correct relative path when app hosted on local iis? you can want this: string applicationpath = filtercontext.httpcontext.request.applicationpath; string returnurl = filtercontext.httpcontext.request.rawurl.replace(applicationpath, "");

angularjs - ui-bootsrap pagination: first page button is not disabled when page loads -

i displaying list of elements inside ng-include. list of elements comes server using $resource query service. list paginated ui-bootstrap pagination directive. server send pagination informations inside json header (properties named x-myapp-…) , intercepted query callback function. here html : <table ng-include src="'partials/tpllist.html'" ng-init="listinit = {'type': collec.type, 'offset': 1}" ng-controller="listctrl" > </table> the tpllist.html : <tbody ng-init="loadlist(listinit)"><tr ng-repeat="elm in list"> <td>{{elm.prop1}}</td><td>{{elm.prop2}}</td><td>{{elm.prop3}}</td> </tr></tbody> <tfoot><tr><td colspan="4"> <span ng-show="pagecount>1"> <pagination num-pages="pagecount" current-page="currentpage" max-size="10" on-select-page=...

jquery - Flash requesting camera access locking up IE < 10 -

we're building chatroom using candy.js, stophe.js , jquery (1.10.2). we've been trying add ability user stream video using flash. problem i'm trying solve, whenever try stream - , flash requests camera access. in ie 8 or 9, browser locks whenever clicked on in access request window flash. if have allowed access setting flash allow on settings_manager06.html page, works fine. no problems. when browser not responding, starts throwing "out of stack space" in various places in jquery script after minute. works fine in every other browser i've test with. if load flash object in page itself, works fine. appears whenever click happens in flash permissions window, in ie 8/9, while there other activity in background, there colliding. note: in order make stophe work in ie 8/9, i'm doing xdomainrequest calls (the jabber server cross domain). seems suspiciously potential issue. i'd grateful suggestions/ideas solve this. problem in candy.js candy....

Ripple Emulator doesn't fire events -

i have newest ripple emulator installed (newest available in chrome store) , works fine, except events. none of them fires (not deviceready in other question, none). neither manually (using events pane) nor automatically ( deviceready ) fired. when use manual method, ripple writes line console, firing event, nothing happens. application not react @ all. have backbutton event bind , not working in ripple. , application stopped working @ all, when moved init part deviceready event, not being fired. of course, on target device fine, code should correct. what can causing such behavior , there workaround it? edit : have ripple emulator (beta) 0.9.15 installed chrome extension on windows 7. fine on destination device, js code (events handlers) should fine. after deeper investigation i've managed solve problem (at least partially -- events fired not). in case missing .js (phonegap source) file problem. the key success to: actually have phonegap / cordova js...

ide - Intellij doesn't show compile time error -

i unable find error in intellij after making mistakes for example: if write following statement string str1 =new string("shoaib") it should show red color stating ; missing.but unable so. may have change internally what need work above issue

cron - Scheduling cronjobs at specified time -

i have scheduled jobs in crontab run 1 one, @ specific time. script crontab : 15 10 * * * /users/sri/files/batchff.sh 45 11 * * * /users/sri/files/batchgc.sh 15 13 * * * /users/sri/files/batch_gui_ff.sh 45 14 * * * /users/sri/files/batch_gui_gc.sh 15 16 * * * /users/sri/files/batch_sim_ff.sh 45 17 * * * /users/sri/files/batch_sim_gc.sh these scripts ideally should start @ 10:15, 11:45, 13:15, 14:45, , on. scripts not starting expected, rather start @ 10:15, 10:15, 10:16, 10:16, 10:17, 10:17. these scripts writing log files also. running in apple mcbook air, os x 12.4.0 darwin

php - To which doctrine2 script do I point Netbeans if my webserver is remote? - using Symfony2 -

can give me hint? my environment is: i developing on windows 7 machine running netbeans ide 7.2 i using (headless) ubuntu 12.04 web- , databaseserver on home network i have started using php / symfony2 , struggling complete setup of environment i have installed php engine on windows machine in order php interpreter don't want maintain webserver on machine too. now want tell netbeans doctrine2 script exploit doctrine ide support in netbeans. doctrine not installed on development machine, cannot find doctrine2 script. what options? this kind of hint, since i'm used working virtual linux installation: provide shared folder on windows machine mount shared folder on ubuntu machine use shared folder apache document root example now can work files on local machine, , server able pull files serverside stuff. might work vice versa, sharing webroot, or whatever directory doctrine in, shared folder, netbeans on windows machine can pull via network. ...

facebook - PHP FB-API blocking -

i using fb/php-sdk library github , getting message after long simulation. know how stop it? thank in advance. "php fatal error: uncaught exception: 368: you̢۪re temporarily blocked: looks going fast , misusing feature, you̢۪ve been blocked 2 days. learn more blocks in body of error/warning message. title is: you̢۪re temporarily blocked. thrown in c:\inetpub\wwwroot\vendor\facebook\php-sdk\src\base_facebook.php on line 1254"

CSS selectors and combinations of tags -

i have sequences of tags such this <div id="info"> <h1>some title</h1> <p>some content</p> <h1>some title</h1> <p>some content</p> <h1>some title</h1> <p>some content</p> </div> i need image separator after each tag, not after last one i have following css styles defined: #info { margin-left:245px; width: 545px; } #info h1{ color:#000; font-size:24px; font-weight:100; } #info p{ color:#6c6f70; font-size:22px; } #info p:last-child :after{ content: ""; } #info h1+p:after{ content: " " url(../img/dotseparator.png); padding-top:25px; display:block; height:8px; } but separator after last paragraph... can please me wrong in styles? thanks! try this #info h1+p:not(last-of-type):after{ content: " " url(../img/dotseparator.png); padding-top:25px; ...

Remove Big play button and show the bottom play menu -

Image
is there possibility remove middle play button @ start (yes know remove css class) , instead show bottom play bar? basically achieve show video (with poster image) , play-menu showing when enter page video. thanks in advance! update: i did andrew said , it's working. bar there unfortunately there's empty space above play control bar. when press play poster image changes movie , empty space filled video, when it's showing poster doesn't fill way. why this? here's image explaining issue: why not both in css? add following lines @ bottom of css. turn off big play button: .vjs-default-skin.vjs-paused .vjs-big-play-button { display: none; } and turn on menu: .vjs-default-skin.vjs-paused .vjs-control-bar { display: block; }

c - Given 2D array with marked cells, find duplicate shapes formed by those marked cells -

given 2d array cells marked , combined forms different linear shapes, how identify duplicate shapes. 0010000100000000000000000000 0010000100000000000000000000 0011100100000100000000011100 0000000100000111111000000000 0010000111100100000000000000 0110000000000001111000000000 0010000100000000000000000111 0000000001000000000011110000 0000000001111110000000000000 0010000001000000000000000000 here have 3 duplicate shapes : 1 111111 1 111 1 find shapes generated connected 1 s looping on cells until find 1 , use flood fill algorithm find shape formed connected cells. how store flood filled shape you, i'll assume created string representation of each one. find distinct strings using of jillions of methods out there comparing strings.

asp.net - Telerik grid binding From Html table -

i have data in html (html table--) <table summary=""><caption>welcome</caption><thead><tr><th>bonus </th><th>points required</th><th>valid for</th><th>min deposit</th><th>bonus code</th></tr></thead><tfoot><tr><td /><td /><td /><td /><td /></tr></tfoot><tbody><tr class="odd"><td>5 bonus</td><td>350</td><td>60 days</td><td>10</td><td>welcome25</td></tr><tr><td>00 bonus</td><td>1200</td><td>60 days</td><td>5</td><td>welcome100</td></tr><tr class="odd"><td>250 bonus</td><td>3000</td><td>60 days</td><td>0</td><td>welcome250</td></tr><tr><td>500 bonus</td><td>5...

twitter - How to retrieve tweets using codebird.php -

i'm trying use codebird show latest tweet on simple website. unfortunately, can't manage make work. here's did now. created app on twitter developer page. obtained key/secret , token/secret. wrote small php script , tried show timeline see if works. here encountered problems. code goes this: <?php require_once ('codebird.php'); \codebird\codebird::setconsumerkey(my_key, my_secret); $cb = \codebird\codebird::getinstance(); $cb->settoken(my_token, my_token_secret); $reply = (array) $cb->statuses_hometimeline(); print_r($reply); ?> (and put various key strings in correct arguments). this code gives array ( [httpstatus] => 0 ). tried print_r($reply[0]); but nothing printed out in page. where wrong? how should modify code last tweet? i'm bit new new twitter api, , lot of stuff confuses me. thank help! i copied , pasted code , it's not working. error regarding codebird class try: require_once ('codebird.php'...

What are "real-world services" for Apple that can be payed by Paypal in iOS app? -

according apple rules, it's allowed use external payment methods paypal goods , services "used outside of application" or "real-world services". app store review guidelines: 11.2 apps utilizing system other in-app purchase api (iap) purchase content, functionality, or services in app rejected 11.3 apps using iap purchase physical goods or goods , services used outside of application rejected we have internet service paid options, dropbox or skype. service can used "outside application" - in literal sense of these words: can used ios application or without it, inside or outside it. the quesion is: internet services dropbox or skype "real-world", can use paypal payment method, or "unreal world", , should use in app purchases? no. if service delivered digitally not qualify--you not allowed use own payment system in app, nor allowed link outside app payment system. in experience putting name of webs...

foreach - Testing to see if a scheduled task exist in powershell -

i can't figure out why below code won't work: function createfirefoxtask() { $schedule = new-object -com schedule.service $schedule.connect() $tasks = $schedule.getfolder("\").gettasks(0) foreach ($task in ($tasks | select name)) { echo "task: $task.name" if($task.equals("firefoxmaint")) { write-output "$task exists" break } } } createfirefoxtask the output this: firefoxmaint task: @{name=firefoxmaint}.name task: @{name=task1}.name task: @{name=task2}.name task: @{name=task3}.name task: @{name=task4}.name task: @{name=task5}.name if echo $task.name shell without going through script, displays name. when used in double-quoted string, variable evaluation stop @ punctuation. can use $() denote subexpression within string, this: "task: $($task.name)" powershell evaluate express...

Deleting rows and columns in matrix based on values in diagonal in R -

with r: if have square matrix, easiest(as fast) way delete row , column if value on diagonal less five? example x1 x2 x3 x4 x1 13 15 12 25 x2 23 4 23 34 x3 21 11 1 11 x4 11 22 23 33 the code delete row 2 , column 2, , row 3 , column 3. tried doing for(i in 1:nrow(mx)), deleting rows changes total number of rows. the final matrix like x1 x4 x1 13 25 x4 11 33 use diag function , logical comparison < , [ subset operator this... idx <- ! diag(m) < 5 m <- m[ idx , idx ] e.g. m # x1 x2 x3 x4 #x1 13 15 12 25 #x2 23 4 23 34 #x3 21 11 1 11 #x4 11 22 23 33 idx <- ! diag(m) < 5 m <- m[ idx , idx ] m # x1 x4 #x1 13 25 #x4 11 33

c# - How to write superscript in a string and display using MessageBox.Show()? -

i trying output area using message box, , should displayed as, example, 256 unit^2... how can write superscript (for powers) , subscript (like o2 oxygen)??? this guy here adds superscript (tm): adding tm superscript string i hope got myself clear! in advance , sorry inconvenience... you try using unicode super/subscripts , example: var o2 = "o₂"; // or "o\x2082" var unit2 = "unit²"; // or "unit\xb2" if doesn't work, i'm afraid you'll need to write own message box.

xml - NullPointerException: Unable to create the container entity manager factory for the org.jbpm.persistence.jpa persistence unit -

i'm attaching top few lines of persistence.xml , ormtasks.xml persistence.xml <?xml version="1.0" encoding="utf-8" standalone="yes"?> <persistence version="2.0" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/persistence"> <persistence-unit name="cms" transaction-type="jta"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <jta-data-source>jdbc/markads</jta-data-source> <non-jta-data-source>jdbc/testserviceds</non-jta-data-source> <mapping-file>meta-inf/jbpmorm-jpa2.xm...

Create Facebook App from PHP SDK -

i know has been asked before, how can create facebook app programmatically? everyone awnsers not possible, there multiple applications (wildfire, shortstack, etc...) create facebook apps , deploy page tab automatically. how can create facebook apps? tab apps can installed on multiple pages - sill same application same app_id (you can check yourself). i think confusing procedure of adding new tab application page creating new application. adding application page not create new instance of application. to directly answer question: can not programaticaly create facebook applications.

Retrieve files from Amazon AWS Service -

the company work had developer load site on amazon aws , need retrieve html files or find out used. making changes , can't find html files used. have been reading on how aws works , it's confusing. i went s3 because that's thought , there 2 buckets have images used on site. if appreciated! it's easiest start @ source. where domain name point? if happen running linux or mac osx, can run dig www.example.com find dns records domain. if see cname records pointing www.example.com.s3-website-us-east-1.amazonaws.com that's website pointing. if website has dynamic content, implemented using server-side language php or python may running server on ec2, amazon's elastic compute cloud. if that's case need log on machine in order files. should able use http://console.aws.amazon.com running ec2 instances. it's possible server running elsewhere on internet, , image files being hosted amazon. if can tell me domain name can find out more l...

python 2.7 - Read in multiple columns with csv readin -

maybe being picky matlab user trying convert having trouble importing data. can't seem read in more 2 columns of data csv read in. here coding using x,y = [],[] csv_reader = csv.reader(open('data.csv')) line in csv_reader: x.append(line[0]) y.append(line[1]) if use data.csv more 2 columns, can't seem return 3rd column , have read in several csv files data want. i bring point using csv format because can't figure out how import else. again, previous matlab user, prefer copy spreadsheet .txt file , import that. direction on appreciated. much this worked fine me long kept adding variables, i.e. z=[] , z.append(line[2]), , on... maybe misunderstanding questions? import csv x,y,z = [],[],[] csv_reader = csv.reader(open('data.csv')) line in csv_reader: x.append(line[0]) y.append(line[1]) z.append(line[2]) if copy spreadsheet , paste text file, can open('data.txt') , split each line \t, if separator between c...

url rewriting in php on xampp server -

i've trying out url rewriting php script on xampp server. first created .htaccess on same folder script , wrote following lines in it rewriteengine on # turn on rewriting engine rewriterule ^direct/?$ direct_name_here.php [nc,l] to rewrite localhost/map/direct_here123.php localhost/map/direct/ but browser displays url localhost/map/direct_here123.php instead of localhost/map/direct/ how can fix it? regards ed

c# - .net control monthcalendar grows -

i using monthcalendar control (version 4.0.0.0) in visual studio 2012 windows form application targeting .net 4.0 framework. cannot change target framework restriction .net 4.0 framework runs on target machines. on development pc (windows 7, .net 4.5 framework, , vs2012) control behaves same in both debug , release. monthcalendar has no anchors (as of now) did have top-right, both experience same issue of displaying large (about 10 percent more) on target boxes (windows server 2003). monthcalendar set showtoday = true , showtodaycircle = true properties box. at runtime set this.monthcalendar_sessiondates.selectionstart = this.monthcalendar_sessiondates.selectionend = datetime.now; the event used dateselected in update listbox (on same screen) list of dates user selects may see different days select. many sites suggest no anchors or setting maximumsize. have no anchors @ point , maximum size same size. any additional suggestions or dealt before?

android - How to scroll to a desired location in a view? -

since scrollview long, , users need scroll down long time arrive desired tablelayout, ask whether there functions in way if design button such when pressed, automatically scroll down desired tablelayout location? i not know named in technical term. tell me how achieve it? there examples of codes? many in advance! refer can scroll scrollview programmatically in android? in activity: button b = (button) findviewbyid(r.id.button1); b.setonclicklistener(new button.onclicklistener() { public void onclick(view v) { myscrollview.scrollto(0, y_index); } });

java.lang.NullPointerException: Cannot print array contents -

Image
this question has answer here: what nullpointerexception, , how fix it? 12 answers i trying write simple banking program. the basic functions : 1. open account - (open <amount>)-- returns account number 2.check balance - (balance <accountnumber>) the code following this.i not posting other classes , class contatins main(), because believe problem lies somewhere in code :: public class bankaccount { private static int bankaccnogen=1001; private int balance; private int bankaccno; private int i=0; bankaccount[] bankarray=new bankaccount[10]; public void openbankaccount(int openamount){ bankaccount ba =new bankaccount(); ba.balance=openamount; ba.bankaccno=bankaccnogen; bankarray[i] = ba; system.out.println("account opened account number : "+bankarray[i].bankaccno); system.out.println("please note account ...

Two Python Version conflict in Ubuntu Oneiric 11.10 issue: ImportError: No module -

i installed python 2.7.5 using make install not altinstall previously 2.7.2+ now when run python gives importerror: cannot import name maxrepeat i know there entries related here. dont have virtualenv installed neither did have before. if run python2.7 runs perfectly. when trying import library mysqldb says module doesnt exist. installed before installing python2.7. what solution? should uninstall whole python or rather how should uninstall python2.7.5 or should keep that? if keep how can import modules? ** latest update** me@me:/usr/local/bin$ dir python2* python2 python2-config python2.7 python2.7-config and: /usr/local/bin$ ls -l total 1776 -rwxrwxr-x 1 root root 101 jul 17 20:17 2to3 -r-xr-xr-x 1 root root 7223 mar 31 20:47 config_data -rwxr-xr-x 1 root root 299 jul 18 20:53 easy_install -rwxr-xr-x 1 root root 307 jul 18 20:53 easy_install-2.7 -rwxrwxr-x 1 root root 99 jul 17 20:17 idle -r-xr-xr-x 1 root root 3910 mar 31 20:47 json...

Random.org True random c++ -

before yells "check forums" duplicate answers did try , couldn't find any. i trying make dice rolling console application in c++ , need implement true random numbers (yes true not pseudo) proving difficult...as sure lecturer intended. i have heard random.org has c++ library link can find broken , cant seem find documentation on it. i trying allow user select dice 4, 6, 8 10 , 20 sided dice , roll 1-100 of selected die. results displayed. does know how can access random numbers between x-y random.org or similar? thanks! the url in link c++ library on random.org http client archive page malformed. it's supposed point doughague/random-dot-org on github. can use access real random number data generated via atmospheric noise.

Why is Outlook Unable to Save a Particular Type of Attachments? -

i have little vba macro save attachments in outlook using following snippet for each objatt in objsourceitem.attachments strfile = strpath & objatt.filename objatt.saveasfile strfile next this works types of attachments except chemdraw attachments. error saying "outlook cannot perform action on type of attachment" not sure if specific chemdraw, maybe has file extension , outlook not recognizing file format. anyway, http://www.cambridgesoft.com/services/documentation/sdk/chemdraw/cdx/general.htm has info on chemdraw type files. appreciated. thanks! if embedded ole object in rtf message, outlook not able extract actual file data attachment (which ole storage blob - istorage).

Rails 4 - Passing Params via link_to? -

i have single form - depending link user clicks display form, want different hidden params passed record , saved upon submission. there nice way this? in advance! for instance: <%= link_to 'general request', new_request_path %> <%= link_to 'project request', new_request_path %> ### -> set request.project = true <%= link_to 'administrative request', new_request_path %> ### -> set request.admin = true for examples, you'd use: <%= link_to 'project request', new_request_path(project: true) %> which produce link http://127.0.0.1:3000/request?project=true and <%= link_to 'administrative request', new_request_path(admin: true) %> which produce link http://127.0.0.1:3000/request?admin=true

c# - Thread Blocking the UI -

i following example c# in nutshell. according text following code supposed non blocking, find form not display until 5 seconds have passed. private void form1_load(object sender, eventargs e) { var tcs = new taskcompletionsource<int>(); new thread(() => {thread.sleep(5000); tcs.setresult(42); }).start(); task<int> task = tcs.task; messagebox.show(task.result.tostring()); } i have feeling it's thread.sleep() , instead of putting new thread sleep, it's putting main thread sleep. why blocking ui thread? when call task.result.tostring() (in messagebox.show ) task class has mechanism waits task finished before giving result (as doesn't have until task finishes. here's proof: private void form1_load(object sender, eventargs e) { var tcs = new taskcompletionsource<int>(); new thread(() => {thread.sleep(5000); tcs.setresult(42); }).start(); task<int> task = tcs.task; thread.sleep(2500); ...

hid - Using HIDAPI, how can you query the raw report descriptor? -

i'd deconstruct raw reports received hid_read function of hidapi . as understand, can achieved using information device's report descriptors. when trying query descriptors, lost somewhere between hid spec , using methods available in hidapi . i love see concrete c or node-hidapi based example queries , enumerates report descriptors device — perhaps mouse keep things simple? i asked alan ott email this, , responded no follows: hidapi not provide functions getting or parsing report descriptor. since hidapi talking custom devices, these devices contain or vendor-defined report items anyway.

Google OpenID force user account selection (like google oauth's login_hint param) -

i implementing interface knows email of user before user has logged in. preferably, since i'm using authentication i'd use openid opposed oauth2. however, if user logged in multiple google accounts user forced select accounts. i'd prefer if tell google wanted specific google account logged in user not have guess account i'm looking (given they're logged in account). better ux. i know google's oauth2 can specify login_hint skip account selection screen if user logged in account specified in login_hint parameter. reference, https://developers.google.com/accounts/docs/oauth2login does know of similar openid? i've read google's documentation , seems it's not possible, perhaps i'm missing something. appreciated! unfortunately, openid doesn't support login hint feature. i recommend use oauth2 if possible, given oauth2 can used authentication only.

json - JSONRPC server returns empty result -

i've coded simple jsonrpc server test go's capabilities, i'm stuck, getting empty result, without error , correct id. i've got following go code: package main import ( "log" "net" "net/rpc" "net/rpc/jsonrpc" ) type experiment int func (e *experiment) test(i *string, reply *string) error { s := "hello, " + *i reply = &s log.println(s, reply) return nil } func main() { exp := new(experiment) server := rpc.newserver() server.register(exp) l, err := net.listen("tcp", ":1234") if err != nil { log.fatal("listen error:", err) } { conn, err := l.accept() if err != nil { log.fatal(err) } server.servecodec(jsonrpc.newservercodec(conn)) } } no matter tried, i've got following response: {"id":1,"result":"","error":null} log...

How to use ssim in ffmpeg -

i looked correct place in ffmpeg command put -ssim , or private options. didn't find got 1 option working , share you. it's working don't know why. first try without ssim , working: ffmpeg -s cif -r 30 -i video.yuv -vcodec mpeg4 -g 12 -bf 2 -sameq video.m4v i tried put ssim below , did not working: ffmpeg -s cif -r 30 -i video.yuv -vcodec mpeg4 -g 12 -bf 2 -sameq -ssim video.m4v ffmpeg -s cif -r 30 -i video.yuv -ssim -vcodec mpeg4 -g 12 -bf 2 -sameq video.m4v and here works: ffmpeg -s cif -r 30 -i video.yuv -vcodec mpeg4 -g 12 -bf 2 -ssim -sameq video.m4v someone have idea why worked in last case , not in commands 2 , 3? the -ssim option relative codec (x264) use. at least explain why case (3) doesn't work, because put option before -vcodec remember ffmpeg option not position independent. , far remember ssim part of avcodeccontext option , should place after fflag2 below can wrong depending of ffmpeg version use. ffmpeg -i input ... cod...

java - How to run methods from another class -

i new java coding. want know how run methods class without using extends or implements functions. i have 2 questions on subject. for organization reasons have set-up subclass under main class has run loop. how can run methods subclass in loop? main class isn't recognizing methods of subclass if proclaimed regularly (if(subclassmethodname()==1);). also, there anyway me run nonstatic methods class (in totally different file) without using extends or implements? (i have tried extends , program using run script doesn't seem allow script ran whatever reason). "(classname).class" menu in eclipse seems have lot of options not sure them accomplish goal... create instance of subclass call method want. class child{ public void sayhello(){ system.out.println("hello"); } } from inside parent: child mychild = new child(); mychild.sayhello();

how to insert multiple php array values into mysql for the same table? -

hi new php , having 3 php arrays namely bookname, bookprice , bookisbn, need insert values like "bookisbn" "bookname" "bookprice" mysql eg: isbn1 bookname1 bookprice1 isbn2 bookname2 bookprice2 isbn3 bookname3 bookprice3 as of tried iterate 3 arrays like, foreach($booknamearray $bookname && $bookpricearray $bookprice && $bookisbnarray $bookisbn) { .. } and while($booknamearray $bookname && $bookpricearray $bookprice && $bookisbnarray $bookisbn){ .. } nothing worked me, please kindly me out achieve this. thanks in advance, naveen. assuming have same number of elements, can use loop, , make string of values: for($i = 0; $i < count($booknamearray); $i++) { $str = $booknamearray[$i] . " " . $bookpricearray[$i] . " " . $bookisbnarray[$i]; //insert $str db }

java - How it comes that URL.openConnection() allows me to read header? -

i experimenting java networking , found bit odd thing, suppose have url url = new url("http://www.google.com"); urlconnection con = url.openconnection(); then can call methods, con.getcontentlength() , on , give me correct values, despite didn't envoke con.connect() . how can be? mean, from/how urlconnection gets headers, didn't invoke con.connect() yet, no requests sent , no headers should available @ moment. the actual tcp connect happens implicitly when call method requires response, such getcontentlength(), getinputstream(), getresponsecode(). doesn't happen @ openconnection(). request sent @ point. unless using 1 of streaming modes , you're doing put or post request content, in case connection opened when start writing request.

javascript - How do I extract texts only without html markup? -

i trying extract texts without html markup using innertext . //table html table structure var cells = table.innertext.trim() the cells data following: 1st cell 2nd cell 3rd cell 4th cell last cell how make every cell data array ? i have tried cells = cells.split(' '); but doesn't work. any here? lot! just extract text each cell: var arr=[], rowcells, myrows=table.rows; (var i=0; i<myrows.length; i++) { rowcells=myrows[i].cells; (var j=0; j<rowcells.length; j++) { arr.push(rowcells[j].innertext.trim()); } }

css - Padding behaving like Margin -

i have 2 divs side side within wrapper div. fit , display correctly. however, when try add padding left side of left hand div, not moves contents of div on right, moves content of right hand div on well! if add on 20px of padding moves right hand div down next row! how on earth possible? posting css , html below. wrapper div "hwrapper". left hand div "rbox", , right hand div "card". said, adding padding left side of "rbox" moves content of "card" right well. how can fix this? #header { height:800px; width: 100%; margin-top: 0px; background:url(/assets/header-tail.gif) 0 0 repeat-x #f7f7f7; } #hwrapper { width: 1000px; height: 600px; margin: 0 auto; text-align: center; } #header .logo { padding: 3px; text-align: center; } #rbox { background:url(/assets/hredbox.png) 0 0 no-repeat; height: 420px; width: 274px; float: left; text-align: left; p...

.htaccess - Redirecting parked-domain/anything to one file -

i have domain cotswoldplayers.co.uk parked on cotswoldplayhouse.co.uk , redirected cotswoldplayhouse.co.uk/redirection.htm using cpanel's parked domain tools. works ok when people go www.cotswoldplayers.co.uk fails if go www.cotswoldplayers.co.uk/any-other-link is there way www.cotswoldplayers.co.uk/anything-at-all go redirection page? thanks change .htaccess rewriteengine on rewritecond %{http_host} cotswoldplayers.co.uk rewriterule ^(.*)$ http://cotswoldplayhouse.co.uk/redirection.htm [l]

c# - where to download the ClearCanvas Imageviewer StudyManagement dll file and how to import it -

everyone, have project in c# using clearcanvas sdk library. dll file, i'm interested in clearcanvas imageviewer studymanagement file. missing clearcanvas imageviewer dll file. error have implememnting using clearcanvas.imageviewer.studymanagement error 1 type or namespace name 'studymanagement' not exist in namespace 'clearcanvas.imageviewer' (are missing assembly reference?) c:\users\don jar\documents\visual studio 2010\projects\trydicom\trydicom\form1.cs 14 31 trydicom can anyones direct me site can download thid dll file. thank much.

function - overloading operator * c++ -

i have been trying compile program giving me error in regards overloading * operator 1 of functions: complex operator *(double n)const when try compile error: no match 'operator*' in '2 * c' here header file: complex.h #ifndef complex0_h #define complex0_h class complex { double realnum; double imagnum; public: complex(); complex(double x,double y); complex operator *(double n)const; complex operator *(const complex &c1)const; friend std::istream &operator>>(std::istream &is,complex &cm); friend std::ostream &operator<<(std::ostream &os,const complex &cm); }; #endif here cpp: complex.cpp #include "iostream" #include "complex0.h" complex::complex() { imagnum = 0.0; realnum = 0.0; } complex::complex(double x, double y) { realnum = x; imagnum = y; } complex complex::operator *(const complex& c1) const{ complex sum; sum.realnum=realnum*c1.re...

Using AJAX to Dynamically Fill a Dropdown VB.Net JQuery -

i trying make ajax call fill dropdown when value selected in dropdown. currently, getting syntaxerror: invalid character error, if remove "datatype: json", mess looks html code. dropdown must bound using value , text pairs. aspx code related dropdown: <%@ page title="" language="vb" autoeventwireup="false" masterpagefile="~/site.master" codebehind="request.aspx.vb" inherits="ndbedp.request" maintainscrollpositiononpostback="true" %> <asp:content id="content1" contentplaceholderid="headcontent" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="featuredcontent" runat="server"> </asp:content> <asp:content id="content3" contentplaceholderid="maincontent" runat="server"> <script type="text/javascript"> $('.entitydrop...

ASP.NET css minification fails when filter: progid:DXImageTransform.Microsoft.AlphaImageLoader is used -

i minifying bunch of css files , 1 of them contains filter: progid:dximagetransform.microsoft.alphaimageloader as png-transparency fix ie6 causes minification proccess fail. there workaround problem? thanks!

Permissions issue with vagrant virtualbox -

i have debian virtualbox set vagrant, in have codebase project i'm working on , i've set folder holds codebase synced host machine (which mac os 10.8.4). learned in order change permissions on subfolders on synced folder must host machine, problem application creates folders (and subfolders) , expects able write them. since vm doesn't have ability chmod it's own folders these folders not created write access default. how can achieved? note: i've tried using umask both host , vm. works on host since changes per terminal don't propagate vm, using on vm doesn't work because folders managed host. umask should way go. to make persistent, need add umask 027 (or whatever mask want) ~/.bash_profile interactive login shell or ~/.bashrc interactive non-login shell user running application, or make system wide placing in /etc/profile . note: ubuntu uses ~/.profile , not have ~/.bash_profile . alternatively, set umask before running applicat...

asp.net mvc 4 - ServiceStack AuthSession null after modifying a js file in an MVC project -

i have project uses mvc 4 , servicestack, in web role in azure service, hosted development in iis express. i'm using custom auth provider 1 in customauthenticationmvc example project; authenticates using membership class , fills roles using roles class. started off developing page straight html/css/js page making api calls servicestack , authenticating pop-up when returned 401, used when stopped , restarted project rebuild service. while developing in form, modify static files , reload page , see changes without disruption auth session, evidenced fact authenticated api calls continue succeed after reloading page. later, once development complete, moved html cshtml controller serves up, added forms authentication, added [authorize] controller, , added code account controller when user logs in, authenticates servicestack, again using code in customauthenticationmvc guide. added forms redirection hijacking prevention continue detect unauthenticated api calls. works fine, except ...

java - Kerberos SSO : high level flow and ldap access -

having few problems grasping entire flow. i'm trying accomplish mighty kerberos sso integration, auth user information picked directly windows. i'm using: spnego filter in tomcat 7 in order obtain username iwa java 1.6 windows server 2003 on backend / windows xp client machine tests my understanding of entire flow, is, on high level : i can use spnego user name via tomcat filter(this part working) i make separate call via ldap (on authenticate kerberos), retrieve whatever information need logged in user (such groups belongs to, etc) i trying use apacheds 2 searching ldap part. question (1): understanding correct ? done in different way? (maybe using spnego directly info need?) now, i'm trying login in backend, ldap, via kerberos, using apacheds, in order retrieve user info, : system.setproperty("sun.security.krb5.debug", "true"); ldapconnectionconfig config = new ldapconnectionconfig(); config.setldaphost(...

VB.net Override OCX onclick event -

i using ocx ipcam in program. when double click on control goes full screen mode. want prevent this. have event in form. there ican @ point prevent click event going ocx? private sub axgsviewerx1_clicksel(sender object, e axgsviewerxlib._dgsviewerxevents_clickselevent) handles axgsviewerx1.clicksel console.writeline("click") end sub thanks you can create own custom control inherit ocx. can override event e.g. protected overrides sub clicksel(byval e _dgsviewerxevents_clickselevent) 'do nothing here. end sub

php - Remove Wordpress navigation labels? -

example: http://i.imgur.com/u9n2fyc.png i got plugin uses images nav items in menu gui in wordpress dashboard. nav label still being generated, , i'd remove them. tried leaving them blank, removes menu item. this how theme calling nav in header.php: <?php $show_member_menu_sticky = false; if ( $data['op_instamember_integration'] == 1 && function_exists('is_stmsmember_logged_in') ) { if ( is_stmsmember_logged_in() ) // im members logged in... $show_member_menu_sticky = true; if ( function_exists('is_stms_admin') ) { $stms = get_option('stms_settings'); // load instamember global settings... if ( isset($stms['global']['admin_unlock']) && $stms['global']['admin_unlock'] == 1 && is_stms_admin() ) $show_member_menu_sticky = true; } } else { if ( is_user_logged_in() ) $show_member_menu_sticky = false; } if ( $show_member_menu_sticky ) member_menu_sticky(); el...