Posts

Showing posts from May, 2011

Chunk patch uploading to online GitHub then push online for low-speed networks -

i on low-speed network. how can push large git commits kind of resume capability? like, can upload chunks of patch files combine them on git server, push them master? usually i'd recommend git such purposes, since compresses , transmits quite efficiently. anywho -- have branch you'd cherry-pick 1 commit @ time , push them individually, say. btw, smaller commits way go! ;-) also, create patches, of course, , upload them somehow else (scp, ...) might resumable way, , apply them on git server. doubt, more efficient, using git.

ldapjs - node.js synchronous function call for authentication -

i newbie in node.js, , trying learn how works. know default node.js function calls asynchronous. need ldap authentication in application need wait server response check whether user credentials right or wrong.the ldap part working fine not sure on how return data function call in synchronous way. below part of code. router.js var express = require('express'); var router = express.router(); var tools = require('./authenticateuser'); router.post('/authenticateuser', function(req, res) { // in below line calling method // should return userdn (a string) tools.searchuser(req.body.user, req.body.passwd); res.render('home.jade'); }); authenticateuser.js module.exports = { searchuser : function (username, password) { admindn = *************; adminpassword = '*********'; basedn = '***'; var ldap = require('ldapjs'); process.env.node_tls_reject_unauthorized = "0"; ...

c# - 'MediaElement.SetSource()' isn't updating consistently -

my program should play video when user presses 'play' button. while this, first time press 'play' button nothing happen. i have traced bug following code, sets mediaelement 'videoplayer': public void playvideo_tapped(object sender, tappedroutedeventargs e) { setupvideo(); videoplayer.play(); } public async void setupvideo() { if(vm == null) return; storagefile videofile = vm.videofile; if (videofile == null || !videofile.contenttype.equals("video/mp4")) return; using (irandomaccessstream filestream = await videofile.openasync(fileaccessmode.read)) { videoplayer.setsource(filestream, videofile.contenttype); } } the culprit seems 'setsource()' method @ end. variable changes first click of 'play' next variable 'videoplayer.playtosource', changed null real value. (as side note, variable 'videoplayer.currentstate' changes 'closed' 'opening' resets 'closed' bef...

android - Handle programmaticaly created spinners and locate them to bottom -

i developing app, can fill school shedule(with auth etc.) in dialog class create new spinner + textview. how allocate them in mainactivity , how set content view bottom of list? know there's layoutparams thing, can't understand it. also great if can me remove items dialog window after choosing. code: public class othersubjectsdialog extends dialogfragment implements view.onclicklistener { public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { getdialog().settitle("title!"); view v = inflater.inflate(r.layout.dialog_layout, null); v.findviewbyid(r.id.btn_inf).setonclicklistener(this); v.findviewbyid(r.id.btn_phys).setonclicklistener(this); v.findviewbyid(r.id.btn_soc).setonclicklistener(this); v.findviewbyid(r.id.btn_chem).setonclicklistener(this); v.findviewbyid(r.id.btn_biol).setonclicklistener(this); return v; } @targetapi(build.version_codes.m) public v...

marshalling - Calling C DLL from C# caused Attempted to read or write protected memory -

i'm trying use zabbix_sender function in c# program. here c# code: [structlayout(layoutkind.sequential, charset = charset.ansi)] public struct zabbix_sender_value_t { [marshalas(unmanagedtype.lpstr)] public string host; [marshalas(unmanagedtype.lpstr)] public string key; [marshalas(unmanagedtype.lpstr)] public string value; } [dllimport("zabbix_sender.dll", charset = charset.ansi)] [return: marshalas(unmanagedtype.u4)] public static extern int zabbix_sender_send_values( [param: marshalas(unmanagedtype.lpstr)] string address, [param: marshalas(unmanagedtype.u2)] ushort port, [param: marshalas(unmanagedtype.lpstr)] string source, [param: marshalas(unmanagedtype.struct)] zabbix_sender_value_t values, [param: marshalas(unmanagedtype.u4)] int count, [param: marshalas(unmanagedtype.lpstr)] string result ); static void main() { zabbix_sender_value_t values; values.host = "some_hostname"; values.key = "ag...

javascript - How to keep selected value after submit form - JQuery -

i have form: <form id="new_user" class="simple_form new_user" method="post" accept-charset="utf-8" action="/admin/stats" novalidate="novalidate"> <div class="col-lg-4"> <h2>stats by:</h2> <div class="col-md-10 col-sm-10"> <div class="form-group country optional user_country"> <select id="user_country" class="country optional wabi-form-control select form-control" name="user[country]"> </div> </div> <div class="col-md-10 col-sm-10"> <input class="btn btn-wabi btn-block" type="submit" value="show stats" name="commit"> </div> </div> </form>' ho keep selected value user_country after show stats button click? with php, p...

python - pandas: Parametric statistic test for two proportions (with H0: p1=p2). How to use scipy.stats? -

based on source data, create dataframe aggregated counts per share looks like: share count_cm total_cm count_pm total_pm 117 395 309 1176 b 38 395 158 1176 c 4 395 22 1176 d 4 395 9 1176 e 8 395 19 1176 f 44 395 175 1176 g 37 395 110 1176 h 35 395 111 1176 11 395 21 1176 j 39 395 92 1176 k 16 395 48 1176 l 31 395 72 1176 m 11 395 30 1176 in order run proportion tests between current month , previous month, calculate z score using following function: import numpy np def z_prop(c1,c2,n1,n2): numerator = c1/n1 - c2/n2 p = (c1+c2...

java - MQ queue manager closed channel immediately during connect -

i have read many articles according issue, stiil have no solution. when try create connection websperemq mqje001: mqexception occurred: completion code 2, reason 2009 mqje016: mq queue manager closed channel during connect closure reason = 2009 after reading different articles tried change ccsid doing mqenvironment.properties.put(mqc.ccsid_property, 1208); // tried other ccsids 1200,819,500 but had no success. read idea @ mq log files find out if there process wich interrupt connection. not able investigate log files since encoded , don't how read them. questions: 1) know how read mq logs? how make them readable? 2) know else cause kind of problem? logs file amqerr01.txt : ----- amqxfdcp.c : 773 -------------------------------------------------------- 04.07.2013 10:41:01 - process(2880.3) user(anton.kasianchuk) program(javaw.exe) amq6118: internal websphere mq error has occurred (20806211) explanation: error has been detected, , mq error recording routine has ...

cordova - How to launch an ionic web app - where should ionic server be running? -

i building ionic app prototyping purposes. first version want web based app. know how run app locally on computer - type ionic serve , app runs. however, have remote clients, not sure how run app. need have ionic server running @ port on main server, , have clients make requests port on server ip address? how this? you take www folder , place on web server. that's there it. say web server address bharat.com , placed www folder in web server root. in case, ionic app visible @ bharat.com/www .

In R Is it possible to do matrix operations on matrices that contain functions? -

i working mathematical model functions contained within matrices simulate dynamics of biological populations. requires calling function update matrix, carrying out matrix multiplication project dynamics of system next time step. i'm wondering if possible embed function directly within matrix , skip explicitly updating matrix elements. the model looks this: state of system in matrix x1, eg x <- c(0,10) the system changes according matrix a a <- matrix(data = c(0, na,0.75,0.75),nrow =2,byrow = t) [,1] [,2] [1,] 0.00 na [2,] 0.75 0.75 where element na function of element 2 in x1, this f.a.12 <- function(x.2){1 + (1 - x.2/1000)} so system simulated this: update marix based on status of x a[1,2] <- f.a.12(x[2]) iterate model updated matrix: a%*%x [,1] [1,] 19.9 [2,] 7.5 this gets iterated 1000 times, updating before each multiplication the real model uses larger matrices containing multiple functions. there r package allows me embe...

sockets - Multi Threaded TCP server in Python -

i have created simple multi threaded tcp server using python's threding module. server creates new thread each time new client connected. #!/usr/bin/env python import socket, threading class clientthread(threading.thread): def __init__(self,ip,port): threading.thread.__init__(self) self.ip = ip self.port = port print "[+] new thread started "+ip+":"+str(port) def run(self): print "connection : "+ip+":"+str(port) clientsock.send("\nwelcome server\n\n") data = "dummydata" while len(data): data = clientsock.recv(2048) print "client sent : "+data clientsock.send("you sent me : "+data) print "client disconnected..." host = "0.0.0.0" port = 9999 tcpsock = socket.socket(socket.af_inet, socket.sock_stream) tcpsock.setsockopt(socket.sol_socket, socket.so_reu...

google refine - How to save only specific JSON elements in a new OpenRefine column -

{ "business_id": "sq0j7bgstazkvqlf5anqyq", "full_address": "214 e main st\ncarnegie\ncarnegie, pa 15106", "hours": {}, "open": true, ** "categories": ["chinese", "restaurants"] ** , "city": "carnegie", "review_count": 9, "name": "don don chinese restaurant", "neighborhoods": ["carnegie"], "longitude": -80.0849615, "state": "pa", "stars": 2.5, "latitude": 40.4083473, "attributes": { "take-out": true, "alcohol": "none", "noise level": "quiet", "parking": { "garage": false, "street": false, "validated": false, "lot": false, ...

c++ - CMake Error at find_package(catkin REQUIRED COMPONENTS std_msgs roscpp) -

i'm using roscpp (ros indigo) c++ project. in cmake file, added find_package(catkin required components std_msgs roscpp) but following error: cmake error @ /opt/ros/indigo/share/catkin/cmake/catkinconfig.cmake: 75 (find_package): not find package configuration file provided "std_msgs" of following names: std_msgsconfig.cmake std_msgs-config.cmake add installation prefix of "std_msgs" cmake_prefix_path or set "std_msgs_dir" directory containing 1 of above files. if "std_msgs" provides separate development package or sdk, sure has been installed. any ideas?

artificial intelligence - 2D Unity Enemy Chase/Evade script in C# -

okay i've been fighting script couple days now. i've made progress in other aspects can't seem enemies chase player character. the script supposed have enemies wander until empty child 'eyes' sees player. should start chasing player. think pac-man. it's doing right making 1 loop of it's wander cycle , stopping , not seeing player @ all. this code i've got far script - using unityengine; using system.collections; public class dudefollow : monobehaviour { transform tr_player; float f_movespeed = 3.0f; private dudemove movescript; public transform eyes; public float sightrange = 3f; // use initialization void start () { tr_player = gameobject.findgameobjectwithtag("player").transform; movescript = getcomponent<dudemove>(); } // update called once per frame void update () { raycasthit hit; if (physics.raycast (eyes.transform.position,eyes.transform.forward, out hit,sightrange) && hit.collider.comparetag (...

c# - Dropbox oAuth2 redirectURL -

i have not been working rest long, have dropbox authenticating in app why need redirecturl? want save token response, although getting following exception in oauthresponse: exception = {"the supplied uri doesn't contain fragment\r\nparameter name: redirecteduri"} this redirect url: https://www.dropbox.com/1/oauth2/redirect_receiver

android - Could not find property 'VERSION_CODE' Error:(21,0) -

i trying import project in android studio 1.5.1. firstly removed 1 error of 'com.android.application' not found error has been risen. enter image description here gradle sync failed: not find property 'version_code' on productflavor_decorated{name=main, dimension=null, minsdkversion=defaultapiversion{mapilevel=14, mcodename='null'}, targetsdkversion=defaultapiversion{mapilevel=23, mcodename='null'}, renderscripttargetapi=null, renderscriptsupportmodeenabled=null, renderscriptndkmodeenabled=null, versioncode=null, versionname=null, applicationid=com.fractalwrench.androidbootstrap.sample, testapplicationid=null, testinstrumentationrunner=null, testinstrumentationrunnerarguments={}, testhandleprofiling=null, testfunctionaltest=null, signingconfig=null, resconfig=null, mbuildconfigfields={}, mresvalues={}, mproguardfiles=[], mconsumerproguardfiles=[], mmanifestplaceholders={}}. the problem version_code , version_name....

javascript - Vue not loading data -

i have vue/coffeescript app looks this: there no errors in console, , says it's making successful external request json, when {{book.name}} , returns test instead of coming json. new vue({ el: '#app', data: { showmodal: false, book: { name: "test", description: "", photo: "" } } ready: () -> this.getbookdata() console.log (this.book) methods: { getbookdata: () -> self = $(this) $.getjson 'ggpk4a.json', (data) -> self.book = data } }) i don't know how in coffeescript, think issue this doesn't refer vue within callback function, setting this.book isn't working. can fix using .bind(this) on function, or setting var vm = this before ajax call , setting vm.book in callback.

java - Inherited controller method without type parameter does not get mapped with RequestMapping -

i created base spring controller latest web app project inherit basic crud controllers, called crudcontroller: class crudcontroller<t, k extends serializable> t entity type, , k key used type (pretty parameters needed spring's crudrepository). create rest controller extending it, so: @restcontroller @requestmapping(path = "/hats") public class hatcontroller extends crudcontroller<hat, integer> { } everything works great, except method gets list of items, /hats . method, 405 method not allowed. when @ logging done during startup, can see requestmappinghandlermapping did not map {[/hats],methods=[get]} did map other 4 methods in controller. here code method isn't being mapped: @requestmapping(method = requestmethod.get) public httpentity<?> getall() { iterable<t> result = controllerrepository.findall(); return new responseentity<object>(result, httpstatus.ok); } after experimentation, have discovered if add paramete...

seo - My Site pages are not indexed in google -

Image
i created site in codeigniter , has many pages not getting indexed in google search result. refer page - there many pages this. other pages same different location name. can body please why google not indexing pages?? it take time index pages. if new optimize website check: basic guidelines optimize website

javascript - HTML Editor With iFrame Not Working -

* { padding: 0; margin: 0; } body { font-family: sans-serif; } .grid { width: 50%; float: left; padding: 30px 50px; } .container { background: #e3e3e3; } textarea { width: 100%; height: 200px; resize: none; margin-top: 20px; margin-bottom: 50px; } iframe { border-style: solid; border-color: aqua; height: 1000px; width: 100%; display: block; } <!doctype html> <hmtl> <head> <link rel = "stylesheet" type = "text/css" href = "style.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script> (function() { $('grid').height($(window).height() ); var frame = $('iframe'); var contents = frame.contents(); var body = contents.find('body') var styletag = contents.find('...

excel - First used cell above address -

Image
i'm creating budget in excel , therefore have categories , subcategories. subcategories intended 1 cell compared respective parent category. subcategories of course can have subcategories on own. in column next "category tree" want print "category path". let's have following tree of categories: i want "category path" printed next this: i thought compose category path category path of parent category (if any) , category name on current row. subcategories can have subcategories on own, don't know in column category name on current row stored. category name on current row i'm using following formula (found on this site (german) ): {=index(a7:f7;match(true;a7:f7<>"";0))} i know there's no category more 5 levels deep, therefore can savely "hard code" e.g. range a7:f7 row 7 , receive "side job" result of above formula. now comes tricky part (at least me) , reason i'm asking question: n...

node.js - package.json start script, babel-node: not found on heroku deploy -

when run heroku local or when npm start locally, app builds , runs fine. when deploy heroku, app crashes saying cannot find babel-node. here log output: 2016-04-21t22:20:44.320025+00:00 heroku[api]: deploy 5d9a9da eagsalazar@gmail.com 2016-04-21t22:20:44.320084+00:00 heroku[api]: release v9 created eagsalazar@gmail.com 2016-04-21t22:20:44.542062+00:00 heroku[slug-compiler]: slug compilation started 2016-04-21t22:20:44.542069+00:00 heroku[slug-compiler]: slug compilation finished 2016-04-21t22:20:44.501025+00:00 heroku[web.1]: state changed crashed starting 2016-04-21t22:20:46.278065+00:00 heroku[web.1]: starting process command `npm start` 2016-04-21t22:20:50.467407+00:00 app[web.1]: 2016-04-21t22:20:50.467434+00:00 app[web.1]: > qc-server@1.0.0 start /app 2016-04-21t22:20:50.467435+00:00 app[web.1]: > babel-node index.js 2016-04-21t22:20:50.467436+00:00 app[web.1]: 2016-04-21t22:20:50.479490+00:00 app[web.1]: sh: 1: babel-node: not found 2016-04-21t22:20:50.521936+00:0...

python - beautiful soup parser can't find links -

i trying parse html document find links using beautiful soup , found weird behavior. page http://people.csail.mit.edu/gjtucker/ . here's code: from bs4 import beautifulsoup import requests user_agent = {'user-agent': 'mozilla/5.0 (x11; linux i686) applewebkit/537.17 (khtml, gecko) chrome/24.0.1312.52 safari/537.17'} t=requests.get(url, headers = user_agent).text soup=beautifulsoup(t, 'html.parser') link in soup.findall('a'): print link['href'] this prints 2 links: http://www.amazon.jobs/team/speech-amazon , https://scholar.google.com/citations?user=-gjkphiaaaaj&hl=en , whereas there many more links in page. can reproduce this? there specific reason happening url? few outher urls worked fine. the html of page not well-formed, should use more lenient parser , html5lib : soup = beautifulsoup(t, 'html5lib') link in soup.find_all('a'): print(link['href']) prints: http://www.amazon....

Issue about Ruby class Timer in rspec -

i ruby newbie trying create class timer following rspec: require 'timer' describe "timer" before(:each) @timer = timer.new end "should initialize 0 seconds" @timer.seconds.should == 0 end describe 'time_string' "should display 0 seconds 00:00:00" @timer.seconds = 0 @timer.time_string.should == "00:00:00" end "should display 12 seconds 00:00:12" @timer.seconds = 12 @timer.time_string.should == "00:00:12" end "should display 66 seconds 00:01:06" @timer.seconds = 66 @timer.time_string.should == "00:01:06" end "should display 4000 seconds 01:06:40" @timer.seconds = 4000 @timer.time_string.should == "01:06:40" end end but don't understand rspec's return error message, says "timer should initialize 0 seconds", stuck @ beginning code , appreciate ca...

html - JavaScript won't change image - Slider -

i don't understand why slider won't work. on html page, have first time, slider, , link javascript. in javascript, have array includes 2 images. unfortunately, slider doesn't work. image won't change. stays on first one. what might wrong? var myimage=document.getelementbyid("slide"); var imagearray=["image1.jpg", "image2.jpg"]; var imageindex=0; function changeimage () { slider.setattribute("src", imagearray [imageindex]); imageindex++; if (imageindex>=imagearray.length) { imageindex=0; } } var intervalhandle = setinterval(changeimage,2000); <!doctype html> <html lang="cs"> <head></head> <body> <img src="image1.jpg" id="slide"/> <script src="javascript.js"></script> </body> </html> try following code: var myimage=docu...

php - Mysql Query Join Table on the most recent row -

i have page of categories, worked fine until did join. the categories display so: category 1-----------------------0----------0 discussion 1 someone category 2-----------------------0----------0 discussion 2 someoneelse now says discussion, need display last discussion posted category based on it's discussion_id . have tried order ... desc sorts category names not discussion names , posted by. $sql = "select *, count(d.cat_id) count discussions d left join categories c on (c.cat_id = d.cat_id) right join soldiers s on (s.uid = d.discussion_poster) group d.cat_id"; $result = query($sql); while (($row = mysqli_fetch_assoc($result)) != false) { $cat_id = $row['cat_id']; $discussion_id = $row['discussion_id']; $cat_title = $row['cat_title']; $discussion_title = $row['discussion_title']; $discussion_time = $row['discussion_time']; ...

Use ffmpeg to edit metadata titles for multiple files -

i'd able add/edit video metadata titles multiple files @ once or single command, don't know how tell ffmpeg this. i read similar post on ubuntu forums , have never used string manipulation in linux before, commands i'm seeing in post way out of comprehension @ moment, , of discussion goes on head. i've got of video files in filename format includes show name, episode number, , episode title. example: show_name - episode_number - episode_title.extension bleach - 001 - shinigami born!.avi is there simple way read title , episode number filename , put metadata tag without having go through each , every file manually? edit 1: found out can iterate through files in directory, , echo filename, , told friend try bash parse strings , return values use in ffmpeg command line. problem is, have absolutely no idea how this. string manipulation in bash confusing on first look, , can't seem output want variables. test bash: file in "bleach - 206 - ...

Convert CSV to this new format -

i have csv file sorted country, state, , city. looks this: usa,california,arcata usa,california,bakersfield usa,california,barstow usa,california,berkeley usa,california,chico usa,california,delano usa,california,el centro usa,california,eureka usa,california,fresno usa,california,irvine usa,colorado,colorado springs usa,colorado,denver usa,colorado,durango usa,colorado,fort collins i want create output file looks this: usa -california --bakersfield --barstow --berkeley --chico --delano --el centro --eureka --fresno --irvine -colorado --colorado springs --denver --durango --fort collins states prepended single dash, , cities prepended 2 dashes within each state. how create output? thanks! please check below script in powershell . have made assumption there 1 country. entries can jumbled in way. also, assume there below row first row in csv headers: country,state,city you can use similar logic in other programming language well. $csvinput = import-csv -pat...

hypothesis spaces knowing a neural network? -

Image
so i'm studying artificial intelligence exam, , see question : knowing e) neural network, corresponding hypothesis spaces? i know answer b), don't have explanation why b). i'm bit clueless have here... thank you the question in artificial intelligence exam consists in finding values x , y output "true" or "false". the figure (e) shows small feedforward neural network. output of neuron function of weighted sum of every inputs (and bias, represented in figure vertical arrows). example, top-left neuron output function of 10*x + 10*y -10 . means output of neuron output1 = f(10*x + 10*y - 10) . function f called activation function . here neurons may considered perceptrons . perceptrons simplest models of neurons : activation function step function : f(u) = 1 if u > 0 , f(u) = 0 otherwise . the aim of question find values of x , y output of network 1/true/positive. to so, compute outputs of network's neurons , find character...

php - Internal Server Error Slim and .htaccess -

first need ya sorry bad english hope u can me strangers. have created domian in linux debian 8. <virtualhost *:80> serveradmin admin@admin.com documentroot "/var/www/saci" servername saci.com serveralias www.saci.com errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/access.log combined <directory "/var/www/saci"> options indexes followsymlinks multiviews allowoverride order allow,deny allow </directory> </virtualhost> i'm using slim , i've created folder named 'app' on folder 'saci' file start.php got this: <?php use slim\app; session_cache_limiter(false); session_start(); ini_set('display_errors', 'on'); define('inc_root', dirname(__dir__)); require inc_root . '/vendor/autoload.php'; $app = new app(); $app->get('/test', function() { echo "this test."; }); ?> now on folder saci i've created folder nam...

Python BeautifulSoup find element that contains text -

<div class="info"> <h3> height: <span>1.1</span> </h3> </div> <div class="info"> <h3> number: <span>111111111</span> </h3> </div> this partial portion of site. ultimately, want extract 111111111. know can soup.find_all("div", { "class" : "info" }) list of both divs; however, prefer not have perform loop check if contains text "number". is there more elegant way extract "1111111" soup.find_all("div", { "class" : "info" }) , makes must contain "number" within? i tried numbersoup = soup.find('h3', text='number') returns none use xpath contains : root.xpath('//div/h3[contains(text(), "number")]/span/text()')

java - Cling with tomcat -

i trying create service autodiscover upnp devices in local network, implementing in webapplication running on tomcat 7 , using 4thline cling library. got error org.fourthline.cling.transport.routerimpl handlestartfailure severe: unable initialize network router: org.fourthline.cling.transport.spi.initializationexception: failed set modified urlstreamhandlerfactory in environment. can't use bundled default client based on httpurlconnection, see manual. in cling's manual cling couldn't use java jdk's httpurlconnection http client operations. suggest configure network transport . i didn't understand how do. had similar problem? can suggest me example? thanks. the code using is: public class example { public static void startdiscovery() { registrylistener listener = new registrylistener() { public void remotedevicediscoverystarted(registry registry,remotedevice device) { string name = device.get...

python lxml xpath get the nodes attributes with specific string pattern -

im learning xpath , trying value of node specific node attribute example(google playstore) using python lxml/html. below code wanted developer email value node "a" attribute "href" starting "mailto:". python code snippet returns app name empty developer email. thank you <html> <div class="id-app-title" tabindex="0">candy crush saga</div> <div class="meta-info meta-info-wide"> <div class="title"> developer </div> <a class="dev-link" href="https://www.google.com/url?q=http://candycrush.com" rel="nofollow" target="_blank"> visit website </a> <a class="dev-link" href="mailto:candycrush@kingping.com" rel="nofollow" target="_blank">candycrush@kingping.com </a> ##interesting part here </div> </html> python code (2.7) def get_app_from_link(self,link): start_p...

c# - SiteMap.CurrentNode return null when using dynamic sitemap -

i want build dynamic sitemap, highlight parent menu, code behind include 2 methods: page_load , smsource_onmenuitemdatabound that: protected void page_load(object sender, eventargs e) { if (!ispostback) { try { sessions.sitemap = data.getsitemapfile(); var xmlsmprovider = new xmlsitemapprovider(); var providerattributes = new namevaluecollection(); providerattributes.add("sitemapfile", sessions.sitemap); xmlsmprovider.initialize("roledemo", providerattributes); xmlsmprovider.buildsitemap(); smsource.provider = xmlsmprovider; hormenu.datasource = smsource; hormenu.databind(); } catch (exception ex) { data.writelog(ex); } } } protected void smsource_onmenuitemdatabound(object sender, menueven...

Mysql search with ignore special characters -

i have table 'products' has column partnumber . i want ignore special characters record while searching. suppose have following 5 records in partnumber: xp-12345 mv-334-3454 xp1-5555 vx-ap-xp-1000 vt1232223 now, if try search "xp1", output should come following records xp-12345 xp1-5555 vx-ap-xp-1000 how write mysql query ? define mysql function strips symbols provided string. delimiter // create function strip_symbols(input varchar(255)) returns varchar(255) deterministic no sql begin declare output varchar(255) default ''; declare c char(1); declare int default 1; while < length(input) set c = substring(input, i, 1); if c regexp '[a-za-z0-9]' set output = concat(output, c); end if; set = + 1; end while; return output; end// delimiter ; then select records table partnumber symbols stripped contains xp1 : select * products strip_symbols(partnumber) ...

javascript - How update html img src from spring controllers method? -

i add capcha jsp page (kaptcha library). this @requestmapping(value = "/captcha.jpg", method = requestmethod.get) public void captcha(httpservletrequest req, httpservletresponse resp) throws servletexception, ioexception { super.captcha(req, resp); } and in page <img src="captcha.jpg"/> now need create button update captcha.(or when clik captcha image) i tried this <a href="captcha.jpg"> <img src="captcha.jpg"/> </a> but when click image open singly. need refresh captcha image after click. maybe javascript, maybe else? how it? update i create <script> function update() { document.getelementbyid('my-image').setattribute('src', "captcha.jpg"); } </script> <a href="" onclick="update()"> <img src="ca...

angularjs directive - Ng-repeat in Sightly -

Image
i trying populate drop-down values using ng-repeat in sightly. aem node saves data string array , able fetch properly, not able populate them throws " ? undefined:undefined ? " error. my code: <select name="${validation.elementname}" id="${validation.elementname}" ng-model="${validation.elementname}" ng-change="${properties.clickfunction}"> <option ng-repeat="opt in ${properties.options}" value={{opt}}>opt</option> </select> and output: : is there missing? sightly totally new me. grateful improve code or pointing mistake. first of all, need wrap data pass value in quotes, should this: value="{{opt}}" second, looks passing values without single quotes , not being recognized strings. take @ plunker: http://plnkr.co/edit/a2gzjbvvv9ozhlolkf4b?p=preview you can see first ng-repeat works expected, second throws error in console , do...

javascript - how to give auto scroll to bottom when page before show -

Image
we developing chat application in showing image,audio , text in content div. we have header div,content div,footer div.in content div adding new data dynamically want show in bottom every time. if want see previous data want scroll down see. how using jquery $(document) .on( "pagebeforeshow", "#chat", function() { window.requestfilesystem(localfilesystem.persistent, 0, onfilesystemsuccess, fail); load = true; $('#opchat').empty(); $("#preopchat").empty(); $("#opchat1").empty(); var checkdata = storagechat.getitem("chatdata"); if (json.parse(checkdata) != null && json.parse(checkdata) != undefined) { storechatdata = json.parse(checkdata).slice(); if (storechatdata.length > 10) { var slicechatdata = []; slicechatdata = storechatdata.slice(math.max( storechatdata.length - 10, 1)); for (var = 0; < slicechatdata.length; i++) { ...