Posts

Showing posts from May, 2011

jcombobox - sorting java combobox items -

i'm trying names , ids database , add them combobox. i've added checkcombobox project; http://chianti.ucsd.edu/svn/csplugins/trunk/soc/jgao/idmapping/src/csplugins/id/mapping/ui/checkcombobox.java by of code; https://stackoverflow.com/a/17097767 resultset resultset= "here getting result set query having order clause while (resultset.next()) { int id = resultset.getint(1); string name = resultset.getstring(2); system.out.println(name); options.add(new option<integer>(name, id)); } system.out.println gives output sorted name items in checkcombobox not sorted. how can add items sorted in combobox? don't use set constructor, use checkcombobox(map<object, boolean> mapobjselected) constructor. use treemap . set constructor creates linkedhashmap default, doesn't preserve order. properly implement compareto method in code option

c# - Bitmap with Nearest Neighbor Causes Tearing -

Image
i've created test application generates code 39 barcode. problem when display barcode on screen, either blurs or gets torn. if use bitmapscalingmode other nearestneighbor , blurred barcode. when use nearestneighbor , diagonal slash shown below. diagonal occurs when resize window. (it stays there if stop in right spot.) image not change size, instead moves across screen resize window. i've tried using renderoptions.edgemode="aliased" well, doesn't seem have effect... torn / blurred / correct wpf sample code: <border borderbrush="black" borderthickness="1" horizontalalignment="center" verticalalignment="top" margin="0,50,0,0"> <image x:name="imgbarcode" stretch="fill" renderoptions.bitmapscalingmode="highquality" renderoptions.edgemode="aliased" /> </border> image generation: imgbarcode.source = loadbitmap(c.generate(barcodetext.text

jquery - Why does my close button not work on touchscreens? -

