Posts

Showing posts from May, 2011

php - htaccess for 2 different type of url for my website -

this question has answer here: rewriting arbitrary number of path segments query parameters 2 answers my site irasol.com. site has 2 different type of url need rewriterule in .htaccess. http://irasol.com/index.php?id=job-board&jobid=technical-uk kindly me rewrite below. http://irasol.com/job-board/technical-uk thanks me solve issue. here are rewriteengine on rewriterule ^([^/]*)/([^/]*)/$ /index.php?id=$1&jobid=$2 [l]

ios - XCode6 GoldMaster submitting build failed with error -

Image
when submit build appstore see errors: error itms-4088: "no software found apple_id: * " @ sofwareassets error itms-4238: "redundant binary upload. there exists binary upload build version '3.0' train '3.0' @ softwareassets/prereleasesoftwareasset. does know should fix that? fix apple id there *" strange, i.e. use normal characters , following increase build: a more 1 binary may uploaded itunesconnect if the build number (select target, xcode -> general -> build, see picture below) increased adding .1 , i.e. if version 3.75 , increase to: 3.75.1 , version still `3.75 app (also in itunesconnect). build number has unique each binary loaded itunesconnect. after new binary uploaded , processed (~ 10 min), can select new binary , submit review. in picture below may see old , new binary listed in itunesconnect in build section of current app version (you click plus sign). new binary selected -> saved -> submit review

javascript - Unable to fetch user's username using PHP SDK -

i able fetch user's details except user's username need in site(coded in ci framework). want site integrated facebook. have used php sdk code. below have provided full code.please let me know if can user's username using user's fb id , fql. <div id="fb-root"></div> <script type="text/javascript"> var button; var userinfo; window.fbasyncinit = function() { fb.init({ appid: 'your app id', //change appid appid status: true, cookie: true, xfbml: true, oauth: true}); // showloader(true); function updatebutton(response) { button = document.getelementbyid('fb-auth'); userinfo = document.getelementbyid('user-info'); if (response.authresponse) { //user logged in , connected fb.api('/me', function(info) { login(response, info)

simulator for semantic project -

i want simulate semantic security project detecting , classifying web application attacks. ontological model developed using description logic based on web ontology language (owl)and implemented using apache jena framework. simulator software appropriation simulate system ?

nsis - Three choices in shortcut options -

we have our installer choices create shortcuts 1) create shortcut current user 2) create shortcut users 3) not create shortcut the first option checked default, if check other work well..the problem if check example 3rd option, move next page , come there 2 choices checked - 1st (default) , 3rd (selected). i new nsis , can't find better way did code not friendly me. appreciate advice. thanks, this have in installation options .ini : [field 5] type=groupbox left=1 right=-1 top=80 bottom=144 text="choice of shortcuts:" state="" [field 6] type=radiobutton left=10 right=-10 top=96 bottom=108 text="create shortcuts users" state=1 flags=group|notify [field 7] type=radiobutton left=10 right=-10 top=112 bottom=124 text="create shortcuts current user" state=0 flags=notify [field 8] type=radiobutton text="do not create shortcut" flags=notify state=0 left=10 right=-10 top=128 bottom=140 then later in nsis script: intcmp $s

internet explorer - Problems displaying google heat map -

hope can me below code. i'm having issues getting heatmap load in chrome load in ie (after refresh) hope can provide me a/some pointers check im new google maps, js , json :-) thank you! <!doctype html> <html> <head> <title>phone home</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <style> html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } </style> <script type="text/javascript" src="../src/markerclusterer.js"></script> <script type="text/javascript" src="../src/jquery.js"></script> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=geometry,visualization&key=****&q

shell - parsing a list file (awk/bash) -

what i'm going creating csv file out of parsed list. [input.txt] list of gadgets. version: 11 created by: jayfour 1 toy no ordered 2 box no ordered 3 spade yes in_stock 4 nail yes in_stock 5 chair no ordered 6 table yes in_stock 7 apple no ordered 9 phone yes in_stock # generated 2014 now created script, should 'awk' , create me csv file this: [output.csv] | id | item | status | stock | | 3 | spade | yes | in_stock | | 4 | nail | yes | in_stock | | 6 | table | yes | in_stock | | 9 | phone | yes | in_stock | "|" represents table borders. script: #!/bin/bash ifiles=`ls input.txt` ifile in $ifiles echo "id;item;status;stock\r" > output.csv id=`awk '/yes/' $ifiles | awk {'print $1'}` itm=`awk '/yes/' $ifiles | awk {'print $2'}` stat=`awk '/yes/' $ifiles | awk {'print $3'}` s

stata - Unit root test for a group of variables -

i want perform unit root tests (adf, dfgls, kpss) on group of variables, x1, x2, x3, x4 . possible write code in stata perform tests in 1 go variables? tried using foreach , unsuccessful. in stata do-file tried: foreach var of varlist lic lac ldc lcc { dfuller 'var' } where lic, lac, ldc , , lcc variable names. i getting error message ' invalid name you using incorrect quotes (de)reference local macro var . should open backtick quote ` , close regular quote ' . should `var' . have 2 regular quotes: 'var' . a reference manual: [u] 18.3.1 local macros .

