Posts

Showing posts from April, 2010

php - SQL JOIN - two teams, one logo database -

i have 2 databases, 1 database(games) contains hometeamid , visitorid. , other database(teams) contains logonames , teamid. (games) hometeamid , visitorid related (teams) teamid. i wanting run sql query outputs teams (games) database shows logos each respective team. want output this. <item> <hometeamid> <home_logo> <visitid> <visitor_logo> </item> when attempting query using php, use select * games left join teams on games.homeid = teams.teamid i can first logo hometeam fine, when use , select * games left join teams on games.homeid = teams.teamid , games.vistorid = teams.teamid i nothing. i able query work, don't logos. let's @ second statement: select * games left join teams on games.homeid = teams.teamid , games.vistorid = teams.teamid you correctly joining 2 tables information need. however, , statement cause homeid = teamid , teamid = visitorid. therefore, can rewr...

xamarin.ios - Getting Error when uploading .ipa file to application loader -

Image
i developing xamarin ios app.i getting below error when upload .ipa file application loader.and dont have ipad pro in info.plist below: how can solve please me. i've encountered weird behaviour icon size related visual studio. make sure have icon named icon-83.5@2x.png in resources folder , set build action bundleresource . now rebuild project. check in info.plist file if have entry this: <string>icon-83.5@2x.png</string> . if can submit ipa. if isn't in there, put in manually under cfbundleiconfiles key , rebuild again. <key>cfbundleiconfiles</key> <array> <string>icon-72@2x.png</string> <string>icon-72.png</string> <string>icon@2x.png</string> <string>icon.png</string> <string>icon-60@2x.png</string> <string>icon-76.png</string> <string>icon-76@2x.png</string> <string...

homebrew - Syntax error while executing any brew command -

error: /usr/local/bin/brew: line 1: syntax error near unexpected token '<<<' /usr/local/bin/brew: line 1: '<<<<<<< 61ffa47gd9dc179ddff792db1dc6f55464f6c16b' i tried removing , adding closing triangular brackets neither 1 worked me. i found similar questions/answers related unexpected token ')', didn't help. this unresolved git conflict. run following command , you’ll fine: cd /usr/local && git fetch && git reset --hard origin/master

node.js - Session variables are undefined out of the scope it is set to a value in nodejs -

