Posts

Showing posts from April, 2012

ruby - function that returns the number of letters that repeat in a string -

trying make function counts number of letters appear more once anywhere in string (not together, , not the number of times repeat). have: def num_repeats(string) repeat = [] i1 = 0 i2 = 1 while i1 < string.length while i2 < string.length if (string[i1] == string[i2]) && (!repeat.include? string[i1]) repeat << string[i1] end i2 +=1 end i1+=1 end return repeat.length end puts(num_repeats('sldhelanlaskjkajksda')) for reason, pushes first letter of string if first letter has been used in rest of string, after that, seems method stops looping through rest of string. i'd know first why current code not working , if there way fix it, , welcome other better solutions. here orthodox way it: 'sldhelanlaskjkajksda'.each_char.group_by(&:itself).count{|_, v| v.length > 1} # => 6 reason code not work because, (i) once i2

checking array length in java and if array length is 0 then throw custom exception -

i getting list while retrieveing converting array , sending later caller function shown below rokeritemlist = brokerinvoice.getlineitems(); return rokeritemlist.toarray(new brokerinvoicelineitem[rokeritemlist.size()]); now query can happens list retrieved may not contain elements , want put check while converting array before check converted array length , if 0 throw custom exception shown below please advise how implement check throw new aseruntimeexception( " no items there in array "); try like: if (rokeritemlist.isempty()) {//check if list empty //throw exception } //your conversion logic

javascript - divide sentence string into substrings =< length of longest single word -

i newbie, , have pile of data strings (sentences). i'm trying divide each sentence substrings each string's length not exceed length of longest single word in sentence, , returning words in original sequence line breaks (photoshop carriage return, "\r") dividing substrings, sentence. words in each string not hyphenated (only full words or groups of words broken @ space be*).* edit: using maximum characters, longest word's character count... line have 2 or 3 words possibly, length of longest word. i've found examples split , count array of words, order them character length, or add line breaks @ set characters, spaces, etc. none know enough see easy modification outcome. appreciated. using replace can replace spaces \n result. a = 'this show navigation menu when scroll page 0px (in right-way). trying show after 200px (on page scroll-up) means not showing right way want show , hide after 200px when scroll \n page.' b = a.replace(/\

editing html with embedded PHP using javascript -

i hope has answer me, i trying create php product page shop website, have sql table stores name of image prefix eg if image file 'test_1.png' table stores 'test'. using embedded php src="images/shop/<?php echo $row['item_img'], '_1.png';?>"></img> what using js, dynamically update src on mouse click. something eg. var imgswitch = function(i){ document.getelementbyid('js-img').src = "images/shop/ <?php echo $row['item_img'], '_';?>i<?php echo '.png';?>"; } even me seems wrong why i've turned guru's here is there anyway possible? if not, suggestions appreciated i trying figure out asking, , think way go: var imgswitch = function(i){ document.getelementbyid('js-img').src = "images/shop/<?php echo $row['item_img'], '_';?>" + + ".png"; } the change in i, have cut string , add variable.

javascript - .click() jquery function not working. Any ideas? -

https://jsfiddle.net/gmz73oew/ so i'm trying make on click of button height of div grows. i've got animation working smoothly i'm having issues when try make happen via clicking button. $(document).ready(function() { $("#button1").click(function(){ $("#mablock").animate({ height: "950px", top: "0px", }, 2000 ); }); } help appreciated. you need add bracket , semicolon end, close ones $(document).ready(function() { opened: $(document).ready(function () { $("#motherfucking-button").click(function () { $("#mablock").animate({ height: "950px", top: "0px", }, 2000); }); }); //here need ');' https://jsfiddle.net/jofish999/aronp88s/

twitter - How to tag a pic with people in a tweet -

since 2014, twitter makes possible send tweet pics have twitter users tagged in them ( ref ). how can through twitter api, , twitter4j if possible? it looks have released feature of app have not released api's same till now. you can check following forum mentions photo tagging api not publicly available yet. per official update twitter staff on 17th april, not made public yet. can follow @twitterapi / @twitterdev updates new api's add.

css - Wordpress Change Active Submenu Color -

this problem consuming of time , couldn't seem right css code it. here's straightforward question: how change text color/background of active submenu? active, mean submenu page in. i change because what's happening on menu rn: http://i.stack.imgur.com/t1nce.png the blue bg , text color btw autogenerated theme's accent color. not sure if css adding being overridden or not. not familiar css well. have no problems on parent pages. active submenu ones. any highly appreciated ! try .current_page_item { color: #fff!important; } if works css overwritten. go "!important" have in mind steals little performance.

Unindexed remote maven repositories in IntelliJ IDEA 14 -

Image
i've imported existing gradle project intellij idea. keep getting notification: unindexed remote maven repositories found. disable... the following repositories used in gradle projects not indexed yet: http://repo1.maven.org/maven2 if want use dependency completion these repositories artifacts, open repositories list , select required repositories , press "update" button ( show balloon ) so, i've opened repositories list , might imagine there http://repo1.maven.org/maven2 type=remote , updated=never. problem is, when click on update button, idea takes few minutes , reports error. java.lang.runtimeexception: org.codehaus.plexus.repository.exception.componentlookupexception: java.util.nosuchelementexception role: org.apache.maven.execution.mavenexecutionrequestpopulator rolehint: what should now? how can solve problem? i'm not looking way disable notifications this. restarting idea doesn't help, trying

passenger - High memory and CPU consumption for rails application on google cloud -

i have compute engine on google cloud 4 core cpu ivy brigde , 15 gb ram , on have deployed rails application. before had hosted rails application on digital ocean , there getting throughput , cpu , memory consumption minimal. never crossed 3 gb memory consumption on digital ocean , cpu consumption max around 50% - 55%. on digital ocean had single instance 4 core cpu , 8gb ram , running mysql,redis , sidekiq on same instance , still handle load easily. but moved google cloud started facing problems same code. expecting more throughput google cloud google has data centers in asia, started facing issue. when restart apache comes normal , again after 2 - 3 hours goes on consuming memeory , cpu , instance stops responding requests anymore. i checked logs..... , there no increase in traffic, cheked logs during load time ensure whether attacking servers. request found valid browsers valid user agents. i don't understand why happening. first felt if ddos/dos attack din't fi

ios - Make Navigation Bar Fixed When Scrolling in Xcode -

in application added navigation bar scrollable view. when scroll view, navigation bar scrolls it. how can make navigation bar fixed when scrolling? thanks. go "storyboard". click on document outline select view controller. select objects want scroll , go "editor" -> "embed in" -> select "scroll view". add objects selected scroll view. create outlet scroll view , add required scroll view code.

c++ - Why is not Qt label refreshed? -

this method call button click void changelabeltext(qlabel* mylabel) { int countnumber = 0; for(int = 0; < 9999; i++)//outer loop { for(int k = 0; k < 65000; k++)//inner loop { countnumber++; } mylabel->settext(qstring::number(countnumber)); } } when code runs text of label set @ end of outer loop , expected set label's text every time inner loop finishes. might causing it? your code executed in main thread , in main thread th ui update happens on events callbacks. need force repaint ui. can calling repaint() or asking aplication process events qcoreapplication::processevents() . need make after changing label.

java - JAVA_HOME is not set. Unexpected result may occur. Set JAVA_HOME to the directory of your local JDK to avoid this message -

i trying install jboss-as-7.1.1.final. first remarqued can't access administration page of jboss. tried add user , password command prompt , saw message appear: java_home not set. unexpected result may occur. set java_home directory of local jdk avoid message. when i've search problem, i've understand have set java_home in run.bat. run.bat content different: #!/bin/sh # placeholder people used run.sh older version redirecting them read readme echo echo ======================================================================================== echo echo start jboss application server please see `pwd`/../readme.txt echo echo ======================================================================================== echo java_home set environmental(classpath) variable in os. batch files pick java_home value dynamically variable. in windows os :- right click on 'my computer'-->'advanced system settings'-->'environment variab

asp.net - On Form POST values are displayed in URL -

controller's action1 calls view contains following html code: @using(html.beginform("action2","controller",new {id = viewbag.link},formmethod.post,new {@class =""})) { @html.antiforgerytoken() <input type="submit" value= "submit"/> } when user submits form following method called: [httppost] [validateantiforgerytoken] public async task<actionresult> action2(int id) { //something return view("display"); } when "display" view displayed url contains: //controller/action2?id=1 how avoid values being visible in url after formmethod post? it happening because you're sending id route value. if want stay out of url, instead send via hidden input element @using(html.beginform("action2")) { @html.antiforgerytoken() <input type="hidden" name="id" value="@viewbag.link" /> <input type="submit" value=

node.js - cycle for in template and "Cannot read property 'length' of undefined" error when compiling with jade -

so search function route /users/search: // peopleroutes.js:25:16 exports.search = function (req, res) { var term = req.query.term; user.find({$or: [ {username: {$in: [term]}}, {bio: {$in: [term]}}, {location: {$in: [term]}} ]}, function (err, users) { var fn = jade.compilefile('path/to/template.jade'), {}); var html = fn(users); res.setheader("content-type", 'text/html'); res.send(html); res.end(); }).sort({username: 'asc'}); }; this template want retrieve: ul.list-group(id='main-list') user in users li.list-group-item div.col-md-3.no-padd-l img(src= user.gravatarurl, alt='avatar') div= user.location div.col-md-9.no-padd-r div.strong= user.username div= user.bio i continue receive fo

Oracle query to convert multiple column into one column -

i have 50 column in table , returns 1 row , want 1 row 50 column displayed in 50 rows , 1 column. can 1 suggest me oracle query it? you can use unpivot 1 row column values select colvalue ( select * table1 unpivot include nulls ( colvalue cols in (col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, ... col50) ) ); sample output: | colvalue | ------------ | 1 | | 2 | | (null) | |..........| if need column column names pivoted table ditch outer select select * table1 unpivot include nulls ( colvalue cols in (col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, ... col50) ); sample output: | cols | colvalue | -------------------- | col1 | 1 | | col2 | 2 | | col3 | (null) | | ..... |......... | here sqlfiddle demo

java - Keep the value of a string secret -

i have string in android application (in java) key encrypt , decrypt messages. it's simple string declare : final static string mykey = "thekey"; the key never changes (and never displayed in app, nor sent through network or else, "stays" in app). is there way people have apk value of string in app? if answer yes, best way sure value of string can stay secret? is there way people have apk value of string in app ? yes, via decompiling. what best way sure value of string can stay secret ? remove apk. or, not worry being discovered. there steps can take make incrementally more difficult retrieve value, such using dexguard package production app. however, not deter wants value.

Android sqlite database data displaying abnormally -

i relatively new android programming , having few issues how database data fetched. trying create simple messaging application. data in database saving expected when comes displaying issue is. message activity displays messages while view message activity displays activity thread. issue data displayed messages activity ordered in descending mode id of each message loads ascending , thereby messages not actual conversation thread. know why messages id loaded in ascending manner. code below: messages activity package com.package.name; import android.annotation.targetapi; import android.content.context; import android.content.intent; import android.os.build; import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.support.v7.widget.toolbar; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.imagebutton; import android.widget.

javascript - Reliable way to get Device Phone Number -

i cant seem find reliable method of getting device phone number using cordova. have no problem pulling contacts, no luck actual device's phone number. found work around using java, seems absurd go jump through many hoops similar this. this plugin apparently works on phones. both phones tested on, returns blank. as @webduvet said, not possible on ios, plugin android , per source code doing right. 1 should give permission access device details in android. permission reading such things in android device <uses-permission android:name="android.permission.read_phone_state"/> not available in plugin.

c++ - Windows 8 App CoreWindow coordinates are reported 20% larger under Windows 10 -

update 1&2: check bottom of question i have several games (built visual studio 2012 c++ under windows 8.0) on windows store. these games have worked fine under windows 8.0 , 8.1. customers complained that, under windows 10, image not centered , part of 'spills' outside screen. i have reproduced problem installing visual studio 2012 update 4 under windows 10. problem window coordinates reported os 20% larger should be. example, mouse move events on 1366x768 window report coordinates 1645.783 x 925.301. time window dimensions correct (as obtained corewindow::bounds) when app first starts -- resize event mess them (mouse events never correct). the same issue occurs if create blank new project based on "visual c++ >> windows store >> direct3d app" template. the "size of text, apps, , other items" option in windows 10 set 100%, can't see how scaling issue. does know why happening? update 1: upon further testing, problem occurs

java - Android Crosswalk allow multiple windows bug(?) -

i'm developing app crosswalk , tinypass authorization in webview. but, when turned multi-window mode on - executing: xwalkpreferences.setvalue(xwalkpreferences.support_multiple_windows, true); i not able open login window. log messages: e/chromium﹕ [error:gpu_channel_host.cc(175)] gpuchannelhost::createviewcommandbuffer failed. e/chromium﹕ [error:webgraphicscontext3d_command_buffer_impl.cc(226)] failed initialize command buffer. but when turned off mutli-window mode, dialog opened, bug: when finished registration , saw "you have access item" button, after click, activity crosswalk closed, because button executed "self.close()" javascript command. multiple windows must ok, because closes current window, if window one, closes activity. maybe found workaround?

javascript - Ajax Load more Script Bug? -

hey test loadmore script found online. not loading content when done scrolling down. loading when complete scrolled xd ! what wrong ? here code <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script type="text/javascript"> $(window).scroll(function() { if($(window).scrolltop() == $(document).height() - $(window).height()) { $('div#loadmoreajaxloader').show(); $.ajax({ url: "loadmore.php", success: function(html) { if(html) { $("#postswrapper").append(html); $('div#loadmoreajaxloader').hide(); }else { $('div#loadmoreajaxloader').html('<center>no more posts show.</center>'); } }

ios - navigationBar change titleView with animation -

i change content of titleview in navigationbar display different kinds of information, instance uisegmentedcontrol or uilabel. change of information should done transition (segmentedcontrol fades out , label fades in). i tried add multiple uiviews in titleview , animate alpha value, it's not working. [self.navigationitem.titleview addsubview:_mainsegmentedcontrol]; so tried change content during animation since value can't animated called immediately: [uiview animatewithduration:0.2 animations:^{ _filtersegmentedcontrol.alpha = 0.0f;} completion:^(bool finished) { [uiview animatewithduration:0.3 animations:^{ self.navigationitem.titleview = _mainsegmentedcontrol; _mainsegmentedcontrol.alpha = 1.0f; }]; }]; any suggestions?

css - How to align two svg masked images on the same line -

Image
i have svg mask , mask works on image in chrome not allow me align 2 images . when align 2 images , apply mask, displays 1 image , when write text before image, text hides image. this svg code <svg width="0" height="0"> <defs> <clippath id="shape"> <path transform="translate(0.000000,163.000000) scale(0.100000,-0.100000)" d="m373 1197 c-355 -355 -363 -363 -363 -402 0 -39 8 -47 363 -402 355 -355 363 -363 402 -363 39 0 47 8 402 363 355 355 363 363 363 402 0 39 -8 47 -363 402 -355 355 -363 363 -402 363 -39 0 -47 -8 -402 -363z" /> </clippath> </defs> </svg> <img class='photo_rectangle_inverse' src='http://i.imgur.com/nr6kefg.jpg' /> <img class='photo_rectangle_inverse' src='http://i.imgur.com/dxah323.jpg' /> and here css code .photo_rectangle_inverse { height:160px; width:170px; -webkit-clip-pa

python - How to stop iterating using itertools.islice when EOF is reached -

i use itertools.islice(self._f, 0, 100, none) read in file piece piece (in blocks of 100 lines) follows: f = open('test.dat', 'r') while (some condition for): f = open(filename, 'r') x = itertools.islice(f, 0, 100, none) dosomethingwithx(x) my problem is, not know how long file , looking condition stop while loop when end of file reached. cannot figure out how done. edit: ok, see difficulty. maybe should reformulate question when itertools.islice capsuled in class here: class reader: def __init__() self._f = open('test.dat', 'r') def getnext(): return itertools.islice(self._f, 0, 100, none) r = reader() while (some condition for): x = r.getnext() dosomethingwithx(x) if don't mind getting list slices, can use iter : with open(filename, 'r') f: x in iter(lambda: list(itertools.islice(f, 100)), []): dosomethingwithx(x) not sure file using have f

Spring GenericFilterBean @AutoWired hibernate property is null -

a simple filter implementation: public class sessionfilter extends genericfilterbean { @autowired private sessionfactory sessionfactory; @override public void dofilter(servletrequest servletrequest, servletresponse servletresponse, filterchain filterchain) throws ioexception, servletexception { system.out.println("sessionfilter : dofilter called. opening session..."); if(sessionfactory == null) { system.out.println("its null"); } sessionfactory.getcurrentsession().begintransaction(); system.out.println("sessionfilter : dofilter calling filter chain.."); filterchain.dofilter(servletrequest, servletresponse); system.out.println("sessionfilter : dofilter closing session."); sessionfactory.getcurrentsession().gettransaction().commit(); system.out.println("sessionfilter : dofilter finished."); } public void setsessionfactory(sessionfactory sessionfactory) { this.sessionfactory =session

java - Searching thousands of files via a thread and "tree walker", writing matches to JTable results in unresponsiveness -

Image
i have revised windows 7 search program write matched files jtable . prior writing jtextarea . output ugly; hence jtable output. jtable , program becomes unresponsive time time if searching thousands of files. (not jtextarea . smooth.) my question how improve responsiveness. i have 1 thread invoked in main , "walks file tree" given node: public static void main(string args[]) { eventqueue.invokelater(new runnable() { public void run() { gui = new gui(); utilities.disable(gui.btnstop); }}); t = new thread(new task()); taskstarted = false; } } here's class header task : public class task extends simplefilevisitor<path> implements runnable{ here's run : public void run() { searchygui.disposition = filevisitresult.continue; files.walkfiletree(path , this); } here's main routine tree walking (there 3 others, 1 processing directories, 1 post-processing them, , 1 er

python 3.x - What is the appropriate tag to scrape those particular informations? -

i'm trying scrape bunch of informations website . i need product product list looking : [name, packaging, price/kg] so first 1 output 3 lists looking like. [royal canin veterinary diet - hypoallergenic dr 21, 7kg,4,84] [royal canin veterinary diet - hypoallergenic dr 21, 14kg,3,71] [royal canin veterinary diet - hypoallergenic dr 21, 14kg,3,71] i've managed names in name list. from bs4 import beautifulsoup import csv import urllib.request collections import * import time start_time = time.clock() page_0=urllib.request.urlopen("http://www.zooplus.co.uk/shop/dogs/dry_dog_food/royal_canin_vet_diet") soup_0 = beautifulsoup(page_0.read(),"html.parser") restricted_webpage=soup_0.find_all( "tbody", {"class":"product-variants-list"} ) readable_restricted_webpage=str(restricted_webpage) soup_1 = beautifulsoup(readable_restricted_webpage,"html.parser") title=soup_1.find_all("tr", {"style"

ios - Touch hotspot UIView like UIButton's with "Shows touch on highlight" -

Image
what best way create programatically semi-transparent uiview, looking this: basically image shows results of pressing uibutton "shows touch on highlight" option turned on. need create touch hotspot feature, move on screen while follow translate gesture.

Using python pandas's Datareader for yahoo finance's key statistic web page vs default yahoo's finance's historial prices web page -

i trying use python's pandas library data scrapping yahoo finance pull data it's historical prices using datareader pandas, want pull data yahoo finance it's key statistic web page "price/book ratio". not sure how modify datareader pull data other historical prices. i use pandas library web scraping, there different functions in pandas me pull data different web page of yahoo finance or modify datareader function pull other data? saving in html? there python yahoo-finance module . can there data want. additionally can build request function: def __request(symbol, stat): url = 'http://finance.yahoo.com/d/quotes.csv?s=%s&f=%s' % (symbol, stat) return urllib.urlopen(url).read().strip().strip('"') use data need. example, last price: def get_price(symbol): return __request(symbol, 'l1') here list other fields can extract.

ionCube Loader installation -

i attempting install ioncube on vps ovh , have ran install , selected appropriate options returns screen header of ioncube has banner saying "important: ensure script removed when no longer required" followed single line of writing says "ioncube loader wizard" , nothing. in addition application using ioncube says still not installed.

node.js - nodejs web server and simultaneous file append -

i've read nodejs event-loop, don't understand is: i've created simple http-server logs whole request post-data file . i used apache-ab flood 700 kb file for-each request . i imagined each request write chunks after each other each tick in event-loop, found full post data written after each request , don't know why , , cannot understand . i'm using this stream = require('fs').createwritestream('path/to/log.file', {flags: 'a'}) log = function(data){ return stream.write(data) } require('http').createserver(function(req, res) { // or req.pipe(stream) req.on('data', function(chunk){ log(chunk.tostring() + "\r\n") }) req.on('end', function(){ res.end("ok") }) }).listen(8000) sorry bad english :) i edited code output chunk size , use identifiable word 'squirrel' search in log file. sent image file using curl instead of ap

angularjs - Chart.js with factory and webservices (Ionic) -

i'm trying use ionic framework angularjs build mobile application. i'm adding data web services in piechart chart.js. my factory : .factory('srvstatproduit', function($http) { var baseurl = ''; var statpro = []; //var baseurl = 'http://webstock/api/'; //var cmdall = $http.get(baseurl + '/api/stat/detail'); return { all: function() { return $http.get(baseurl + '/api/stat/detail'); } }; }) my controller : .controller("piectrl", function ($scope,$http, srvstatproduit, $stateparams) { srvstatproduit.all().success(function(data) { $scope.statpros = data; console.log(data); //exemple pie chart chart.js $scope.labels = ["download sales", "in-store sales", "mail-order sales"]; $scope.data = [data.qte]; }); my html: <div ng-controller="piectrl"> <div> <canvas id="pie

jQuery Removing specific text from an element -

i want remove text "by:" element in website. want rest of text remain there. how can achieve jquery? thank you. the html <div id="text">by: anonymous minnesota</div> i want be: <div id="text">anonymous minnesota</div> if wanted find every element "by:" in , remove it, try this: $(':contains("by:")').each(function(){ $(this).html($(this).html().split("by:").join("")); }); this removes occurrence of "by:" in element. if want target specfic type of elements, change $(':contains("by:")') include whatever selector suits you.

Error building Xamarin.Android project using Xamarin.Studio -

i'm using latest stable version of xamarin.android , xamarin.studio. when try build android project i'm getting following error: /library/frameworks/mono.framework/versions/4.0.3/lib/mono/4.5/microsoft.csharp.targets: error : tool executable '/msbuild/14.0/bin/mcs.exe' not found how can diagnose , fix issue? i had problem after trying use c# 6 features in xamarin studio on windows. in case had added following project file: <propertygroup condition="'$(platform)' != 'unix'"> <csctoolpath>$(msbuildprogramfiles32)\msbuild\14.0\bin</csctoolpath> </propertygroup> which worked fine on windows, gave me error had, when tried on mac. should have been: <propertygroup condition="'$(os)' != 'unix'"> <csctoolpath>$(msbuildprogramfiles32)\msbuild\14.0\bin</csctoolpath> </propertygroup> there discussion here: http://forums.xamarin.com/discussion/4291

objective c - Call Block_Release inside block to be released -

is possible release block inside itself? compiler it's fine, i'm not sure if @ runtime crash, since releases memory executed @ same time. cancel_block_t somefunction(/*args*/){ __block bool canceled = no; __block cancel_block_t cancel_block = block_copy(^{ canceled = yes; block_release(cancel_block); //<-- can this? cancel_block = null; //<-- can this? }); // […] return cancel_block; } would approach more safe? cancel_block_t somefunction(/*args*/){ __block bool canceled = no; __block cancel_block_t cancel_block = block_copy(^{ canceled = yes; dispatch_async(dispatch_time(dispatch_time_now, 0.001 * nsec_per_sec), dispatch_get_global_queue(dispatch_queue_priority_low, 0),^{ block_release(cancel_block); cancel_block = null; }); }); // […] return cancel_block; } thanks help! edit #1: corrected return type of function. is non-arc code? arc au

javascript - Calling a function according to class in JQuery -

sorry question, need little code in jquery / javascript i have code emulate button <a href=""></a> code <a href="@url.action("create", "tourist", new { id = model.id })" eventsid="@model.id" class="btn btn-primary newtourist"><i class="fa fa-plus"></i> add</a> i need code call function in <script></script> declaration declaration <script type="text/javascript" src="~/scripts/jquery-1.11.0.js"></script> <script type="text/javascript"> function clearerrors() { $('#msgerrornewtourist').html(''); $('#msgerror').html(''); } function writeerror(control, msg) { var err_msg = '<div class="alert-message error"><a class="close" href="#">×</a><p>' + msg + '</p></div>'

jquery - How to run ajax in wamp server -

i working on ajax days , still won't work. decided download sample program using ajax still won't work. there wrong server? doens't return error. not show jquery. client.php <html> <head> <script language="javascript" type="text/javascript" src="jquery.js"></script> </head> <body> <!--------------------------------------------------------------------------------------------- 1) create html content can accessed jquery ----------------------------------------------------------------------------------------------> <h2> client example </h2> <h3>output: </h3> <div id="output">this element accessed jquery , text replaced</div> <script id="source" language="javascript" type="text/javascript"> $(function () { //----------------------------------------------------------------------------

unicode - Is there a non-heuristic way of finding the encoding of a string (ie. list)? -

for iodevices 1 can use io:getopts/1 example couldn't find method plain strings. for example, manpage = os:cmd("man ls"). % [76,83,40,49,41,32,32,32,32,32,32,32,32,32,32,32,32,32,32, % 32,32,32,32,32,32,32,32,32,32|...] io:format("~p~n",[manpage]). % [76,83,40,49,41,(...) io:format("~ts~n",[manpage]). % ls(1) user commands ls(1) % name % ls - list directory contents the documentation on using unicode in erlang mentions heuristic ways may out of date because according examples io_lib:format/2 ~ts control characters produces utf-8 output. trying erlang 18.0: bullet = "\x{2022}". % [8226] io:format("~ts~n", [bullet]). % • % ok io:format("~ts~n", ["•"]). % • % ok io_lib:format("~ts~n", [bullet]). % [[8226],"\n"] i know use unicode:characters_to_binary/{1,2,3} because accepts latin1 or utf8 encod

javascript - Ember CLI Hook/Event Error -

i'm using ember cli 1.13 , i'm attempting create router mixin in addon binds willtransition hook, issue i'm encountering not limited event. at point mixin looks such: import ember 'ember'; export default ember.mixin.create({ genericfunction: function(transition) { console.log('--- generic function ---'); }.on('willtransition') }); when attempting run dummy app utilising mixin, following error: uncaught typeerror: (intermediate value)(intermediate value)(intermediate value).on not function when including , using addon in separate application, there no errors , functions expected. there no warnings, errors, else hint towards issues use in full application. the environment config of dummy app , separate application identical, i've ruled out environment config potential issue. i'm not sure whether or not broken functionality in ember or whether i'm required take additional steps make dummy app behave you

cordova - Does android kill apps by itself? -

i have app made phonegap , testing on android. having problems app have stopped when wasn't using phone, lose logs when check later. although isn't logs problem, need app not stop other reasons also. just clear, stopped mean when click on app icon again start app loading screen instead of opening before would. so know is, why stopping? there error making crash or android kill apps not active time or else? no. officially android version, not kill application when not use phone. background application may killed if foreground application require more memory. please check document . so maybe there background service declare self foreground(start startforeground ), , need memory. or, system level service need memory, think.

UITableView Empty with iOS 9 beta 5 update -

Image
after updating xcode 7 , ios 9 beta 5 on iphone, none of uitableviews displaying data, except one. downloading information parse database, , 1 works, downloading 1 section of table, not other. other 3 table views download information, , calculate correct number of rows, nothing being displayed. tried displaying static text cells, not displaying that. any clue of going on? don't think problem downloading parse data, displaying onto tableviews. let cell:mychinupstableviewcell = tableview.dequeuereusablecellwithidentifier("cell") as! mychinupstableviewcell if namesarray.count > 0 { cell.namelabel.text = namesarray[indexpath.row] cell.bodytext.text = chinupsarray[indexpath.row] let count = likesarray[indexpath.row] cell.likecount.text = "♥︎ " + string(count) } return cell it table view, still gets point across. unless missing something, in correct hierarchy here. i added label test, , not appearing well

codeigniter - [PHP]User complaining about logging in to prexisting accounts after facebook signup -

today, informed when user signed on website facebook redirected user's account (if account exists redirected login ) specific user account didn't exist should have spit out error below. first user complain of this. login script simple , straight forward. see issues logic of code or facebook issue? i'm pretty stumped on 1 seems working other users. any appreciated. thank you. language php , code igniter here code.. public function signin_fb_check(){ $this->layout = false; $this->template = false; $check_exists_user = $this->user->row(array('conditions' => array_filter(array( 'email' => $this->ahrform->get('email') )))); if(count($check_exists_user)>0){ $id = $check_exists_user->id; $userid = $check_exists_user->id; $this->ahruser->user('login', $userid); $session_token = uniqid(); $uinfo = array(&#

Exclude copying duplicate values (Excel VBA) -

i'm automating copying html table excel duplicates must deleted or excluded in being copied. code below, copy values html table cells transpose/copy again cells. cannot figure out way on how exclude duplicate values being paste final cells. there button wherein copied value paste excel. there 10 rows in every html table. code: option explicit private sub hand_over_click() application.screenupdating = false dim e, m, integer, k variant range("xet1").select activesheet.pastespecial format:="html", link:=false, displayasicon:= _ false, nohtmlformatting:=true columns("e").numberformat = "mmm dd yyyy h:mm:ss am/pm" columns("i").numberformat = "ddd" e = 6 m = 1 while not range("c" & e) = "" e = e + 1 wend = 5 1000 if activesheet.cells(a, 5).value <> "" if range("xev" & m) <> "" range("c" & e).value

debugging - Java: try(Scanner scan = new Scanner(System.in) { } causing an exception -

using try(scanner scan = new scanner(system.in)) { } causing exception in thread "main" java.util.nosuchelementexception when try debug says variable information not available, source compiled without -g option. and shows below code public scanner(inputstream source) { this(new inputstreamreader(source), whitespace_pattern); } one of methods uses line: protected string loginname(){ string username; string password; try (scanner scan = new scanner(system.in)) { // line causing error. system.out.print("enter username: "); username = scan.next(); system.out.print("enter password: "); password = scan.next(); } if(getusernameslist().contains(username)) if(password.equals(getpasswordslist().get(getusernameslist().indexof(username)))) return username; else return "-1"; else return "-1"; } you're closing system.in (a global-varia

html - Outter page wrap doesn't set for the height of the whole page -

i have following code not cover full page height if page has content beyond normal view port (not having scroll). if scroll down outer div displays small bit , goes white. why outer div not taking full height of page if requires scrolling? html ,body { height: 100%; font-style: helvetica; } .page_background, .page { margin: 0 auto; } .page_background { width: 100%; min-height: 100%; background: -webkit-linear-gradient(#282828, #888888); /* safari 5.1 6.0 */ background: -o-linear-gradient(#282828, #888888); /* opera 11.1 12.0 */ background: -moz-linear-gradient(#282828, #888888); /* firefox 3.6 15 */ background: linear-gradient(#282828, #888888); /* standard syntax */ position: absolute; /*height: 100%;*/ } .page { background-color: #ffffff; width: 85%; min-height: 100%; bottom: 0; position: absolute; height: 100%; left: 7.5%; } <div class="page_background"> <div class=&

reactjs - React parent renders with initial state before successful ajax call sets state -

i'm using react webpack , babel compiling jsx. have parent component looks this: const menu = module.exports = react.createclass({ loaduser() { let xhr = new xmlhttprequest(); xhr.open('get', this.state.url, true); xhr.onload = function() { let data = json.parse(xhr.responsetext); this.setstate({ user: data }); }.bind(this); xhr.send(); }, componentdidmount() { this.loaduser(); }, getinitialstate() { return { url: this.props.url, user: [] }; }, render: function() { return ( <div classname="menu"> <nav user={this.state.user} /> ... </div> ); } }); as can see, attempt use this.setstate(...) set this.state.user data received xmlhttprequest. however, when try access in child, nav

Start the Cordova app from Windows 10 Universal app -

i started explore windows 10. my idea create windows 10 universal app. app have page show icons of cordova apps (these cordova apps reside in local memory - html, css, js). when click cordova app icon, then, universal app should able open cordova app (say, home.html). subsequently, able gain functions of cordova app(for example, 'take picture') could please tell me how create universal app handle cordova stuffs in order start cordova app? (html, css, js) why want create windows 10 universal app? if think use html, css, js, should use apache cordova visual studio. more information , samples: cross-platform development in visual studio visual studio tools apache cordova

java - Why don't these threads run in sequence? -

this question has answer here: synchronized block not working 8 answers i have difficulty understanding synchronized , reentrant lock. here small program experimenting with: import java.util.concurrent.executorservice; import java.util.concurrent.executors; public class reentr { public static void main(string[] args) { executorservice eservice = executors.newfixedthreadpool(2); (int = 1; <= 2; i++) { eservice.execute(new process()); } try { thread.sleep(1); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } eservice.shutdown(); } } class process implements runnable { int count = 0; @override public void run() { processtest(); } public synchronized void processtest() {