Posts

Showing posts from January, 2011

django csrf for api that works with ios apps -

i building ios app communicates server getting data. if normal app, can send csrf token via forms (since same domain). but, ios apps, dont think can set csrf token . so, when making requests ios apps, server, getting error regarding csrf. so, whats solution this? disabling csrf feature or other better way ? first ios app, please tell me better way follow that. for urls ("api end points") ios app accessing, need specify @csrf_exempt on corresponding view functions disable csrf protection. more details here - https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#django.views.decorators.csrf.csrf_exempt and protect urls via other authentication methods, such session authentication. for authentication purposes, can take reference django rest framework , django tastypie has done. both use sessionauthentication classes handle authentication , protect exposed urls (api endpoints) ios app can connect to. references:- http://django-rest-framework.org

Highslide: Pause HTML Slideshow when Gallery Expands -

i created html gallery expands image every window. http://mmvirtualtours.com/0002/photos.php when run gallery slideshow pause when contained image expands. trying following code: hs.expander.prototype.onafterexpand = function() { if (this.contenttype == 'html') { this.slideshow.pause(); as pause after every transition in slideshow. need change contenttype , or there better way this? thanks! remove this: hs.expander.prototype.onafterexpand = function() { if (this.contenttype == 'gallery') { this.slideshow.pause(); } }; add this: // stop slideshow when viewing large image function stopslideshowandexpand(element, config) { var exp = hs.getexpander(element); if (exp.slideshow) { exp.slideshow.pause(); } return hs.expand(element, config); } change onclick large image in highslide-maincontent div: <a class='highslide' href='media/01.jpg' onclick="return stopslideshowande

http post - Passing values to server by HttpPost Android -