i using nodejs , trying access session variable in route not same route session variable defined , set. keeps telling me session variable not defined! this set session variable: var http = require('http'); var express = require('express'); var bodyparser = require('body-parser'); var mysql = require('mysql'); var urlencodedparser = bodyparser.urlencoded({ extended: false }) var app = express(); var dateformat = require('dateformat'); var nodemailer = require('nodemailer'); var cookieparser = require('cookie-parser') var session = require('express-session'); app.use(cookieparser()); app.use(session({ secret: "this_is_a_secret", resave: false, })); app.post('/auth',urlencodedparser,function (req, res) { conn.query('select * users user_name="'+req.body.username+'" , user_pass="'+req.body.password+'"',function(err,res1...

ruby on rails - RSpec throws a NoMethodError, but method works in the app -

i have method 'current_balance' defined in invoice.rb: class invoice < activerecord::base belongs_to :purchase has_many :payments, dependent: :destroy validates :number, presence: true validates :currency, format: {with: /\a[a-z]+\z/, message: "please enter 3 letter currency code in caps."} validates :total_due, presence: true validates :due_date, format: {with: /\d{4}-\d{2}-\d{2}/, message: "format must yyyy-mm-dd"} validates :status, presence: true def self.next_due where("due_date >= ? , status = ?", time.now, 'open').order("due_date desc").first ? where("due_date >= ?", time.now).order("due_date desc").first.due_date : '' end def self.overdue where("due_date < ? , status = ?", time.now, 'open').order("due_date desc").first ? where("due_date < ?", time.now).order("due_date desc").first.due_date : '...

Spring boot log4j pattern -

i'm moving logback log4j , have replicate default configuration in spring boot log4j. that's have far, doesn't previous one. log4j.category.org.springframework=info log4j.appender.console=org.apache.log4j.consoleappender log4j.appender.console.layout=org.apache.log4j.patternlayout log4j.appender.console.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss} %-5p %c{1}:%l - %m%n i'm trying make this: 2014-03-05 10:57:51.112 info 45469 --- [ main] org.apache.catalina.core.standardengine : starting servlet engine: apache tomcat/7.0.52 2014-03-05 10:57:51.253 info 45469 --- [ost-startstop-1] o.a.c.c.c.[tomcat].[localhost].[/] : initializing spring embedded webapplicationcontext 2014-03-05 10:57:51.253 info 45469 --- [ost-startstop-1] o.s.web.context.contextloader : root webapplicationcontext: initialization completed in 1358 ms 2014-03-05 10:57:51.698 info 45469 --- [ost-startstop-1] o.s.b.c.e.servletregistrationbean : mapping se...

java - How to activate Payara class loading parameter fish.payara.classloading.delegate? -

i have guava class loading issues , can resolve issues adding glassfish-web.xml stated in official documentation . however don't want add not backward compatible glassfish-web.xml (deployment on glassfish 3.1.2.2 not working) , activate class loading within payara 162 stated in official documentation , blog article release 162 . i didn't find exact specification on how set system property , no way working tried individually. jvm-option asadmin create-jvm-options --target server-config -dfish.payara.classloading.delegate=false system property asadmin create-system-properties --target domain fish.payara.classloading.delegate=false asadmin create-system-properties --target server fish.payara.classloading.delegate=false asadmin create-system-properties --target server-config fish.payara.classloading.delegate=false all 3 system property targets together none of ways worked. it's feature, not bug :( as mentioned developer intended wars not ob...

c# - MVC custom roles based off of windows authenticated credentials -

i have mvc 5 web applications authenticating users via windows authentication. goal implement custom roles based on windows authenticatied username. have seen atricles explain this, build application on desgin of user roles, not windows autnetication. my issues is, how can add custom roles based off windows authenticated account? one approach id add custom filters restricted controllers in order validate access: [haspermission(enumsecuredfunctionality.accounts)] public class account : controller { } inside custom filter can handle permissions: public class haspermission : actionfilterattribute { public enumsecuredfunctionality[] actions { get; set; } public haspermission(params enumsecuredfunctionality[] actions) //for example can pass secured functionalities restrict { actions = actions; } public override void onactionexecuting(actionexecutingcontext filtercontext) { basecontroller controller = (basecontroller)filtercont...

common table expression - sql cte with parameter in excel microsoft query -

when using sql cte parameter in excel microsoft query as: ;with cte1 (select id ,item.itemlookupcode item item.notes '%'+?+'%' ), cte2 (select itemid trans time between ? , ?) select cte1.itemlookupcode,cte2. ,cte2.itemid cte1 join cte2 on cte1.id = cte2 .itemid i receive following error [microsoft][odbc sql server driver] invalid parameter number [microsoft][odbc sql server driver] invalid descriptor index can me? i faced issue , after lot of playing around modifying way parameters passed, here's found: parameters work sql queries without cte. looks an excel bug, ticket has been closed .

java - Best way for passing parameter from top function to bottom across entire service? -

i looking long time best way of passing parameter top function bottom. let me explain situation. have java web-service, parameter user, header in request , need parameter in 5th function call. controller -> api -> adaptor -> local function in adaptor -> exchange. so, end adding parameter each function call along way passing parameter. the problem need api calls in service. , should unique per request. (can't have massing around request). i hope question clear, love sharpen if needed. thank you. edit1: explained example: controller(string data) calls -> api(string data) calls -> adaptor(string data) calls -> local private function(string data) using data in exchange(string data) call. is there way data controller local private function in adaptor without passing parameter on each function in way? context example, must unique per rest request , not session. i suggested create properties class hold data , pass functions. if need field...

Using "any" function in groovy always return the result of the last item closure -

i'm trying following : """foo bar""".eachline { line -> ['foo', 'baz'].any{ println(it + ' - ' + line) line == } } result : foo - foo foo - bar baz - bar false i test if of lines of multiline string """foo bar""" is present in array ['foo', 'baz'] . but here returns false event if foo present in string. what doing wrong ? try: """foo bar""".split('\\n').any { line -> ['foo', 'baz'].contains(line)}

solr - $Project inside find mongodb -

it's possible transform this: db.processodomain.aggregate([{ $project: { 'status': 1, 'instancia': 1, 'ano': 1, 'numeroprocesso': 1, 'partes': '$informacoesadicionais.partes' } }]) to this: db.processodomain.find({} , { 'status': 1, 'instancia': 1, 'ano': 1, 'numeroprocesso': 1, 'partes': '$informacoesadicionais.partes' } ) because need make projection in solr query, , there don't accept aggregate function. thaks no far know either have use aggregation pipeline projection stage or in application layer.

Check if PHP session has already started -

i have php file called page has started session , page doesn't have session started. therefore when have session_start() on script error message "session started". i've put these lines: if(!isset($_cookie["phpsessid"])) { session_start(); } but time got warning message: notice: undefined variable: _session is there better way check if session has started? if use @session_start make things work , shut warnings? recommended way versions of php >= 5.4.0 if (session_status() == php_session_none) { session_start(); } source: http://www.php.net/manual/en/function.session-status.php for versions of php < 5.4.0 if(session_id() == '') { session_start(); }

sql - SOQL statement joining 2 objects -

Image
having issues retrieving data 2 different sf objects, custom object , accounts object. there field in contact object, first i'm trying tackle jobs db , account object. here query without join: contact__c , practice_name__c both type lookup. i'm not sure these 2 values returned are... keys used in clause? here can see relationships: can show me join return query above field names rather foreign keys? here lookup query foreign key practice name above: for accessing fields of lookup objects don't need join query, can these fields in 1 query, instance: select name, email__c, contact__r.name, practice_name__r.name job_database__c status__c = 'active'

continuous integration - Ansible : Using regular expression in the module "copy" -

the context i'm trying build continuous-integration platform , in ansible playbook use maven-dependency-plugin:get download artifact nexus on master deployed on remote server using ansible module copy . in order make lightweight , generic playbook, defined variable called app_version that, if it's defined, download given version , if not download latest version nexus repository. artifact downloaded in given directory ( /tmp/delivery/ ). below ansible task: - hosts: local tasks: - name: "downloading war" shell: > mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -dgroupid=app-dartifactid=app-dversion={{ app_version if app_version defined else 'latest' }} -dpackaging=war -drepositoryid=my-nexus -ddest=/tmp/delivery/ my problem to assure playbook genericity, need write regular expression in ansible module copy pick artifact having pattern app*.war looks module don't provide ability. below cop...

android - Setting Overflow and popup colors in Toolbar -

i can't find reason why part of menu stays in light background color , light textcolor. tried lot of different things in styles xml nothing had effect on it. someone can me? <style name="mytheme" parent="theme.appcompat.light.darkactionbar"> <!-- customize theme here. --> <item name="colorprimary">@color/colorprimary</item> <item name="colorprimarydark">@color/colorprimarydark</item> <item name="coloraccent">@color/coloraccent</item> <item name="android:windowcontentoverlay">@null</item> <item name="actionbarstyle">@style/myactionbar</item> <item name="android:windowbackground">@color/backgroundcolor</item> <item name="android:textcolor">#ffffff</item> </style> <style name="myactionbar" parent="@...

openedge - Structures or javascript/json objects in progress ABL? -

we're migrating 11.6 , think it's great moment rethink old habits , improve concepts. one of these things way we've been dealing parameter definitions in functions , procedures. often times have procedures , functions need lot of parameters, either inputs or outputs. personally, readability , maintainability reasons, don't have methods many parameters explicitly declared. in order avoid problem , still allow large number of parameters, we've manually implemented key-value pair approach single parameter. but there drawbacks approach: it's not possible tell parameters needed inspecting method signature. you'll need boilerplate code, methods pushing , pulling values. so said, hear others' thoughts. have ever implemented similar? is there work javascript/json object in abl? current implementation. define variable param character no-undo. addvalue('id', '1', param). addvalue('date', string(today), param). r...

Access and change 2d Json Array, Javascript -

i'm trying access , change data receive json api call. the format of call this: { "count": 391, "value": [ { "id": "id1", "name": "name1", "url": "url1", "project": { "id": "projid", "name": "bt-git", "url": "otherurl", "state": "wellformed" }, "defaultbranch": "master", "remoteurl": "remote" }, { "id": "id2", "name": "name2", "url": "url2", "project": { "id": "projid", "name": "bt-git", "url": "otherurl", "state": "wellformed" }, "defaultbranch": "m...

mod rewrite - .htaccess RewriteRule to webserver without changing URL -

i port-forwarding .htaccess, following scenario: https://example.com => http://getcontent.from:8080 https://example.com/test => http://getcontent.from:8080/test https://example.com/favicon.ico => http://getcontent.from:8080/favicon.ico https://example.com/img/asdf.png => http://getcontent.from:8080/img/asdf.png but url should stay 'example.com'. the primary target forward node-server on different server because have no https there. you can use example #2 brontobytes , change port well.

Can I parallelize this nested for loop? (Python 3.5) -

i found out bottleneck of code following block. n of order 10,000, , l (10,000)^2. rq_func function takes indices (tuples) , returns float v , dictionary sp_dist of {index : probability} format. is there way can parallelize code? have access cluster computing can use 20 cores @ time , use option. r = np.empty((l,)) q = scipy.sparse.lil_matrix((l, n)) traverser = 0 # populate r , q traversing array s_index in state_indices: a_index in action_indices: v, sp_dist = rq_func(s_index, a_index) r[traverser] = v sp_index, prob in sp_dist.items(): q[traverser, sp_index] = prob traverser += 1

PowerShell regex and e.164 telephone numbers -

i'm looking telephone numbers have 12 or 13 digits. the following 2 regex work: ps c:\data\umcp> $bla = [regex]'^(\+[3][9])?([0-9]\d{9})$' ps c:\data\umcp> $twelv -match $bla true ps c:\data\umcp> $bla = [regex]'^(\+[3][9])?([0-9]\d{10})$' ps c:\data\umcp> $thirt -match $bla true but ps c:\data\umcp> $bla = [regex]'^(\+[3][9])?([0-9]\d{9} | ^\+[3][9])?([0-9]\d{10})$' ps c:\data\umcp> $thirt -match $bla true ps c:\data\umcp> $twelv -match $bla false how should use | or? you have whitespaces around pipe, , whitespace matters. make whitespace (like this, e.g.) "formatting whitespace", add (?x) ignorepatternwhitespace inline modifier start of pattern. also, should careful unescaped parentheses, make groups , must paired. your fixed pattern like '^(?:(?:\+[3][9])?[0-9]\d{9}|(?:\+[3][9])?[0-9]\d{10})$' | |--opt.gr.-| | |-opt.gr.--| | |---------- branch 1------|-------- ...

html - Overlaying Image ontop of FontAwesomeIcon -

i designing personal website , wanted use font-awesome icons. unfortunately, font-awesome doesn't have every single icon , wanted python icon. have downloaded python icon separately different source , want place image on top of font awesome icon. this image of how did when both icons font-awesome: please click here see how look could please telling me how this. fontawesome provides class fa-stack overlap 2 icons. try this, <span class="fa-stack fa-lg"> <i class="fa fa-twitter fa-stack-1x"></i> <img src="http://placehold.it/40x40" class=" fa-stack-1x" style="width: 100%;opacity: 0.5;"> </span> thanks!

vba - sumif, vlookup usage together -

Image
i think having mental block afternoon. i have sheet - sheet acts table codes. column b in both sheets detailed description dont need, second table may have few rows or hundreds, example. second sheet subset of first , removing granularity adding column c sum them up. column a(unique code) b c 1 abd wood 2 rkger wood 3a egje concrete 4 kepog metal 5 kepog metal 2nd sheet column b c 1 abd 4.5 2 rkger 5.5 3a egje 5 4 kepog 3 basically want return wood 10 concrete 5 metal 3 i think need sumif , vlookup using example data provided (you can modify rows needs). in column d of sheet2 , put formula: =vlookup(b2,sheet1!$b$2:$c$6,2,false) see image below: after, in order not have separate sheet, add in bottom total section following formula: =sumif($d$2:$d$5,d8,$c$2:$c$5) see image below:

c# - How to display output in single line -

my program generating output, expecting different output generated. if send 6 input numbers, should compare numbers , generate answer. using system; using system.collections.generic; using system.io; using system.linq; class solution { static void main(string[] args) { string[] tokens_a0 = console.readline().split(' '); int a0 = convert.toint32(tokens_a0[0]); int a1 = convert.toint32(tokens_a0[1]); int a2 = convert.toint32(tokens_a0[2]); string[] tokens_b0 = console.readline().split(' '); int b0 = convert.toint32(tokens_b0[0]); int b1 = convert.toint32(tokens_b0[1]); int b2 = convert.toint32(tokens_b0[2]); if (a0 > b0 || a0 < b0) { console.writeline(1); } if (a1 > b1 || a1 < b1) { console.writeline(1); } if (a2 > b2 || a2 < b2) { console.writeline(1); } } } ...

javascript - Google Polymer: Toast prevents modals from exiting -

just wondering if else ran following problem, basically, whenever activate paper-toast modal open, , try exiting modal clicking outside of it, (the default paper-dialog functionality), modal can't exit without toast disappearing first. there way fix or workaround? expected behavior in polymer? thanks! note: might worth pointing out toast has fixed position @ bottom of screen

ios - stepping may behave oddly; -

Image
i developing application xcode 7.3.1 swift language, application crash on navigation second view controller class's viewdidload method below error " compiled optimization - stepping may behave oddly; variables may not available. " have tried many solution available on google. can 1 me solve issue? not happened everytime. 2 or 3 time crashing installation , works fine. note : happened release mode not in debug mode. thanks

Android SQLite SELECT syntax error apex -

i created parametric query works perfectly. when string passed apex, error sqliteexception: near "'%'": thi query string sql = "select titolo, icona, colore, tipo, identificativo, dato_campo table " + "where titolo '%" + parametro + "%' " + "or dato_campo '%" + parametro + "%' group identificativo"; if parametro string of type stringa' , error. how can fix? problem string has single quote characters breaks sql query string. simulating parametro == test01 - ok "select titolo, icona, colore, tipo, identificativo, dato_campo table titolo '%test01%' or dato_campo '%test01%' group identificativo"; simulating parametro == stringa' nok "select titolo, icona, colore, tipo, identificativo, dato_campo table titolo '%stringa'%' or dato_campo '%stringa'%' group identificativo"; as can see,...

'[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user' error -

i trying connect local network sql server via excel vba run-time error: [microsoft][odbc sql server driver][sql server]login failed user 'myuid' when use connection string connectionstring ="driver={sql server};server=mylocalserver; database=mydb;trusted_connection=yes;uid=myuid;pw=mypwd;" i have windows authentication authentication method sql server. do need sql , windows authentication? there wrong connection string? if set uid , pw, it's more sql account. account exist in sql? when remove uid , pw, , replace trusted connection, it's using windows authentication. if this, make sure windows account has permissions in sql.

android - Phonegap Developer: Why is My Device Not Compatible With Version? -

i tried downloading phonegap developer through google play, showing: your device not compatible version my phone techno w4 running on android 6.0. reason why device not compatible according google play store. also how manually download , instal apk files on mobile device. new phonegap , couldn't proceed tutorial because of inability cross stage because of compatibility issue. checkout this github phonegap developer app issue page , check surajpindoria comment on 28 jul 2016, on above page. lists out supported api level, hardware requirements, , permissions. if phone missing google play show device incompatible. visit per text in same comment for unable install current version play store, keep copy of released versions of developer app here. can download , install version need there.

ruby on rails 4 - Rgeo, activerecord-postgis-adapter does't fire SQL statements for attributes of type point -

so i'm running rgeo activerecord-postgis-adapter , have rails 4 app's db.yml file set correctly. but when set attributes of activerecord model like: place .create(name: 'some name', geom: rgeo::geographic.spherical_factory(:srid => 4326) .point(latitude,longitude) and check sql insert statement fires, won't include geom in insert insert "places" ("name", "some_attr"..... <- no geom attr being inserted. if has seen before , has idea problem might be, please thanks!

python - Accessing wrong attribute when trying to reset value...? -

in example code i'm trying make whole pile of data callable: class data(object): def __init__(self, data): self._raw_data = data key, val in data.items(): if isinstance(val, dict): if 'data' in val.keys(): setattr(self, key, dataset(val)) else: setattr(self, key, data(val)) else: setattr(self, key, val) def __getattr__(self, name): return none @property def raw(self): return self._raw_data class dataset(data): def __init__(self, data): self._raw_data = data super().__init__(data) entry in self.data: # need debug self.data[self.data.index(entry)] = data(entry) what ends happening this. i'll try: >>> example = {'dataset': {'id': 1, 'data': [{'param1': 3, 'param2': 4}, {'param1': 5, 'param2...

rx java - RxJava Zip with priorities -

here's problem. have number of async operations result gets aggregated single 1 further processed. however, not operations equal , error handling different based on operation fails. to elaborate, let's have operations a, b , c. if fails, need end processing if b or c fail, continue processing others normal. currently, achieve using count down latches , lot of state management taking close hundred lines of code. move rxjava based implementation. first thought trying observable.zip operator treats observables equals , not true in case. other idea chaining calls, works, means operations won't start @ same time resulting in greater overall time. can guide me on how achieve this? use .onerrorresumenext : observable<t> a, b, c; observable.zip( a, b.onerrorresumenext(t -> observable.just(null)), c.onerrorresumenext(t -> observable.just(null)), (x, y, z) -> <your aggregation>) ... representing errored observables null you...

How to call a certain function inside an if statement in python? -

i relatively new python, in foundation year learned bbc basic pretty basic , acquired many bad habits there. learned python aid of codecademy, however, how can call function inside if statement? in first if statement called function mainmenu(menu) , however, not displaying function contents. why? (by way trying atm machine practice of things learned , consolidate print "hello ! welcome jd's bank" print print "insert bank card , press key procede" print raw_input() passcode = 1111 attempts = 0 while passcode == 1111: passcodeinsertion= raw_input("please insert 4-digit code: ") print"" if passcodeinsertion == str(passcode): print "this working" #testing----- print "" mainmenu(menu) elif attempts < 2: print "sorry ! wrong passcode" attempts += 1 print "------------------------------------------------" print "...

c++ cli - creating a contact with custom field? -

i'm working on uwp software requires manage contacts list. each contact must store @ least 1 public key (hash) identify themselves. checked api uwp , quiet unclear me how this. for windows8 phone there storedcontact wich seems able store custom fields. example can found @ page 16 of presentation here : http://www.slideshare.net/windowsphonerocks/16-interacting-with-user-data-contacts-and-appointments for uwp, tried first add storedcontact. have no access windows::phone::personalinformation (see namespace here : https://msdn.microsoft.com/en-us/library/windows/apps/jj207745.aspx ). (n.b. i'm not targeting phone device). then tried add custom field contact ( https://msdn.microsoft.com/library/windows/apps/br224849 ) @ point have no idea how to. since windows::applicationmodel::contacts sealed cannot try create child class , adding property hashkey. technicaly have class hashkey wich windows::applicationmodel::contacts::contactphone. if it's not possible store cu...

python - JSONDecodeError: Extra data: line 1 column 228 (char 227) -

i using ipython data analysis, can't load json file. please me load json file in ipython. , want skip same words in first line make clean format, want each record looks : {"station_id":"72","num_bikes_available":18,"num_bikes_disabled":0,"num_docks_available":20,"num_docks_disabled":1,"is_installed":1,"is_renting":1,"is_returning":1,"last_reported":"1467164372","eightd_has_available_keys":false}, here code: in [9]: path = 'stationstatus.json' in [10]: records = [json.loads(line) line in open(path)] here error: jsondecodeerror traceback (most recent call last) <ipython-input-10-b1e0b494454a> in <module>() ----> 1 records = [json.loads(line) line in open(path)] <ipython-input-10-b1e0b494454a> in <listcomp>(.0) ----> 1 records = [json.loads(line) line in open(path)] //anaconda/lib/p...

java - convert a word documents to HTML with embedded images by TIKA -

i'm new in tika. try convert microsoft word documents html using tika. i'm using tikaondotnet wrapper used tika on .net framework. conversion code following: byte[] file = files.tobytearray(new file(@"mypath\document.doc")); autodetectparser tikaparser = new autodetectparser(); bytearrayoutputstream output = new bytearrayoutputstream(); saxtransformerfactory factory = (saxtransformerfactory)transformerfactory.newinstance(); transformerhandler handler = factory.newtransformerhandler(); handler.gettransformer().setoutputproperty(outputkeys.method, "html"); handler.gettransformer().setoutputproperty(outputkeys.indent, "yes"); handler.gettransformer().setoutputproperty(outputkeys.encoding, "utf-8"); handler.setresult(new streamresult(output)); expandedtitlecontenthandler handler1 = new expandedtitlecontenthandler(handler); tikaparser.parse(new byt...

c - Unresolved symbols building pocketsphinx application -

im trying started using pocketsphinx error: gcc -i /home/noahchalifour/libraries/pocketsphinx/include -i /home/noahchalifour/libraries/sphinxbase/include pocketsphinx.c -o pocketsphinx /tmp/ccagvqgz.o: in function `main': pocketsphinx.c:(.text+0x20): undefined reference `ps_args' pocketsphinx.c:(.text+0x6b): undefined reference `cmd_ln_init' collect2: error: ld returned 1 exit status every time run code: #include <pocketsphinx.h> #define modeldir "/home/libraries/pocketsphinx/model" int main(int argc, char *argv[]) { ps_decoder_t *ps = null; cmd_ln_t *config = null; config = cmd_ln_init(null, ps_args(), true, "-hmm", modeldir "/en-us/en-us", "-lm", modeldir "/en-us/en-us.lm.bin", "-dict", modeldir "/en-us/cmudict-en-us.dict", null); printf("success!\n"); return 0; } you should link pocketsphinx ...

send url to ajax's success () from Django backend -

i want send data html view django backend process , backend send url html view redirect user page. it's this: page 1 ----user's input data --- ajax --- > backend --- process --- url page 2 --- ajax --> page 2 the problem that, don't know how send url ajax after processing user's data, have redirect using window.location.href = '/' . think code not clean way. wonder if there way send url ajax's success backend. here code n html : function dosomething(data){ $.ajax({ type: "post", url: url_post_by_ajax, data: { 'data' : data, }, success: function (response) { window.location.href = '/'; }, error: function (data) { alert('failed'); } });} please me. thank you! in processing view: from django.http.response import jsonresponse def whatever_your_view_name_is(request): (data processing......

How to convert a compressed stream to an uncompressed stream in c# using GZipStream -

following various samples i've been able convert memory stream compressed stream , byte array save in database i'm having trouble going other way. here's i've got far... ... using (memorystream compressedstream = new memorystream()) { ...some code builds compressedstream undetermined number of bytearrays database using (memorystream uncompressedstream = new memorystream()) { // method 1 using (gzipstream unzippedstream = new gzipstream(compressedstream, compressionmode.decompress)) { unzippedstream.copyto(uncompressedstream); } // method 2 using (gzipstream unzippedstream = new gzipstream(uncompressedstream, compressionmode.decompress)) { compressedstream.copyto(unzippedstream); } ... uncompressedstream } } method 1 seams follows examples see on here causes error "stream not support writing" method 2 seams make more sense uncompressed stream empty p.s. ...

python - Memory error when using Pandas built-in divide, but looping works? -

i have 2 dataframes, each having 100,000 rows. trying following: new = dataframea['mykey']/dataframeb['mykey'] and 'out of memory' error. same error if try: new = dataframea['mykey'].divide(dataframeb['mykey']) but if loop through each element, this, works: result = [] idx in range(0,dataframea.shape[0]): result.append(dataframea.ix[idx,'mykey']/dataframeb.ix[idx,'mykey']) what's going on here? i'd think built-in pandas functions more memory efficient. @ayhan got right off bat. my 2 dataframes not using same indices. resetting them worked.

php - how to exclude certain views with laravel view composer -

how can make sure load data via view composer select views , exclude few, 2 views specific? can use regex instead of '*'? public function boot() { view()->composer( '*', 'app\http\viewcomposers\profilecomposer' ); } there 2 views i'd avoid, extend same blade used others, not sure declaring 99 others best - if can define ones left out that'd great. perhaps not best way doing can done this in services provider register view composer public function boot() { view()->composer( '*', 'app\http\viewcomposers\profilecomposer' ); } in profilecomposer compose method view class repository type hinted. use name of current name of view , make condition excluded view name. class profilecomposer { public function __construct() { // dependencies automatically resolved service container... } /** * bind data view. * * @param view $vie...

php - Mysqli connection fails in shell and goes well in apache (macports) -

i hope fine today. have weird problem. changed web apps use mysqli connect mysql instead of mysql_connect. when server apache, goes fine , queries sent properly. however, when executing php scripts in terminal, following error: error 2002: no such file or directory i checked socket files in php56/php.ini, , socket declared. mysqli.default_socket=/opt/local/var/run/mysql55/mysqld.sock however, in shell, php socket wrong. somehow socket path changes apache terminal php environment , lost. php.ini configuration file usin me@macbook-pro /users/me/www$ php -i | grep mysqli mysqli mysqli.allow_local_infile => on => on mysqli.allow_persistent => on => on mysqli.default_host => no value => no value mysqli.default_port => 3306 => 3306 mysqli.default_pw => no value => no value mysqli.default_socket => /var/mysql/mysql.sock => /var/mysql/mysql.sock mysqli.default_user => no value => no value mysqli.max_links => unlimited => unlimited...

php - Where do services go in MVC? -

i've asked several developers, , gotten different answers every time. let's i'm working in mvc framework , have class called validator . object has bunch of methods can used tell if email or phone number valid, or if given value has content in it. say want make service property of model i'm creating. can inject construction method of model class. however, service fit in in mvc? model? where should file stored? models? in it's own directory, perhaps called services ? i think have different view [sadly no pun intended] of model in mvc, services should go in model layer. first, model shouldn't class. model a model, of one application. application modelized in different things (contained in model layer): entities, mappers, services. for exemple, file hierarchy representing concept: application controller model entities mappers services view say want make service property of model i'm creating....

javascript - Do single/double quotes make a difference if nothing is escaped? -

as see it, both 'mars%22%3a%22' , "mars%22%3a%22" equivalent, nothing being escaped. i have been creating javscript bookmarklet time now. @ 1 point, stopped working when pasted as-is bookmark in chrome. i discovered solution after guess-and-check: a pair of double quotes needed single quotes. why? the following line single-quotes inside split() causes no problems in bookmarklet: loaddoc("/page1/" + aarray[i].href.split('mars%22%3a%22')[1].slice(0,7),i); the line below double quotes cause bookmarklet not run @ all: loaddoc("/page1/" + aarray[i].href.split("mars%22%3a%22")[1].slice(0,7),i); no error shown in console. note double-quote version run fine if pasted javascript console directly! what not understanding? javascript not distinguish between single , double quotes in way language ruby (where string interpolation , backslash escape sequences work in double-quoted string). both types of quote ha...

android - How to retain the fragment once the App got destroyed or closed -

i trying develop app requirement retain tab after closing app or if app gets destroyed in run time my app has 3 tabs,i adding items in secondtab "checklist" when ever close app second tab again new page instead of items added previously i want app same picture 2 after closing app,but seems everytime close app tab appears picture 1 picture 1 http://i.stack.imgur.com/ksgtz.png picture 2 http://i.stack.imgur.com/ouim4.png psuedo code : public class mainactivity extends appcompatactivity implements actionbar.tablistener { sectionspageradapter msectionspageradapter; viewpager mviewpager; public fragment fragment; private fragmentactivity mycontext; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final actionbar actionbar = getsupportactionbar(); view viewactionbar = getlayoutinflater().inflate(r.layout.titlebar, nul...

php - Why does this only work once? -

i'm trying put simple feedback form uses php email results us. script works once, email intended.. every time afterwards, there's no email , no error. have idea why? <?php $email_to = "admin@urbansushi.com"; $name = $_post['name']; // required $email = $_post['email']; // required $date = $_post['date']; // required $email_subject = "new feedback customer"; $email_message .= "name: ".clean_string($name)."\n"; $email_message .= "date of visit: ".clean_string($date)."\n"; $email_message .= "email: ".clean_string($email)."\n"; // create email headers $headers = 'from: '.$email."\r\n". 'reply-to: '.$email."\r\n" . 'x-mailer: php/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> you concatenating $email_message not declaring initially: $email_message ....

unity3d - How to calculate z position of ImageTarget with screen and AR Camera? -

i new unity3d , vuforia. developing ar project unity3d , vuforia. want show found target object when lost. can show them, wrong position devices. want scale game object them's z position. note: world center mode: camera using imagetarget of vuforia i want calculate z position of imagetarget fit screen , ar camera. how it?

c# - LINQ Query Decimal Field to Constant Value -

Image
i have stack of different colored pick-up sticks want remove duplicates , sort color , shortest longest in each color. here's partial code: stickstack stickstack = new stickstack(); list<stick> nodupesticks = stickstack.pile .groupby(st => new { st.lengthincm, st.colorblue, st.colorgreen, st.colorred }) .select(st => st.firstordefault()).tolist(); var bluesticks = nodupesticks .orderby(s => s.lengthincm) .where(s => s.lengthincm >= 5.0m && s.lengthincm <= 20.0m && s.colorblue >= s.colorgreen && s.colorblue >= s.colorred) .select(s => new stick(s.lengthincm, s.colorred, s.colorgreen, s.colorblue)); var greensticks = nodupesticks .orderby(s => s.lengthincm) .where(s => s.lengthincm >= 5.0m && s.lengthincm <= 20.0m && s.colorgreen >= s.colorblue && s.colorgreen >= s.colorred) .select(s => new stick((decimal)s.lengthincm, s.colorred, s.colorgreen...

mysql - POSTGRE how to select parent name from hierarchical table -

how select hierarchical table parent id? have table this +-----------+------------+-------------+ | id | parent_id | name | +-----------+------------+-------------+ |1 | 0 | | +-----------+------------+-------------+ |2 | 1 | a1 | +-----------+------------+-------------+ |3 | 0 | b | +-----------+------------+-------------+ |4 | 3 | b1 | +-----------+------------+-------------+ |5 | 3 | b2 | +-----------+------------+-------------+ and want show table this +-----------+------------+-------------+ | id | name | parent | +-----------+------------+-------------+ |1 | | null | +-----------+------------+-------------+ |2 | a1 | | +-----------+------------+-------------+ |3 | b | null | +-----------+------------+-------------+ |4 ...

javascript - How do I prevent form submission in Angularjs if I am submitting the form using enter key? -

i have applied validation form (it has 2 fields) don't know how prevent submitting,current flow is: after pressing enter key student's name , marks added on localstorage , displayed on screen there unable prevent empty data submitting. these js functions: $scope.searchenter = function() { if (event.which == 13 && $scope.student != "") { $scope.addstudent(); } }; $scope.addstudent = function() { if ($scope.marks > 65) { var pass = true; } else { pass = false; } $scope.students.push({ 'studentname': $scope.student, 'marks': parseint($scope.marks), 'pass': pass }); $scope.student = ''; $scope.marks = ''; localstorage['studentslist'] = json.stringify($scope.students); }; this html part: <div class="row"> <div class="col-xs-12"> <form class="form-horizontal" novalidate name=...

How to show progress bar in HTML file while batch-file is running -

i have written servlet run bat file. bat file copies content specified path , re-starts server. show progress bar in html page end user w.r.t batch-file progress i.e, progress bar should progress while files copying , should show server started after copy completed , restarted server. here code: protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { system.out.println("dopost invoked"); string buildpath = request.getparameter("buildpath"); system.out.println(buildpath); try { file file = new file("c:/users/hrushi/desktop/html/buildpath.txt"); filewriter filewriter = new filewriter(file); filewriter.write(buildpath); filewriter.flush(); filewriter.close(); } catch (ioexception e) { e.printstacktrace(); } runtime.getruntime().exec("cmd /c start c:/users/h...

java - RoboGuice Error: Didn't find class "AnnotationDatabaseImpl" on path -

trying simple app run roboguice encountering error: didn't find class "annotationdatabaseimpl" on path: looks lot of people error, , none of solutions seem work me. have done taken androidstudio blank app template. mainactivity.java: package com.example.temp.robotest; import android.os.bundle; import roboguice.roboguice; import roboguice.util.robocontext; import java.util.hashmap; import java.util.hashmap; import java.util.map; import com.google.inject.key; import roboguice.activity.roboactionbaractivity; public class mainactivity extends roboactionbaractivity implements robocontext { protected hashmap<key<?>, object> scopedobjects; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } public map<key<?>, object> getscopedobjectmap() { return this.scopedobjects; } } and gradle: apply plugin: 'com...