Posts

Showing posts from June, 2010

javascript - usings sprites with Jquery multiple images -

so am using sprites show blank checkboxes , on each click want have goes blank, green check mark, grey check mark, x. link sprite image. http://s23.postimg.org/fz6v0ts6z/sprite.png anyways able select box once , turns red x off can't change check marks... great! <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" ></script> <title></title> <style> #catnav li { display: block; width:25px; height: 25px; text-indent: -9999px; background: url(images/sprite.png)no-repeat; } #catnav li a#list-one-button { background-position: -25px -25px; } #catnav li.activeblankbutton1 a#list-one-button { background-position: -25px -75px } #catnav li a#list-two-button { background-position: -25px -75px; } #catnav li.activeblankbutton2 a#list-two-button { background-position: -25px -25px; } #catnav li a#list-three-button { background-position: -25px -125px; } #cat

javascript - Video not resuming/Jumping in time not working -

another question video-coding. so have been trying work videos in webapplication, has been far. here's problem, video i'm playing local file. whenever pause video or jump specific time, video player disables itself. works when hit 'play' again, causes video 'reload'. when hit 'play' once more, video starts again beginning. this annoying , have no idea causing behave that. chrome, because firefox not bug in way, resuming works , on. the code below simple video-player html5 <style type="text/css"> .easyhtml5video span { display: none; } </style> <div class="easyhtml5video" style="position: relative; max-width: 854px; max-height: 510px;"> <video controls="controls" autoplay="autoplay" runat="server" id="video" preload="none" style="width: 100%">

ruby on rails - Bold items in a string based on 1 or more matches -

i have following: str = "hello world. today wednesday" matchedterms matchedterms contains data so: > "world" > "word, is" what update str so: "hello <b>world</b>. today <b>is</b> wednesday" what right way in ruby/rails update string given matchedterms? thanks the string#gsub method takes block can make pretty easy (and should more efficient writing iterator/loop). here's how i'd go this: matched_terms = ["world", "is"] pattern = regexp.new(matched_terms.join("|"), regexp::ignorecase) str = "hello world. today wednesday" result = str.gsub(pattern) { |match| "<b>#{match}</b>" } # => "hello <b>world</b>. today <b>is</b> wednesday" i couldn't understand why had "word, is" 1 of matchedterms given example output... simplified "is" . if wanted "word, is&q

c# - Use of @class with custom class on MVC Html.ActionLink with HtmlAttributes failing -

i've read through links here find these techs. no exact match see, so... i have custom css class, i'm trying apply using htmlattributes containing @class , never overwrites underlying css (in same file) <a> . deleting default css a fails. contrast, when use @style in htmlattributes , works. i'm assuming there's subtle boneheaded mistake in syntax. nb: goal make links buttons. i'll settle removing underlining proof of concept. here razor markup works , quote object contains text in property, , id used against model / db: @html.actionlink(quote.quotecontent.supplybytesasstring(), "readquote", new {quotecontentid = quote.quotecontentid }, new { @style = "text-decoration: none;" }) fine. dumps underlining. following doesn't work, , can't tell why. actual css comes last here. dumps underlining among other things, none of applied. @html.actionlink(quote.quotecontent.supplybytesasstring(), "readquote&qu

sql - MySQL- Counting rows VS Setting up a counter -

i have 2 tables posts <id, user_id, text, votes_counter, created> , votes <id, post_id, user_id, vote> . here table vote can either 1 (upvote) or -1(downvote). if need fetch total votes(upvotes - downvotes) on post, can in 2 ways. use count(*) count number of upvotes , downvotes on post votes table , maths. set counter column votes_counter , increment or decrement everytime user upvotes or downvotes. extract votes_counter . my question 1 better , under condition. saying condition, mean factors scalability, peaktime et cetera. to know, if use method 1, table millions of rows, count(*) heavy operation. avoid situation, if use counter during peak time, votes_counter column might deadlocked, many users trying update counter! is there third way better both , simple implement? the 2 approaches represent common tradeoff between complexity of implementation , speed. the first approach simple implement, because not require additional coding. the seco