i trying post values server http post method getting error: org.apache.http.client.httpresponseexception: not found detail message - not found i using keyvalue pair method send values, please hep me in this, appreciated. code - httpparams httpparams = new basichttpparams(); httpconnectionparams.setconnectiontimeout(httpparams, 1000); httpconnectionparams.setsotimeout(httpparams, 1000); httpparams p = new basichttpparams(); httpclient httpclient = new defaulthttpclient(p); string url = "myurl"; httppost httppost = new httppost(url); try { list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>( 7); namevaluepairs.add(new basicnamevaluepair("username", "test")); namevaluepairs.add(new basicnamevaluepair("password", "ramos")); namevaluepairs.add(new basicnamevaluepair("fullname", "mark"));

How can I split a CSV file in PHP? -

i have big csv file. want separate file separate files based on value in 1 of fields. this have done. using fgetcsv convert csv array, , using in_array , check content , display if contains string within array. i getting comparison string text file iteratively check whether contained in csv. in case have specified "testing". below code: if (($handle = fopen("test.csv", "r")) !== false) { while (($data = fgetcsv($handle, 1000, ",")) !== false) { if(in_array("testing", $data)) { var_dump($data); } } fclose($handle); } this working, stuck. how write $data csv file? or there better way this? it's pretty simple , if string has on line, don't need fgetcsv. just $srcfile = new splfileobject('test.csv'); $destfile = new splfileobject('new.csv', 'w+'); foreach ($srcfile $line) { if (strpos($line, '

Parsing excel data ( containing xml ) in VBA -

i have simple excel file containing rows , columns. 1 of column contains rows of data string (xml data) <employee name="r1" designation="developer"> <skillset language="c#"/> </employee> <employee name="e2" designation="developer"> <skillset language="java"/> </employee> i read information in excel file, parse based on particular skillset , put them in same excel workbook in adjacent column. may need provide button click may trigger action. how approach problem. should write macro or should write excel addin. excel can either 2003 or earlier/2007/2010. i can think of writing user defined function read cell data but, how read through columns in vb , how re-use function across different excel-workbooks. although maybe coming @ late hour, had thesame problem mention. i'm kind of new vba. client wanted database application in access 2003. after persuation, able c

android - OnActivityResult Doesn't work with activityGroup -

im app use tabhost. , activitygroup load activities under tab. on 2nd tab open activitygroup "tabgroupactivity"... , here open child activity "childactivity2". "childactivity2" want open normal activity has theme dialog. , when return normal activity want run onactivityresult() in childactivity2. onactivityresult() in childactivity2 not working. the code in childactivity2 start normal activity is data.putint("doctorid", doctor_id); intent createschedule = new intent(scheduleweekly.this, createschedule.class).putextras(data); startactivityforresult(createschedule, 1); this onactivityresult() @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if(resultcode==activity.result_ok) { log.e("get","result"); ................. ...

c# - Bundle Wont Include -

i have simple bundle wish include @scripts.render("~/bundles/bjqs") the bundle config looks this bundles.add(new scriptbundle("~/bundles/bjqs").include( "~/scripts/bjqs-1.3.min.js")); however never gets included. if manually include this @scripts.render("~/scripts/bjqs-1.3.min.js"); it works, defeats purpose of bundle. help me stack overflow, hope. sometimes may need clear ignorelist,especially if including min files in bundle. bundles.ignorelist.clear(); and add bundles.add(new scriptbundle("~/bundles/bjqs").include( "~/scripts/bjqs-1.3.min.js")); a post on behavior here

javascript - jQuery iScroll clickable list elements while retaining scroll? -

is possible have clickable elements? such list elements? while using iscroll? seems short of button, or maybe link can't click on element make something. had similar issue inputs well. enough searching able find solution helped me place work inputs. have need have scrollable ui while having ability click on thats not button or link, such li contained within specific uls. so wondering if there way of having iscroll tell difference between click or tap rather vs scroll, , such have action desired.

java - Can you programmatically access current Heroku dyno id/name? -

on heroku, can programmatically, within app, kind of identifier dyno executing code? example dyno name (e.g. "web.1" or "worker.1"), or other id. if yes, how in java? there hostname of machine (which looks d.long_guid . suppose (though haven't tried) should work: string localhostname = java.net.inetaddress.getlocalhost().gethostname(); also, little known secret, can "web.1", "web.2" id's looking @ value of environment variable ps1 string hostid = system.getenv("ps1") edit 2013-july-26 as per heroku changelog , local environment variable dyno replaces ps , replaced ps1 .

objective c - How to make a uibutton with touch down action and touch up inside action -

i need make 1 button 2 actions, touch down used play sound , touch inside stop playing sound when let go of button connect 2 methods both these actions. [self.yourbtn addtarget:self action:@selector(touchdownmethod:) forcontrolevents:uicontroleventtouchdown]; [self.yourbtn addtarget:self action:@selector(touchupinsidemethod:) forcontrolevents:uicontroleventtouchupinside];

node.js - Attach helpers to Jade when running client side (in browser) -

i have made single page app powered node js (express) mongo db. have used jade templating , have templates rendered in browser. templates render fine except unable workout how add helpers. in particular i18next. i have set route template/get/ looks this: var fs = require('fs'); var jade = require('jade'); exports.get = function(req, res){ fs.readfile('views/partials/listing_snippet.jade', {encoding: 'utf-8'}, function (err, data) { if (err) throw err; console.log(data); t = jade.compile(data, {client: true, compiledebug: false}); res.send('var template = {listing_snippet: ' + t.tostring() + '}'); }); } i include , jades 'runtime.js' scripts @ top of page. template renders fine calling template.listing_snippet({locals: foo}); but can not i18next's helpers work. assume need attach helper somehow... documentation little thin in area.

c++ - QueryDWORDValue returns 0 -

i using cregkey retreive dword value registry. code below returns 0 (buf zero), actual value in registry 1354357483. cregkey reg; reg.open(hkey_local_machine, "software\\microsoft\\windows nt\\currentversion", key_read); dword buf; dword s = reg.querydwordvalue("installdate", buf); if (s == error_success) { reg.querydwordvalue("installdate", buf); cout << hex << buf; } i suspect has character sets far not find solution. project character settings set "not set". tried unicode , using wide strings no avail. also followup question, there way read binary data registry , casting std::string? data addition/loss not problem trying do. hans passant correct. program reading 32bit version of registry while regedit showing 64bit version why values did not match. adding key_wow64_64key flag read intended registry solved problem.

Is there a convenient way to prototype future structure of View layer of MVC framework (Rails or like) on pure HTML? -

my "rails friends" have situation when ui designer beginning work on prototyping ui screens on own - rails programmer busy , going join work later, later. i know, easy ask ui designer learn rails rendering mechanism, begin prototyping on rails, interested, is possible setup views structure using partials (reusable pieces of html views) using pure html, without ruby code inside? the approach see use ssi . there other options? what needed possibility 1 html-file have string like <whatever include other.html ...> which include contents of other.html inside body. this way, future project can divided logically on changeable/nonchangeable parts without ruby/php code partials. update 1 the quoted wiki page ssi has client side includes section suggests using object tag seems work <object type="text/html" data="test.html"></object> one suggestion use sinatra , simple , quick web framework static sites. it's e

android - Issue in getView() Of BaseAdapter For GridView -

Image
i creating calender app. in user should enter events. events stored in local database. have created baseadapter class. in baseadapters getview() method happened cant understand. please see screen shot have attached here. in screen find calender. @ right bottom side call see white-gray colored plus button. when user press button in calender's grid view grid shells display green colored small plus sign. done in baseadapters getview() method. please see code here : package com.examples; import java.lang.reflect.array; import java.text.parseexception; import java.text.simpledateformat; import java.util.arraylist; import java.util.calendar; import java.util.date; import java.util.gregoriancalendar; import java.util.hashmap; import java.util.iterator; import java.util.list; import android.r.integer; import android.content.context; import android.content.sharedpreferences; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.graphics.col

jmenuitem - How to refresh item in a popup menu? -

i have popup menu (that comes out when user uses right click on specified elements), wich items readed list. want when item selected, item disabled in popupmenu (then if action happen return enabled). have implemented popupmenu, cannot implement enable/disable jmenuitem element. can me? thanks class popuptriggerlistener extends mouseadapter { public void mousepressed(mouseevent ev) { if (ev.ispopuptrigger()) { menu.show(ev.getcomponent(), ev.getx(), ev.gety()); x = ev.getx(); y = ev.gety(); } } public void mousereleased(mouseevent ev) { if (ev.ispopuptrigger()) { menu.show(ev.getcomponent(), ev.getx(), ev.gety()); x = ev.getx(); y = ev.gety(); } } public void mouseclicked(mouseevent ev) { } } } jlabel label = new mylabel("right-click"); public test() { setdefaultcloseoperation(jframe.exit_on_close);

Does selenium webdriver support css contains? -

i've read "the css2 contains function not in css3, selenium supports superset of css 1,2 , 3." will contains supported selenium server using webdriver or supported when using selenium ide? i came across more information may useful you. use contains in css selector. have use :contains pseudo class not supported in recent versions of css selector engines,upon webdriver relies css selector, hence not preferred way these days. same effect of using contains use div[name*='part'] in css selector , match div tags id contains 'part'. equivalent using //div[contains(@name,'part')] in xpath selector. this question has similar discussions own. check stackexchange answer more information.

Jquery chained select box, how to disable blank option -

<select id="countryselect" name="country> <option value="us">united states</option> . . </select> <select id="cityselect" name="city"></select> this html code and $.cityselect = function(){ var td= $('#countryselect').val(); $.ajax({ type: "post", url: "action.php", data: {'countrytd':td}, success: function(e){ $('#cityselect').html(e); }, }); }; this chained select function. mysql process creating options in action.php. here thing, when use function, result that <select id="cityselect" name="city"> <option value></option> // empty value <option value="1">new york</option> <option value="2">broadway</option> </select> i dont want empty value because need information. there

asp.net - Render the same user control multiple times -

is possible render same user control (.ascx) multiple times? idea create dashboard widgets represented user controls. there can several widgets differ settings only. mvc view: @html.partial("reportviewerusercontrol", 1) @html.partial("reportviewerusercontrol", 2) user control: <%@ control language="c#" inherits="system.web.mvc.viewusercontrol<system.int32>" %> <script runat="server"> private void page_load(object sender, eventargs e){ /* */ } </script> <div> <form id="form1" runat="server"> <asp:scriptmanager id="scriptmanager1" runat="server"> </asp:scriptmanager> <rsweb:reportviewer id="reportviewer1" runat="server" asyncrendering="false"> </rsweb:reportviewer> </form> </div> now 1 user control displayed

php - Regex link from google results -

i trying urls google results, google api doesn't allow getting more first 100 results, thought of copying google content, pasting file , using preg_match_all results. unfortunately not regular expressions. can me this? main problem links not have "http://". $body="php – wikipedia, wolna encyklopedia pl.wikipedia.org/wiki/php‎ php jest najczęściej stosowany tworzenia skryptów po stronie serwera www, ale może być on również używany przetwarzania danych z poziomu ... możliwoÅ›ci - historia - moduÅ‚y - skÅ‚adnia php: hypertext preprocessor php.net/‎tÅ‚umaczenie strony server-side html embedded scripting language. provides web developers full suite of tools building dynamic websites: native apis apache , ... downloads - documentation - simple tutorial - news archive - 2012 php: downloads php.net/downloads.php‎tÅ‚umaczenie strony binaries other systems. not distribute unix/linux binaries. l

python - Evaluate javascript on a local html file (without browser) -

this part of project working on work. i want automate sharepoint site, pull data out of database , coworkers have front-end access to. i managed mechanize (in python) accomplish using python-ntlm, , patching part of it's source code fix reoccurring error. now, @ hope final roadblock: part of form need submit seems output of javascript function :| , lo , behold... mechanize not support javascript. don't want emulate javascript functionality myself in python because ideally reusable solution... so, anyone know how evaluate javascript on local html download sharepoint? want run javascript somehow (to complete loading of page), without browser. i have looked selenium, it's pretty slow amount of work need done... looking pyv8 try , evaluate javascript myself... surely there must app or library (or anything ) can this?? well, in end came down following possible solutions: run chrome headless , collect html output (thanks koenp link!) run phantomjs ,

wordpress - Change height of Navigation bar in Twenty Eleven theme -

Image
i need change menu height 41px; in twenty eleven theme. i follow this steps . and this. need increase height of menu "about" box need menu responsive.

delphi - How to set multiple array fields at once without using a for loop in pascal? -

i learning pascal , stuck problem concerning array manipulation. have come across method of setting arrays, have seen in other languges, not know how similar in pascal. the declaration of variable looks this: rotationbounds: array of array of integer; setlength(rotationbounds, 5, 5); and want this: rotationbounds := [ [0, 0, 0, 0, 0], [0, 1, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 1, 0], [0, 0, 0, 0, 0], ]; basically, trying set multi-dimentional array directly, rather looping through it. one of focuses make picture, easy read , understand. is there way achieve this? i using borland delphi 6 compiler progam. in delphi 6 there no built in support dynamic array initialization. i'd use pair of helper functions this: type tintegerarray = array of integer; tintegermatrix = array of tintegerarray; function integerarray(const values: array of integer): tintegerarray; var i: integer; be

include - 2 JQuery menus conflicting -

i have 2 jquery navigation menus. my main navigation (navig.php) uses following jquery scripts: <script src='/new/navig/js/jquery-1.8.1.min.js' type='text/javascript'></script> <script src='/new/navig/jquery.kwicks.js' type='text/javascript'></script> my sub menu (menu.php) uses following jquery scripts: <script type="text/javascript" src="/new/menu/jquery.js"></script> <script type="text/javascript" src="/new/menu/sliding_effect.js"></script> i have little knowledge of subject, seeing both these navigations included in pages, have declare jquery @ start of every page? if scripts delete in these pages? edit: moved first script each page index.php includes pulled to. menu.php still worked fine navig.php did not (same before). script in navig.php being declared in body before used , not work anywhere else. is there way overcome conflict or need find m

javascript - Rendering in backbone error -

i'm trying render don't know javascript , compare error: uncaught referenceerror: wrapper not defined. render result of collection's fetch in same view. var homeview = backbone.view.extend({ template: handlebars.compile(template), events: { }, initialize: function() { console.log("inhomeview"); var amici = new usercollection(); amici.fetch({ success: function() { amici.each(function(object) { console.log(object.tojson()); var wrapper=object.tojson(); }); }, error: function(amici, error) { // collection not retrieved. } }); this.render(); }, render: function() { var context=wrapper; var html =this.template(context); this.$el.html(html); return this; } }); return homeview; }); perhaps want similar (please read comments in code below): var homeview = backbone.view.extend({ template: handle

vb.net - Populating a DataGrid using a Parameterised SQL Server Stored Procedure -

i'm newb visual studio , vb , need little help. i've created project in visual studio 2012 express with: a data connection sql server db within data set a data source/tableadaptor linked a stored procedure . it seems difficult see data connections, data sets, data sources , table adaptors have been created , i'm confused why 1 , 2 aren't same thing. the stored procedure accepts parameters , provides results based on parameters. in preview - works fine. now, i'm trying populate data grid data data source using supplied parameters when button pressed. i'm falling down. i've instantiated tableadaptor private sub btnreport_click_1(sender object, e routedeventargs) handles btnreport.click dim tableadapter new jbdataset.p_utility_unlocked_tasksdatatable() me.mydatagrid.datasource = tableadapter.getdata("report", "1234") end sub i think first line (dim) correctly instantiates tableadapter know second line

java - Assigning another class variable value to another class Variable -

i have 2 arrays in 2 different jframes(stores records objects) , haves separate attributes 2 arrays. trying when user enters details in first form , in radio button selection if user selects inpatientcare, open second form , make user enter inpatient care details in form. when user clicks register in inpatient care form , import firstname , last name details user entered in first form , second form put in inpatient care array (2nd array). i have tried using get/set methods value stored in firstname, error called "exception in thread "awt-eventqueue-0" java.lang.nullpointerexception". here have done :- private string firstname; public string getfirstname() { return firstname; } // have got input through text field in firstname variable havent showed here. in second form used method , tried assign in variable. string firstname = patient.getfirstname(); in second form used method value stored in firstname variable, pr

push notification - putExtra using pending intent not working -

i have written code in gcmintentservice sends push notifications many users. use notificationmanager call descriptionactivity class when notification clicked. send event_id form gcmintentservice descriptionactivity protected void onmessage(context ctx, intent intent) { message = intent.getstringextra("message"); string tempmsg=message; if(message.contains("you")) { string temparray[]=tempmsg.split("="); event_id=temparray[1]; } nm= (notificationmanager)getsystemservice(notification_service); intent = new intent(this, descriptionactivity.class); log.i("the event id in service is",event_id+""); intent.putextra("event_id", event_id); intent.putextra("gcmevent",true); pendingintent pi = pendingintent.getactivity(this,0, intent, 0); string title="event notifier"; notification n = new notification(r.drawable.defaultimage,message,system

batch file - set /P if statement error (windows 8) -

can please tell me wrong line of code? :server @echo off color 04 title start server cls echo start minecraft server? (y/n) set /p %serverchoice%=blah>nul if %serverchoice%==y start c:\users\link1_000\desktop\bukkit_craft\run.bat pause>nul goto :start all gives me cd unexpected @ time, run echo on see if changes directories, does't. ideas? not sure cd error coming since don't have cd in code shown, set line should not have percent signs: set /p serverchoice=blah>nul with percent signs, interprets environment variable, isn't need.

grails - How to set unique hasMany relations based class properties? -

i have 2 domain classes: class book { string name static hasmany = [articles: article] } class article { string name static belongsto = [book: book] } i want validate book have unique articals in terms of article name property. in other words: there must no article same name in same book. how can ensure that? you can custom validator on book class (see documentation ). a possible implementation can this: static constraints = { articles validator: { articles, obj -> set names = new hashset() (article article in articles) { if (!names.add(article.name)) { return false } } return true } } in example using java.util.set check duplicate names ( set.add() returns false if same name added twice). you can trigger validation of object mybookinstance.validate() .

how to get bounding box or rect (getBBox()) for svg path in jquery -

i want getbbox() svg path in jquery. tried this $("#"+ path id)[0].getbbox() -> returns x=0,y=0,width=0,height=0 i have added path svg element. tried other element in svg, example text node in case returns bounding box value. how can calculate bounding box path in svg? <path id="container_svg_john_0" fill="none" stroke-width="3" stroke="url(#container_svg_john0gradient)" stroke-linecap="butt" stroke-linejoin="round" d="m -2390.2 -125.8888888888889 l 0 0 m 0 0 l 251.60000000000002 -45.77777777777778 m 251.60000000000002 -45.77777777777778 l 503.20000000000005 -11.444444444444445 m 503.20000000000005 -11.444444444444445 l 629 -183.11111111111111 "/> getbbox native svg method , isn't part of jquery need write $("#"+ path id)[0].getbbox() example if you're getting non-zero value example , 0 value in code there must else going on you've not shown us. th

android - Alternate image in a imageview of screen -

i have 2 images in drawable folder , desire alternate 2 images in view every x time. try use asynctask don't work , can't found solution. my xml code <imageview android:id="@+id/imageload" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:layout_marginbottom="64dp" android:adjustviewbounds="false" android:baselinealignbottom="false" android:contentdescription="@string/imatge" android:croptopadding="false" android:fitssystemwindows="false" android:focusable="false" android:focusableintouchmode="false" android:src="@drawable/hdtitol2" /> i call class with: new modifyimage().execute(null,null,null); the main class contains de class async code public class mod

javascript - Skrollr - How to stop the div stop scrolling when reaching top ot window -

i trying make website using skrollr (javascript library): http://prinzhorn.github.io/skrollr/ the scrollr works fine, not able figure out 1 thing. how stop div scrolling further away top of screen. once top of div hits top of page, want stop scrolling, when second div starts coming on top of it, gives feeling of stacked cards. and when scrolling back, div start scroll after 1 on top has left bottom of page. i hope explanation bit clear, if not try explain using graphics. now code part. after reading documentation, tried both these: data-top , data-end none of them worked actually. i tried: data-top="background-position:0px 0px;" i not sure if want achieve possible or not. if not, can overlapping vertical scrolling reducing scroll speed after top of div crosses top of browser window. please ask me if of explanation confusing, know it's not easy explain problem verbally. skrollr not magic, css. if want div stop, find way using css. accomplis

github - Differences between two versions of the same file in nonadjacent commits in git -

let's have repository commits: latest-commit before-latest-commit ... some-old-commit let's has file called 1.file let's looks across various commits: some-old-commit: a=1; before-latest-commit: a=1; b=2; c=3; latest-commit: a=1; c=3; can somehow view differences between latest-commit , some-old-commit versions of 1.file (preferably on github) , have line c=3; marked new, while went on b left out (as it's irrelevant). this seems basic, wasn't able achieve desired result. use: git diff some-old-commit..latest-commit -- 1.file you'd not able run on github first fetch github in local repository.

vb.net - VB 2012 TextBox.Clear() not working -

Image
i'm working on encryption program , uses "pin" calculate stuff encryption. have textbox user can insert "pin". i'd prevent people entering numbers. added on keypress event: if not char.iscontrol(e.keychar) if not char.isnumber(e.keychar) msgbox("invalid character", , "warning!") textbox3.clear() end if end if it shows msgbox , doesn't write textbox until close th emsgbox. typed character appears in textbox. when write 1 works same before, replaces last character instead of writing one. there i'm missing because looks bug me? set es_number windows style textbox: public class form1 public const gwl_style integer = (-16) public const es_number integer = &h2000 public declare function getwindowlong lib "user32" alias "getwindowlonga" _ (byval handle intptr, byval nindex integer) integer public declare function setwind

Dwolla MassPay get data for each user? -

its not clear dwolla's api if there way info for each user's failed vs. succeeded payment using dwolla's masspaycreate() or masspaydetails() api calls? both api calls seem report aggregated data seems confusing because i'd expect masspaydetails() return array of data parsed transaction details each user. what's deal this? i've extended jobbyid() api call accept "include_details" parameter, when specified true, returns job's rows , details. additionally, i've added api call, rowbyid() , accepts job row id, , returns detailed information specified row only.

hosting - accessing image from public_html not possible -

i using cyberhost.in host jsf application. problem facing whenever trying access image files public_html folder getting 404 error . have kept war file in webapps folder. using c-panel, thing want take backup of files website have kept them in public_html folder. saving files under webapps/[war file name] when ever trying overwrite webapps/[war file name] getting permission denied error . you should upload image files on location have mentioned in code, otherwise should change location in website code of same. also check permissions/ownership of files

leaflet - How to determine what terrain / map type a marker or point is on? -

is possible leaflet.js or mapbox.js determine terrain / map type marker on.. example sea, land, road or buildings? http://leafletjs.com/ http://mapbox.com/ if building own map tilemill , interactivity: http://mapbox.com/tilemill/docs/crashcourse/tooltips/ wouldn't necessary have have popup appear, instead use utfgrid key/value store indicate areas tapped on map.

Wordpress custom author urls -

i want implement custom author urls. currently author urls this: http://site.com/author/author-name/ i want http://site.com/my-custom-url-here for each individual user. have tried using author_rewrite_rules filter, using following code, converts url correctly gives me page not found message when browse url add_filter('author_link', 'no_author_base', 1000, 3); function no_author_base($link, $author_id) { $link_base = trailingslashit(get_option('home')); $link = preg_replace("|^{$link_base}author/|", '', $link); return $link_base . $link; } add_filter('author_rewrite_rules', 'no_author_base_rewrite_rules'); function no_author_base_rewrite_rules($author_rewrite) { global $wpdb; $author_rewrite = array(); $authors = $wpdb->get_results("select user_nicename nicename $wpdb->users"); foreach($authors $author) { $author_rewrite["({$author->

audio - Playing just one sound android -

i'm developing little quizz app , play sound depending on if user answers question correctly or not. i've got many sound files in "assets/". what play 1 of these sounds. i've been able play sound, not one, both sound (correct , incorrect) played 1 after other. how can play one? here's source: public void audioplayer(){ //set mediaplayer mp = new mediaplayer(); try { string mp3file = "correct.mp3"; assetmanager assetman = getassets(); fileinputstream mp3stream = assetman.openfd(mp3file).createinputstream(); mp.setdatasource(mp3stream.getfd()); mp.prepare(); mp.start(); } catch (exception e) { e.printstacktrace(); } } put sound files i.e fail , applause in raw folder , use following code : private assetfiledescriptor splaysounddescriptor = null; private assetfiledescriptor sfailsounddescriptor = null; private mediaplayer mp = null; public static fi

GIT pull conflict: how come not on any branch? -

i have branch checked out , edit , commited file. in meanwhile, else pushed changed same file. when git pull, see first, rewinding head replay work on top of it... applying: add new line applying: create 1 conf using index info reconstruct base tree... falling patching base , 3-way merge... auto-merging <filename> conflict (add/add): merge conflict in <filename> recorded preimage '<filename>' failed merge in changes. patch failed @ 0002 create 1 conf when have resolved problem run "git rebase --continue". if prefer skip patch, instead run "git rebase --skip". restore original branch , stop rebasing run "git rebase --abort". i tried manually resolve conflict in file, see not on branch. wondering why happening. git status # not on branch. # untracked files: this normal. need fix file , follow rebase instructions - --continue . you resolve issue by edit files resolve conflict perform git checkout --ours -

php - Can I schedule HTTP requests from Apache? -

i trying build website user can control switches. switches on remote nodes (for simplicity nodes can extract useful data http requests). user may set schedule when turn on , turn off switches. (e.g. turn on @ 4:00pm , off @ 6:00pm on tuesdays example). is possible send http requests wamp/lamp system @ specific times? (no page should loaded in browser)? example, @ 4:00pm on tuesday, send http request turn on , @ 6:00pm send request turn off. if not, best way handle such scenario? c program maybe? the website written on php running on apache web server. running on wamp on windows or httpd (under fedora linux). data stored on mysql database (that includes schedule) thank :-) use cron , curl . cron can run commands @ particular times, , curl can send http requests. crontab might this: # m h dom mon dow command 0 16 * * tue curl http://localhost/turn_on.php 0 18 * * tue curl http://localhost/turn_off.php see crontab(5) more information on for

casting - How can I remove the number associated with typeid( ).name( ) in C++? -

i have factory method class generates "items" , returns pointer item creates. i have derived classes of item. example, item can "weapon" "consumable" or "armor." i need detect type of item created can cast item type. did test lines , looks it's doing want, except adding number associated type. example: i had line: cout << "type created: " << typeid(pitem).name() << endl; which return base class item, display: "4item" i changed to: cout << "type created: " << typeid(*pitem).name() << endl; which give me correct derived type, throw in number. "5armor" why did pitem return base class? , why return int type? how can remove int? a solution want - in "cheating" kind of way: string type; string returnedtype = typeid(*pitem1).name(); (int i=1; < returnedtype.length(); i++){ type.p

design patterns - Difference between Business Delegate and View Helper -

they seem same thing - seperate presentation tier logic complexities of business tier. difference? both try separate complexities of components, but: view helper 's intent make views lighter (make them display stuff, really); business delegate intends decouple 2 components (leaving details of plumbing work third 1 in between them). i can see confusion comes from, alike in way. but, in practice, address 2 different issues: view helper as systems grow, people tend start putting code on view, jsp, , begins more , more complex. views aren't supposed have lot of code. supposed display data. if put heavy calculation in jsp, instance, on 1 hand code hidden amongst html tags and, on other, can't reuse anywhere in system. imagine having maintenance in code this. you'd go crazy. view helper teaches way can avoid making views simpler through creation of helper class heavy work , make jsp call instead of keeping complex code inside jsp. business

java - Editing the jsp content from a taglib -

i have filter processes given servlet mapping , includes jsp holds structure of every page. servletcontext.getrequestdispatcher( "/index.jsp" ).include( request, response ); inside jsp have custom jstl tag handles inclusion of jsp portion inside parent according series of rules (the inclusion done inside "body" tag: pagecontext.include( processuri.getjsplocation( request.getrequesturi() ) ); inside latest included jsp want able write stylesheet , append response. using taglib that. <taglib:head> <link rel="stylesheet" href="some.css" > </taglib:head> since contents of last jsp included "body" tag need access "head" , insert html after last item (i cannot insert stylesheet inside "body" tag). <head> ... <!-- want insert here --> <link rel="stylesheet" href="some.css" > <head> <body> ... how access processed resp

c# - Quick Search out of bounds of array and confusing array behaviour -

i'm having multiple problems program (c#.net) , have no idea what's causing them. the program intended sort list of names , birthdays (formatted first name,last name,dd/mm/yyyy ) in ascending , descending order first name, last name, , birthday. have other functions have not yet been implemented. the first problem in quiksortstr method. program crashes in first if block, stating j out of bounds of array. happens whether or not mode == "asc" . the second, , more confusing problem when values loaded text file, every odd-indexed value of first , last null, while each odd-indexed value of bday 1/1/0001 . i've included full program below reference, quicksort method , use of parallel arrays required. apologies lack of comments. thanks in advance help. i'm stumped. namespace names_arrays { public partial class frmnamarrays : form { system.globalization.cultureinfo culture = new system.globalization.cultureinfo("en-ca"); string[

java - FileWriter false overwrites file from string A to Z BUT leaves only string Z; how do I keep string A-Z? -

so have following code within program. i'm trying print variables have declared in main of program csv file. want replace in csv file (the file exists before portion of code have replace there). now, tried (myfoo, false) happens program iterates through a-z , leaves z in csv file. want write a-z in csv file , not @ z. my code: for(int t=0; t<superarray.size(); t++) { string temp = superarray.get(t).character; int temp2 = superarray.get(t).quantity; int temp3 = superarray.get(t).width; string temp4 = superarray.get(t).color; int temp5 = superarray.get(t).height; string eol = system.getproperty("line.separator"); string line=temp+","+temp2+","+temp3+","+temp4+","+temp5 + eol; file myfoo = new file("letters.csv"); filewriter foowriter = new filewriter(myfoo, true); foowriter.write(line); foowriter.close()

Spring - tag form:textarea must be empty, but is not error -

i want value in spring form based textarea using jstl tag, code given below how render this? <form:textarea value="${u.content}" path="content"> </form:textarea> i error "tag form:textarea must empty, not" on running view page if form bound commandname/modelattribute don't need value attribute path enough. e.g. if form declared below. <form:form id="form" method="post" modelattribute="formbean"> your text area needs just <form:textarea path="name"/> where name attribute of formbean object public class formbean { private string name = "name"; } pre initialized values. @requestmapping(value="/personform") public string showform(model model) { //read values db , add model .e.g. person person = new person(); model.addattribute("person", person); return "personform"; } jsp: <form:form ac

javascript - Add input box to div on click .html -

i have simple jquery script setup add input box div when div clicked. problem is, when click in input box add text, thinks i'm clicking on div again , try's add input box again, not letting me add text. $(".match").click(function() { var match_id = $(this).find(".match_id").text(); $(this).find("#bet").html("<div><input type='text'></div>"); }); any ideas how fix it? the problem input in div. need stop click event propagating div. try adding this: $('.match input').click(function(e) { e.stoppropagation(); e.cancelbubble = true; }); or, if want 1 input ever added div, can change event listener this: $('.match').one('click', function() { ... }); one() execute event listener , remove element, execute maximum of once each matched element.

What are the differences between the older row_number() and the newer OFFSET + FETCH based pagination in SQL Server? -

i have few questions in context of older row_number (sql server 2008) , newer offset + fetch (sql server 2012) paging mechanism provided sql server 2012. what limitations row_number()? is offset + fetch improved replacement row_number()? are there use-cases sufficed using 1 , not other? are there performance differences between two? if yes, 1 recommended? thanks. using row_number() works fine - it's more work necessary; need write "skeleton" cte around actual query, add row_number() column output set, , filter on that. using new offset / fetch simpler - , yes, it's better performance, these 2 links can show you: new t-sql features in sql server 2012 comparing performance different sql server paging so overall: if you're using sql server 2012 - should definitely use offset/fetch rather row_number() paging

vb.net - Getting a listbox item value safely in a thread -

hi have program run threads , updates ui in process. have used .invokerequired safe threading , running ok. in 1 of threads necessary use value of item in listbox created in thread (listbox2.items(index)) , i'm doing dim item1 integer =listbox2.items(index) . program running fine , showing no exceptions or error messages, however, if add watch of same line following message + accessibilityobject {"cross-thread operation not valid: control 'listbox2' accessed thread other thread created on."} system.invalidoperationexception. is normal? there way safely value of item in listbox located on thread? to answer question cross thread exception, normal , not allowed access ui elements different thread 1 created on. fix need use control.invoke() execute lambda expression run access code on thread created listbox. dim item1 integer if listbox2.invokerequired listbox2.invoke(sub() item1 = listbox2.items(index)) else item1 = listbox2.items(index) end

Load many large bitmap images as thumbnails - Android -

i'm working on media player app , wish load album art images display in listview. right works fine images i'm auto-downloading last.fm under 500x500 png's. however, added panel app allows viewing full screen artwork i've replaced of artworks large (1024x1024) png's instead. now when scroll on several albums high res artwork, java.lang.outofmemoryerror on bitmapfactory. static public bitmap getalbumartfromcache(string artist, string album, context c) { bitmap artwork = null; file dirfile = new file(sourcelistoperations.getalbumartpath(c)); dirfile.mkdirs(); string artfilepath = sourcelistoperations.getalbumartpath(c) + file.separator + sourcelistoperations.makefilename(artist) + "_" + sourcelistoperations.makefilename(album) + ".png"; file infile = new file(artfilepath); try { artwork = bitmapfactory.decodefile(infile.getabsolutepath()); }catch(exception e){} if(artwork == null) {