Posts

Showing posts from May, 2015

html - Divs displaying outside of container div -

there strange issue in simple html structure. here html code <body> <div class='datepicker' style="display: inline-block"> <div id="daydiv" class='daydiv borderme'> <div id='uparrowdivs' class="borderme" style='display: inline-block; height:10%;width:100%;'> <div class='uparrowdiv borderme'> </div> <div class='uparrowdiv borderme'> </div> </div> </div> </div> </body> here 2 innermost divs displaying outside of parent div has id "uparrowdivs". here jsfiddle link can see whats going on in stylesheet. add rule .uparrowdiv vertical-align: top; see the fiddle

extjs - Sencha touch 2 Event listeners in Ext.Define -

i reading sencha docs event handling , listeners config. in documentation of the listener config found note : note: bad practice specify listener's config when defining class using ext.define(). instead, specify listeners when instantiating class ext.create(). i have seen number of s.o. answers have listeners in ext.define() . also came accross blog post the evils of ext.define , listeners think more relevant ext-js sencha touch 2. , new sencha touch. can explain difference cons of adding listeners in ext.define() , difference make? the problem pretty basic. if have listener property in class, moment create instance of class , add listener property particular instance, gong override ext.define 's listener property. this: var obj = { foo: { bar : 'hello world' } }; obj = ext.merge(obj, { // here ext.merge show how 2 objects can merged foo : 'i got changed!' }); will bar property of foo object? no. identical prope...

dependency injection - Equivalent of @ImplementedBy in Spring -

what equivalent of guice's @implementedby annotation in spring di? (i googled no results.) there not exist jit default binding in spring. can set 1 implementation dependency or use naming qualifier @named or @qualifier annotation specify implementation static binding (not equivalent @implementedby guice implementation). i created spring extension enabling jit-binding. library add @implementedby annotation spring. see https://github.com/devacfr/spring-implementedby , give me feedback

asp.net mvc 4 - SignalR connection error -

i have simple chat client project running using signalr , mvc identical asp.net one (i'm experimenting - client code identical). i've wired following watch things occur: $.connection.hub.statechanged(function(state){console.log(state)}); the connections working fine i've noticed if shut down iis express , watch console in chrome, see this: //as expect state goes connected connecting object {oldstate: 1, newstate: 2} //then times out after 30 secs , throws awesomeness @ console websocket connection 'ws://localhost:61623/signalr?transport=websockets&connectiontoken=vdf640emz7pfmtoc6vxle_5-7qs5dzmszv4spbqo7efemsssitnwkszreqfl4mgq8txitg2xb5f-2zdhp-2t3shpzn2hemty1zmewlb8non5oruvexasoark9xjeo5b00&connectiondata=%5b%7b%22name%22%3a%22chathub%22%7d%5d&messageid=b%2c7%7cl%2c0%7cm%2c0%7cn%2c0&tid=0' failed: websocket closed before connection established. jquery.signalr-1.0.1.js:1117 //reconnecting disconnecting - why error above? object {oldstate:...

centos - Linux Process Monitoring Using Statsd and Graphite -

i monitor linux processes (log cpu , ram usage statistics , display them graphically on period of time) using statsd , graphite. have configured statsd , graphite run services. how can send linux resource usage statistics (namely cpu , ram) statsd can graphically viewed graphite web ui? thanks. we use collectd (collectd.org) our os-level metrics graphite. don't go through stated, collectd has own summarizing functionality.

mysql - Representation of a simple messeger application using a database -

in application there users, conversations , messages. more 2 users participate in conversation. i thinking this:(---- relations, capital_words entities) message ---- conversation ---- user msg contains sender , content sent; conversation contains users participate in conversation; but not enough because sender user , there link between msg , user. if add relation have problem because sender should user participate conversation.(there is-a relation if i'm not mistaking) i don't know how model problem. if conversation between 2 users, need message , user. in fact conversation entity pretty strange. if eliminate conversation initial problem have add in message field contains list of partecipants. in way miss concept of conversation , if have retrieve msgs related conversation need join of data :) . --> impractical i appreciate every suggestion. don't know if database idea kind of application. thought not difficult work with.(keeping in mind can lose perfo...

How can I get the date of the last Full Crawl in Sharepoint 2010 using Powershell? -

i can run following current crawls , there determine last crawl completed date. # search app sharepoint $searchapp = get-spenterprisesearchserviceapplication "my search service" get-spenterprisesearchcrawlcontentsource -searchapplication $searchapp $contentsource = get-spenterprisesearchcrawlcontentsource "mycrawl" -searchapplication $searchapp $contentsource.crawlcompleted but last time any crawl completed. want date of last full crawl. i can see information in crawl history. when try , crawl history (see http://blogs.msdn.com/b/carloshm/archive/2009/03/31/how-to-programmatically-export-the-crawl-history-to-a-csv-file-in-powershell.aspx ) using below don't seem object can work (its 1 big string container far can tell) , full of ids. $s = new-object microsoft.sharepoint.spsite("http://portal"); $c = [microsoft.office.server.search.administration.searchcontext]::getcontext($s); $h = new-object microsoft.office.server.search.administ...

osx - Bash command substitution stdout+stderr redirect -

good day. have series of commands wanted execute via function exit code , perform console output accordingly. being said, have 2 issues here: 1) can't seem direct stderr /dev/null. 2) first echo line not displayed until $1 executed. it's not noticeable until run commands take while process, such searching hard drive file. additionally, it's obvious case, because output looks like: sh-3.2# ./runscript.sh sh-3.2# com.apple.auditd: loaded sh-3.2# attempting... enable security auditing ...success in other words, stderr displayed before "attempting... $2" here function trying use: #!/bin/bash function savechange { echo -ne "attempting... $2" exec $1 if [ "$?" -ne 0 ]; echo -ne " ...failure\n\r" else echo -ne " ...success\n\r" fi } savechange "$(launchctl load -w /system/library/launchdaemons/com.apple.auditd.plist)" "enable security auditing" any or ad...

YouTube gives error on google app engine quota error. but my app hardly make some 100 requests to youtube api -

my application using youtube api gives me error response when on google app engine <?xml version='1.0' encoding='utf-8'?><errors><error><domain>yt:quota</domain><code>too_many_recent_calls</code></error></errors> but on localhost works fine. application in sandbox mode so, hardly request going youtube google app engine server. getting error. please me. do use personal api key? if not, start doing so, otherwise allowed quotas small. if have api key, able check quota usage in developer console—and able check why quota exceeded. source: https://developers.google.com/youtube/faq#quota , https://developers.google.com/youtube/v3/getting-started#quota

expressionengine - How do you restrict content to a specific set of member groups? -

i using expressionengine 2.5.5 , have template multiple conditional statements... {if logged_in && member_group == '1' || member_group == '7'} <div>content</div> {/if} {if logged_in && member_group != '1' || member_group != '7'} <div class="authnotice"> <p>you not authorized view content.</p> </div> {/if} {if logged_out} <div class="authnotice"> <p>please <a href="#">log in</a> or <a href="#">register</a>.</p> </div> {/if} the second statement not work displays message "you not authorized view content" if conditions met. does know best practice combining these 3 conditions in single template? your second condition true. should change {if logged_in && member_group != '1' || member_group != '7'} to {if logged_in && member_group != '1' &...

Collapse all rows when expanding another row using jqGrid subgrid -

hi tech gurus, how can expand 1 row in jqgrid? that when click subgrid expand row expanded columns should collapsed. have added "expandonload:false" attribute in subgrid creation. not working. pls give correct solution. thanks, senthil b the documentation expandonload states: expandonload when set true make rows expanded automatically when new set of data loaded. this says nothing collapsing other rows (columns?) when row expanded. but answer question - here programmatic solution tony using collapsesubgridrow : function(rowid, selected) { var rowids = $("#grid").getdataids(); $.each(rowids, function (index, rowid) { $("#grid").collapsesubgridrow(rowid); }); } you need call on subgridbeforeexpand event.

spring mvc - sending http request don't work correctly -

i have extjs 4 form , i'm sending information save on data base i'm using spring security , spring mvc so in extjs form in submit function use url method:'post', url: 'meeting/create.action', and on controller use this @requestmapping(value = "/meeting/create.action", method = requestmethod.post) public void add(meetingui data) { system.out.println("in add post method"); meetingui saveduser = service1.create(data); if (saveduser != null) { logger.debug(" created succesfully"); } else { logger.debug("error trying create account."); } } no data been received information saved in database null , other error shown http status 404 - /writeup/web-inf/meeting/create.jsp i dont want /meeting/create.action integrated spring security think that's error please 1 have solution your handler method has return type of void . re...

How do I use jquery inside WordPress Loop? -

how use jquery inside wordpress loop without repeating effect <div class="post"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <a class="post_image" href="<?php the_permalink(); ?>" > <img class="post_image_home" src='<?php $thumb = get_post_custom_values('post_thumb'); echo $thumb[0]?>' alt="postimg" /> </a><!--post_image--> <?php endwhile; endif; ?></div><!--post--> jquery : $j=jquery.noconflict(); $j('document').ready(function() { $j('.post').hover(function() { $j('.post_image').stop().animate({"margin-bottom":"10px",},"fast"); },function(){ $j('.post_image').stop().animate({"margin-bottom":"0px",},"fast"); }); ...

jquery - Dependent columns using hansontable plugin -

i using jquery handsontable plugin , wondering if there's way use "dependent" columns. this is, when change 1 column, other updated depending on previous column value. one of columns call location , , auto-complete shows list of possible locations. (city + postal code + country) that's correct, however, in database storing id each location. therefor need hidden column store (which i've created) need updated when user change location column using auto-complete. is possible somehow? didn't find either in documentation or @ internet. thanks. yes, have done same reasons you using afterchange event... afterchange: function (changes, source) { afterchange(changes, source); } ... can change values of other cells ... function afterchange(changes, source) { if (source === 'loaddata') { return; //don't on load } var rowindex = 0, columnid = 1, oldtextval = 2, newtextval = 3, ntv = '', nv = '...

javascript - Like count increased dramatically/uniformly across site -

i implemented fb og tags site wide within our site's templates week ago. however, don't think did properly, every og property has homepage url, title, etc. regardless of page (since they're in templates, opposed page level). now noticed our count has increased dramatically & uniformly on many pages of our site. pages had few likes week ago (e.g. our homepage: http://www.jwsuretybonds.com/ ) or no likes have 58. removed og tags templates yesterday (except homepage), , nothing changed. idea causing this?

algorithm - Job assignment with NO cost, would Hungarian method work? -

so have job assignment problem doesn't have traditional cost hungarian method requires. for example: i have 3 workers - a, b , c have 5 jobs - 1, 2, 3, 4 , 5 each worker has list of jobs can perform, so: worker can work on job 1, 2, 5 worker b can work on job 1, 2 worker c can work on job 1 the end result (since there's no cost) maximum number of assignments can achieve. in example, can achieve maximum of 3 assignments: worker on job 5 worker b on job 2 worker c on job 1 is hungarian method way solve this? should use "dummy" costs? thinking maybe using index of job preference cost; idea? assign cost -1 job can, , others zero. then run hungarian algorithm , give answer(it returns -answer,in fact). don't large numbers, may cause overflow(unless implement hungarian carefully). indeed, it's maximum matchings in bipartite graphs, , there many ways solve problem, see wiki pages: http://en.wikipedia.org/wiki/matching_(graph_theo...

xslt - How to get all preceding nodes regardless of the current position -

structure of xml <root> <q id="a">1</q> <q id="b">2</q> <q id="c">3</q> <x> <q id="d">3.1</q> <q id="e">3.2</q> <q id="f">3.3</q> </x> <q id="g">4</q> <q id="h">5</q> </root> this xpath expression : //q[@id=$currentqid]/preceding::q i'm trying list of preceding q nodes regardless of current position (i'm passing current position parameter xslt) when on a,b,c,g,h nodes returns me correct list of preceding nodes. bu when on d,e,f not working right. example: when current node g returns, a,b,c,d,e,f when current node f returns d,e,f although expect a,b,c,d,e if 1 can find solution good. thank you. use : ($yournode/preceding::q | $yournode/ancestor::q)/@id xslt - based verification : <...

android - Array problems - Source not found -

hey guys have got following problem: i trying create new array code. public class minefield { mine[][] mines; public minefield(int cols, int rows) { mines = new mine[cols][rows]; } } so when executing code runs fine of course. when add single line: mines[0][0].setcoordinates(0,0); the debug perspective opens , gives me "activitythread.performlaunchactivity(activitythread$activityclientrecord, intent) line 2180 and text in red "source not found" i working on android application. but not able find out why can't call method of object out of freshly created object array? trying create 2 dimensional array of mines , giving every single mine specific coordinates. do know solutions or alternatives, let me know! thanks in advance! you getting nullpointerexception because mines[0][0] null should initialize mine. i.e mines[0][0]=new mine(); and then mines[0][0].setcoordinates(0,0);

packaging - Python package: how to avoid redefining author version etc? -

i distribute python package (i use setuptools , have working setup.py file), , related documentation (produced using sphinx). i find myself bit confused fact have specify authors names, maintainers, version, release, date, emails etc in different parts. i wondering if there way define kind of common information once package , use both in setup.py script , in .rst files , on. what possible approaches problem? if invoking sphinx using distutils, case covered. answer in documentation in sphinx/setup_command.py . example, setup.py should have part looks this: # necessary when not using setuptools/distribute sphinx.setup_command import builddoc cmdclass = {'build_sphinx': builddoc} name = 'my project' version = '1.2' release = '1.2.0' setup( name=name, author='bernard montgomery', version=release, cmdclass=cmdclass, # these optional , override conf.py settings comman...

php - Regex for identifying all kinds of spaces to be used as a delimiter for exploding a string into an array? -

i'm not proficient regular expressions when needed identify if paragraph (post excerpt in wordpress) started word "by" , if did apply css class word "by" , next 2 words did exploding string array delimited space, manipulating array , imploding it. something weird happening though. " " delimiter doesn't work on spaces (and there no double spaces being used). there multiple versions of space character out there? shouldn't whole site have same encoding type , therefore there 1 space character? if edit 1 of problem posts , delete first couple of spaces , replace them new spaces, code works fine. my code below (i know declared lot of variables): part under elseif{ describing, pasted whole conditional block reference. $byline = strtolower(string_limit_words(get_the_excerpt(),1)); $storysnippet = string_limit_words(get_the_excerpt(),16); $storyexplode = explode(' ', $storysnippet); if (($byline=="by") && strtol...

Trouble isolating emails when downloading via Python script -

i have script fetches emails account, downloads attachments, creates html email blast program, , zips them nice little archive. works when 1 email present in inbox, however, script hangs when multiple emails exist. feel because section of script zips files not looping correctly. trying accomplish 1 zip file each email. 3 emails in inbox = 3 seperate zip files. i've done best reduce code maximum readability while still maintaining core structure. point me in right direction here? thanks! code: for emailid in items: resp, data = m.fetch(emailid, "(rfc822)") email_body = data[0][1] mail = email.message_from_string(email_body) part in mail.walk(): if part.get_content_type() == 'text/plain': content = part.get_payload() #do something/define variables email contents if mail.get_content_maintype() != 'multipart': continue part in mail.walk(): if part.get_content_maintype...

R Merge Dataframe -

i have multiple data frames have same column headers want append them 1 after other make 1 big dataframe. best way this. i used following: not sure right way do: append(x, y) i tried rbind ended following error expected since these data frames have different length in size: error in names(value[[jj]])[ri] <- nm : 'names' attribute [2066] must same length vector [9] in addition: warning message: in names(value[[jj]])[ri] <- nm : number of items replace not multiple of replacement length here example: > x user_id rev_page rev_id rev_parent_id page_ns rev_length delta deleted rev_curr_minor timestamp edit_count lang_level 1 705834 1048946 32026867 30924739 0 2959 82 0 0 2005-12-19 23:21:24 0 n 2 705834 1048946 32028621 32026867 0 3085 126 0 0 2005-12-19 23:36:33 1 n 3 705834 21402 32032828 32027632 0 14...

unix - how to use FILENAME to set different files in awk -

i have 2 files lets say... 1) student records having information id,name , city 2) student marks having id ,totalmarks,percentage student records (file) 101 | nik | mumbai 102 | zeel | chennai 103 | gurav | delhi student marks (file) 101 | 80 | 80 102 | 90 | 90 103 | 90 | 90 and want retrieve information in forms student name it's percentage nik | 80 zeel | 90 gurav | 90 how write using awk command awk -f'|' -v ofs="|" 'nr==fnr{a[$1]=$2;next}$1 in a{print a[$1],$3}' studentfile markfile didn't test, should work. output like: nik|80 zeel|90 .... edit -f'|' #field separator -v ofs="|" #output field separator 'nr==fnr{a[$1]=$2;next} #nr overall record line number, fnr record line number 1 input file. see man page detail. part processing first input file, , save id , name in array $1 in a{print a[$1],$3}'#now processing 2nd input file, marks. if id in array...

ios - AVAudioRecorder with mac mini micro -

i want use avaudiorecorder on mac mini. there no microphone input jack. i think should buy earpods use avaudiorecorder. maybe these : http://store.apple.com/uk/product/md827zm/a/apple-earpods-with-remote-and-mic if plug earpods mac mini (headphone out), work inside iphone & ipad 6.0 simulator ? could record voice without debugging ios device ? yes, i've tested avaudiorecorder in simulator on mini , works. reluctance test on device worry. always test on device, hardware-dependent functionality concerned (as here). however, mini not understand earpods. have use usb microphone.

java - Proper way to update static variable periodically -

i have static variable load @ beginning of class. want update variable every hour. question proper way of doing this? the way trying following requires method updates static variable in every constructor: import java.util.date; public class myclass { private static string globalstring = ""; // initialize lastupdate 2 hours make sure first update happens private static date lastupdate = new date(system.currenttimemillis() - (2 * (3600 * 1000))); myclass() { updateglobalstring(); // more stuff here... } myclass(string string) { updateglobalstring(); // more stuff here... } private synchronized void updateglobalstring() { // check if need update if (lastupdate.before(new date(system.currenttimemillis() - (3600 * 1000)))) { // things update globalstring here... lastupdate = new date(); } } } any other ideas/better way of doing it? you ...

formatter - highcharts round decimals for gauge labels -

Image
i have gauge here , can't figure out how round decimals on round label one. tried this: title: { text: when, style: { fontsize: fontsizemin + 4 + 'px' }, formatter: function () { math.round(this.y * math.pow(10, 1)) / math.pow(10, 1); } }, but didn't work... use this: highcharts.numberformat(this.y,0) example: http://jsfiddle.net/cakqh/24227/

python - Iterating over a Django QuerySet while deleting objects in the same QuerySet -

i wondering best way iterate on django queryset while deleting objects within queryset? example, have log table entries @ specific times, , wanted archive them there no more 1 entry every 5 minutes. know may wrong, kind of going for: toarchive = log.objects.all().order_by("-date") start = toarchive[0].date interval = start - datetime.timedelta(minutes=5) entry in toarchive[1:]: if entry.date > interval: entry.delete() else: interval = entry.date - datetime.timedelta(minutes=5) so guess have answered own question asking it, if else curious. thought there have been problem when deleting objects while iterating on them, there isn't. code snippet in question right way it.

Selenium: Can't SendKeys() to an item that was below the visible window but was made visible by Click() -

i have problem text field visible @ time of sendkeys. i'm using iedriverserver.exe , c#. here's how can reproduce problem: the text field in question visible in window have scroll down see it. scroll down click on element using code this: var element = driver.findelement(by.xpath("…")); element.click(); this scrolls window down , makes text field visible. but when try send text now-visible window: element.sendkeys("blah"); i exception: when_applicant_enters_application.should_be_instantly_approved_on_external threw exception: openqa.selenium.elementnotvisibleexception: element not displayed how can fix or workaround problem? selenium version: 2.32.1 os: windows 7 browser: ie browser version: 9.0.15 i've written code demonstrating problem , submitted selenium tech support volunteers. the full discussion @ http://code.google.com/p/selenium/issues/detail?id=5620 take-home is: // doesn't work // driver = new i...

batch file - How to make changes in uninstallation process of project developed in c#.net -

i developed small project in c#.net. want create file in windows or system32 folder. create setup of project , add file system32 , run setup. successfull works. problem , when uninstall project add/remove program frm control panel file been deleted system32 or windows folder. dont want uninstallation process delete that. so tried thing, use batch file creating file in windows folder , after runs setup.msi file. works. when used batch exe converter converting batch exe , add setup.msi file in , batch file creates file in windows folder failed run setup.msi file. software iexpress workes in case problem iexoress , not add administrator manifest. , batch file needs that, becouse creating file in windows folder. i have no experience. fresher. job less. tring freelancing work. first. please give answer example. thank you. salil malek as general rule, standard uninstall procedure must remove files user's computer pertinent particular application (installed setup/.ms...

xslt 1.0 - How to make on xml field an attribute of another field? -

i have following xml file: <generic_etd> <dc.contributor>nserc</dc.contributor> <dc.creator>gradstudent</dc.creator> <dc.contributor>john smith</dc.contributor> <dc.contributor.role>advisor</dc.contributor.role> <dc.date>2013-05-07</dc.date> <dc.format>30 pages</dc.format> <dc.format>545709 bytes</dc.format> <dc.contributor>jane smith</dc.contributor> <dc.contributor.role>committee member</dc.contributor.role> </generic_etd> which transformed following using xslt 1.0: <etd_ms> <etd_ms:contributor>nserc</etd_ms:contributor> <etd_ms:creator>gradstudent</etd_ms:creator> <etd_ms:contributor role="advisor">john smith</etd_ms:contributor> <etd_ms:date>2013-05-07</etd_ms:date> <etd_ms:format>30 pages</etd_ms:format> <etd_ms:format>545709 bytes</etd_ms:...

c++ - Can you help me break down what this code is actually doing? if ((a = b > c ? d : e) == e) a++; -

int = 2, b = 3, c = 5, d = 4, e = 1; if ((a = b > c ? d : e) == e) a++; the answer a=2 i not understand doing. can me figure out block of code step step? if ((a = b > c ? d : e) == e) a++; equals to: if (b > c) = d; else = e; if (a == e) a++; also have at: what '?' in c++?

PHP contact form email being received with no sender and email is not being populated in the body -

i able receive email information except email address entered in form, , when receive email, "no sender" instead of person's name. new php , have done several google searches can't figure out doing wrong. please help. thanks this html: <?php include("parts/doctype.php"); ?> <?php include("parts/header.php"); ?> <div class="page-wrap"> <?php include("parts/nav.php"); ?> <div class="page-grid"> <h1 class="site-section-title">contact us</h1> <div class="content-area"> <form action="send-mail.php" method="post"> <div class="contactname"> <h1 class="heading name">name</h1> <label for="first-name" class="first_name">first name...

linux - Implement an algorithm in bash -

i have following algorithm, , want implement in bash . void wepkey64(char *passphrase, unsigned char k64[4][5]) { unsigned char pseed[4] = {0}; unsigned int randnumber, tmp; int i, j; for(i = 0; < strlen(passphrase); i++) { pseed[i%4] ^= (unsigned char) passphrase[i]; } randnumber = pseed[0] | (pseed[1] << 8) | (pseed[2] << 16) | (pseed[3] << 24); (i = 0; < 4; i++) { (j = 0; j < 5; j++) { randnumber = (randnumber * 0x343fd + 0x269ec3) & 0xffffffff; tmp = (randnumber >> 16) & 0xff; k64[i][j] = (unsigned char) tmp; } } } what's equivalent of function in bash ? are sure /bin/sh on system bourne shell? on many systems /bin/sh boune-again shell (bash).. can check with: sh --version if have access gawk , has bitwise operators described here: http://www.gnu.org/software/gawk/manual/html_node/bitwise-functions.html i ...

database - Query retrieving vs. calculus - best performance? -

i have doubt, best, in term of performance, retrieving large database (50k+ rows growing) on mysql "calculated" data or perform calculus on fly? the calculus division , multiplication of data yet retrieved db, lot of data (minimum ~300 calculus per load). another note, "page" can loaded multiple times (it's not one-load). i think calculate value (e.g. using background task) , retrieving db best solution in term of performance, right? there lot of difference in 2 approach? i'd play strengths of each system. aggregating, joining , filtering logic belongs on data layer. it's faster, not because db engines have 10+ years of optimisation doing that, minimise data shifted between db , web server. on other hand, db platforms i've used have poor functionality working individual values. things likes date formatting , string manipulation suck in sql, you're better doing work in php. basically, use each system it's built do. ...

java - Groovy abstract controller <Domain Class> -

embarrassed, can't find errors in ways. no matter try m object (not actual generic type). have simple setup( m grails domain): class newscontroller extends abstractcontroller<news> { } class abstractcontroller<m> { def show(long id){ log.info(m) // prints: info common.abstractcontroller - class java.lang.object def entity = m.get(id) //errors // .. other code } } please gentle, feels brain fart/something stupid. i type erasure(or groovy equivalent). so m there compile time checking(at least in java). how works in interpreted language little more interesting, think victim of related circumstances. it appears groovy has stricter requirements throwing away generic information source completely. leads interesting behavioral stuff @ runtime. http://groovy.codehaus.org/generics

SQL Server : remove duplicated text within a string -

i have sql server 2008 table column containing lengthy html text. near top there link provided associated mp3 file unique each record. links are formatted follows: <div class="mediasaveas"><a href="filename??.mp3">download audio </a></div> unfortunately many records contain 2 or 3 sequential , identical instances of link there should one. there relatively simple script can run find , eliminate redundant links? i'm not entirely sure - because explanation wasn't clear - appears want, although whether or not consider "simple script", don't know. declare @link nvarchar(200) = n'<div class="mediasaveas"><a href="filename123.mp3">download audio </a></div>' declare @baddata nvarchar(max) = n'cbjahcgfhjasgfzhjaucv' + replicate(@link, 3) + n'cabhjcsghagj', @startpattern nvarchar(34) = n'<div class="mediasaveas">...

iphone - iOS Verify previous app purchase/install -

is there way verify apple servers when user first installed app? let's have payed app , want make free ads not send ads bought. since it's not iap assume store kit out of question. later edit: problem being ones buy, delete , reinstall. nope, can't that! best way remove current app app store , relaunch using different bundle id. people bought can keep how is, although won't updates. a possible workaround here's workaround thought of. when send out next update, set flag in nsuserdefaults mark has paid user. next update only; remove code right after update. then, when send out version ads, check flag determine if should display them. problem if paid user ever re-installed app, see ads on.

c++ - How to split class definition between multiple .cpp and .cu files? -

i've got class nested classes mixing both c++, cuda , thrust. want split member definitions across number of files. // in cls.h: #include <thrust/device_vector.h> class cls { class foo { // define in foo.cu (include "cls.h") kernelwrapper(); } class bar { // define in bar.cu (include "cls.h") thrust::device_vector a; thruststuff(); } thrust::device_vector b; purecpp(); // define in cls.cpp (include "cls.h") morethrust(); // define in cls.cu (include "cls.h") } in each definition file #include "cls.h" . however, getting assortment of compiler errors no matter try, purecpp referenced not defined . i've read thrust can used .cu files. because parent class cls declares thrust-type variables b (and hence #include s thrust/device_vector.h ), force files #include cls.h made .cu files? where use extern "c" in case? suppose cls.cpp r...

php - Validate string against regex -

i'd validate file paths regular expression. far i've come this: preg_match('/[^a-za-z0-9\.\/\\\\]/', $string); so return 1 if string has other characters a-z, a-z, 0-9, dot, \ , / how can make returns 1 if there more 2 dots in string, or if dot @ end of string? and how can allow : if it's present 2nd character , followed \ or / . example c:\file should valid for first 2 requirements: preg_match('/[^a-za-z0-9\.\/\\\\]|\..*\.|\.$/', $string); the \..*\. match if there more 2 dots. \.$ match if there dot @ end. separating each of these portions (including original regex) | make regex match 1 of expressions (this called alternation). the last requirement little tricky, since if understand correctly need return 1 if there : , unless colon second character , followed \ or / . following regex (as php string) should that: '/:(?!(?<=^[a-za-z]:)[\/\\\\])/' or combined other regex (note have add : first character clas...

javascript - Handling asynchronous response in JS - limited access to JS files that can be edited -

i modifying third party - web client application in have access js files. search function limited search in 1 given server node @ time, , work around, hardcoded server nodes , created loop, invoking "search" several times, @ different nodes. the server response (in form of form - without getters) automatically handled callback, renders view of form. means able display last response , displaying 1 set of result. to handle this, added $trs = $(tr).clone(true) on callback function, saving rows previous forms , - made last loop "search" have callback - append collected rows $tr , display last form complete results nodes. but result inconsistent. displays result 1 server node. think caused delay in server response caused form render last. tried put delay settimeout function, keeps me getting result @ all i new web programming - js , jquery both (well css , html lol) , ask suggestions on better way handle this. thank you! _handleconfigsubmit: function ...

c# - String or binary data would be truncated when uploading file in MVC -

the file 14kb (14,000 bytes). have read varbinary(max) column type (which using) supports 8,000 bytes. correct? how can upload file database? if (file.contentlength < (3 * 1048576)) { // extract fielname var filename = path.getfilename(file.filename); using (memorystream ms = new memorystream()) { file.inputstream.copyto(ms); byte[] array = ms.getbuffer(); adj.resumefile = array; adj.resumefilecontenttype = file.contenttype; } } the error: string or binary data truncated. statement has been terminated. check other columns inserting during process. check contenttype column image/jpeg , not image or jpeg. here list of possible content types can create enough space in contenttype column accordingly.

reporting services - SQL Server Report Builder - Show Count of Sub Groups -

Image
i have sql server reporting services report shows customer order data, it's grouped follows: store customer customer order items so, each report grouping of stores, subgroup of customers per store, , items per customer. i'm trying show aggregate sale , other information @ each header record of appropriate group in report. of working well, each store header record, want show count of customers. i'm trying use variation and\or combination of rowcount, countdistinct , other aggregate functions, no avail. can me determine how can "count" of customer groups show @ store level header? tia! countdistinct on customer should work fine - no need specify scope if it's in store group header row. i put simple test together. data: report in designer: most important thing note countdistinct on customer in store header row; expression used: =countdistinct(fields!customer.value) end result, showing correct values: pl...

activerecord - CodeIgniter Nested Query -

i have piece of code getting conferences database, specific subscriber not subscribed. i have 2 tables: conferences - holds conferences read - holds subscriber conferences here code, mysql 1064 error. function getpossibleconferencesofsubscriber($sub_id) { $a = "select * conference c c.issn not in (select issn read sub_id=$sub_id)"; $query = $this->db->query($a); return $query->result(); } ok, found problem. guess "read" command, mysql confuses table name read , command read. hope helps someone, saves 1 hour.

oauth 2.0 - Force expiring OpenStack Swift Tokens -

is there way force expire or revoke openstack swift tokens? looking api method this. bing / google search didn't return useful. in swauth (after version 1.0.7), try include "x-auth-new-token: true" in http header. , swauth issue new token , revoke old token.

android - Flashed bootloader, now adb/fastboot no longer see the device -

i restoring nexus s factory image i've done before on other nexus s phones. after flashing bootloader, can no longer connect phone adb. "enable usb debugging" checked in developer options, usb debugging never starts when plug phone in. phone had custom version of jelly bean on , flashing ics. have tips how can adb working again on phone? here shell output things went wrong. after flashing bootloader, fastboot no longer connect flash radio. script used flash phone @ end of output. zzz:$ pwd /users/zzz/downloads/soju-imm76d zzz:$ ls bootloader-crespo-i9020xxkl1.img flash-all.sh flash-base.sh image-soju-imm76d.zip radio-crespo-i9020xxki1.img zzz:$ flash-all.sh sending 'bootloader' (1536 kb)... okay [ 0.282s] writing 'bootloader'... okay [ 0.369s] finished. total time: 0.651s rebooting bootloader... okay [ 0.001s] finished. total time: 0.001s < waiting device > ^c zzz:$ more flash-all.sh #!/bin/s...

C# LINQ to DATASET Grouping with a total -

i have datatable in data set. table has 3 columns , not grouped. table1 field1 string field2 datetime field3 decimal i need grouped on field1, field2, totaled on field3 tring accomplish in linq results not coming out correctly. i want original data table in dataset (in foreach?) if not possible know easy remove/add table. here have far not quite working; var newsort = row in objecttable.asenumerable() group row new { fullname = row.field<string>("fullname"), attenddate = row.field<datetime>("attenddate"), } grp select new { fullname = grp.key.fullname, attenddate = grp.key.attenddate, sumdayshours = grp.sum(r => r.field<double>("dayshours")) }; foreach (var row in newsort) { dstemp.tables["groupeddata"].rows.add(fullname, row.attenddate, row.sumdayshours); ...

subroutine - Perl sub made from string -

i trying use sub in perl contained in string. currently have $sub = "sub{ $in = shift; if($in =~ /bla.*wam/){return 1;}}"; i try , use doing $sub->("test"); or &{$sub}->("test"); both examples above spit out whole function if name of sub not find. looks this: undefined subroutine [function printed here] what getting wrong here? let's scalar $sub contained string "foobar" . if $sub->() , attempting call subroutine named foobar . if subroutine not exist, error. you trying call subroutine name sub{ $in = shift; if($in =~ /bla.*wam/){return 1;}} , thoroughly ridiculous name sub , doesn't exist in program. (and actually, since it's double-quoted, $in interpolated without realizing it.) so, first of all, don't that. if want anonymous subroutine, make this: my $sub = sub { $in = shift; if($in =~ /bla.*wam/) { return 1; } }; then execute this: $sub->("test"); if real...

php - cron job on wordpress site is generating fatal error -

i did created cron job script in wordpress site using theme. when script called cron not working fine. function in script not recognized, because script not see them , report them undefined function. fatal error: call undefined function get_option() do need include more, or how make script run cron job ? you can use wp_cron() , wordpress's built in cron function: http://codex.wordpress.org/function_reference/wp_cron otherwise, issue get_option not being recognized because wordpress core not loaded. need require wp-load.php in external php script absolute path file: require_once("/path/to/wordpress/wp-load.php");

Two different ways to implement Decorator pattern in PHP -

while doing tutorials on decorator pattern, i've encountered 2 different implementations. implementation 1 (referred i1) implementation 2 (referred i2) in short, i1's parent decorator class implements original object's interface (in example, class propertydecorator implements propertyinterface . original object property implements propertyinterface well). i2's parent decorator class not implement original object's interface (in example, decorator_wrapper not implements cupcake interface. in fact, there not cupcakeinterface @ all). my question is, is merely personal preference of understanding , implementing decorator pattern? or 1 wrong , 1 right? just depends on needs. let's see: abstract class can provide abstract methods. can provide real functions , variables. can extended. class can extend 1 parent. interface can provide abstract methods. a class may implement several interfaces. i prefer using base abstra...

javascript - trying to get jquery load to work -

when navigate through menu want contentarea div change , not reload whole page. want use jquery load function read div page (from members.html div coltwo) , insert onto page (into div contentarea). have been trying couldn't work. any editing script helpful! <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>my title</title> <link href="default.css" rel="stylesheet" type="text/css" /> </head> <script type="text/javascript" src ='http://code.jquery.com/jquery-1.9.1.min.js'</script> <script type="text/javascript"> $(document).ready(function() { function memberspage(){ $('#contentarea').load('members.html #col...

java - Should we ever call setClientId() on the connection factory? -

this in context of creating durable subscription. there setclientid() in defaultmessagelistenercontainer , 1 in singleconnectionfactory . my understanding : durable subscription consumer/subscriber. different consumers should capable of using different client ids. different consumers should able share connection. there 1 (listenercontainer,listener) pair per consumer. so, makes sense setclientid() @ listenercontainer. but, why there setclientid() @ connection factory level ? even though singleconnectionfactory has single connection, connection shared multiple consumers, across multiple sessions. right ? needless more dangerous cachingconnectionfactory (which inherits method singleconnectionfactory). extended version: can 1 should not use setclientid() on single/cachingconnectionfactory ? made more imperative following statement in defaultmessagelistenercontainer's setclientid(): furthermore, client id can assigned if original connectionfactory hasn...

TinyMCE's value in bean on second submit (using jsf.ajax.addOnEvent) -

i have set basic testcase in i'm experience (to me) weird behaviour. when using setup below, typed value in editor visible h:outputtext on second submit. e.g. change value in editor "myvalue" send ajax-request h:outputtext shows "test" (default value bean) change value in editor "anothervalue" send ajax-request h:outputtext shows "myvalue" send ajax-request h:outputtext shows "anothervalue" note: there's custom composite, please ask code if needed (it creates textarea tinymce , loads .js file below) index.xhtml <h:body> <h:form> <mh:editor id="tinymceeditor" value="#{bean.value}" /> <h:commandbutton value="ajax"> <f:ajax execute="tinymceeditor" render="show" /> </h:commandbutton> <h:outputtext id="show" value="#{bean....

VB.Net Form DirectCast on Forms.Panel -

i need loop through textboxes of form, located inside panel. i'm trying this.... for each cntrl control in directcast(me.controls(panelname), panel).controls next the reason need feed panel's name loop because have 2 panels exist in 2 different tabpages. button exists on each tabpage performs same function, panels , textboxes have different names. have loop inside function handles both tabpage button clicks, therefore need loop point right panel. the "panelname" matches target panel's name, , panel of system.windows.form.panel. i "object reference not set instance of object." message. is not possible? no need cast: for each cntrl control in panelname.controls next if have name of panel , not control reference, @ least need know tabpage has panel: for each ctrl control in tabcontrol1.tabpages(1).controls("panel1").controls next alternatively, can use: me.controls.find(panelname, true) to return panel name wh...

php - Grabbing key value from a mysql query -

i thought quite basic reason can't figure out. i have query $result = mysql_query("select * users.information limit 0,1"); to grab data (such firstname, lastname), use snippet of code <?php while ($row = mysql_fetch_assoc($result)): ?> <?php foreach($row $key=>$value) { echo $value; } ?> <?php endwhile; ?> which correctly prints want. now in separate table, want have such print individual values separately. thought quite simple like first name: however, not work. if $value, of course makes sense, prints last value in array. how grab individual values? parse $value different values, or there easier way? thank you. $data = array() ; //create storage, can access later. <?php while ($row = mysql_fetch_assoc($result)): ?> $data[] = $row ; //add value storage. <?php foreach($row $key=>$value) { echo $value; } ?> <?php endwhile; ?> we ready. have $data ...

jquery - Get DIV width and height in javascript -

i'm trying div width , height user changes , submit number page. can't seem figure out how width , height though. <script> $(function() { $( "#set div" ).draggable({ stack: "#set div", preventcollision: true, containment: $('#main_content'), stop: function(event, ui) { var mydiv = document.getelementbyid("set"); var pos_x = ui.offset.left; var pos_y = ui.offset.top; var width = mydiv.style.width; ----this doesn't work var height = mydiv.style.height; ----this doesn't work var window_width = window.innerwidth; var window_height = window.innerheight; var need = ui.helper.data("need"); console.log(pos_x); console.log(pos_y); console.log(width); console.log(window_width); console.log(need); //do ajax call server $.ajax({ ...

Using Javascript to change an Image src -

i have simple piece of code supposed change img src of img called innings. it's pretty straightforward, onclick call function changeimage , , depending on current src of image, change next iteration of images. code looks like: <script type="text/javascript" > function changeimage() { var mysrc = document.getelementbyid('inning'); alert(mysrc.src); if (mysrc.src = "1st.png") { alert('im in here'); mysrc.src = "2nd.png"; } else if (mysrc.src = "2nd.png") mysrc.src = "3rd.png"; else if (mysrc.src = "3rd.png") mysrc.src = "4th.png"; else if (mysrc.src = "4th.png") mysrc.src = "5th.png"; else if (mysrc.src = "5th.png") mysrc.src = "6th.png"; ...