Posts

Showing posts from March, 2013

android - How to make invisible images visible? -

i developing card game. divide 13 cards each client using server, when divide 13 cards 1st player, 9 cards invisible , remaining 4 visible. want when click 1 image, remaining 9 cards gets visible? how this? - code this: string str=" "c,a", "c,k", "c,q", "c,j", "c,10", "c,9", "c,8", "c,7", "c,6", "c,5", "c,4", "c,3", "c,2""; drawcards(str); private void drawcards(string drawstring) { string[] separated = msglog.split("\\,"); (int = 2; < separated.length - 1; += 2) { string symbol = separated[i]; string num = separated[i + 1]; string resourcename = symbol + num; //symbol , number used image xml file int resid = getresources().getidentifier(resourcename, "id", getpackagename()); im = (imageview) findviewbyid(resid); context context = im.getcontext(); ...

python - Create modules for Linux install of PocketSphinx? -

i trying python 3.4 working pocketsphinx on linux (ubuntu 14.04 os) machine. yesterday, installed both sphinxbase-5prealpha , pocketsphinx-5prealpha . confirmed install running pocketsphinx_continuous -inmic yes i'm trying move on python api can't find python modules ( sphinxbase , pocketsphinx ) anywhere in directories. searched web can find references installing/creating pocketsphinx file relates windows install. how create modules sphinxbase , pocketsphinx in linux installation? , should live in relation ../mysphinxdirectory ? you can install python modules pocketsphinx , sphinxbase through pip. just run: sudo pip install pocketsphinx the sphinxbase module requirement of pocketsphinx installed automatically when install pocketsphinx package. then in python program, should able import modules them using: from pocketsphinx.pocketsphinx import ... sphinxbase.sphinxbase import ... the pocketsphinx repository includes an example can tes...

c# - Inserting into a View Error -

i getting following error, when try insert view using entity framerwork (6): store update, insert, or delete statement affected unexpected number of rows (0). entities may have been modified or deleted since entities loaded. refresh objectstatemanager entries. this happening on context.savechanges() any appreciated.

php - how to call background function from web controller in yii2 -

i have controller function save file in db , create personal pdf file every record in db , email him . problem take time. can call console controller web controller function , pass id console function? or there better or other method this? i don't think calling console command web controller much. but purpose can use example this extension . usage: imported class: use vova07\console\consolerunner; $cr = new consolerunner(['file' => '@my/path/to/yii']); $cr->run('controller/action param1 param2 ...'); application component: // config.php ... components [ 'consolerunner' => [ 'class' => 'vova07\console\consolerunner', 'file' => '@my/path/to/yii' // or absolute path console file ] ] ... // some-file.php yii::$app->consolerunner->run('controller/action param1 param2 ...'); but recommend use work queues rabbitmq or beanstalkd , these more suit...

java - How to create a constraint validator for multiple fields through annotation in spring 4.* -

how create validator restrictions more fields through annotation in spring 4.* example @uniquevalidator @entity @table(name = "persons") @uniquevalidator(message="peson exist",columns={"name","lastname"}) public class { @column private string name; @column private string lastname; } roughly speaking.. select ... persons name='qwerty' , lastname='asdfgh' here's 1 way in spring mvc , jsr 303 validation: create constraint annotation: package com.awgtek.model.validation; import java.lang.annotation.documented; import java.lang.annotation.elementtype; import java.lang.annotation.retention; import java.lang.annotation.retentionpolicy; import java.lang.annotation.target; import javax.validation.constraint; import javax.validation.payload; /** * target field should unique in data store. */ @documented @constraint(validatedby = uniquenamevalidator.class) @target(elementtype.type) @reten...

python - Create a vm or cloud service on azure using libcloud? -

i’m having problem libcloud/drivers/azure.py when create vm or cloud service, receive 400 bad request without body. me out of please? here code: # connecthandler use pem file create connection server, return azurenodedriver objet conn = _connecthandler.api_connect(compute_ressource) try: result = conn.ex_create_cloud_service(name= "testcloudservicezt200", location= "central us") except exception e: logger.error(e) else: return result and here got in return: <libclouderror in <libcloud.compute.drivers.azure.azurenodedriver object @ 0x7fceaeb457d0> 'message: bad request, body: , status code: 400'> could please tell me why error, , maybe give me examples of azure.py, grateful. thx!! the azure driver seems new, since it's not included in latest release available via pypi. had same problem, used ipdb @ request , xml created azure driver. @ first thought found number of problems, after looking @ source , not output ...

iis - ASP.NET page getting Windows Authentication Prompt -

Image
i have asp.net website uses c#. uses forms authentication logging users in. switched hosting providers , moved windows server 2000 windows server 2012 r2, iis has changed considerably. since moving, website works expected exception 1 area. whenever try access .aspx page that's in particular directory, prompted enter our windows credentials. this only happens in "reports" directory. have other pages in other directories , don't prompt when accessing those. i made sure "reports" directory had same permissions other directories: and made sure anonymous , forms authentication enabled "reports" directory. my web.config simple , looks this: <authentication mode="forms"> <forms loginurl="webportal.aspx" protection="all" timeout="50000000" name=".aspxauth" path="/" requiressl="false" slidingexpiration="true" defaulturl="webportal.aspx...

android - How can I put element beside another? -

Image
i want put atendentebalaoprodutovalor element beside atendentebalaoprodutonome , atendentebalaoproduto2 below atendentebalaoprodutonome . this, tried this: atendente.xml <?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <!-- <imageview style="@style/imagematendente" android:id="@+atendente/imgatendente"/>--> <relativelayout style="@style/layoutatendentebalao" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+atendente/rltatendentebalao"> <textview style="@style/campoatendentebalaotexto" android:id="@+atendente/txttexto"/> <!-- venda orientada --> <relativelayout ...

How to use regex non capturing group for string replace in java -

i had requirement change assemblyversion on new build. using java code string.replaceall(regexpattern,updatedstring); this code works fine normal regex patterns, not able use non-capturing groups in pattern. want use non-capturing groups make sure don't capture patterns other required one. code tried: string str="[assembly: assemblyversion(\"1.0.0.0\")]"; str=str.replaceall("(?:\\[assembly: assemblyversion\\(\"\\d\\.\\d\\.)?.*(?:\"\\)\\])?", "4.0"); system.out.println(str); here, want match string [assembly: assemblyversion(int.int , replace minor version. expected outcome [assembly: assemblyversion("1.0.4.0")] , i'm getting result 4.04.0 . can please me on this? why not use looka-head / look-behind instead? they non-capturing , work here: str = str .replaceall( "(?<=\\[assembly: assemblyversion\\(\"\\d\\.\\d\\.).*(?=\"\\)\\])", "4.0...

input - Cant get to second read [Prolog] -

im having trouble these reads, can read first value, doesn't print second write , goes menu: adicionar_viagens :- write('nova partida:'),nl, read(nova_partida),nl, write('novo destino:'),nl, read(novo_destino),nl, write('hora partida:'),nl, read(nova_hora_partida),nl, write('novo chegada:'),nl, read(novo_hora_chegada),nl, write('preco:'),nl, read(novo_preco),nl. in prolog, variables start either underscore or upper case letter. in argument read/1 calls you're using atoms (i.e. constants). thus, the calls succeed if term read unifies atoms. calls fail if input else, making call adicionar_viagens/0 predicate fail , behavior you're observing. change code to: adicionar_viagens :- write('nova partida:'), nl, read(nova_partida), nl, write('novo destino:'), nl, read(novo_destino), nl, write('hora partida:'), nl, read(nova_hora_partida), nl, write('novo chegada:'),...

Linkedin API: Get insights (clicks, interactions, engagement) for company updates -

i'm trying extract stat information updates (posts) of company pages. have succeeded in getting: likes , comments ( https://api.linkedin.com/v1/companies/1337/updates ) daily/monthly impressions ( https://api.linkedin.com/v1/companies/1337/historical-status-update-statistics ) but can't seem find can get: clicks, interactions , engagement. does know if information available through api or partnership programs? query should like https://api.linkedin.com/v1/companies/3502837/historical-status-update-statistics:(time,like-count,impression-count,click-count)?time-granularity=month&start-timestamp=1388514600000&end-timestamp=1433097000000&format=json after url, before query params :(time,like-count,impression-count,click-count)

css - PDF conversion suddenly fails if reading stylesheet from SSL -

i've been using evopdf version 3.5 without problem long of sudden can’t read stylesheet ssl. string html = "<link href=\"https://www.domain.com/styles.css\" rel=\"stylesheet\" type=\"text/css\" />test"; pdfconverter pdfconverter = new pdfconverter(); byte[] bytes = pdfconverter.getpdfbytesfromhtmlstring(html); it works fine if loading stylesheet http . , on iis stylesheet can read ssl. i have no idea how troubleshoot this. can dns issue? the reason ssl 3.0 disabled on server , versions of evo html pdf converter lower 4.0 don’t have full support tls , therefore might not work on servers when accessing https documents or resources. can lead errors, missing images , styles if resources referenced https urls in html document.

sql - find similarity of merchant with customers -

i have table in sql server 2012 have columns: user_id , merchant_id i want find top 5 similar partners each merchant. similarity defined normalized number of overlapping costumers; i can not find solution problem. the following query counts number of common customers 2 merchants: select t.merchantid m1, t2.merchantid m2, count(*) common_customers table t join table t2 on t.customerid = t2.customerid , t.merchantid <> t2.merchantid group t.merchantid, t2.merchantid; the following gets 5 based on raw couns: select * (select t.merchantid m1, t2.merchantid m2, count(*) common_customers, row_number() on (partition t.merchantid order count(*) desc) seqnum table t join table t2 on t.customerid = t2.customerid , t.merchantid <> t2.merchantid group t.merchantid, t2.merchantid ) mm seqnum <= 5; i not know mean "normalized". term "normalized" in statistics not change orderi...

C# order of bytes sent and received by socket -

Image
i wondering order of sent , received bytes by/from tcp socket. i got implemented socket, it's , working, that's good. have called "a message" - it's byte array contains string (serialized bytes) , 2 integers (converted bytes). has - project specifications :/ anyway, wondering how working on bytes: in byte array, have order of bytes - 0,1,2,... length-1. sit in memory. how sent? last 1 first send? or first? receiving, think, quite easy - first byte appear gets on first free place in buffer. i think little image made nicely shows mean. they sent in same order present in memory. doing otherwise more complex... how if had continuous stream of bytes? wait last 1 has been sent , reverse all? or inversion should work "packet packet"? each block of 2k bytes (or whatever size of tcp packets) internally reversed order of packets "correct"? receiving, think, quite easy - first byte appear gets on first free place in buffer. ...

android - google play service stop working when run app -

i developing wear/handeheld app. have problem when run app on handheld, getting error "google play service stopped working". stack trace of error following: java.lang.runtimeexception: error receiving broadcast intent { act=android.intent.action.package_added flg=0x4000010 (has extras) dat=package:com.fzv.myapp } in com.google.android.gms.wearable.node.u@41d42a08 any ideas going on here, because working on problem 3 days , still not resolved ...

OpenStack API token lifespan extension -

all, openstack api issues token after successful authentication. however, valid 1 hour. is there workaround or possibility extend token's lifespan? thanks & regards, ganesh. you may want take @ solutions used heat , openstack orchestration engine. heat needs able execute actions on behalf of user @ point in future. heat cannot store token because, have stated, tokens expire. heat offers 2 solutions "deferred authentication". keystone trusts stored passwords there lots of details how heat handles here , here . there api examples of keystone trusts on enovance blog , , more on here .

vba - Excel UDF: retrieving value from arbitrary, closed, external workbook -

Image
i looking way return value arbitrary workbook (the workbook not open @ time of running udf), defined based on calculations in udf. pseudo code: start calling =somefunc(currentcell) in cell function somefunc(adr range) region_eval = "c" & range(adr).row ' column c contains string entries, of have corresponding sub-dir (see filereference). networklocation = activeworkbook.path networkpath = networklocation & "\locations\" filereference = networkpath & region_eval & "\productlist.xlsx" workbook.open filereference readonly perform index/match call against sheet in workbook somefunc = returned value close workbook , end function this desired behavior. the logic return desired values ok, have tried in simpler formula, , in udf relies on file being opened manually: index(locationlist_$a$5000, match(masterlist_a1, locationlist_$b$5000)) i have, after hours of hair-pulling, discovered functionality not directly available ...

html5 - href link to load page and excute specfic jquery depending on link -

i need link go page , run specific jquery script depending on link. possible? heres menu: <div class="navdropdown"> <ul class="nav "> <li><a href="page/index.html#content1">content 1</a></li> <li><a href="page/index.html#content2">content 2</a></li> <li><a href="page/index.html#content3">content 3</a></li> <li><a href="page/index.html#content4">content 4</a></li> </ul> </div> </li> on page/index.html have 4 div #content1 & on different content in. css of #content is: display:none; and jquery change correct div display correct selection. display:block; i cant head around this. please? :) you might need use plugin jquery.ba-hashchange.js if want thi...

excel - How can I divide a number of cells by another? -

i'm trying query divides number of cells number of cells, keep on getting error. here contents of cells: http://i.gyazo.com/5954cf9dfcdc8cc430b81125d7313d22.png =sum((z2:z19) / (v2:v19)) i #value! error. how come can't divide 1 selection other try this: =(sum(z2:z19)/sum(v2:v19))

powershell - Move-item inside loop (one liner) -

i'm trying move files based on csv list. here's csv: newalias,path tat000017.txt,tat000010.txt here's powershell: import-csv tatlist.txt | foreach {move-item -path $_.path "new\"+$_.newalias} but error: move-item : positional parameter cannot found accepts argument '+@{newalias=tat000017.txt; path=tat000010.txt}.newalias'. at line:1 char:30 import-csv tatlist.txt | foreach {move-item -path $ .path "new\"+$ .newalias} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ categoryinfo : invalidargument: (:) [move-item], parameterbindingexception fullyqualifiederrorid : positionalparameternotfound,microsoft.powershell.commands.moveitemcommand i'm running powershell in same directory tatlist.txt , files there in directory. as per comment change to: move-item -path $_.path "new\$($_.newalias)" you need notation $($myvariable.myproperty) having properties's variable exp...

powershell - Get Public Key from CSR -

can please me following question (using powershell) i have csr in base64 string saved variable called $csr i want public key csr, reason want want check public key (and therefore private key) not being reused when submitting csr microsoft ca. idea copy of cert same subject name (if 1 exists) ca , check public key again csr. so need public key csr mentioned, far have done following $requestx = new-object comobjectx509enrollment.cx509certificaterequestpkcs10 $requestx.initializedecode($csr,6) `$requestx.publickey rather public key being returned com object. have use reflection on com object extract public key? there easier way? (i use certutil , bit of regex rather not) thanks e brant i figured out messing etc.... so goal compare public key in csr public key in existing certificate see if match of not (now may easier way, got it) $csr = @" <csr here in base64> "@ $objxx = [system.security.cryptography.x509certificates.x509certificate2]::creat...

bar chart - reportlab barchart categoryAxis below zero -

how display "categoryaxis" not in 0? i have negative values in chart "categoryaxis" on 0 position. for example: have minimum value -4.50 , "categoryaxis" on position. try set valuemin less 0 valueaxis example valueaxis.valuemin = -5 categoryaxis category not data bc = verticalbarchart() ... bc.valueaxis.valuemin = -5 (or set dynamically) bc.valueaxis.valuemax = 50 bc.valueaxis.valuestep = 10

windows phone 8 - Error : DEP6100 : Downloading package '7123B57E-F819-4B1E-8EE2-677E10756394' -

i'm trying deploy first wp app visual studio 2013. when run teh app on device, got error: error : dep6100 : following unexpected error occurred during boostrapping stage 'downloading package '7123b57e-f819-4b1e-8ee2-677e10756394'': filenotfoundexception - system cannot find file specified. filepicker.windowsphone i'm working on vmware. some users have problem, no real solution. find way solve think it`s language problem can change language @ tools -options-international settings restart vs. example default language chinese change english problem sloved.

meteor - Use ReactiveVar in {{each}} helper -

i have reactivevar in helper returns number of photos placed in template photocount:-> template.instance().rvphotocount.get() now need reactively populate html # of img returned photocount. tried using {{each photocount}}<img> receive error {{#each}} accepts arrays, cursors or falsey values. how tackle this? the {{#each}} operator used iterating on list of things, such as, in case, list of images. currently passing {{#each}} number of images have. , each not know how iterate on single number! if want display each of images, should pass each image list itself, in form of array or cursor: {{#each images}}<img src={{src}} />{{/each}} if want display number of images, use {{photocount}} ! <p>there {{photocount}} images.</p> if want print number of same "static" img, you'll have pre-process array in helper: photocount: function(){ var countarr = []; var count = template.instance().rvphotocount.ge...

java - GridView CAB not showing up on Long click -

gridview = (expandablegridview)findviewbyid(r.id.grid); gridview.setchoicemode(expandablegridview.choice_mode_multiple_modal); gridview.setmultichoicemodelistener(new expandablegridview.multichoicemodelistener() { @override public void onitemcheckedstatechanged(actionmode mode, int position, long id, boolean checked) { if(checked) { checkeditems.add(position); } else { checkeditems.remove(checkeditems.indexof(position)); } int checkedcount = gridview.getcheckeditemcount(); mode.settitle(checkedcount + " selected"); } @override public boolean oncreateactionmode(actionmode mode, menu menu) { log.i("test", "oncreateactionmode"); menuinflater inflater = mode.getmenuinflater(); inflater.inflate(r.menu.menu_main, menu); menu.finditem(r.id.done).setvisible(false); ...

Eu Cookies Law and Javascript -

this not technical question more related legislation: in these years european countries due adjust eu cookies law (synthetically every web site must inform/asks agreement/and on users every kind of cookies used sites). spent time analyze possible implementations informer banner/pop up. our doubt concerns javascript implementation, example suggested here https://www.cookiechoices.org/ google collaboration. these implementations - pure javascript - should work if browser enables javascript, happens if browser disables javascript? web site outlaw? these implementations - pure javascript - should work if browser enables javascript, happens if browser disables javascript? web site outlaw? the mechanism used show agreement quite simple, explained on first page , can implemented serverside code in javascript: with each tool, can customise notice or statement directed visitors , invite visitors close message (using wording of choice such "close", "...

java - Tess4J NoClassDefFoundError -

i'm trying use tess4j following: public static string parseimagecharacters(bufferedimage image) throws exception { tesseract instance = tesseract.getinstance(); return instance.doocr(image); } but i'm getting exeption: java.lang.noclassdeffounderror: com/sun/media/imageio/plugins/tiff/tiffimagewriteparam @ net.sourceforge.tess4j.tesseract.doocr(tesseract.java:237) @ net.sourceforge.tess4j.tesseract.doocr(tesseract.java:221) ... which refers following line in tesseract class: return doocr(imageiohelper.getiioimagelist(bi), rect); i'm using gradle build tool dependency: compile 'net.sourceforge.tess4j:tess4j:2.0.0' (any maven solutions fine!) what missing? i've seen few posts including various .dll files, thought tess4j included these? it seems need have java advanced imaging i/o tools dependency well. add dependency list 'com.sun.media:jai_imageio:1.1'

c# - Using Startup class in ASP.NET5 Console Application -

is possible asp.net 5-beta4 console application (built asp.net console project template in vs2015) use startup class handle registering services , setting configuration details? i've tried create typical startup class, never seems called when running console application via dnx . run or inside visual studio 2015. startup.cs pretty much: public class startup { public startup(ihostingenvironment env) { configuration configuration = new configuration(); configuration.addjsonfile("config.json"); configuration.addjsonfile("config.{env.environmentname.tolower()}.json", optional: true); configuration.addenvironmentvariables(); this.configuration = configuration; } public void configureservices(iservicecollection services) { services.configure<settings>(configuration.getsubkey("settings")); services.addentityframework() .addsqlserver() .adddbcontext<applicationcontext>(o...

How do I force-quit an individual app on an actual Apple Watch (not in the simulators)? -

when developing app, useful force-quit application without having re-start entire device. on iphone, can force-quit active app double-clicking home button , swiping app top. for actual apple watch (not simulators), force-quitting app particularly useful since there connection problems between xcode , watch app. also, force-quit apple watch app when not connected xcode. so, how can force-quit / terminate active app on apple watch without restarting entire device? when app terminate open: press , hold side button , wait until shut down screen appear. let go of side button. press , hold side button again until home screen appears. your formerly active app has been terminated. ps: side button button below digital crown.

Fileupload with javascript and php -

when use fileupload , can't path work. path show c:\fakepath\ram_education (2).sql doesn't insert in database here code: function carrer() { var name=document.careerfrm.name.value; var lname=document.careerfrm.lname.value; var email=document.careerfrm.email.value; var mobile=document.careerfrm.mobile.value; var currently=document.careerfrm.currently.value; var intrested=document.careerfrm.intrested.value; var city=document.careerfrm.city.value; var state=document.careerfrm.state.value; var zipcode=document.careerfrm.zipcode.value; var experience=document.careerfrm.experience.value; var resume=document.careerfrm.resume.value; url="career_db.php?name="+name+"&lname="+lname+"&email="+email+"&mobile="+mobile+"&currently="+currently+"&intrested="+intrested+"&city="+city+"&state="+state+"&zipcode="+zipcod...

scala - How can I 'discover' type classes/implicit values in the current scope? -

i've made use of few of scala's built-in type classes, , created few of own. however, biggest issue have them @ moment is: how find type classes available me? while of write small , simple, nice know if exists i'm implement! so, there list, somewhere, of type classes or implicit values available in standard library? better, possible somehow (probably within repl) generate list of implicit values available in current scope? it's job ide. intellijidea 14+ check out implicits analyser in scala plugin 1.4.x. example usage: def mymethod(implicit a: int) = { } implicit val a: int = 1 mymethod // click mymethod , press ctrl+shift+p, "implicit parameters" shown eclipse check out implicit highlighting . scala repl you can list implicits this: :implicits -v and investigate origin defined here : import reflect.runtime.universe val tree = universe.reify(1 4).tree universe.showraw(tree) universe.show(tree)

asp.net - IIS 7.5 Powershell script - Management service & Configure Web Deploy Publishing -

i creating script automate iis install on server 2012, having script near completed can't find information on following 2 topics: - management service - configure web deploy publishing specifically within management service looking set ip automatically using pre-set parameter within script ,is possible? forums/articles have read have yet mention area within powershell secondly within configure web deploy publishing, looking change default username, again using pre-set parameter within script. if point me in right direction perfect. thanks! about iis management service, looked @ own server setup scripts few years old , not exclusively powershell: it seems there 2 registry locations need change, here's part of script: sc.exe config wmsvc start= delayed-auto reg.exe add hkey_local_machine\software\microsoft\webmanagement\server /v enableremotemanagement /t reg_dword /d 1 /f net start wmsvc in same registry key there reg_sz ipaddress can set. there a...

C#:Error:Object reference set to an instance of object -

i working on accounting desktop application gives many specific information users. the part having trouble here date = comboboxedit2.editvalue.tostring(); line should not assigned null did. not find better options , obviously, compiler gives me object reference not set instance of object. error. i'm using devexpress , found .editvalue control check info database. thank you. here's complete method, public void fillcombo2() { using (sqlconnection con = new sqlconnection("server=dll;database=bsservis;user id=sa;password=1;")) { con.open(); string date = ("select date bsservis.dbo.enumeration"); date = comboboxedit2.editvalue.tostring(); system.data.sqlclient.sqldatareader dr = null; sqlcommand cmd = new sqlcommand("select distinct(date) bsservis.dbo.enumeration warehouse_nr='" + date + "'"); ...

ios - wrong boolean result within if statement -

this code should print false console print true nsmutablearray *data = [[nsmutablearray alloc]init]; uilabel *label = [[uilabel alloc] init]; label.tag = 7; if(label.tag <= (data.count - 1)) { nslog(@"true"); } else { nslog(@"false"); } anyone can explain this? data.count 0 unsigned integer ( nsuinteger ). (data.count - 1) 0 - 1 in case won't equal -1 because integer unsigned. maximum integer ( 4294967295 ). call integer underflow . you can fix label.tag + 1 <= data.count with unsigned integer, have take care subtraction. way fix using cast signed integer: label.tag <= ((nsinteger) data.count) - 1

ruby - How can I create a custom exception in my Rails application? -

i trying create custom exceptions in rails, 've problem designed solution. here i've done far: -create in app/ folder folder named errors/ file exceptions.rb in it. app/errors/exceptions.rb : module exceptions class apperror < standarderror; end end in 1 of controllers, tried raise it: raise exceptions::apperror.new("user not authorized") but when call controller's action, here get: nameerror (uninitialized constant exceptions::apperror did mean? typeerror keyerror ioerror eoferror did mean? typeerror keyerror ioerror eoferror ): i think don't have understood how create new directories , files, , use them. i've read created in app dir, eager loaded, can't understand problem. short version: rails' automated code loading - fact in case files contain exceptions doesn't matter (see guide on subject more details) r...

java - How to get wifi direct devices name from WifiP2pDeviceList -

i want wi-fi direct name when execute request peers, here code: if (wifip2pmanager.wifi_p2p_peers_changed_action.equals(action)) { log.d(tag, "success discover peers "); if (mmanager != null) { mmanager.requestpeers(mchannel, new wifip2pmanager.peerlistlistener() { @override public void onpeersavailable(wifip2pdevicelist peers) { // todo auto-generated method stub if (peers != null) { if (device.devicename.equals("abc")) { log.d(tag, "found device!!! "); toast.maketext(getapplicationcontext(), "found!!", toast.length_short).show(); } } } }); } else { log.d(tag, "mmaganger == null"); } } i want devicename list of peers can found 1 named "abc". idea? if want others device name: wifip2pmanager.req...

linux - FFMpeg installation in Ubuntu 12.04 and using it in PHP-FFMpeg -

i have tried many many failed attempt install ffmpeg in ubuntu 12.04. used following links: 1 , 2 , 3 , many others. then need use in php-ffmpeg , need deploy in linux based server. requirement. but after trying, downloaded static build through link . this helped me convert video , use ffmpeg through terminal in ubuntu. cannot use through php-ffmpeg library which need run . in docs of php-ffmpeg written this library requires working ffmpeg install. need both ffmpeg , ffprobe binaries use it. sure these binaries can located system path benefit of binary detection, otherwise should have explicitely give binaries path on load. and not getting this.

wordpress - Loading index.php contents which located outside blog folder for post single page -

i'm creating blog page wordpress static php website. when blog page url changes pretty permalink ( example.com/blog/my-post-page ), loading contents (not redirecting index.php, contents loading , url http://example.com/blog/my-post-page ) of index.php (home page site) located outside blog folder instead of single.php contents. when permalink changes default ( example.com/blog/?p=123 ), work perfectly. i need url http://example.com/blog/my-post-page . edit : - have updated permalink custom structure /index.php/%postname%/ . post pages showing example.com/blog/index.php/my-post-page . i think issue raised new wordpress version. (version 4.2.2). solutions remove index.php url ? my directory structure:- / - root /blog - blog folder /blog/wp-content/themes/mytheme/ - theme folder /blog/wp-content/themes/mytheme/single.php - post single page /index.php ...

php - Send param to remote modal bootstrap -

i want send form remote modal bootstrap, <?php include ("project.php"); ?> <div id="tnew" class="inner cover" > <form class="objectif"> <input class="form-control" name="pname" required autofocus> <p class="lead"><a href="#" data-toggle="modal" data-target="#project" class="btn btn-lg btn-default" name="projectname" type="submit">résoudre!</a> </p> </form> </div> and here project.php: <div class="modal fade" id="project" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header">...

javascript - JSON response format is not correct (angularjs) -

i have problem json response when call youtube api angularjs : code: sc.factory('videoapi', ['$resource', function($resource) { return $resource( 'https://www.googleapis.com/youtube/v3/search', {callback: 'json_callback'}, { get: { method: 'get', params: { order: 'date', part: 'snippet', channelid: 'ucy8zyy7ysq80jw1ijo2bjva', type: 'video', key: '*** key ***' }, isarray : false, } } ); }]); sc.controller('scontroller', ['$scope','videoapi', function ($scope,videoapi) { videoapi.get().$promise.then(function(data) { console.log(data); // console.log(data); ...

ios - Cordova Hybrid App fails, Legacy Android Build Works -

Image
i've written small application test working of cordova app on xdk. source code same this question however, attaching code here : (function() { "use strict"; /* hook event handlers */ function register_event_handlers() { /* button login */ $(document).on("click", ".uib_w_9", function(evt) { //intel.xdk.notification.showbusyindicator(); /*$.post("http://url/test.php", {test:'1'}, function(res){ alert(res); } );*/ $.ajax({ beforesend: function(){ intel.xdk.notification.showbusyindicator(); }, type: "get", url: 'http://url/test.php', data:{test:'1'}, success: function(res){ alert(res); intel.xdk.notification.hidebusyindicator(); }, error:function(res){ alert(res); ...

php - CakePHP - Find hasMany association without hasMany relation in Model? -

again want ask question cakephp : have 2 model user , comment relation 1-n (one user have many comment). want use find() list infomation both user , it's comments format data return : array ( [user] => array ( [id] => 121 [name] => gwoo kungwoo [created] => 2007-05-01 10:31:01 ) [comment] => array ( [0] => array ( [id] => 123 [user_id] => 121 [title] => on gwoo kungwoo [body] => kungwooness not gwooish [created] => 2006-05-01 10:31:01 ) [1] => array ( [id] => 124 [user_id] => 121 [title] => more on gwoo [body] => of 'nut? [created] => 2006-05-01 10:41:01 ) ) ) bu...

javascript - How to add a navigation sidebar and a footer to an AngularJS template without ng-include.? -

i'm new angular development. have been using few paid angular admin themes. in of them, developers have added ng-view , ng-class attribute index.html . want know how add sidebar navigation , footer every page without using ng-include . if not want use ng-include , can put html directly in index.html . called layout template , view contains common elements along application. in summary, in index.html outside ng-view element going appear in every page (as long use module such angular-route routing within same original html document (e.g. index.html )). i recommend follow official angularjs tutorial if new framework. also, ng-book ari lerner must-read on topic.

javascript - Count the number of child div inside parent div and align the child divs in the middle of the parent div -

i have 8 child divs inside parent div. have count width of parent div , divide width number of child width , place them in middle of parent div using javascript you can width of parent , split 8. can set width of children using .css('width') . in example set height same width, can see there 8 divs. if want height max, set css 100%. html <div class="outer"> <div class="inner"></div> <div class="inner"></div> <div class="inner"></div> <div class="inner"></div> <div class="inner"></div> <div class="inner"></div> <div class="inner"></div> <div class="inner"></div> </div> js var countdiv = $('.inner').length, outerwidth = $('.outer').css('width').replace('px', ''), singlewidth = outerwidth...

How we can create List of GString in groovy -

arraylist<gstringimpl> a= ["gaurav " , "ashish"]; println a; here gives error when used gstringimpl . the code below works in groovy 2.4.3: import org.codehaus.groovy.runtime.gstringimpl arraylist<gstringimpl> = ["gaurav " , "ashish"] println println '' def b = "hello" println b.class.name println b println '' def c = "worl${100 char}" println c.class.name println c yielding [gaurav , ashish] java.lang.string hello org.codehaus.groovy.runtime.gstringimpl world your code should work import org.codehaus.groovy.runtime.gstringimpl .

c++ - Why don't the changes to my variables survive until the next iteration? -

i want update instances of struct storing in map within loop, changes instance variables don't survive iterations of loop (within 1 iteration, new variables set, in next operation reset initial value). here simplified version of doing: map<int, regionoverframes>* foundregions = new map<int, regionoverframes>; (int = 0; < frames.size(); i++) { // find regions in current frame map<int, regionoverframes> regionsincurrentframe; (region region: currentframe.regions) { if (foundregions->count(region.regionid) == 0) { regionoverframes foundregion; foundregion.regionid = region.regionid; regionsincurrentframe[region.regionid] = foundregion; (*foundregions)[region.regionid] = foundregion; } else if (foundregions->count(region.regionid) > 0) { regionoverframes foundregion = (*foundregions)[region.regionid]; regionsincurrentframe[region.regionid...

php - Inherit dynamic template in Phalcon Volt -

i need load page, "inserted" in template - read it, volt's template inheritance should trick , does... kinda. hardcoded values, shown in examples, work fine - following example works: <!-- template --> <div id="site_content"> {% block test %} {% endblock %} </div> and page, inherits template: {% extends "../../templates/de/index.volt" %} {% block test %} {{ content() }} {# registered volt function outputs generated content #} {% endblock %} however, same page might need inherit different template , must decided on runtime, name of template must generated dynamically. 2 options occurred me: set template name variable , use when extending - problem here don't see way use afterwards. that guy seems have had same problem , there neither answer of how it, nor confirmation isn't possible @ all. register function generate complete string (e.g. {% extends "../../templates/de/index.volt" %}) , compi...