html - Select specific div class using nth-child -

please have @ http://jsfiddle.net/kv7uq/1/ .productlist div.grid:nth-child(4n+5){ clear:left; } what i'm trying achieve create 4 column grid. above code used in fiddle seems fine - if @ fiddle there no 4 column grid. <div class="pagenav"></div> <div class="pageheading"></div> the above 2 divs child divs of container div, , located prior grid divs causing conflict. if 2 divs removed, grid comes out fine. i'm not sure if fixable, please - thank you. just offset 2 compensate divs. instead of +5 , use +3 . .productlist div.grid:nth-child(4n+3){ clear:left; } http://jsfiddle.net/kv7uq/2/ if don't want first box have clear: left +7 .

android - Get TimePicker Current Time on Button Click -

friends new on android app developing. have completed app. in last stage, i'm facing difficulties , trying last 3 days solve not. i need current hour , minutes time picker (without dialog) when user clicks button. want save data database on button click. would please me providing xml , java file below. xml: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.example.timepicker.mainactivity" > <timepicker android:id="@+id/timepicker"

java - Populating Text area using button slection -

i'm trying have text displayed depending on button selected, can't seem work, /* * change license header, choose license headers in project properties. * change template file, choose tools | templates * , open template in editor. */ package nameage; /** * * @author eddie */ public class nameage extends javax.swing.jframe { /** * creates new form nameage */ public nameage() { initcomponents(); } /** * method called within constructor initialize form. * warning: not modify code. content of method * regenerated form editor. */ @suppresswarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="generated code"> private void initcomponents() { buttongroup1 = new javax.swing.buttongroup(); jlabel1 = new javax.swing.jlabel(); jtextfield1 = new javax.swing.jtextfield(); jlabel2 = new javax.swing.jlab

backup - Got fatal error during xfer (setuid failed) - Backuppc cygwin rsyncd -

i trying implement rsyncd (through backuppc) on windows 2002r2 server has cygwin on (for accessing mail logs). use lighter installation cygwin1.dll , rsyncd.exe plus config files (rsyncd.conf, rsyncd.lock, rsyncd.log & rsyncd.secret) , install service can triggered remote backuppc server approach doesn't work here server has cygwin installation. i installed rsycd package through cygwin installation, set service (following guide ) , configured work backuppc server. pings server okay , know passes authentication (as has path rsyncd.secrets wrong) presents me error: 2014-06-26 13:03:01 full backup started directory cdrive 2014-06-26 13:03:01 got fatal error during xfer (setuid failed) 2014-06-26 13:03:06 backup aborted (setuid failed) the user privileged , have not received error light installation method (mentioned above) in same os environment. unfortunately not around setuid error found different implementation allows me achieve same results systems. here

android - Apps can't read my XML webservice -

i got xml in www.ravaana.ml/webservice/1.xml , got xml here http://www.ravaana.ml/webservice/2.xml apps cant read it. dont know should do. here's code : public class beritaterbaru extends fragment { // variables xmlparser parser; document doc; string xml; listview lv; listviewadapter adapter; arraylist<hashmap<string, string>> menuitems; progressdialog pdialog; // xml node keys static final string key_item = "item"; // parent node static final string key_id = "id"; static final string key_judul = "judul"; static final string key_berita = "berita"; // flag current page int current_page = 0; public void onstart() { super.onstart(); lv = (listview) getview().findviewbyid(r.id.list); menuitems = new arraylist<hashmap<string, string>>(); new loadmorelistview().execute(); // loadmore button button btnloadmore = new button(getactivity()); btnloadmore.settext("load more")

hibernate - java.lang.AbstractMethodError For Java 7 and Glassfish 4.0 but it Working perfectly in Java 6 with Glassfish 3.1.2 -

i trying login application, getting below error in glassfish console. javax.ejb.transactionrolledbacklocalexception: exception thrown bean: java.lang.abstractmethoderror @ com.sun.ejb.containers.ejbcontainertransactionmanager.checkexceptionclienttx(ejbcontainertransactionmanager.java:665) @ com.sun.ejb.containers.ejbcontainertransactionmanager.postinvoketx(ejbcontainertransactionmanager.java:507) @ com.sun.ejb.containers.basecontainer.postinvoketx(basecontainer.java:4475) @ com.sun.ejb.containers.basecontainer.postinvoke(basecontainer.java:2009) @ com.sun.ejb.containers.basecontainer.postinvoke(basecontainer.java:1979) @ com.sun.ejb.containers.ejblocalobjectinvocationhandler.invoke(ejblocalobjectinvocationhandler.java:220) @ com.sun.ejb.containers.ejblocalobjectinvocationhandlerdelegate.invoke(ejblocalobjectinvocationhandlerdelegate.java:88) @ com.sun.proxy.$proxy435.find(unknown source) @ myservername.server.facade.__ejb31_generated__usersfacade__intf____bean__.find(unkno

android - Get Index Of The Shuffled Item After collections.shuffle -

i trying jigsaw puzzle app in android. in this, have split bitmap many small chunks. these chunks displayed in gridview now need shuffle them. then, need know each image chunk's actualposition(where piece supposed be, actual location in image) , currentposition(where piece located). actualposition , currentposition 2 integer arrays. there way can each image chunk's currentposition , actualposition after shuffling after every move user make can check wether every image chunk's actualposition equals currentposition . if user wins game. can please me out. below number puzzle game in pure java works. can run command line. re-prints whole matrix after every move (not pretty). demos basic game. hope of code self explanatory. shows basic 2-dim mapping of game, position tracking, validating based on numbers. have fun. package madhav.turangi.basic.game; import java.util.random; import java.util.scanner; public class numberpuzzle { int size; int[][]

azure - Service Bus 1.1 installation getting failed on windows 2008 R2 SP1 core -

i trying install windows azure pack: service bus 1.1 on windows server 2008 r2 sp1 core os through windows platform installer 5.0 (offline installation) . using below link installation http://blogs.msdn.com/b/biztalknotes/archive/2013/12/17/how-to-do-offline-install-of-service-bus.aspx ,but facing following issue: error message: starting installation started downloading products... started downloading: 'windows azure pack: service bus 1.1' downloaded: 'windows azure pack: service bus 1.1' install completed (failure): 'windows azure pack: service bus 1.1' service bus_1_1 : failed. downloaded file failed signature verification , may have been tampered verifying successful installation... windows azure pack: service bus 1.1 false install of products: failure please , thank in advance. check installation log, if log record looks this, 1639 error: msi (s) (20:5c) [14:22:31:139]: product: wi

java - An Error during unitTest Testing Spring mvc controller using mock -

it's first time using mockito test spring mvc controller .here error don't know why. project using spring3.2 , mybatis. controller code follow this: @controller @requestmapping(value = "/person") public class mocktestcontroller { private appusermodel appusermodel; @autowired public mocktestcontroller(appusermodel appusermodel) { this.appusermodel = appusermodel; } @requestmapping(value = "/{id}", method = requestmethod.get) public string getperson(@pathvariable long id, model model) { model.addattribute("person", appusermodel.getmemberbyid(id)); return "test/person"; } } and here unittest code: @runwith(springjunit4classrunner.class) @contextconfiguration(locations = { "classpath*:/spring.xml", "file:web/web-inf/spring/operator-servlet.xml" }) public class mockcontrollertest { @mock private appusermodel appusermodel; @injectmocks private mocktestcontroller mockcontroller; private moc

python - Tkinter: italicizing already bold text (overlapping tags) -

i have python tkinter program can select text, press shortcut , make selected text bold. can use different shortcuts other styles such italics. however, i'm having problem while user in running program if try make bold text italicized via shortcut, text appears italicized , not both bold , italics. know makes sense, because tags assigned 1 or other, , doing both isn't going merge effect of tags. however, don't know of way determine happens when have multiple tags on text. can have tag somehow represents overlap of 2 other specific tags? the way see handle (from see in documentation) use text.tag_bind bind function each of style tags interesting stuff make proper text, , proper text, both bold , italic. suppose that's doable, if it's not right way it, i'd know. i don't have trouble making tag both bold , italics @ once. need able handle overlapped tags. here's pertinent code of i'm doing already: def set_tag_styles(self): self.myt

jquery - The footer Doesn't show at the end of div slide -

the footer missing after end of division. <div id="fullpage"> <div class="section " id="section0"> content1 </div> <div class="section " id="section0"> content1 </div> <div class="section " id="section0"> content1 </div> <div class="section " id="section0"> content1 </div> </div> <footer> footer </footer> and script <script type="text/javascript"> $(document).ready(function() { $('#fullpage').fullpage({ verticalcentered: false, resize : true, easing: 'easeinquart', navigation: true, navigationposition: 'right', scrolloverflow: false, }); }); </script> i use full page js scrolling working smoothly footer not showing. this footer solution tried not supported fullpage default. made simpl

audio - whistle detection is not working with musicg api in android -

i trying develop app detects whistle sound, have used musicg library working fine problem is no work devices. how library working recorder thread contineously recording audio in background , detector thread matching recorded buffer via whistleapi.iswhistle(buffer); method. problem above mentioned method returning false specific devices returning true samsung , google nexus right @ point. can tell me should resolve issue important project. me out! in recorderthread class change "audioformat.channel_configuration_mono in channel_in_mono , framebytesize=4096.... private audiorecord audiorecord; private boolean isrecording; private int channelconfiguration = audioformat.channel_in_mono;//channel_configuration_mono private int audioencoding = audioformat.encoding_pcm_16bit; private int samplerate = 44100;//44100 private int framebytesize = 4096; // 1024 fft size (16bit sample size)//4096 byte[] buffer;

how to trigger a gcm to send a push notification to android device(using java server) -

i new java server side development, have followed link [ http://javapapers.com/android/google-cloud-messaging-gcm-for-android-and-push-notifications/][1] , implemented gcm android device, problem dont know how trigger gcm server while content updated in db,i need notify each , every update of db user, need watch db using timer task or there default solution keep track of db ? my server side code : regid = "my registration id"; string usermessage = request.getparameter("message"); sender sender = new sender(google_server_key); message message = new message.builder().timetolive(30) .delaywhileidle(true).adddata(message_key, usermessage).build(); result = sender.send(message, regid, 1); have tried many solution till not getting exact solution, suggestion, ideas or related links welcome in advance without knowing spe

Python Pyramid not rendering JSON correctly -

i using mongoengine's to_json method on object wish render in json-rendered pyarmid page. i've done lots of json rendering in pyramid, not mongoengine. mongoengine's to_json method simple calls json_util.dumps . works fine in python. problem when pyramid renders page, rendered this: { "0": "\"", "1": "{", "2": "\\", "3": "\"", "4": "_", etc... however, json dump looks ok in python, before rendered: '{"_id": {"$oid": "4ebca43ccc7a67085b000000"}, "created": {"$date": 1346419407715}, "modified": {"$date": 1403757381829}, "modified_by": {"$oid": "4ebca43ccc7a67085b000000"}, "email": etc... as has been suggested in comments, seems json being jsonified more once, can't figure out where. i pick user object database , attach e

jquery - Count number of selected images on file upload -

this question has answer here: count number of files in input box jquery? 3 answers <input type="file" name="images[]" class="upload" accept="image/*" multiple="multiple"/> now when choose i.e. 5 images, how can number jquery? when it's chosen, want write 5 images chosen. demo use files.length $('input[type="file"]').change(function () { console.log($(this)[0].files.length); });

vba - Bloomberg API: How to check wether connection works? -

i implementing tool relies on bloombergs blpapilib2, bloomberg api com lib 3.5. before giving user access refresh-data functionality, want make sure connection works. approach far: check wether library available , linked. loop through references job. open connection session.start() . hoping error here, won't give me one. thus, step 3. request data , verify (make sure not empty) surporisingly, cannot reliably reproduce getting empty result. expected session relies on user being looged terminal. seems wrong; if log out, request handled , return correct data. i can imagine 2 scenarios: some background caching in bbcom-server an alternative authentication method used i have 2 questions: q1. best way make sure user able download data? q2. how can verify whether connection has been established , user authenticated? thanks. to "cut" connection, need log out , log in on different machine. if log out feed still available using api. this ho

css - CSS3 transform and transition doesn't work properly on firefox -

i'm trying make affect on box drop 5px down when hovering. it work smoothly on chrome on firefox it's doesn't transition. please have @ next codepen using firefox , using chrome <div class="test"></div> .test { background-color:blue; width: 200px; height: 200px; @include transition(transform .3s 0 ease); @include transform(translatey(0)); &:hover { @include transform(translatey(5px)); } } using padding here's preferred method using padding : jsfiddle demo css: body { margin: 0; padding: 0; } .test { background-color:blue; width: 200px; height: 200px; } .test:hover { margin-top: 10px; } .transition { -webkit-transition: margin 0.5s ease-out; -moz-transition: margin 0.5s ease-out; -o-transition: margin 0.5s ease-out; transition: margin 0.5s ease-out; } using transform or if still want use transform : jsfiddle demo css: body { mar

coldfusion - Issues with Application Scope for fetching the CFC's -

i trying cfc linked getting error: here configration in application.cfc <cfset application.relativepath = "/"> <cfset application.componentspath = replace(application.relativepath,"/","",'all')> <cfset application.cfcpath = application.componentspath & "com"> <cfset application.tools = '#application.cfcpath#.tools'> now when acces cfc page this: <cfset result = application.cfcpath.tools.savedrivers(form)> i getting error: element cfcpath.tools undefined in java object of type class [ljava.lang.string; referenced '' if try <cfset result = application.tools.savedrivers(form)> i error: the savedrivers method not found. either there no methods specified method name , argument types or savedrivers method overloaded argument types coldfusion cannot decipher reliably. coldfusion found 0 methods match provided arguments. if java object , verified method exists,

c# - Using Object.Equals(Object) with a reference type -

i'm trying use method object.equals(object) compare 2 different instances of class have created need compare value not reference of instances. researching subject i've found need use value types, struct, in order able use method equals compare value of instances , not reference have large library of classes i'm afraid of change type class struct because don't know other consequences have...any advice whay should do? can override method equals class compare values instead reference? know lot of ways ir what's 1 give best performance , " programming correction "...? yes, have override equals method , == operator of class , in write comparison logic. for more read guidelines overloading equals() , operator == (c# programming guide)

php - Difference between return value of non-blocking flock function and the $wouldblock argument? -

i'm trying understand non blocking flock , wouldblock argument $fp = fopen('/tmp/lock.txt', 'r+'); if(flock($fp, lock_ex | lock_nb, $wouldblock)) { echo 'lock obtained'; } else{ echo 'unable obtain lock'; } fclose($fp); documentation says wouldblock: the optional third argument set 1 if lock block (ewouldblock errno condition). reproducing in test enviroment concurrent condition, if process has gained lock, flock function immeditatly return false (non blocking) so why should care $wouldblock value if return value of flock function in non-blocking mode allready tells me lock couldn't obtained? i can't difference between flock function returning false , $wouldblock argument setted 1, , $wouldblock argument usefull for. this because flock() may fail not because lock gained somewhere else. in such case wouldn't block waiting lock being released, return false. in other words lock_nb if flock returns false