i got close button shows when image clicked, image resized , after clicking close button resized origin size. works fine on pcs not on mobile devices. here code: $(document).ready(function () { $('.image').click(function (event) { /* code hiding elements , enlarging image here */ $('#close_button2').show(); }); $('#close_button2').on('touchend click', function(event){ /* code showing elements , display image in smaller size again */ $('#close_button2').hide(); }); $(document).keyup(function (e) { if (e.keycode == 27) { /* code pressing escape button */ } }); }); instead of $('#close_button2').on('touchend click', function(event){ tried: $('#close_button2').click(function (event) { $('#close_button2').on( "vclick", function( event ) { //jquery mobile - there conflicts code $('#close_button2').on(ismobil

How to update Inner controls value in list in windows phone 7? -

i working in windows phone application have 1 listbox control. , 1 button inner control. so in list 20 buttons after binding data. want change data of button once clicked. this sample code. first app windows phone. <listbox grid.row="1" horizontalalignment="left" margin="10,10,0,0" name="lstinstagramtags" verticalalignment="top" width="444" height="562" selectionchanged="lstinstagramtags_selectionchanged"> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal" height="100" margin="-10,-10,-10,-10"> <button click="button_click" content="needtochangethisvalue" width="150" fontsize="13" height="60" margin="-560,35,5,5" /> </stackpanel> </datatemp

java - Play framework routes -

i want catch unkown operations. my routes file looks this: get / controllers.maincontroller.index() #all other routes #finally /[^/]+/ controllers.maincontroller.fault() the final definition @ bottom on list because of priority given above operations, otherwise requests true /[^/]+/ condition. the problem goes default catch page saying 'action not found' how can catch routes? i believe get /*route controllers.maincontroller.fault() would work better. route capture path received, can pass argument fault method. but, suggest alternative: can implement globalsettings object override method def onhandlernotfound(request: requestheader): future[simpleresult] this method called each time request not possible find proper handler. can find more information here: http://www.playframework.com/documentation/2.2.x/scalaglobal

php - date_sub function unrecognized in EasyPHP -

hello have writte php script uses date_sub function of php substract number date (eg.-1 date date). had , running using xampp(my server) in easyphp shows error "unrecognised command" date_sub. anyone knows error? used xaamp 3.2.1 php 5.4.22 i not sure version of php on easyphp(not server) think lastest available. (i can check it) date_sub should avaiable php 5.3.0 apear not using 5.4.22 think. if cant update can same functionality using strtotime $date = time(); $date = strtotime("-8 days",$date); $date = strtotime("-8 hours",$date); etc.

console - how to register my UART putc or puts function for use with standard library printf() function? -

i writing bare metal program beaglebone. use uart0 serial debug messages. have made custom function called uart0_putc(const char c); and uart0_puts(const char *str); which output character or string uart0 able see in terminal window. sourcery-codebench mentor graphics compiler suite using here provides standard c-libraries printf(). want hook uart0_putc , uart0_puts can use provided printf() getting formatted messages on terminal. anyone can tell me feasible? , how same? thanks in advance.

Cloudflare: how to set-up (DNS and name servers) -

first thought topic better suited server fault, after reading faq think otherwise. so, set cloudflare domain (i want use free cdn), documentation of cloudflare hardly sufficient beginner myself. lack of clarity worse in case, because domain , webspace hosted @ different companies. when put domain in cloudflare website, checks website , tells change name servers 2 servers of theirs. problem 1: should change name servers of domain host, or name servers of webspace host? (the latter didn't seem possible, suppose answer former.) after that, cloudflare gives list of different domains/subdomains of website , dns server and/or ip linked it. but: when go control panel of domain host, of these subdomains there - other ip addresses. shouldn't same? should change host's ip addresses ones cloudflare presents? should add subdomains can find on subdomain's host cloudflare? is possible not have change settings on webspace hosting? please not close "what h

php - En-/decrypt "AES/ECB/PKCS5Padding" in Java -

could tell me how decrypt data (using java) has been encrypted php function? php code public function pad($data, $blocksize = 16) { $pad = $blocksize - (strlen($data) % $blocksize); return $data . str_repeat(chr($pad), $pad); } public function decryptecb($data) { return mcrypt_decrypt(mcrypt_rijndael_128, self::blob_encryption_key, self::pad($data), mcrypt_mode_ecb); } public function encryptecb($data) { return mcrypt_encrypt(mcrypt_rijndael_128, self::blob_encryption_key, self::pad($data), mcrypt_mode_ecb); } i have tried of things here of them without padding , when add padding don't work. edit 1: (from php) the input looks this: http://pastebin.com/2cyig9nh key this: m02cnq51ji97vwt4 and output this: http://pastebin.com/xca50ugh (the java code) public class mcrypt { private secretkeyspec keyspec; private cipher cipher; private string secretkey = "m02cnq51ji97vwt4"; public mcrypt() {

delphi - A generic list of records that contains dynamic array -

i have generic list of records. these records contains dynamic array following type tmyrec=record myarr:array of integer; name: string; completed: boolean; end; var mylist:tlist<tmyrec>; myrec:tmyrec; then create list , set array length followings mylist:=tlist<tmyrec>.create; setlength(myrec.myarr,5); myrec.myarr[0]:=8; // demonstration myrec.name:='record 1'; myrec.completed:=true; mylist.add(myrec); then change data in myarr , change myrec.name , add item list myrec.myarr[0]:=5; // demonstration myrec.name:='record 2'; myrec.completed:=false; mylist.add(myrec); when myrec.myarr changes after adding first item list, myarr stored list changes. other record fields not. my question how prevent changes in myrec.myarr reflected on array stored in list item. do need declare multiple records. this example can simplified so, removing reference generics: {$apptype console} var x, y: array of integer; begin

Im trying to delete duplicates in excel from two columns AND also delete the original too -

we have 2 email lists have been "mixed" mistake. the first column has: email addresses want as aso don't want there. the second column has: the email addresses aren't needed and want extract column 1. is there simple way delete duplicates , delete unwanted email addresses column 1 too? i hope can understand ramble. for duplicate part : go "data" tab , click "remove duplicates", having selected columns. for data not want, might need "filters" if understood problem. go "data" tab, click "filters" , select data want, delete rows.

c - Set mixer as "default" ALSA API -

i wrote code open , control mixer volume: char *card, *channel; snd_mixer_t *handle = null; snd_mixer_elem_t *elem = null; static long alsa_min, alsa_max; void alsa_open_mixer( void ) { int err; static snd_mixer_selem_id_t *sid = null; if ((err = snd_mixer_open (&handle, 0)) < 0) return; if ((err = snd_mixer_attach (handle, card)) < 0) goto error; if ((err = snd_mixer_selem_register (handle, null, null)) < 0) goto error; if ((err = snd_mixer_load (handle)) < 0) goto error; snd_mixer_selem_id_malloc(&sid); if (sid == null) goto error; snd_mixer_selem_id_set_name(sid, channel); if (!(elem = snd_mixer_find_selem(handle, sid))) goto error; if (!snd_mixer_selem_has_playback_volume(elem)) goto error; snd_mixer_selem_get_playback_volume_range(elem, &alsa_min, &alsa_max); if ((alsa_max - alsa_min) <= 0) goto error; snd_mixer_selem_id_fre

javascript - ng-repeat not working in iOS -

i have ng-repeat looks this: <div ng-repeat = "header in headers" ng-show = "headers.length > 0"> <div class = "promoheader"> {{header.descript1}} </div> <div class="touchcarousel minimal-light promoscarousel"> <ul class="touchcarousel-container"> <li ng-repeat = "promo in header.promos" class="touchcarousel-item" ng-class = "{'disabledpromo' : invalidpromo(promo)}"> <a id = "{{promo.promoid}}" ng-click = "viewpromo(promo)"> <img class = "tcimage" ng-src = "{{promo.photourl}}"/> <div class = "tctext"><span class = "tctext-inner">{{promo.descript1}}</span></div> </a>

cassandra - Are PreparedStatements cached by CQL string? Does Datastax PreparedStatement retain statement ID? -

are statement caches on server , client side cached strictly string rendition of preparedstatement, or else? in other words, if 2 different preparedstatements created different means, end having same cql textual rendering, both have prepared (assuming same server)? if come different clients? much less importantly... under conditions client able translate preparedstatement statement id, without consulting server? (i'm coming oracle experience, if helps.) if 2 different preparedstatements created different means, end having same cql textual rendering, both have prepared (assuming same server)? if come different clients? executing same statement different clients ran test on this, 2 clients execute identical prepared statement twice, cql statement cache in o.a.c.cql3.queryprocessor#preparedstatements ended storing 2 statements though string rendition identical meaning preparedstatements different clients cached. executing same statement same client

c# - handle exceptions with attributes -

can please explain, in easy/simple way, how handle exception via attributes? for example if have simple code this: class test{ static void main(string[] args){ try { console.writeline("div= "+ division(0)); } catch (dividebyzeroexception e) { console.writeline("attempted divide 0 -->" + e.message); } console.readline(); } public static int division(int i){ return 10 / i; } } how can change code using attributes? this cannot done .net out of box. tl;dr - there no "very easy/simple way (...) handle exception via attributes" you're trying handle exceptions in aop way (aspect oriented programming), attach aspects methods - using attributes, example. postsharp allows this: without postsharp: public class orderfulfillmentservice { public void fulfill( order order ) { try { // stuff. }

sql - MySQL join with two potential field names -

for website i'm working on tasked implementing private messaging system. basic scenario here is, there several message entries in database, each containing sender , recipient. however, "current user" should able see both messages, both relevant him. problem is, interested in data of other user, not own. "current user" can both sender or recipient. my query down here gets job done, hardly elegant. joining both users, deciding using if data should get. select if(m.sender = ?, 1, 0) isself, if(m.sender = ?, u_recipient.id, u_sender.id) other_id, if(m.sender = ?, u_recipient.displayname, u_sender.displayname) other_name, if(m.sender = ?, u_recipient_avatar.url, u_sender_avatar.url) other_avatar, m.text text messages m left join user u_sender on u_sender.id = m.sender left join avatars u_sender_avatar on u_sender_avatar.id = u_sender.avatarid left join user u_recipient on u_recipient.id = m.recipient

javascript - How to handle changes in the validation in the Java Scripts in the J2EE applications -

how handle changes in validation in java scripts or adding additional validation in java scripts? we need refresh browser cache reload updated java scripts. is there optimized way handle reloading automatically , using cache when required.

objective c - Replace %20 with space character while saving file iOS -

i recording audio file , saving document directory. given name contain space character. when save document directory, space characters changed %20. know how save that audio file name contain space character. nsstring *mydbnew = [documentsdirectory stringbyappendingpathcomponent:recordingaudioname ]; nsurl *recordedtmpfile = [nsurl fileurlwithpath:mydbnew]; edited - audio recording , save local directory. recorder = [[ avaudiorecorder alloc] initwithurl:recordedtmpfile settings:recordsetting error:&error]; you're using nsurl , spaces invalid characters in url. that's why it's converted %20.

sql server - how to split a column into multiple value using sql -

if have thousands of rows data , find out if column called "last name " contains both first name , last name (could middle initial too). sql command use ? (sql server 2008). once find it, how split last name field , place first name or middle initial in own columns ? for example: first name mi last name john b. smith karen a. jones jane lawrence joan k. bates could done in excel ? you spaces in last name: select * t lastname '% %'; you rows first name missing: select * t firstname null or firstname = ''; edit: if assume names "simple" given in sample data, can do: update t set firstname = left(lastname, charindex(' ', lastname) - 1), lastname = right(lastname, charindex(' ', reverse(lastname))), mi = (case when lastname '% % %' rtrim(ltrim(su

java - Can't load personal dll with jna from netbeans -

i'm using netbeans 7.4 / jdk 1.7u51 i downloaded jar jna official site, in version 4.0.0. i have internally developped dll interface in plain c, loads ctypes in python . dll compiled in release visual 2010, runtime in path. d:\fl006\downloads>dir d:\deploy\spotlight\spotlight-1488\pasanbuslibrary.dll directory of d:\deploy\spotlight\spotlight-1488 29.01.2014 11:13 1'690'112 pasanbuslibrary.dll i tried load in java jna: public interface clibrary extends library { (...snip...) void pasanipcinitializelibrary(string xclient, string xbusname, int xtimeout); void pasanipcterminatelibrary(); } public static void main(string[] args) { nativelibrary.addsearchpath("pasanbuslibrary","d:\\deploy\\spotlight\\spotlight-1488"); clibrary bus = (clibrary) native.loadlibrary("pasanbuslibrary",clibrary.class); (... snip ...) this out of book standard dll load, custom location. when activating jna debug, s

Python: Sending the print function as a parameter -

my professor had mentioned it's possible pass functions print parameter, when try , implement syntax error. small missing here? def gotime(sequence, action): element in sequence: action(element) def main(): print("testing begins") test = list ( range( 0 , 20, 2) ) gotime(test, print) print("testing complete") upon running following, receive syntax error: gotime(test, print) ^ syntaxerror: invalid syntax if define own function uses print, works, so: def printy(element): print(element) def gotime(sequence, action): element in sequence: action(element) def main(): print("testing begins") test = list ( range( 0 , 20, 2) ) gotime(test, printy) print("testing complete") in python 3 work out of box. in python 2.7 however, can do: from __future__ import print_function def foo(f,a): f(a) foo(print,2) 2 note in python2.7 after from __future__ impo

opencv - Scan Business Card Tesseract and Leptonica iOS -

i trying scan business card using tesseract ocr, doing sending image in no per-prossesing, heres code using. tesseract* tesseract = [[tesseract alloc] initwithlanguage:@"eng+ita"]; tesseract.delegate = self; [tesseract setvariablevalue:@"0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz@.-()" forkey:@"tessedit_char_whitelist"]; [tesseract setimage:[uiimage imagenamed:@"card.jpg"]]; //image check [tesseract recognize]; nslog(@"here text %@", [tesseract recognizedtext]); picture of card this output as can see accuracy not 100%, not concerned figure can fix simple per-processing. if notice mixes 2 text blocks @ bottom, splits address, , possibly other information on other cards. how can possibly use leptonica(or else maybe opencv) group text somehow? possibly send regions of text on image individually tesseract scan? i've been stuck on problem while possible solutions welcome! i recommend using a

scala - Example of State monad in business application -

i looking simple example of state monad in business application. i have found examples -- memoisation calculate fibonacci numbers , random numbers generation -- see example business domain (preferably in scala). for example, can find examples of using option, either, list, reader, , writer monads: option : entity (order, product, customer, whatever) not exist either : failure list : customer orders, order items, etc. reader : read entity database writer : write log now looking similar state monad, i.e. stateful computation mutable state, understand it. the typical application reach state need supply of values, random number generator or supply of unique identifiers. another typical use case testing application interacts database. using state , can simulate in-memory database , check program manipulates database in expected way.

java - How can I run a secondary / augmented query in Spring Data JPA to determine calculated value? -

i using spring data 1.4.1 eclipselink 1.5.0. i have entity such: @entity public class { // ... other fields ... @transient private boolean calculatedfield; } i ideally want populate calculated field on post load. value logically rather complicated query. in hibernate, can annotate field @formula. aware eclipselink not provide similar functionality. bound eclipselink. i wondering if spring data jpa provides mechanisms processing entity information create , run "additional" queries, if will. or augment original query? my first thought implement repository , set field in secondary query. i'd rather avoid concrete implementations of repository if could. suggestions? i ended implementing descriptorcustomizer . prefer orm agnostic solution. time being, solved issue.

javascript - Images don't display in ie9 when inserted using ajax and innerHTML, until users right clicks on and clicks "Show Pictures" -

Image
i upgrading wesbite work ie9 (i really hate ie), , after fiddling worked, except when inserting html page using code below, none of pictures display. $("#div").innerhtml(htmltoinsertwithimgtags); the inserted html looked little this: if right clicked on of img's , clicked on "show pictures", magically appeared, below: this happens due trust setting in internet explorer, if image's want insert present on web page, internet explorer trusts new content , shows pictures. so got round problem adding code following (i'm aware isn't html) static part of page, , when picture inserted using ajax , innerhtml eveything worked expect. <img url="redcircle.gif" style="display:none" />

How does Eclipse generate the Plugin Specified Entries in the XML catalog? -

i eclipse plug-in specify xsd file eclipse can added catalog. the org.eclipse.wst.xml.core.catalogcontributions extension point lets add catalog (this requires have web tools (wst) component of eclipse installed). for example org.eclipse.wst.xsd.core plugin adds this: <extension point="org.eclipse.wst.xml.core.catalogcontributions"> <catalogcontribution id="default"> <uri name="http://www.w3.org/2001/xmlschema" uri="platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xmlschema.xsd" /> <system systemid="http://www.w3.org/2001/xml.xsd" uri="platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd"/> </catalogcontribution> </extension>

garbage collection - Check the value gcTrimCommitOnLowMemory from .NET code -

i'm trying confirm various runtime settings have changed being applied application. in particular gctrimcommitonlowmemory in runtime section of aspnet.config file. how can check value of current application? i go read .config file, want check running value of apps runtime. i've tried searching no avail. calling configurationmanager.getsection("runtime") returns system.configuration.ignoresection instance. i go reading .config file manually (and indeed i'm doing in related case). think it, when you're using system.configuration apis happens in background well. so, if unfortunate [1], when don't expose runtime -section, can still read manually , end same effect. the accuracy of results should equally well. if change values of settings after application has started, configurationmanage theoretically see values, though "stale". self-reading approach no worse here. fwiw, use following xpaths read value you're afte

android - Accessing the global value outside function -

i'm trying set value(global) in function , access outside function in "on create()" in android i've tried making global variable static, , tried write in "edit text" , parsing in "on create()" . keeps initializing 0.0 (the variable double type) when tried access in "on create()", oh , can't return value because function nested hierarchy complex. :( can me this; public class tryactivity extends activity { double bat;\\ global value public void oncreate(bundle savedinstancestate) { disp(); // calling function disp set value bat string to_string=double.tostring(bat); system.out.println("current battery level ==="+to_string); \\ prints 0.0 wrong value super.oncreate(savedinstancestate); setcontentview(r.layout.main); } public void disp(){ this.registerreceiver(this.batteryi

jquery - Open links in new window -

i have jquery script opens link in new window: $(document).on('click', 'a.externalurl', function () { window.open(this.href); }); and in template got snippet of code: {{#facebook}} <a href="{{facebook}}" target="_blank">facebook</a> {{/facebook}} the problem is, it's opening localhost in url , in stead of going directly facebook.com. example: http://localhost:57391/www.facebook.com use "http://{{facebook}}" or "https://{{facebook}}" href attribute

java - Can not assign ServletContext spring 3 -

i trying use servletcontext.getrealpath in util class load file resource (not part of unit testing) not work. i tried both use "implements servletcontextaware": @component public class utils implements servletcontextaware{ private servletcontext servletcontext; @override public void setservletcontext(servletcontext servletcontext) { this.servletcontext = servletcontext; system.out.println("**** "+servletcontext); } } which throws npe since servletcontext not assigned spring. and @autowired route: @component public class utils{ @autowired private servletcontext servletcontext; which throws nosuchbeandefinitionexception when tomcat being starting: caused by: org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [javax.servlet.servletcontext] found dependency: expected @ le ast 1 bean qualifies autowire candidate dependency. dependency annotations: {@org.springframework.b

javascript - Jquery Detect Change when Updated by JQuery -

i know might appear paradoxical i'm trying work out how detect change on text input when value updated jquery. during user using page javascript this: $('#licenseownerid').val(company.id); what want react value being set , execute function. so far i've tried following methods: var obj = document.getelementbyid('licenseownerid'); obj.onchange = function () { alert('select changed!'); }; and i've tried this: $('#licenseownerid').bind('change input propertychange', function(event) { alert('select changed!'); }); and i've tried this: $('#licenseownerid').change(function () { alert('select changed!'); }); none of these seem fired when value updated , cannot think of other methods try , hook up. correct way (if any) wire up? i'm starting wonder if possible , consequently cross browser safe. it's easy this: $('#licenseownerid').val(company.id).trigg

Dynamicly change TYPO3 fluid Layout by typeNum -

i using extension fluidpages , want switch layout typenum. possible change f:layout by condition? wont work: <f:layout name="{f:if(condition: '{typenum} == 666', then: 'pageajax', else: 'page')}"/> suggested approach: <f:layout name="page/{typenum}"/> required files: resources/private/layouts/page/0.html resources/private/layouts/page/666.html please note: works if {typenum} variable guaranteed exist - if not, face "template file not found" error empty filename. avoid this, can use vhs extension's v:var.convert viewhelper ensure proper value: <f:layout name="page/{typenum -> v:var.convert(type: 'integer')}"/>

.net - AccessViolationException in C# multithreaded form -

first off first c# project. have been working on project 6 months. we have winforms program , contains logging gui. in order keep rest of program responsive wanted create logging gui on separate thread since can quite intensive when lots of stuff going on. this how attempted open the form on new gui thread. in general works , keeps main gui responsive. randomly accessviolationexception ( http://pastebin.com/7tltbsei ) when activated , @ loss. var thread = new thread(() => { loggingform = new loggingform(logger.path); application.run(loggingform); }); thread.name = "loggingformguithread"; thread.start(); the logging gui batch reads log file , appends richtextbox. doesn't touch managed code. you need set apartment state of thread sta. thread.setapartmentstate(apartmentstate.sta); thread.name = "loggingformguithread"; thread.start(); this required many user interface components (such richtextbox ) function correctly.

javascript - Do Firefox and other browsers do event listeners differently? -

after spending hours on end trying determine happening , why code not work, i've decided maybe else see i'm not. this program, cut down as possible: <!doctype html> <html> <head> <script> var asml = function(content){ var isdef = function(prm){ return typeof prm !== 'undefined'; }; var loadcontent = function(){ asml.viewport = (function(){ var self = this; var pvar = p(self); this.size = function(){ if(affectedchange[0]){ affectedchange[0].ifthis.push([window, "resize"]); } return { x: function(){ return pvar.element.offsetwidth; }, y: function(){ return pvar.element.offsetheight; }, } } this.parent

jquery - Counting duplicate objects in array of Javascript objects -

i'm trying parse sub-objects of javascript object count number of sub-objects same , return new json object counts. that's not clear, here's fiddle . given crslistdata in fiddle, i'd return this: objtoreturn = [ { key: "consigned", values: [ { mapkey: 2007 (4), mapval: [["ford f-150 (3)"], ["honda civic (1)"]] }, { mapkey: 2011 (1), mapval: "toyota camry (1)" }, { mapkey: 2005 (1), mapval: "dodge ram (1)" } ] }, { key: "run", values: [ { mapkey: 2007 (2), mapval: "ford f-150 (2)" }, { mapkey: 2011 (1), mapval: "toyota camry (1)" } ] }, { key: "

c# - Change gridview text to hyperlink -

i have gridview user contact information want include links online social media profiles email is, if gridview had name, role , contact contact row have user's email address , link social media account. here code have far accomplish this, unsure of make text hyperlink on being databound protected void contacts_onitemdatabound(object sender, griditemeventargs e) { var dataitem = e.item griddataitem; if (dataitem != null && dataitem["contact"].text == "test@tester.com") { dataitem["contact"].text = //where stopped because figured text hyperlink go here } } and here aspx code gridview, using telerik same idea: <telerik:radgrid id="contacts" runat="server"> <mastertableview autogeneratecolumns="false" bordercolor="white" headerstyle-font-bold="true" headerstyle-for

android - Webview reload page get force close -

im using webview loading webpage , every 5s reload page. page loaded ok after 5s when should start reloading this: especially @ line 48 method: wvnovamenzacammera.reload(); 01-31 21:01:06.198 26188-26361/com.pfittech.menzauniza e/androidruntime﹕ fatal exception: timer-0 java.lang.runtimeexception: java.lang.throwable: warning: webview method called on thread 'timer-0'. webview methods must called on ui thread. future versions of webview may not support use on other threads. @ android.webkit.webview.checkthread(webview.java:2093) @ android.webkit.webview.reload(webview.java:955) @ com.pfittech.menzauniza.communityfragment$1$1.run(communityfragment.java:48) @ java.util.timer$timerimpl.run(timer.java:284) caused by: java.lang.throwable: warning: webview method called on thread 'timer-0'. webview methods must called on ui thread. future versions of webview may not support use on other threads. @

javascript - Is there a way to explicitly test if a device supports double-click? -

i wrote game, , allows users configure own game settings. one of options play card double-clicking it. however, on mobile device, if user selects option, game gets stuck because there no double-click on mobile device. so i'd detect if device supports double-click, , if does, great, if doesn't fall preference instead. i tried once , failed. tried detecting if device supports touch (using modernizr), that's wrong, because computers support both double-click , touch, in case want still let people double-click. (supporting touch not opposite of supporting double-click) is there way tell if browser/device combo supports traditional double-click? no, outside of prompting user attempt perform action , detecting if single or double click occurs, there not (yet) cross device standard detecting available input methods. you could, on other hand, attempt use detection library modernizr ( http://modernizr.com/docs/ ) detect if on touch device, , swtich detecting

javascript - jQuery Context Menu Not Working -

i'm trying make custom right-click (context) menu website, title says i'm failing completely. jsfiddle example of code: http://jsfiddle.net/rb49h/ $(document).ready(function () { // context menu :p $context = $("#contextmenu"); $(document).bind("contextmenu", function(e) { e.preventdefault(); $context.fadeout(300); settimeout(function () { $context.css({top: e.pagey + "px", left: e.pagex + "px"}); $context.fadein(300); }, 301); }); $(document).bind("click", function (e) { if (!$(e.target).is("#contextmenu")) { $context.fadeout(300); } }); }); bootstrap setting .dropdown-menu display:none default. if override that, works: http://jsfiddle.net/fr4f9/ .dropdown-menu { display:block; } (as side note, don't care 300 ms delay. makes feel unresponsive , laggy).

javascript - Submitting a form on change event of file input in IE -

invoking click event on file input element show browser dialog, results in access denied message in ie, when submitting form. there no way achieve file uploads invoking click event on input file manually, in ie, using pure javascript?

javascript - Element getElementsByClassName IE -

this question has answer here: getelementsbyclassname() doesn't work in old internet explorers ie6, ie7, ie8 6 answers i have code document.getelementsbyclassname ie if (!document.getelementsbyclassname) { // 4ie document.getelementsbyclassname = function(classname) { var elarray = [], tmp = document.getelementsbytagname("*"); regex = new regexp("(^|\\s)" + classname + "(\\s|$)"); ( var = 0; < tmp.length; i++ ) { if ( regex.test(tmp[i].classname) ) { elarray.push(tmp[i]); } } return elarray; }; } how change code make work single html element? div.getelementsbyclassname('123') you have couple options. first since getelementsbyclassname returns array, if know based on class name passed it's going

How to detect recursion in Java methods -

how can check inside method body, if method, call, calls in turn method back. // method, control public void mymethod() { if( stackcontainsmymethod() ) { throw new runtimeexception("do not call me"); } ... handler(); } // else implements protected abstract void handler(); the handler must not call mymethod() . want enforce @ runtime. can simple approach? regards. if want @ current stack trace , check yourself: stacktraceelement[] trace = thread.currentthread().getstacktrace(); for(int i=0; < trace.length; i++) { //look , exit }

ios - UIImageView jumps around -

i call method every 0.2 seconds send uiimageview position via socket.io: - (void)update { cgpoint touchlocation = blue.center; if (!cgpointequaltopoint(touchlocation, lastlocation) && !isanimating) { nsdictionary *json = [nsdictionary dictionarywithobjectsandkeys:@(touchlocation.x), @"x", @(touchlocation.y), @"y", nil]; [socketio sendjson:json]; lastlocation = touchlocation; } } when other device recieves data, it's displayed so: - (void)socketio:(socketio *)socket didreceiveevent:(socketiopacket *)packet { int x = [[packet.name valueforkey:@"x"] intvalue]; int y = [[packet.name valueforkey:@"y"] intvalue]; [uiview animatewithduration:0.2 animations:^{ [red setcenter:cgpointmake(x, y)]; }]; } even though animated movement, animation jittery/jumpy on receiving side. send raw data touchesmoved: i'm sending lot of data. i've tried changing update interval

html - Using Tether Javascript Library causing exception -

i working on new website , want include footer @ bottom of container div. i found javascript library called tether ( http://github.hubspot.com/tether/ ) having problem implementation. below html code <html> <head> <title>bug reporting</title> <link href="stylesheet.css" type="text/css" rel="stylesheet" /> <script src="includes/jquery.js"></script> <script src="includes/tether/tether.js"></script> <script> $(document).ready(function() { new tether({ element: '.footer', target: '.container', attachment: 'top left', targetattachment: 'bottom left' }); }); </script> </head> <body> <div class="container&