Posts

Showing posts from February, 2015

php - str_replace wordpress menu -

i have menu of following hyperlinks. 1) our work 2) clients 3) 4) contact my question is, how can prevent following code not replace li in 'clients'? it outputs 'caents', although need stop outputting <li> tags in menu. <nav> <?php // first let's our nav menu using regular wp_nav_menu() function special parameters $cleanmenu = wp_nav_menu( array( 'container' => false, // div outside menu ul, don't need 'depth' => 0, 'sort_column' => 'menu_order, post_title', 'echo' => false, // don't display yet ) ); // find closing bracket of each li , opening of link, instances of "li" $find = array('><a','li'); // replace former nothing (a.k.a. delete) , latter "a" $replace = array('','a'); echo str_replace( $find, $replace, $cleanmenu ); ?> </nav> i wouldn't recommend parsing html way. take time , lea

java - Intent to HomeActivity after login status success -

this loginactivity.java this send login details httpasynctask .java final button button = (button) findviewbyid(r.id.btnlogin); button.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { try { // email edit view value string email = emailet.gettext().tostring(); // password edit view value string password = pwdet.gettext().tostring(); // instantiate http request param object // requestparams params = new requestparams(); // when email edit view , password edit view have values // other null if (utility.isnotnull(email) && utility.isnotnull(password)) { // when email entered valid if (utility.validate(email)) { //call async task jsonobject js = new httpasynctask(getapplica

java - How to read inputs from console -

i have read following format. 1 12 23 34 so, inputs separated line. i have tried following br = new scanner(system.in); num = integer.parseint(br.next()); while(br.hasnextint()) { num = br.nextint() ; system.out.println(num); } but not working expected. if enter first input, started processing , prints. not waiting me enter next line. in c, can make use of sscanf. in java have no idea how allow user enter multiline input? plese suggest ideas try br = new scanner(system.in); while (true) { int num = integer.parseint(br.nextline()); system.out.println(num); }

scene2d - Flicker of ImageTextButton in libgdx -

Image
i'm creating store stage in libgdx using scene2d.ui package. i'm seeing weird flicker when showing stage larger versions of buttons appear behind smaller buttons: the larger background buttons flicker on , off, while front ones appear normal. background ones aren't clickable, front ones - again, appear normal. here relevant code: private void init(skin skin) { this.skin = skin; boytexture = new texture(gdx.files.internal("images/character.png")); cattexture = new texture(gdx.files.internal("images/character_cat_girl.png")); horntexture = new texture(gdx.files.internal("images/character_horn_girl.png")); pinktexture = new texture(gdx.files.internal("images/character_pink_girl.png")); queentexture = new texture(gdx.files.internal("images/character_queen_girl.png")); // set root table table = new table(); table.setfillparent(true); addactor(table); table.add(new label("characte

File transfer between java client and c server -

i trying send file java client c server......the issue c server receiving 1 byte @ time irrespective of buffer size......i wanna tranfer data in chunks (may 512 bytes or more) @ time......can take , point out whats wrong or must changed....thanks in advance... c server: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <pthread.h> #define port 8880 #define filename "incoming.txt" void* thread_proc(void *arg); int main(int argc, char *argv[]) { struct sockaddr_in saddr; int sockfd,connfd; int status; pthread_t thread_id; int val; sockfd = socket(af_inet, sock_stream, ipproto_tcp); val = 1; status = setsockopt(sockfd, sol_socket, so_reuseaddr, &val, sizeof(val)); if (status < 0)

python - Re-mapping a sorted list into a dictionary -

i've got dict of page ids mapped supporter ids. split them lists called avatars , non_avatars , because want them sorted avatars, , without (respectively), , want sort them on ['user']['supported_date'] . here original data dict: pages = { 274: { 1307: { 'support': 1, 'profile_id': 1307, 'id': 16, 'user': { 'first_name': 'robot10', 'photo': '/static/images/avatars/avatar-male-100.png', 'supported_date': '2014-11-18 19:56:35.961452+00:00', 'id': 1307, }, }, 1298: { 'support': 1, 'profile_id': 1298, 'id': 19, 'user': { 'first_name': 'robot1', 'photo': '/user_photos/01/f2/01f236a6a15fee6

html - Scroll issue with tody in ipad -

while adding check-box body of table extremely slows down scroll actions on ipad. issue ipad. mozilla ,chrome in ie 10+ works fine. without check-box works fine in ipad. don't know why addition of check-box slows down scroll's performance.i faced issue while using following code: .custom-table { table { width: 100%; table-layout: fixed; border-collapse: collapse; } .header { border-top: 1px solid #dae3e9; tr { padding: 5px 0 5px 0; } } table > thead > tr > th >.custom-checkbox { display: inherit; float: left; } table > tbody> tr >td { width: 600px; padding: 0; height: 30px; border-bottom: 1px solid #dae3e9; .custom-checkbox { margin-bottom: -15px; margin-top: 0px !important; } span.text-limit{ width:70%; } } td.property{ text-ali

java - finalize() not getting called -

why finalize() not being called here. code compiled , ran there wasn't output. package temp; public class temp { int i; temp(int j) { = j; } public void finalize() { if (i == 10) { system.out.println("finalize called."); } } public static void main(string[] args) { temp obj = new temp(10); system.gc(); } } your call system.gc(); makes no difference, since temp instance has reference ( obj ) it's not eligible garbage collection. even if eligible garbage collection, calling system.gc(); doesn't collect objects have no reference them immediately.

memory - Web driver brower heap analysis -

we running our integration tests using selenium web driver(chrome/ie/firefox). is there options analyze browser memory usage (heap analysis) web driver tests. (or) how can integrate integration tests. is there options save browser heap snapshot while running web driver test. please suggest. not sure if helped, ran tests locally , looked @ system usage on computer. its not exact, gave me ball park 512m in use per thread. basically, added chrome jobs , chromedriver job , used heaviest java job. if have found better way please share :)

python - How to comprehend instructions like json.load(fp[, encoding[, cls[, obje...... ? -

i came across when reading python official documentation json.load : json.load(fp[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]]) may know how should comprehend this? for example, if want set parameter parse_float 3 , how should construct argument? also, [, ....] mean? why there comma preceding formal parameters? the square brackets […] common metalanguage notation used denote optional component of syntax in documentation , manuals. "optional" here means can either omit or keep inside brackets (but not subset of it). in sense analogous (…)? in regular expressions. the usage predates python: can find in various unix manpages. not part of python's syntax, though find in many docs. when documentation says: foo(x[, y]) formally, means both of following acceptable: foo(x) foo(x, y) for example: json.load(fp[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse

android - Get experience points and level from google plus profile or Get Data from google plus profile -

Image
i using google play game services in game data , leaderboard scores google leaderboard. i noticed screen in leaderboard profile. as can see name , , level , xp points. i wondering there way these data can show in custom leaderboard. i got data name , profile image. but couldnt find way game data. suggest me ideas. for getting player's experience points , level ,first have fetch local player signed in game.for should use player manager of gpgs sdk player object contains required information. please check link: player api reference

parse.com - Lazy Loading using JQuery dataTables with Parse database -

i using jquery datatables display data parse.com. have 5000 rows in database , tables takes long time load. i've attempted solve problem using lazy loading via jquery datatables pipeline. looked @ example: http://www.datatables.net/examples/server_side/pipeline.html not working me. using rest api parse url. below code. please help. thank you! // pipelining function datatables. used `ajax` option of datatables // $.fn.datatable.pipeline = function ( opts ) { // configuration options var conf = $.extend( { pages: 5, // number of pages cache url: '', // script url data: null, // function or object parameters send server // matching how `ajax.data` works in datatables method: 'get' // ajax http method }, opts ); // private variables storing cache var cachelower = -1; var cacheupper = null; var cachelastrequest = null; var cachelastjson = null; return function (

windows phone 8 - windowsphone 8:How To Avoid White Blank Screen Splashing a Second Before Loading WebBrowser -

i want resolve issue when i'm loading content of html in webview white blank screen splashing on webview.is browser default background color?or behaviour this? there solution issue.please 1 how resolve issue. you have make visible after navigation completed. see here more info: windows phone webbrowser control tips

asp.net - Bootstrap CSS for RadiobuttonList -

Image
radion button : <div class="control-group"> <label class="control-label">mode</label> <div class="controls"> <asp:radiobuttonlist id="radiobuttonlist1" cssclass="radio" autopostback="true" title="please select mode of payment" repeatdirection="horizontal" onselectedindexchanged="radiobuttonlist1_selectedindexchanged"> <asp:listitem>cash</asp:listitem> <asp:listitem>cheque</asp:listitem> <asp:listitem>demand draft</asp:listitem> <asp:listitem>net banking</asp:listitem> </asp:radiobuttonlist> </div> </div> i have applied bootstrap css for: text box, dropdown list, textarea, buton, etc. everything looks fine, except radiobutton list, looks terrible: how solve ? i not use <

java - Getting exception while refreshing Spring ApplicationContext in Spring Boot application -

we using spring boot our application. after starting application, in runtime adding(loading) new bean existing applicationcontext. annotationconfigapplicationcontext appcontext = new annotationconfigapplicationcontext(); appcontext.register(newbean.class); appcontext.refresh(); after adding bean doing refresh of applicationcontext during refresh mbean trying reregister endpoints , getting following error (getting error these endpoints - requestmappingendpoint, environmentendpoint, healthendpoint, beansendpoint, infoendpoint, metricsendpoint, traceendpoint, dumpendpoint, autoconfigurationauditendpoint, shutdownendpoint, configurationpropertiesreportendpoint) caused by: javax.management.instancealreadyexistsexception: org.springframework.boot:type=endpoint,name=configurationpropertiesreportendpoint @ com.sun.jmx.mbeanserver.repository.addmbean(unknown source) @ com.sun.jmx.interceptor.defaultmbeanserverinterceptor.registerwithrepository(unknown source)

plot - R make circle/chord diagram with circlize from dataframe -

Image
i make chord diagram using circlize package . have dataframe containing cars 4 columns. 2 first columns contains information on car band , model owned , next 2 columns brand , model respondent migrated to. here simple example of dataframe: brand_from model_from brand_to model_to 1: volvo s80 bmw 5series 2: bmw 3series bmw 3series 3: volvo s60 volvo s60 4: volvo s60 volvo s80 5: bmw 3series audi s4 6: audi a4 bmw 3series 7: audi a5 audi a5 it great able make chord diagram. found example in worked i'm not able convert data right format in order make plot. code in circlize package. produces 1 layer, guess need two, brand , model. mat = matrix(1:18, 3, 6) rownames(mat) = paste0("s", 1:3) colnames(mat) = paste0("e", 1:6) rn = rownames(mat) cn = colnames(mat) factors = c(rn, cn) factors = factor(factors, levels = fa

javascript - How to include Custom Js in Bootstrap's custom Sub Theme directory For Drupal 7 -

my custom theme doesn't read javascript file have linked in .info file. paths directory correct. while inspecting page shows default bootstrap script files. i had exact same problem. workaround include script in html.tpl.php file: find html.tpl.php under sites > > themes > bootstrap > theme > system. make copy of file , add custom theme directory (sites > > themes > custom theme). create folder in custom theme javascript , name js. add javascript file js folder. open html.tpl.php file copied custom theme, , insert following line anywhere between tags: save, flush chache , should go.

Twilio Error : Authenticate -

hello developers using twilio api , purchased number. i have created secure ssl site uploaded following code. show following error error : authenticate <?php // include twilio php library require 'services/twilio.php'; // twilio rest api version $version = '2010-04-01'; // set our accountsid , authtoken $sid = 'myworkingsid'; $token = 'myworkingauthtoken'; // instantiate new twilio rest client $client = new services_twilio($sid, $token, $version); try { // recent calls foreach ($client->account->calls $call) { echo "call $call->from $call->to @ $call->start_time of length $call->duration"; } } catch (exception $e) { echo 'error: ' . $e->getmessage(); } kindly me in issue

jquery - Extract few key value pair from JSON object to another JSON -

i've got json object that: var storeoriginallist = '[{"store_id" : "1932","store_name" : "1 sale day12","keywordurl" : "1-sale-a-day1234","category" : "stores"},{"store_id" : "1171","store_name" : "100 day loans","keywordurl" : "100-day-loans","category" : "stores"}]' i want extract store_id , store_name , make new json object. my question is, can without looping. if yes, please provide sample code. you can't reasonably without looping, no. try regular expression, a) looping, too, in processing of regex; , b) using regular expressions manipulate non-regular things json or html prone failure. here tools use in solution: json.parse array#map - loops you json.stringify

active directory - Azure AD ACS filter users by group -

i have mvc application , use azure ad (premium) acs authentication allow users access. thing want allow specific users sign-in , not ad members. i found this post side comment said regardless assigned , not - way users can sign in. found acs cannot receive user groups detailed (without using graph api). there way allow access users specific group? thanks! assuming talk access control service - http://azure.microsoft.com/en-us/documentation/articles/active-directory-dotnet-how-to-use-access-control/ . acs can recieve user goups. , done in rule groups. can transform aad group claim role claim. having aad groups turn in asp.net roles. can create new group in aad, enlist set of users in group. later can configure authorization rules in mvc require specific role. there 2 interesting reading on acs subject: acs federation provider, claims transformation federated identity microsoft acs

selenium - run parallel classes in parallel tests -

to reduce run time of tests want run tests in parallel. have few classes can't run in parallel each other. lets have 2 types of classes: - parallel classes - contains class1, class2 - notparallel classes - contains class3, class4 want run class1 , class2 in parallel class3 , class4 (but lass3 not run in parallel class4) i tried this: <suite name="sanity" thread-count="2" parallel="tests"> <test name="parallel" preserve-order="true" parallel="classes"> <classes> <class name="class1"/> <class name="class2"/> </classes> </test> <test name="notparallel" preserve-order="true"> <classes> <class name="class3"/> <class name="class4"/> </classes> </test> </sui

maven - How to build all modules from a certain aggregator project and all dependencies of those modules? -

with maven, can specify list of projects build (-pl) , indicate dependencies of listed projects should build (-am), example: mvn install -pl examplegroup:exampleartifactid -am is there way specify projects build should projects given aggregator pom? have tried enter aggregator project -pl option, doesn't seem build configured modules @ all. example: examplegroup:a has: <modules> <module>b</module> <module>c</module> </modules> examplegroup:b has: <modules> <module>d</module> <module>e</module> </modules> now want build both d , e , dependencies. if there dependency d or e c, build modules. if there no dependency, d , e should build.

html - Issue with Twitter Buttons -

Image
i'm having sort of issue twitter button on webpage. in firefox developer edition, background of webpage causes button render incorrectly. example: #container { background-color: #f0f1f4 } causes text within button render white. here's how looks: what's that? edit bug in firefox developer edition, , not carry on official firefox release. bug report has been filed: firefox bug #1112240 the text on twitter button takes color of container, #f0f1f4. you need specify in style sheet own color: a.twitter-share-button { color: #333; } i hope helps, please read more documentation there: https://dev.twitter.com/web/overview/css

javascript - ReferenceError: display is not defined -

i got 'referenceerror: display not defined' script link below. <script type="text/javascript" src="catalog/view/javascript/jquery/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="catalog/view/javascript/jquery/ui/jquery-ui-1.8.16.custom.min.js"></script> i replace them latest version 1.11.1 , tried <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> but still there reference error. should change display function(script): function display(view) { if (view == 'list') { $('.product-grid').attr('class', 'product-list'); $('.product-list > div').each(function(index, element) { html = '<div class="left">'; var image = $(element).find('.image').html(); if (image != null) { html += '<div class="image&quo

php - OS X install libcurl / Solr installation -

i set default apache server php on os x yosemite, installed pear, installed solr brew ( brew install solr ) , trying install solr extension php pecl using pecl install solr this gives me error configure: error: please reinstall libcurl distribution - easy.h should in <curl-dir>/include/curl/ error: `/private/tmp/pear/install/solr/configure --enable-solr-debug=no --with-curl=/usr --with-libxml-dir=/usr' failed however, curl command available in terminal. did give wrong path when asked during installation enable solr debugging (compiles solr in debug mode) [no] : libcurl install prefix [/usr] : libxml2 install prefix [/usr] : and, if yes, how find right path? or need install curl again and, if yes, best way , can using homebrew? i same problem libxml2, won't i? thanks guys! the problem solved installing os x developer tools. you can via terminal executing xcode-select --install i hope may having same problem!

javascript - node.js 100% CPU -

Image
i have problem node.js application. i'm using websocket transfer data mysql , works , fast till time when node raise consume 100% cpu, such 100% take long time, 1 hour. , during communications between server , websockets slow down. know reason , how resolve it? here screens server: top command: profiler:

http - Passing a value with ajax and catching with php -

after 3 days , many lame questions on community,i finnaly understand little bit of ajax post...still couldnt find answer 1 little problem.how catch value passed ajax,with php? $(document).on('click','tr.listcontractrow', function(e){ var path = $(this).data('path'); $.post("contract.php", {id: path}, function(data){ alert("data sent , received: " + path); }); }); the values sent, i've tested it,the alert shows right value,i checked console log.but somehow cant catch php....: if(isset($_post['id'])){ $var = $_post['id'] echo $var; } but without succes.any ideas? update: echo '<table>'; $row=mysql_fetch_array($query){ echo '<tr class="listcontractrow" data-path="'.$row['id'].'">'; echo '<td></td>'; echo '<tr>'; } echo '</table>'; the visible thing can see there mi

android - AudioRecord Lollipop crash -

i have crash in app in lollipop, working perfect previous versions. crash: f/libc (25307): fatal signal 7 (sigbus), code 2, fault addr 0x993b260c in tid 25750 (pool-16-thread-) i/debug (14112): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** i/debug (14112): build fingerprint: 'google/hammerhead/hammerhead:5.0/lrx21o/1570415:user/release-keys' i/debug (14112): revision: '11' i/debug (14112): abi: 'arm' i/debug (14112): pid: 25307, tid: 25750, name: pool-16-thread- >>> de.shopnow <<< i/debug (14112): signal 7 (sigbus), code 2 (bus_adrerr), fault addr 0x993b260c i/debug (14112): r0 993b260c r1 8fd03344 r2 000006fc r3 00000004 i/debug (14112): r4 00001500 r5 00000000 r6 993b2d0c r7 9e8ed640 i/debug (14112): r8 00000700 r9 b591bd0c sl 8d1ff7d4 fp 00000000 i/debug (14112): ip 80000000 sp 8d1ff7c0 lr b58da9b7 pc b6f4cef8 cpsr 800b0030 i/debug (14112): i/debug (14112): bac

php Opening file using file_get_contents or curl through windows auth -

ive got website want open file server. server connected using network drive. the file uses windows authentication. because of this, using echo file_get_contents('\\\**.**.local/data/user/*/*.xlsx'); results in file_get_contents(\\*.*.local/data/user/*/*.xlsx) [function.file-get-contents]: failed open stream: permission denied i found similar problem here: how use file_get_contents() retrieve file behind windows nt auth but cant work. using this: geturl('\\\*.*.local/data/user/*/*.xlsx','username','password'); always results in : could not resolve host: \\*.*.local using geturl('file://*.*.local/data/user/*/*.xlsx','username','password'); gives me couldn't open file /data/user/ / .xlsx what doing wrong? i think can both use: geturl('file:////*.*.local/data/user/*/*.xlsx','username','password'); or geturl('file://\\*.*.local\data\user\*\*.xlsx'

c# - WPF Handwriting .NET 4.5 Windows 8: Missing IAWinFX.dll and others -

i trying use text recognition wpf inkcanvas control on windows 8.1 computer .net 4.5. note: **wpf inkcanvas control windows 8.1 **, not windows forms, nor windows apps! according should quite easy: msdn: handwriting recognition however when paragraph stuck. add reference wpf ink analysis assemblies, iawinfx.dll, iacore.dll, , ialoader.dll, can found in \program files\reference assemblies\microsoft\tablet pc\v1.7. replace contents of code behind file following code. i not have these files on computer. tried on windows 7 pro pc , can still not find them. from searching stackoverflow , elsewhere seems other people have had similar issues, , there seem several different versions of inking/handwriting recognition available. instance appears putting in windows 8 store app should quite easy. question wpf program .net 4.5 per msdn documentation! i went down exact same path you, , have solution. msdn handwriting recognition link stated doesn't work, , because

formbuilder - Rails: If my Quiz model should be created on completing the quiz, how does form_for know what to refer to? -

i've been told should not create quiz object before quiz completed; user go quiz page, not complete it, , there 'unused' quiz sitting on database. can see logic of that. i can't see how quiz supposed work without being passed @quiz object. here's quizzescontroller, which, when quiz needed, gets routed 'new' action: class quizzescontroller < applicationcontroller def index end def new @user = current_user @quiz = quiz.create(user_id: current_user.id) end def create @results = quiz.where(user_id: current_user.id).last redirect_to results_path end end at moment, can see i'm coding actions possible. later, in 'new' action, i'll add test see if current_user has done quiz and, if so, redirect results_path. here form partial rendered part of quizzes/new.html.erb: <%= form_for(@quiz) |f| %> <p> <%= f.check_box(

Show Grid Item According Screen Size in Android GridView -

Image
hello, develop android app have many categories show. , support multi-screen size. now, decide show gridview sample image. question 1: is ui suitable or not application? if ui not app, please give me advice. :) question 2: is possible implement it? bcz i'm newbie android. have no idea how show grid item count according screen size. please help. question 3: i learn , create app support multi-screen size , responsive layout. there ref: source learn? thank you. try this that worked me [ https://gist.github.com/sakurabird/6868765][1]

PHP 5.3.23 - PHP 5.6.3 - Zend framework 1.12 memory usage increase -

we've been running on php 5.3.23 while , have cron jobs use bit of memory due objects , referencing. crons never exceeded 128m though not 64m. since upgraded php 5.6.3 of these crons use insane amounts of memory , still die, though have not been changed. 1 of these crons surpasses 2gb of memory is there known cause issue? or have more information on how debug it? i've tried - putting in function per loop call, references gone after function, - manual garbage collection - unsetting objects manually - xhprof memory usage it seems keeps climbing up. makes me feel in zend framework mysqli adapter maybe due opcache, stores bytecode in shared memory. it's enabled in php 5.6 default. more info here .

sql - Join tables resulting only one row -

i trying join following 2 tables: table patient | table incident patient.id patient.birthdate | incident.patientid serviceid 1 1/1/2000 | 1 8 2 1/1/1990 | 1 8 3 1/1/2005 | 2 10 4 1/1/1980 | 3 11 5 1/1/2000 | 3 11 6 1/1/1990 | 3 11 7 1/1/1980 | 6 23 8 1/1/2000 | 7 8 in order make age seperation of patients grouped serviceid. select serviceid, sum(case when floor((cast (getdate() integer) - cast(patient.birthdate integer)) /365.25 ) between 0 , 15 1 else 0 end) [under 15],