sharepoint - How to find if OneDrive is active for a user in Office365 through API? -

is there way find out user has onedrive site(for office365 account)? i'm getting user list sharepoint site through https://{domain}-my.sharepoint.com/_api/web/siteusers but there no field indicate if user has active onedrive .by onedrive mean personal site of sort; https://{domain}-my.sharepoint.com/personal/user_name_domain_microsoft_com one way find out accessing url user , check if yields 404 response. i'm trying done via rest api? on this? the following user properties used distinguish actual (or active) spo users: principal.principaltype property - principaltype.user value specifies user principal type useridinfo.nameidissuer property - configuration-agnostic reference type of name identifier issuer, spo users value: urn:federation:microsoftonline rest request: /_api/web/siteusers?$filter=principaltype eq 1 , userid/nameidissuer eq 'urn:federation:microsoftonline'

dygraph, bypass csv file x-axis and create own x-axis value -

i generate csv file data: 0.86, -18.55, -28.14 -0.85, -17.81, -28.70 -1.29, -17.81, -28.70 -1.71, -16.61, -28.70 , on. now not want dygraph use first colum x-axis in graph. want dygraph generate number me starting @ 0. x-axis 0, 1, 2, 3 etc data in file y-axis values. is posible? searched documentation/forum, can't find it. regards, robertho dygraphs expects first column x values. if want x-axis 0, 1, 2, etc., you'll need add first column values.

Where do you use macros in clojure where functions wont work -

i'm new in learning , working clojure i've got basic question on macros in clojure. didn't find case need macros i'm wondering if there real case macro , no normal function or multimethod solves problem. can show simple example this? think didn't understand concept of macros in clojure. clojure macros take literal code whereas functions take evaluated code. in turn, macros useful when need manipulate literal code . literal code , evaluated code equivalent except 2 (very important) instances: symbols , expressions (maps, vectors, sets, strings, keywords, numbers, booleans, etcetera, "evalute themselves"). user=> 1 ;evaluates 1 user=> "abc" ;evaluates "abc" user=> :xyz ;evaluates :xyz user=> [1 "abc" :xyz] ;evaluates [1 "abc" :xyz] as opposed to: user=> (+ 1 2) ;an expression evaluates not 3 user=> math/pi ;a symbol evaluates not 3.141592653589793 user=> + ;another example, li

java - Handling date format in JSpinner with SpinDateModel -

Image
i have following lines of code: spinnerdatemodel spinmod=new spinnerdatemodel(); jspinner spin=new jspinner(spinmod); //spin.seteditor(new jspinner.dateeditor(spin,"dd.mm.yyyy")); when display spinner can edit , write in month field two-digit number want. if click on jspinner side can increase , decrease month or day numbers values legal. but, if add last outcommented line, wouldn't work, either. the question how make jspinner accept legal dates custom format. also, if make actionlistener added button gets date, "correct date" applying getvalue() directly jspinner , wrong 1 (the 1 entered) if apply date editor's format value obtained jspinner . want action listener correct value in custom format , want jspinner accept input in custom format. possible? my test code below: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; import java.text.*; //for date format pub

html - How to add style or put a class in a php form_submit button -

i want button awesome don't know how apply styles or put class on button http://i.stack.imgur.com/efvzg.jpg <?php echo form_submit('submit', 'submit');?> i want put css properties button make http://i.stack.imgur.com/jmfli.jpg .. .btnback{ background: #3498db; border: solid 1px; border-color: #3498db; background-image: -webkit-linear-gradient(top, #3498db, #2980b9); background-image: -moz-linear-gradient(top, #3498db, #2980b9); background-image: -ms-linear-gradient(top, #3498db, #2980b9); background-image: -o-linear-gradient(top, #3498db, #2980b9); background-image: linear-gradient(to bottom, #3498db, #2980b9); -webkit-border-radius: 5; -moz-border-radius: 5; border-radius: 5px; color: #ffffff; font-size: 15px; padding: 5px; width: 100px; text-decoration: none; vertical-align: middle; } please teach me how it.. thanks if code igniter:

HTTP GET request in JavaScript? -

i need http get request in javascript. what's best way that? i need in mac os x dashcode widget. you can use functions provided hosting environment through javascript: function httpget(theurl) { var xmlhttp = new xmlhttprequest(); xmlhttp.open( "get", theurl, false ); // false synchronous request xmlhttp.send( null ); return xmlhttp.responsetext; } however, synchronous requests discouraged, might want use instead: function httpgetasync(theurl, callback) { var xmlhttp = new xmlhttprequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) callback(xmlhttp.responsetext); } xmlhttp.open("get", theurl, true); // true asynchronous xmlhttp.send(null); } note: starting gecko 30.0 (firefox 30.0 / thunderbird 30.0 / seamonkey 2.27), synchronous requests on main thread have been deprecated due negative effects user experience.

jQuery - jump to first div class on anchor click -

Image
i want use jquery animate jump first occurrence of class on page, @ moment using basic code error in console when fire onclick event. this html razor: @model list<business.models.interviewcentres.interviewcentresviewmodel> @{ viewbag.title = "index"; } <h2> interview centre bookings</h2> <br /> website showing dates between <b>@datetime.now.adddays(21).toshortdatestring()</b> , <b>@datetime.now.adddays(92).toshortdatestring()</b> @{ string previouslocation = ""; } <!-- each unique location , add list. use build clickable links --> @{ list<string> locations = new list<string>(); } @foreach (var item in model) { if (!locations.contains(item.location)) { locations.add(item.location); } } <br /> @foreach (string location in locations) { <a href="#" class="lnknav"><span style="color: #772432; border-bottom-style: dotte

Twisted XMLRPC proxy -

i'd make xmlrpc proxy balancer using twisted. [xmlrpc server 1_1 8.8.8.8:8000] <--> [----------------------] <--- client [proxy example.com:8000] <--- client [xmlrpc server 1_2 9.9.9.9:8000] <--> [----------------------] <--- client so there 2 xmlrpc instances represents same methods. need xmlrpc-proxy between instances , clients. 1 more thing - proxy should accept json calls (kind of http://example.com:8000/rpc2 , http://example.com:8000/json ). right trying implement xmlrpc proxy calls. can't receive answer client although sendline() calling. import argparse twisted.internet import protocol, reactor, defer, threads twisted.web import xmlrpc twisted.internet.task import loopingcall twisted.internet.defer import deferredqueue, deferred, inlinecallbacks twisted.protocols.basic import linereceiver import configfile bcsxmlrpc import xmlrpc_request_parser, xmlrpc_marshal customlogging import logging

jms - Take first message to arrive on one of 2 queues -

i have application i'd consume messages queue a, if queue empty, i'd consume messages queue b instead of sitting idle. ever want process 1 message @ time, , if consumer busy processing message (from either queue), other pending messages (on either queue) should remain on queue until consumer idle again (this gives other consumers chance process new message). so, example, if message arrives on either queue or queue b while consumer idle (waiting), consumer picks up. if message arrives on either queue while consumer processing message, nothing happens until consumer has finished processing current message. , if message available on both queue , queue b, consumer prefers pick message queue a. edit : i'd equally happy informed messages available consume on both & b, , implement own logic choose 1 want pull queue. subscribing both queues @ once in separate threads doesn't appear work because: if message m arrives on queue a, consumer have unsubscribe queue

c# - Unable to attach debugger to a process running as different user Visual Studio 2012/2013 -

Image
i have windows service running low privileged domain account. account local administrator. when try attach debugger service when project/solution open in visual studio 2012/2013 error "unable attach process. operation not supported. unknown error: 0x80072ee6." did not have problem vs 2010. if close project/solution , try again, able attach. reproducible every time. my setup: windows server 2008 r2 64 bit. visual studio 2013 ultimate (had same issue in 2012) running domain account part of local administrator group. msil windows service running 64 bit. running locally . built c#/.net 4.5.1 how can keep project/solution open , attach debugger process?

Implement Association in MongoDB -

i need implement association between objects in mongodb allow retrieval queries level. suppose have model account->application->device->users . suppose want query on user collection using account reference, or level of hierarchy want query on users. as have no support joins cannot keep separate association collection, if keep association collection have series of queries, , output association collection can huge array of objects , left 2 options use iterative query each object array use $in operator both disastrous use if array big. i have figured out approach keep tree of ancestors follow document. { _id: objectid(""), name:"", timestamp:isodate(" "), ... ancestors :[{_id:objectid(""),..},{_id:objectid(""),..},{_id:objectid(""),..}] } suppose users document ancestors deviceid,applicationid,accountid. not sure how useful be. 1 thing sure above model if new level in added updating

java - NullPointerException using getResource -

i'm trying create application recognize faces, following this tutorial . however, whenever run code below, error: exception in thread "main" java.lang.nullpointerexception class detectfacedemo { public void run () { cascadeclassifier facedetector = new cascadeclassifier(getclass() .getresource("/lbpcascade_frontalface.xml").getpath()); } } am supposed copy xml file directory? thanks! from comment, think put main/resources in wrong directory (and forgot src part of tree). from tutorial, should have following structure: src/main/java/<java packages or classes> you have src folder there. create main directory in src , , resources directory in main . put xml file in resources directory , should go.

c# - How can I stop Entity Framework caching my data? -

before marks duplicate answer, please read carefully, haven't yet found question deals scenario... i'm developing asp.net mvc application in vs2013 uses ef6. below refers debugging sessions, not deployed instances. on dev machine via vs , sql server 2008 r2 management studio. the mvc project has injected (using ninject) instances of business logic layers, , these in turn have injected repositories. repositories query database via ef. i added data database directly (ie ssms, not via code in application), , showed on web site correctly. modified data, again via ssms, , time web site showed duplicate entries, know definite there aren't any. i know context caching, stopped debug run , pressed f5 again in visual studio, thinking destroy context , create new 1 in new debugging session - duplicate data still shown. hmm, restarted vs, kill off context , web servers running, , tried again - duplicate data still shown. hmm, let's try restarting sql server - same p

service - WMI StartService Parameter -

i starting service in c# code using wmi, , set startup parameters. is there way this? couldn't find relevant far. thanks in advance. thomas. these other posts helped me solve issue : https://superuser.com/questions/809868/wmi-startservice-parameter dynamics ax 2012 regconfig not work

google app engine - GAE Python: Webapp2 Equivalent of Flask request.data -

i had convert python flask code webapp2 code (used in gae). flask code snippet if request.method == 'post': post_body = urlencode(request.data) attempt 1 if self.request.method == 'post': post_body = urllib.urlencode (self.request.data) error :: file "/base/data/home/apps/s~myapp/1.378592258368936474/main_v3.py", line 1397, in post post_body = urllib.urlencode (self.request.data) file "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webob-1.1.1/webob/request.py", line 1238, in __getattr__ raise attributeerror(attr) attributeerror: data attempt 2 if self.request.method == 'post': post_body = urllib.urlencode (self.request.body_file) error :: file "/base/data/home/apps/s~myapp/1.378591983192817348/main_v3.py", line 1397, in post post_body = urllib.urlencode (self.request.body_file) file "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urll

grails - How to render Json data which is Needed -

[ {name: "name1", y: val1}, {name: "name2", y: val2}, {name: "name3", y: val3}, ..., {name: "namen", y: valn} ] i value in json format how use this format in piechart in grails ? just put values in hash , use render json. def getorganizationgroups() { def result = grouptype.findall().sort({it.sortorder}).collect() { [ code: it.grouptypecode, name: it.displayname, sort: it.sortorder ] } render(result json) }

Heroku No valid, non-passphrase-protected keys given error -

i have files: addtrustexternalcaroot.crt star_mydomain_com.crt trustedsecurecertificateauthority5.crt usertrustrsaaddtrustca.crt domain.key domain.key passphrase protected , generated during creation of csr files (files required .crt files certificate provider. tried: heroku certs:update certs/star_mydomain_com.crt certs/domain.key but following error: ! no valid, non-passphrase-protected keys given. how can generate valid crt/key heroku? (i tried other crt files domain key not valid domain certificates. domain.key generated following command: openssl genrsa -des3 -out domain.key 2048 here's how remove passphrase private key: openssl rsa -in certs/domain.key -out certs/domain-nopassphrase.key you'll need enter current passphrase on private key. if prompted passphrase on new key, not enter 1 (just press enter). you can update ssl endpoint using cert + new key: heroku certs:update certs/*.crt certs/domain-nopassphrase.key

find and replace string (regex) across multiple files in linux using sed -

i have list of files strings {{abc-exfs-value}} . sub string abc differs in each of file. example, regex search (java) like: \{\{*-exfs-value\}\} return strings of concern here. how proceed on replacing strings match regex pattern in files in linux? i able list of files using grep -r '\-exfs\-value' . . using sed how replace strings? i think what's needed: sed -i.bak 's/\({{\)[[:alnum:]]\+\(-exfs-value}}\)/\1xyz\2/g' file1 file2 ...

javafx - How can I rotate a label -

in javafx 8 specify css rotate label instead of text going left right, goes bottom top. how can that? any node can have it's rotation styled via css using -fx-rotate css attribute. this angle of rotation in degrees. 0 degrees @ 3 o'clock (directly right). angle values positive clockwise. rotation center. so in code or fxml can have: label.setstyle("vertical"); and in css stylesheet can define: .vertical { -fx-rotate: -90; } also note james_d's answer suggestion of wrapping label in group account rotation when performing layout bounds calculations.

c# - Get IP address used by HttpWebRequest -

i trying reach domain hosted on several ip's. when ip range changes, our firewall block requests since ip not allowed. the app notify cannot establish connection, not tell ip address trying use. i using httpwebrequest create request, , httpwebresponse receive response it doesn't seem httpwebrequest has ip address in property when instantiated url, or after request has been made. i hesitant see if can httpwebresponse because don't know if have ip address if firewall blocks it. one example has been mentioned set delegate to: static void main(string[] args) { httpwebrequest req = (httpwebrequest)webrequest.create("http://www.microsoft.com"); req.servicepoint.bindipendpointdelegate = new bindipendpoint(bindipendpoint1); console.readkey(); } public static ipendpoint bindipendpoint1(servicepoint servicepoint, ipendpoint remoteendpoint, int retrycount) { string ip = remoteendpoint.

php - Getting the property value from an array contained in an object that itself is contained in another object -

i trying property of array contained within object contained in object. the code below var_dump ed object . trying value property identity i.e 'identity' => int 101 .. i put 'identity' => 101 in asterisk demonstration purposes only; rendered values not have asterisk. 4th last line of code. i know how values multidimensional arrays; not sure multidimensional objects object(zfcuser\authentication\adapter\adapterchain)[373] protected 'event' => object(zfcuser\authentication\adapter\adapterchainevent)[456] protected 'name' => string 'authenticate.success' (length=20) protected 'target' => &object(zfcuser\authentication\adapter\adapterchain)[373] protected 'params' => array (size=4) 'request' => object(zend\http\phpenvironment\request)[194] ... **'identity' => int 101**

tags - break a line in XML -

reminder: dont have experience on code @ all. im working on xml file/code notepad ++, code im working on: <textobject name="cmnaorigen" left="6.5" height="1.5" top="3.2" width="6.0"> <text>av. el bosque norte 500 - of. 1102 las condes - santiago - chile tel: (56-2) 2362 2200 - fax: (56-2) 2362 2496 </text> <color r="0" name="black" g="0" b="0" a="255"/> <font name="arial" sizeinpoints="8" italic="false" bold="false"/> <border> <backgroundcolor name="white" r="255" g="255" b="255" a="255"/> </border> <objectformat horizontalalignment="leftalign" enablesuppress="false"/> </textobject> what im trying break lines in text this: av. el bosque norte 500 - of. 1102 las condes - santiago - chile tel: (56-2) 2362

python - Generating Boolean Expressions from Subqueries in SQLAlchemy -

i have following sqlalchemy models: pending_state = 'pending' complete_state = 'success' error_state = 'error' class assessment(db.model): __tablename__ = 'assessments' id = db.column(db.integer, primary_key=true) state = db.column( db.enum(pending_state, complete_state, error_state, name='assessment_state'), default=pending_state, nullable=false, index=true) test_results = db.relationship("testresult") class testresult(db.model): __tablename__ = 'test_results' name = db.column(db.string, primary_key=true) state = db.column( db.enum(pending_state, complete_state, error_state, name='test_result_state_state'), default=pending_state, nullable=false, index=true) assessment_id = db.column( db.integer, db.foreignkey( 'assessments.id', onupdate='casc

php - How would I handle game actions through a REST API? -

i have php-based game works in typical request/response fashion, generating , outputting pages. wish separate presentation , game logic, porting api-based (using phalcon ). allow me make mobile app can interact same code base. i'm new whole rest api thing trying follow guidelines set forth in restful web services . understanding api should work follows: post /v1/users adds new user. /v1/users returns list of existing users... , on. however, client consuming api (via ajax likely) should issue higher-level commands. example, don't want savvy user making api call modifies experience. instead, data modification side effect of game action takes place based on player input. for example, client may "hey, attack monster", @ point server verify player has enough energy, carry out attack, add gold , experience player, , return result client. these actions transactional, multiple conditions needing true , multiple results needing occur in order action considered succ

python - Django, sending emails through Mandrill without language_code setting -

i'm using mandrill api send emails. problem emails don't have proper language_code setting used in settings.py in settings.py file have following lines: template_context_processors = ( "django.contrib.auth.context_processors.auth", "django.core.context_processors.request", "events.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.tz", ) ... language_code = 'es' time_zone = 'utc' use_i18n = true use_l10n = true use_tz = true in managment/commands/sendmails.py , of code send emails is: def generate_html(events): template = loader.get_template('mail_request_list.html') return template.render(context({'events': events})) def send_emails(): mandril_client = mandrill.mandrill(key) message = { 'from_email': 'info@myapp.com', 'from_name': 'myapp', 's

asp.net web api - Handle NullObjects across two models web api -

i have 2 models in asp.net web api. 1 database model, , other model end user passes in , map properties this: public static individualproc toindividualnternal(this assignmentexternal item) { return new individualproc() { individualid = (int)item.person.id, eventid = (int)item.event.id, eventscehduleid = item.schedule.id, eventgroupid = item.group.id }; } the problem when user passes null, exception; "nullable object must have value". how can cast nullable properties exception not caused? what's nullable? purpose of answer i'm going assume nullable int: item.event.id and regular int: eventid in case, can't directly cast former latter because there's no way int handle case of null value. nullable<t> structure has properties check value: eventid = item.event.id.hasvalue ? item.event.id.value : default(int) this check if nullable int ha

c# - $Metadata with WebAPi OData Attribute Routing Not Working -

i'm using odata attribute routing odata endpoint. here example of have: [odatarouteprefix("profile")] public class profileodatacontroller : odatacontroller { [odataroute] [enablequery] public ihttpactionresult get() { var repo = new repositories.profilerepository(); return ok(repo.getprofiles()); } [odataroute("({key})")] [enablequery] public ihttpactionresult get([fromodatauri] string key) { var repo = new repositories.profilerepository(); var result = repo.getprofiles().singleordefault(x => x.id== key); if (result == null) return notfound(); return ok(result); } } here set up: config.mapodataserviceroute("odata", "odata", modelgenerator.getedmmodel()); here edmmodel generation: public static iedmmodel generateedmmodel() { var builder = new odataconventionmodelbuilder(); builder.entityset<profile>("profile").

Best Approach for JPA lazy loading over Rest/AngularJS -

sorry general question, there approach still using jpa lazy loading of entities, when developing restful angularjs application. in old jsf days, work when backing bean accessed list. i using eclipselink , spring data, jersey restful end points. regards i generally you'd have trigger lazy loading of entities prior entitymanager being closed during lifecycle of request. to so, can use "open entitymanager in view" pattern. spring provides filter can apply: openentitymanagerinviewfilter (read docs here: http://docs.spring.io/spring/docs/4.1.0.release/javadoc-api/org/springframework/orm/jpa/support/openentitymanagerinviewfilter.html ). alternatively, can manually call getmylazycollection() on jpa entity(ies) prior serializing them json.

recursion - understanding compareto() method in java -

i came across mit lecture on recursion checked palindrome using recursion,and there checked using logic compare first , last alphabet , on.. thought follows just pseudo code: string original="abba"; string reverse = ""; for(int i=original.length()-1;i>=0;i--) { reverse+=new string(original.substring(i,i+1)); } if(original.equals(reverse)) system.out.println("palindrome"); else system.out.println("not palindrome"); i have 2 doubts is logic better recursion or conventional logic in terms of time complexity? how compareto() method checks if strings equal? compare bytecode or something? you should use equals , not compareto , since compareto returns int , not boolean if condition expect. alternately can check if (original.compareto(reverse)==0) , means strings equal. as how compareto works, compares each pair of characters having same index, , returns difference betwe

html - Responsive footer goes to top on mobile; sticks to bottom on phone emulators and desktop? -

recently deployed responsive word press template minimal plugins. footer works on mobile phone emulators , desktop. on actual devices, shoots right below headers above content. want footer stick bottom. my mobiel test device nexus 5(1080p). i've tried altering footer usual suggestions nothing works both. turned off php functions fo determining mobile still doesn't work. here's footer css here responsive css , php code if ($px_theme_option['responsive'] == "on") { echo '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">'; wp_enqueue_style('responsive_css', get_template_directory_uri() . '/css/responsive.css'); css( relvant footer classes responsive.css) /*============ media 768px start ============ */ @media (min-width: 768px) , (max-width: 979px) { #footer{ overflow:

android - How to use TextToSpeech: stopping and playing again? -

i have problem tts. i'm using code below, when tts "is speaking", calling tts.speak() after tts.stop() doesn't work (no voice). both return 0 ( success ). can wrong ? better approach ? if(tts.isspeaking()) { tts.stop(); // return success } tts.speak(longtext, texttospeech.queue_flush, null); // return success i not quite sure you're trying accomplish if want ignore speaking, can use queue_flush without stop(). //if(tts.isspeaking()) { // tts.stop(); //} tts.speak(longtext, texttospeech.queue_flush, null);

Automatic crop filling in HTML & CSS -

i working on tumblr blog, in photos cropped square. effect works when photos portrait not landscape. instead, photos shown landscape. @ http://hugowolfdesigns.tumblr.com/ see mean (the first , second photos show not desire; third photo shows effect i'm trying achieve). what code can use make photos crop way square shape? this use crop currently: <div id = "photo"> <a href="{permalink}"><img class = "default" img src="{photourl-500}" width="250"/></a> </div> however if use height="250" stretches photo, rather cropping it. you need assign width or height image depending on whether landscape or portrait image. in instance control width/height in css, not inline. use jquery assign correct class correct image type. example http://jsfiddle.net/xukcc3sv/ css img.portrait, img.square { width: 100px; } img.landscape { height: 100px; } jquery // i've added ca

css - HTML date display alignment -

i designing web page has list of dates appearing on below other. want align dates such line below each other. have tried using align didn't make difference. tried putting style tag got error said: "element "style" not allowed child of element "div" in context." here's code of page: <div class="report-title"> <h1>response tracking report</h1> </div> <div class="info"> <div style="width:93%;float:left;"> <p class="title">project: </p> <p class="value"><?php echo $response_data['project_name']; ?></p> </div> <div class="spacer"></div> <div style="width:7%;float:left;"> <p class="value"><?php echo date("y-m-d"); ?></p> </div> <div class="bottom"></div> </div&g

actionscript 3 - AS3: Error Access of undefined property -

hey guys seem having huge brain fart today, can't see figure out doing wrong here when creating button. here's lines of code set of eyes me figure out i'm doing wrong. name_btn.addeventlistener(mouseevent.click, scrollbox); function scrollbox(event:mouseevent):void{ } i left out code in between these 2 lines there wasn't lot of things go through.

selenium - Chrome not working with Robotframework / Selenium2Library -

i trying use chrome browser test cases. same tests work fine firefox , phantomjs. , chrome browser starts never opens page. i have installed 1. chromdriver : port=9515 version=19.0.1068.0 2. chrome : version : 37.0.2062.120 (64-bit) 3. selenium: version : 2.42.1 4. robotframework : version : 2.8.5 i think have paths variables configured accordingly well. google-chrome , starts chrome chromedriver , starts chromedriver following line responsible starting chrome , opening page. *** variables *** ${browser} chrome ${my-url} http://www.google.com/ open browser | ${my-url} | ${browser} errors : chrome: webdriverexception: message: u'unable either launch or connect chrome. please check chromedriver up-to-date. using chrome binary at: /opt/google/chrome/google-chrome' webdriver logs shows error initializing session capabilities { "browsername": "chrome", "chromeoptions":

apache - PHP not loading php.ini -

running php/apache on redhat 6.5 environment. running issues php installation. php installed , compiles source , used following command configure it. './configure' '--prefix=/u/g/php' '--with-libxml-dir=/u/g/util/libxml2/' '--with-apxs2=/u/g/apache/bin/apxs' '--with-config-file-path=/u/g/php/config' '--enable-mbstring' this works can run php , appache. trying enable extension , php.ini file have configured not getting read. in php_info() has configuration file (php.ini) path /u/g/php/config however understand it, should contain file /u/g/php/config/php.ini started/stopped service.. any ideas? most servers have more 1 php.ini file. best guess you're editing wrong one. see 1 being used php, run this: <?php $inipath = php_ini_loaded_file(); if ($inipath) { echo 'loaded php.ini: ' . $inipath; } else { echo 'a php.ini file not loaded'; } ?> edit: if returned 'not loaded

Django REST Framework Customized Json Data Format -

i, started using django rest framework few days ago, it's wonderful framework, can't find info this: serialized model "deposito" , data in json format succesfully, want add fields total (total records). thanks help. data obtained serializers.modelserializer [{ "id": 78, "numero": "2014051100001", "monto": "100.00", "ingreso": "2014-08-13t22:30:00z", "entregado": true }, { "id": 533, "numero": "2014051100221", "monto": "200.00", "ingreso": "2014-08-22t14:45:00z", "entregado": true }] data want get { "rows": [{ "id": 78, "numero": "2014051100001", "monto": "100.00", "ingreso": "2014-08-13t22:30:00z", "entregado": true

join - SQL 4 tables query -

can me queries wrote, , didn't work correctly, maybe except first one. we have 4 tables - columns: table_cars - id | brand | type | license table_equipments - id | name | description table_distances - id_car | date | distance table_cars_equipments - id_car | id_equipment and questions: show cars have equipment "fire extinguisher" , have been driving yesterday show brands no equipments show total distance driven car "xxxx" in last month show average distance per day driven cars "some description" my solution: select table_cars.id, table_cars.brand, table_equipments inner join table_cars_equipments on table_equipments.id = table_car_equipments.id_equipment inner join table_cars on table_cars .id = table_cars_equipments.id_car inner join table_distances on table_distances.id_car = table_cars.id table_equpments.name = 'fire extinguisher' , table_date.date = now() - interval 1 days; select table_cars.brand

python - Efficiently find overlap of a lists of tuples -

i have bunch of lists, each composed of tuples. a = [(1,2,3),(4,5,7),(8,9,10),(5,6,2)] b = [(1,3,6),(4,2,8),(3,6,7),(5,2,8)] c = [(6,2,3),(1,7,2),(5,7,2),(7,2,7)] i need find group of tuples such first element of tuple appears in every list. (i know confusing) above example, overlap be: overlap = [(1,2,3),(1,3,6),(1,7,2),(5,6,2),(5,2,8),(5,7,2)] this because tuple number '1' in first element of tuple appears in every list. same number '5'. what best way this? i have working code, feel there better way this. big_list = [a,b,c] overlap = [] all_points = list(set([item item in big_list])) (f,s,t) in all_points: in_all = true lest in big_list: present = false (first, second, third) in lest: if first == f: present = true if not present: in_all = false if in_all: overlap.append((f,s,t)) you can use set intersection this: >>> itertools import chain >>

c# - ASP.NET Razor views are not updating when simply updating html -

asp.net razor views not updating when updating html. i'm trying add few elements on page when application running in debug mode, , changes not being seen in browser when refresh page. however, if stop , restart application, changes seen. i've tried disabling cache, sending headers (pragma no-cache), shift reload on browser, nothing seems work. this quite frustrating having continually bounce app. what i'm using: asp.net 4.5, iisexpress, visual studio 2013. does know how turn off output cache can debug without having restart entire application? thanks try hitting ctrl+f5 on web page. old files may cached browser. see question more details: get rid of [dynamic] javascript views in visual studio

c - Why does this greater than function work? -

i working on homework assignment supposed make function called isgreater(x,y) returns if x larger y, can use bitwise operators along + , !. have solved problem, using rule if x , y have different signs, x >= 0 , y < 0 or if x , y have same sign if y-x negative. however, when looking around how other people solved it, noticed following method works correctly whatever reason. y = ~y; return !(((x&y) + ((x^y) >> 1)) >> 31); i cannot life of me understand why works, figure has first bit in x isn't set in y or something? note: apparently valid solution if x , y ints, not unsigned int. 31 means interested in sign. if ((x&y) + ((x^y) >> 1)) > 0 x > ~y. x & ~y produce number msb first bit x has set bit , y has 0. x^~y produce number unset bits represent bits x , y differ. if shift right 1 need sum become positive. happen if first nonzero bit of of x&y (meaning first bit x set , x , y different) meets set bit in ((x^y)