Posts

Showing posts from June, 2011

php - how to select/deselect all checkboxes generated in loop when parent checkbox is checked -

<script> $(function(){ $('.parent').on('click',function(){ $(this).find('.child[]').attr('checked',this.checked); }); }); </script> <table> <thead> <tr> <th>s no.</th> <th><input type="checkbox" name="select1" id="select1" class="parent" /></th> <th>title</th> <th>end date</th> <th>action</th> <th>deal type</th> <th>status</th> </tr> </thead> <tbody> <tr> <?php $sql="select * table_name id='$id'"; $result=mysql_query($sql); $sn=1; while($show=mysql_fetch_array($result)) { $student=$show['student']; ?> <td><?php echo $sn; ?></td> <td><?php echo "<input type='checkb

image - How to combine two features (two minimum distance classifiers) -

hello first post here, i work on tracking objects through images without prior training. use 2 features, color of region (the ab channels of lab space) , hog. in initial experiments, found using min. distance classifier hog feature alone has advantage of low false positives fp high fn. on other hand, using min. distance classifier color alone increases tp , decreases fn results price of increasing fp. my question, how combine 2 classifiers? know standard algorithm in unsupervised way. i tried combine 2 features 1 feature (after normalization) hog dominates results. if weighted combined feature, results worse either of two. the results reach till (cascade) 2 classifiers, running color first increase possibilities run hog (with threshold little bit higher used hog alone). googled topic don't have enough knowledge classification find standard methods. thanks

haskell - Instancing Monoid for a Type -

i have type in haskell make map have several values associated key. if compile following code: type mapa k v = map k [v] instance monoid (mapa k v) --mempty :: mapa k v mempty = dm.empty --mappend :: mapa k v -> mapa k v -> mapa k v mappend b = dm.unionwith (++) b ghci throw: illegal instance declaration `monoid (map k [v])' (all instance types must of form (t a1 ... an) a1 ... *distinct type variables*, , each type variable appears @ once in instance head. use -xflexibleinstances if want disable this.) in instance declaration `monoid (map k [v])' should mapa newtype or data ; or what's problem? in case, do want create newtype . when use type , create type synonym , entirely cosmetic-- mapa k v means same thing map k [v] . want create new type instead because normal maps have monoid instance overlap new one, leading confusing behavior. since mapa type behaves in fundamentally different way, want different type: newty

fadein - Jquery .html, then .fadeout -

i trying update .html('') , delay(400) , fadeout , thereafter update .html('') , , fadein again... if(data==1) { var html = "an other text" $('#nyhedsbrev').html('<br/><p style=\"width:100%; text-align:center;\">tak din tilmelding</p><br/>'); $('#nyhedsbrev').delay(2000).fadeout().html(html).fadein(); } it works fine if use line 2 - or if try line one. however, these won't work. i have tried combine 2 lines - deleting second $('#nyhedsbrev) . can explain how can first show new text - fade out replace innner html , fade in? clarify - - - problem first part not show - fade out/in works... jquery fadein / fadeout (and other animates methods) can take callback second argument. if(data==1) { var newhtml = html; $('#nyhedsbrev').fadeout(500, function() { $('#nyhedsbrev').html(newhtml).fadein(); }); } working example : jsfiddle

git - What is the tree hash of a specific commit hash? -

i need shell command-line puts tree hash corresponding specific commit hash. know git cat-file commit $commitid | grep ^tree can it, have filter output of that. there command prints hash? git log -1 --pretty="%t" $commitid

php - How do you take the color model used such as AdobeRGB and transfer it into sRGB? -

it seems i've ventured little-documented area here in imagemagick/imagick. i'm using php's imagic - not command line. have convert photos experienced photographers take, converts color model not consistent had used make more vibrant photos. example: http://www.picturemojo.co.nz/image/muriwai-gannet-colony-auckland-new-zealand/ photo twice vibrant , depthy. inaccurate color conversion blandifies it.

ruby - Class level variable acts like an instance variable instead -

i'm new ruby, being called upon maintain old, undocumented code here , there. have base class in ruby put hash class variable. @@projects = hash.new and want derived classes add via method (passing in parameter). problem is, seems each derived class has own copy of hash, instead of accessing single 'static' version of it. could help? class base @@projects = hash.new def addsomething key, value @@projects[key] = value end end class derived < base def initialize ... addsomething key, value ... end end so, in code sample above, every time add value @@projects in addsomething function size/length of hash 1, never grows. acts if it's instance variable not want. any ideas? i'm stumped here. probably wrong in code hidden behind ... in initializer of derived. code below works me fine: irb(main):032:0> class base irb(main):033:1> @@projects = {} irb(main):034:1> def add(k, v) irb(main):035:

php - Zend Framework 2: Disable module on production environment -

ok, here's problem: i have module in zend framework 2 application wish not include on production. therefore, made file inside config/autoload called local.php following content: 'modules' => array( 'application', 'my_local_module', ), while config/application.config.php contains: 'modules' => array( 'application', ), when try access module in url, 404 returned. however, when set modules inside application.config.php file, module displayed properly. environment variable set local . put following lines in index.php: <?php // ... // current environment (development, testing, staging, production, ...) $env = strtolower(getenv('application_env')); // assume production if environment not defined if (empty($env)) { $env = 'production'; } // default config file $config = require 'config/application.config.php'; // check if environment config file exists , merge defau

android - How can I continuously stream the content of a SQLite table via command line (adb sqlite3) instead of manually pulling it? -

i have batch script shows me content of sqlite db table on real device: @echo off set packageid=com.brightideahub.motorassistant set databasename=test_event_data.db set tablename=test_table adb shell "su -c 'sqlite3 -header -column /data/data/%packageid%/databases/%databasename% \"select * %tablename%\"'" pause the problem every time db changes have re-run script see changes. is there way stream content of db, how logcat messages show real-time? also, have been going through options available sqlite3 command. can explain -batch , -interactive options exactly, , whether use trying achieve? sqlite3 -help usage: sqlite3 [options] filename [sql] filename name of sqlite database. new database created if file not exist. options include: -bail stop after hitting error -batch force batch i/o -column set output mode 'column' -cmd command run "comman

slider - Inverting alpha value java -

i writing game slider controls alpha value of color. seems working fine except want invert alpha value. example if value 0 value become 255, , if value 255 become 0. unfortunately google searches turned no easy way or built in methods doing this. appreciated thanks. do simple math : int alphavalue = 255 - slidervalue for example: when slidervalue = 0, alphavalue = 255 - 0 = 255 when slidervalue = 255, alphavalue = 255 - 255 = 0

android - how to stop repeating alarm from another activity -

i have set repeating alarm on multiple tasks in app. getting task notification properly. when clicking on dismiss button alarm not cancelling. have created alert dialog notification user. i passing db _id pendingintent uniqueid multiple alarms on different tasks. alarm ringing not stopping. please guide me this. here's activity class setting alarms protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.alarm_layout); // code.. setalarm.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated method stub idval=idval+1; // fetching id db. alarm_intent= new intent(alarmactivity.this, receiveractivity.class); alarm_intent.putextra("str_text", str_text); alarm_intent.putextra("cls_id", idval); pendingintent = pendingintent.getbroadcast(alarmactivity.this

Binding data to combobox in WPF -

i beginner in programming, wpf . have application in wpf . have changed connection .sdf database entity framework sqlcecommand . unfortunatelly, before had following code binding combobox . <dockpanel grid.row="4"> <button x:name="loadbutton" height="20" tooltip="choose setting name load" width="75" padding="2,2,2,2" margin="2,0,2,0" horizontalalignment="left" verticalalignment="center" content="load settings" command="{binding loadsettingscommand}"/> <combobox x:name="loadsettingscombobox" tooltip="choose setting name load" itemssource="{binding mode=oneway, path=settings/}" selectedvalue="{binding loadsettingname, mode=onewaytosource}" selectedvaluepath="name" grid.column="1" > <combobox.itemtemplate> <datatemplate> <textblock

c# - How to two joins in linq -

i trying write sql query linq: query: select s.s_name, sub.state, sub.to, sub.evaluation, sub.task_id submit_task sub join student s on s.id=sub.student_id join task t on t.id=sub.task_id t.t_name = "bbbb"; linq: var subtask = (from sub in ado.submit_task join s in ado.student on sub.student_id equals s.id join t in ado.task on sub.task_id equals t.id t.t_name == listview3.selecteditems[0].text select new { s.s_name, sub.state, sub.to, sub.evaluation, sub.task_id }); but not working. when try dubugg, nothing's happened, no error or result. see mistake ?? thankk you var text = listview3.selecteditems[0].text; var subtask = (from sub in ado.submit_task join s in ado.student on sub.student_id equals s.id join t in ado.task on sub.task_id equals t.id t.t_name == text select new { s.s_name, sub.state, sub.to, sub.evaluation, sub.task_id });

Unable to convert .mp3 to .m4a using ffmpeg -

i aware legal constraints in using libfaac testing purpose. i have compiled ffmpeg faac enabled. when tried convert .mp3 .m4a here error getting. please provide resolution problem. tried on 2 different sources of .mp3, still getting same error. [user@ip-10-161-13-26 ~]$ ffmpeg -i kalimba.mp3 -c:a libfaac kalimba.m4a ffmpeg version 0.11.1 copyright (c) 2000-2012 ffmpeg developers built on may 4 2013 09:33:27 gcc 4.4.6 20120305 (red hat 4.4.6-4) configuration: --enable-libfaac --enable-nonfree --disable-yasm libavutil 51. 54.100 / 51. 54.100 libavcodec 54. 23.100 / 54. 23.100 libavformat 54. 6.100 / 54. 6.100 libavdevice 54. 0.100 / 54. 0.100 libavfilter 2. 77.100 / 2. 77.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 15.100 / 0. 15.100 [mp3 @ 0x2464680] header missing [mp3 @ 0x2463100] max_analyze_duration 5000000 reached @ 5015510 [mp3 @ 0x2463100] estimating duration bitrate, may inaccurate input #0, mp3, 'kali

artificial intelligence - Hooking any AI chatbot to Facebook chat -

i haven't tried on this, possible? if is, there way of making plugin firefox or chrome? or making software enables hook ai chatbot facebook chat. want use cleverbot or igod. you can connect facebook chat via xmpp api , though believe using connect bot or not user-to-user chat violation of rules.

css - Overflow is not working on hover -

i want place image, title, text in particular box , box rounded. box has background color opacity rgba color. when box hovered overflow not working. have following html structure: <article id="post-181" class="post-181 post type-post status-publish format-standard hentry category-uncategorized"> <header class="entry-header"> <h2 class="entry-title"><a href="#">a paradisematic country</a></h2> <div class="post-info"> <p>posted <a href="#">admin</a> on april 25, 2013</p> </div> </header> <div class="entry-content"> <img width="270" height="208" src="http://roi.me/files/google-vs.-bing.jpg" class="alignright wp-post-image" alt="logos mini"> </div><!-- .entry-content --> </article> and css

java - How to get rid of a color in an image -

i want image, buffered image, have transparent background, first tries using png, gif, tried using imagefilters not hit off, decided use simple jpeg, set background color , rid of color, again, assume imagefilters fit that, don't know how use them, color want rid of 0xff00d8 (magenta). can way this, or example? jpeg doesn't support transparency. make sure buffered image supports transparency: bufferedimage bi = new bufferedimage(w, h, bufferedimage.type_int_argb); the in type_int_argb stands alpha measure of opacity. you need set pixel value 0x00000000 in order make transparent. //load image bufferedimage in = imageio.read(img); int width = in.getwidth(), height = in.getheight(); bufferedimage bi = new bufferedimage(width, height, bufferedimage.type_int_argb); graphics2d g = bi.creategraphics(); g.drawimage(in, 0, 0, null); g.dispose(); //change color int colortochange = 0xff00d8; (int x=0;x<width;x++) (int y=0;y<height;y++) if(bi.get

java - How to set a button which would repeat its task? -

this first app, i've ever programmed , create button repeat task after pressing once. code use download values yahoo server: public class mainactivity extends activity implements view.onclicklistener{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); return true; } public void onclick (view v) {} public void go (view v) { intent myintent =new intent (intent.action_view); myintent.setdata(uri.parse("http://download.finance.yahoo.com/d/qoutes.csv?s=clm13.nym&f=nb3gh")); startactivity(myintent); toast.maketext(this, "done!", toast.length_short).show(); } } i've read timer , handler commands, i'

Searching for most performant way for string replacing with javascript -

i'm programming own autocomplete textbox control using c# , javascript on clientside. on client side want replace characters in string matching characters user searching highlight it. example if user searching characters 'bue' want replace letters in word 'marbuel' so: mar<span style="color:#81bef7;font-weight:bold">bue</span>l in order give matching part color. works pretty fine if have 100-200 items in autocomplete, when comes 500 or more, takes mutch time. the following code shows method logic this: highlighttextpart: function (text, part) { var currentpartindex = 0; var partlength = part.length; var finalstring = ''; var highlightpart = ''; var bfoundpart = false; var bfoundparthandled = false; var chartoadd; (var = 0; < text.length; i++) { var mychar = text[i]; chartoadd = null; if (!bfoundpart) { var mycharlower = mychar.tolowercase();

email - Unable to send HTML mail through mail() -

the mail sent below code includes html tags. how can rid of tried few ways still mail output scrambled html tags. , need on if better way of sending array of elements through mail(); my code: <?php include('mail.php'); include('mail\mime.php'); $errors=array(); if(empty ($_post)===false) { //$product = $_post['product']; //$quantity = $_post['quantity'] ; $email="noreply@cortexonline.in"; $item1 = $_post['product']['1']; $item2 = $_post['product']['2']; $item3 = $_post['product']['3']; $item4 = $_post['product']['4']; $item5 = $_post['product']['5']; $quan1 = $_post['quantity']['1']; $quan2 = $_post['quantity']['2']; $quan3 = $_post['quantity']['3']; $quan4 = $_post['quantity']['4&

PHP use mySQL to check existing username -

i have been following tutorial building simple registration / login script. http://forum.codecall.net/topic/69771-creating-a-simple-yet-secured-loginregistration-with-php5/ i new php, have lot of experience using c++, thought transitions wouldn't hard, need figure out syntax. did very quick introduction mysql @ university, thought lot easier use mysql check existing username when user has registered, though knowledge isn't good. thought work; select username codecalltut username = username; would work? selecting username database codecalltut , checks see if username being inputted username? if correct don't know how include in php. i've tried using $qry = "select username codecalltut username = username;" but syntax error when moves next statement. <?php $qry = "select username codecalltut username = username;" //if register button clicked. } else { $usr = new users; //create new instance of class

mongodb - Mongo DB Nested CRUD c# -

hi starting build cms around mongo db c#. i have basic document looks fields removed simplicity here... { "_id" : objectid("518438c35ea2e913ec41c138"), "content" : "some html content here", "title" : "robs article", "author" : "rob paddock", "dateposted" : isodate("0001-01-01t00:00:00z"), "articlestatus" : "live" } to call document have following code public ienumerable<article> getarticledetails(int limit, int skip) { var articlescursor = this.mongoconnectionhandler.mongocollection.findallas<article>() .setsortorder(sortby<article>.descending(a => a.title)) .setlimit(limit) .setskip(skip) .setfields(fields<article>.include(a => a.id, => a.title, => a.author)); return articlescursor; } to create new document have public virtual void create(t ent

Using gnuplot for discrete distribution -

is there relatively simple way plot graph of distribution of discrete data? e.g. have set of float values on range 0 1 , need chart diagram on 10 ranges ([0.0, 0.1], [0.1, 0.2], ..., [0.9, 1.0]) of how many of given floats hit respective range. thanks. this can done "frequency plot". if frequency option set "all points same x-value replaced single point having summed y-values" (help smooth frequency). means if assign every point y-value 1 result number of points having particular x-value. now, in order able sum points within range can use function rounds off values of data as suggested here bin(x)=0.1*floor(x/0.1) plot "datafile.txt" using (bin($1)):(1.0) smooth frequency boxes you might want tweak appearance of boxes set boxwidth , set style fill .

Using R to save images & .csv's, can I use R to upload them to website (use filezilla to do it manually)? -

first should lot of on head, apologize in advance using incorrect terminology , potentially asking unclear question. i'm doing best. also, saw thispost ; rcurl tool want use task? every day 4 months i'll analyzing new data, , generating .csv files , .png's need uploaded web site other team members checking. i've (nearly) automated of data collecting, data downloading, analysis, , file saving. analysis carried out in r, , r saves files. use filezilla manually upload new files website. there way use r upload files web site, don't have open filezilla , drag+drop files? it'd nice run r-code , walk away, knowing once finishes running, newly saved files automatically put on website. thanks help! you didn't specify protocol use upload files using filezilla. assume ftp. if so, can use ftpupload function of rcurl : library(rcurl) ftpupload("yourfile", "ftp://ftp.yourserver.foo/yourfile", userpwd="username:pa

How to parse data from localhost xml file in android -

hi iam trying parse xml file hosted in localhost server. on executing did'nt data. please me if knows. my code: package com.example.androidtablayout; import java.io.ioexception; import java.io.inputstream; import java.net.malformedurlexception; import java.net.url; import java.net.urlconnection; import javax.xml.parsers.documentbuilder; import javax.xml.parsers.documentbuilderfactory; import org.w3c.dom.document; import org.w3c.dom.nodelist; import android.app.activity; import android.os.asynctask; import android.os.bundle; public class photosactivity extends activity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.photos_layout); try { new photosactivity().start(); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } } private void start() throws exception { url url = new url(&

Really Messed Up in Github/Git. Should I rebase? Or what? -

ok messed github. working on project on computer a. created github repo , pushed commits it. wanted add changes reason wasn't working , authors got messed because didn't correctly. anyway out of frustration deleted github repo. how repush files new repo created, instead of old one? first, delete old github remote attached repo (usually remote name called origin ): $ git remote rm *remote-name* next, add new one: $ git remote add origin git@github.com:your_username/your_repo.git finally, push commits new repo: $ git push --set-upstream origin master

apache - PHP script works in browser but times out as cron job -

i wrote php script fetches rss feeds , stores them in database. if access script through browser, runs flawlessly (with admittedly 2 minute wait before outputs log), when runs part of cron job, produces 40% of output , dies out... i looked around net , tried adding these 2 lines script: ini_set('max_execution_time', 0); ini_set("memory_limit","256m"); still same problem. i'm sure it's settings issue because current server running script cron-job no problems, , php error log showing few warnings. what's best way troubleshoot problem on ubuntu server? update i noticed if run php code straight command line, perfect execution, think it's cron job problem. noticed execution stops whenever wants add new data mysql database, guess narrows down possibilities..

asp.net mvc - MVC to WebAPI authentication for the same application -

i'm building website have mvc side , data webapi backend of our own, hosted on different server (or on azure). we're going use forms authentication. since want users need log-in once (to mvc website), recommended way transparently authenticate users webapi backend same information entered on mvc forms authentication login? since authentication works based on cookies, best way call webapi authentication action/method on login action of mvc app, auth cookie webapi , use on every call webapi end? any guidance appreciated gr7, can't i've ever attempted doing. let me point out bothering me idea, , how think can make work. you have asp.net mvc application running on 1 web server, , asp.net webapi application running on server. want use cookie 1 on other. how cookie mvc application valid webapi app? if username , password of user same on both systems, cookie generated 2 different applications not same it? clear, i'm not 100% sure it, suspicion. her

javascript - Disable Firefox's silly right click context menu -

Image
i making html 5 game requires use of right click control player. i have been able disable right click context menu doing: <body oncontextmenu="return(false);"> then came attention if hold shift , right click, context menu still opens in firefox! so disabled adding js well: document.onclick = function(e) { if(e.button == 2 || e.button == 3) { e.preventdefault(); e.stoppropagation(); return(false); } }; however, if hold shift, , double right click in firefox still opens! please tell me how disable bloody thing once , (i'm willing revert obscure, hacky, , unpractical solution, long works). you never able entirely disable context menu in cases, firefox has setting allows user tell browser ignore such hijinx trying pull. note: i'm on mac, setting in pretty uch same place on platforms. that being said, try event.preventdefault() (see vikash madhow's comment on other question: how disable right-click context-menu in javascript )

typo3 show submenu without subpages -

i have website pages, presented in normal menu. every page has subpages , shows them in submenu. except 1 page. page has no subpages , should have content menu navigates different content sections on page. thing content navigation done with: temp.contentnav = content temp.contentnav { table = tt_content select { pidinlist = 7 orderby = sorting = colpos=0 languagefield=sys_language_uid } renderobj = text renderobj { field = header wrap= <li>|</li> typolink.parameter.field=pid typolink.parameter.datawrap=|#{field:uid} typolink.atagparams = class="linksubpage" if.istrue.field=header } wrap = <ul id="submenu"> | </ul> } page.10.marks.menu.2a.no.after.cobject < temp.contentnav but works if page has @ least 1 subpage. workaround add subpage , hide submenulink, there better solution show custom submenu without adding subpages? use hmenu item levels generate submenu. behavi

php - how to set default la page as default in css -

i have been struggled 1 sticky issue regarding set default li. what try achieve set li , related page default one. , when users click on others links, load other pages. html markup: <div id="productintro"> <div id="leftnav"> <ul> <li class="head"> <a href="javascript:void(0)" onclick="show('.$row["id"].',1);"> pictures</b></a> </li> <li class="head"> <a href="javascript:void(0)" onclick="show('.$row["id"].',2);"> <b>comments</b></a> </li> <li class="head"> <a href="javascript:void(0)" onclick="show('.$row["id"].',3);"> <b>others</b></a> </li> </ul> </div&

c++ - uint24_t and uint48_t in MinGW -

i'm looking uint24_t , uint48_t types in gcc , mingw. know neither standardized, i've come across references them online, , i'm trying figure out: what header need include them. whether cross-platform (at least on windows, linux, , mac osx), or specific targets. what names are. uint24_t, __uint24, __uint24_t? the standard uintxx_t types provided in stdint.h (c, c++98) or cstdint (c++11). on 8-bit data, 24-bit address avr architecture, gcc provides built-in 24-bit integer, not portable. see http://gcc.gnu.org/wiki/avr-gcc more info it. there no standard 24-bit or 48-bit integer types provided gcc or mingw in platform independent way, 1 simple way portable 24-bit number on platform use bitfield: struct bitfield24 { uint32_t value : 24; }; bitfield24 a; a.value = 0xffffff; a.value += 1; assert(a == 0); the same can done 48-bits, using uint64_t base.

html - css how to prevent content from drifting underneath fixed position areas? -

i've created html template have sidebar set position: fixed; when minimize browser less width page set to, main content drifts underneath sidebar when user viewing sidescrolls. is there fix set entire container sidebar , main content single fixed block? http://jsfiddle.net/vuj6t/2/ <body> <div id="container"> <section id="sidebar"> <nav> <ul> <li><a href="/"></a></li> <li><a href="/"></a></li> <li><a href="/"></a></li> </ul> </nav> </section> <section id="stream"> <article> </article> <article> </article> <article> </article> </section> </div> </body> body { height: 100%; overflow: auto; margin: 0; padding: 0; position: relative; } #container { margin: 0 auto; padding: 0; position: relative; width: 700px; }

Learning a binary classifier which outputs probability -

when, in general, objective build binary classifier outputs probability instance positive, machine learning appropriate , in situation? in particular, seems support vector machines platt's scaling candidate, read around web uses kernel logistic regression or gaussian processes task. there evident advantage/disadvantage of 1 approach against others? thank you listing potential algorithms use general task close impossible. since mentioned support vector machines (svms), try elaborate little on those. svm classifiers never output actual probability. output of svm classifier distance of test instance separating hyperplane in feature space (this called decision value). default, predicted label selected based on sign of decision value. platt scaling fits sigmoid on top of svm decision values scale range of [0, 1], can interpreted probability. similar techniques can applied on type of classifier produces real-valued output. some evident advantages svm include: c

backbone.js - Combining UNDERSCORE.JS and JSP -

i'm trying develop web application obtains information server (in mysql database ) , shown client (via browser) information. i want use backbone.js , default templates system (underscore.js) in client part. other hand, want use jsp accessing information mysql database in server. my problem don't know fine if it's possible combine jsp , underscore.js (independently of syntax's problems associated fact <% %> structure same both technologies of). i have searched it, haven't found example use both technologies. it's possible combine both? or why not? can show me example? thanks in advance!! modified next: i'm aware of syntax problem's existence, don't understand combine both (jsp , undescore.js). if have next template (underscore.js) in html file: <!-- language: lang-js --> <script type="text/template" id="showtemplate"> <h2> <%= title %> <small>by: <%= author

android - Checkbox not clickable in simple listview -

i have simple listview (not custom listview) checkbox in right side these checkboxes not clickable. here mainactivity.java code: setlistadapter(new arrayadapter<string>(this, android.r.layout.simple_list_item_multiple_choice, getresources().getstringarray(r.array.myarray))); and here xml code: <listview android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" > </listview> also need find out checkbox clicked on click of button. i have seen may questions posted on stackoverflow realeated custom listview. listview.setchoicemode(listview.choice_mode_multiple); listview.setlistadapter(new arrayadapter<string>(this, android.r.layout.simple_list_item_checked, getresources().getstringarray(r.array.myarray)));

javascript - Choropleth in Leaflet -

i'm new leaflet (and stackoverflow) , i've been trying choropleth show on map. have basic leaflet map shows up, when try geojson display, thrown error. var map; window.onload = initialize(); function initialize(){ setmap(); }; function setmap() { map = l.map('map').setview([45, -90], 7); var layer = l.tilelayer('http://{s}.acetate.geoiq.com/tiles/acetate/{z}/{x}/{y}.png',{ attribution: 'acetate tileset geoiq', }).addto(map); var mylayer = l.geojson().addto(map); mylayer.adddata(counties); }; "counties" refers name of geojson file created. need style in anyway show up? any great appreciated. thanks! to show yes. start with: function getcolor(d) { return d > 1000 ? '#800026' : d > 500 ? '#bd0026' : d > 200 ? '#e31a1c' : d > 100 ? '#fc4e2a' : d > 50 ? '#fd8d3c' : d > 20 ? '#feb24

wordpress - Redirect people who visit from a specific link to another page -

i have situation a.com link products, , have visitors come check out, , discussing it. i not want this, nore interested in pointless visits, eats away @ bandwidth. i want manually place code in product page's header, or .htaccess file, redirect a.com, a.com, or google.com a typical link come in format: forum.a.com/showthread.php?t=1111111 i know can code: rewriteengine on # options +followsymlinks rewritecond %{http_referer} badsite\.com [nc] rewriterule .* - [f] but not wish show "forbidden" message. want kindly show them on way away site. solution : <?php $http_referrer=$_server['http_referer']; if ($http_referrer) { // check if referrer on noentry list // if redirect page if ($http_referrer == "http://website.com") { header("location: http://gotothiswebsiteinstead.com"); die(); } } else { //everything ok } ?> something should wa

java - Page not found 404 on unauthorized URL when page not exists -

i have following setup of spring security default deny (see example below). don't want change default deny because it's defensive way of security configuration , it's considered practice. if user want access page doesn't exist gets 403 because default deny strategy. want result 404 when page not exists , 403 when user have restricted access. there way configure spring security behavior? example : <intercept-url pattern="/posts/remove" access="hasrole('admin')" /> <intercept-url pattern="/posts/add" access="hasrole('editor')" /> <intercept-url pattern="/posts" access="permitall" /> <intercept-url pattern="/" access="permitall" /> <!-- default access denied --> <intercept-url pattern="/**" access="denyall" /> </http> when user requests /something-that-not-exists should 404 (no

php - Wampserver Orange - PHP_curl.dll -

my wampserver orange , won't change. when go onto apache error log get php warning: php startup: unable load dynamic library 'c:/wamp/bin/php/php5.4.3 / ext/php_curl.dll' - application has failed start because side-by-side configuration incorrect. please see application event log or] use command-linesxstrace.exe tool more detail.\r\n in unknown on line 0 i understand common problem relating php_curl.dll. have tried many solutions , none work. have tried both php 5.4.3 dll fixes(anindya's blog) , replaced dll file in \wamp\bin\php\php5.4.3\ext. curl ticked , active in php.ini file. extension_dir = "c:/wamp/bin/php/php5.4.3/ext/" ( curl located) php_curl.dll libeay32.dll ssleay32.dll have been copied c:/wamp/bin/php/php5.3.13/ext/ c:\windows\system32. is there else causing error merely trying install zend , been complicated trying work. i running wamp 2.2 on windows 7 64 bit. have restarted wamp after making changes. 1st.

nsstring - Strange Overflow - Objective-C -

i trying solve problem 22 project euler , following code : nsarray *alphabet = [nsarray arraywithobjects:@"a",@"b",@"c",@"d",@"e",@"f",@"g",@"h",@"i",@"j",@"k",@"l",@"m",@"n",@"o",@"p",@"q",@"s",@"t",@"u",@"v",@"w",@"x",@"y",@"z",nil]; nserror *error = nil; nsstring *file = [[nsbundle mainbundle] pathforresource:@"names" oftype:@"txt"]; nsstring *names = [[nsstring alloc] initwithcontentsoffile: file encoding: nsasciistringencoding error: &error]; if (names == nil) { [nsexception raise:@"error reading file :" format:@"%@",error]; } nsmuta

attributes - OpenGL 3/4 glVertexAttribPointer stride and offset miscalculation -

i having problem getting vertex array pointed properly: const float vertices[] = { /* position */ 0.75f, 0.75f, 0.0f, 1.0f, /* color */ 1.0f, 0.0f, 0.0f, 1.0f, /* position */ 0.75f, -0.75f, 0.0f, 1.0f, /* color */ 0.0f, 1.0f, 0.0f, 1.0f, /* position */ -0.75f, -0.75f, 0.0f, 1.0f, /* color */ 0.0f, 0.0f, 1.0f, 1.0f, }; ... glbindbuffer(gl_array_buffer, vertexbufferobject); glenablevertexattribarray(0); glenablevertexattribarray(1); glvertexattribpointer(0, 4, gl_float, gl_false, 0, 0); glvertexattribpointer(1, 4, gl_float, gl_false, 0, (void*)16); gldrawarrays(gl_triangles, 0, 3); gldisablevertexattribarray(0); gldisablevertexattribarray(1); i not understand how stride , offset work. correct way of going using glvertexattribpointer() in situation? stride , offset specified in bytes. using interleaved vertex array position , color both 4 floats. th i-th element in particular attribute array next one, there distance of 8 floats, stride should 8*sizeof(glfloat).

jquery - 0x800a139e - JavaScript runtime error: cannot call methods on dialog prior to initialization; attempted to call method 'close' -

i have cancel button not working on jquery modal dialog , appreciate help. exception i'm getting when click on cancel button of modal: 0x800a139e - javascript runtime error: cannot call methods on dialog prior initialization; attempted call method 'close' this partial view i'm displaying on modal: @model models.office @{ layout = null; } @scripts.render("~/bundles/jquery") @scripts.render("~/bundles/jqueryui") @styles.render("~/content/bootstrap") @scripts.render("~/bundles/bootstrap") @styles.render("~/content/css") @styles.render("~/content/themes/base/css") @scripts.render("~/bundles/modernizr") <script src="~/scripts/jquery.validate.min.js"></script> <script src="~/scripts/jquery.validate.unobtrusive.min.js"></script> <script src="~/scripts/jquery.unobtrusive-ajax.min.js"></script> &l

Using subtract predicate in swi prolog -

i need subtract numbers given list. use swi prolog. did. subtract([1,4],[1,2,3,4,5],'l') but doesnt seem working in swi prolog..pls me.... l needs variable, name must without quotes, this: subtract([1,4],[1,2,3,4,5],l). this produces empty list, because both 1 , 4 in larger list. if switch lists around, l [2,3,5] : subtract([1,2,3,4,5],[1,4],l). here demo on ideone .

parsing - Handling extra operators in Shunting-yard -

given input this: 3+4+ algorithm turns in 3 4 + + i can find error when it's time execute postfix expression. but, possible spot during conversion? (wikipedia article , internet articles i've read not handle case) thank you valid expressions can validated regular expression, aside parenthesis mismatching. (mismatched parentheses caught shunting-yard algorithm indicated in wikipedia page, i'm ignoring those.) the regular expression follows: pre* op post* (inf pre* op post*)* where: pre prefix operator or ( post postfix operator or ) inf infix operator op operand (a literal or variable name) the wikipedia page linked includes function calls not array subscripting; if want handle these cases, then: pre prefix operator or ( post postfix operator or ) or ] inf infix operator or ( or , op operand, including function names one thing note in above pre , inf in disjoint contexts; is, if pre valid, inf not, , vice versa. implies using sam