Posts

Showing posts from July, 2015

node.js - Error: database names cannot contain the character '.' -

i'm using meteor.js , went change of html output in .html file , started giving me error: error: database names cannot contain character '.' i haven't changed anything, thing recall doing inbetween starting new project created using meteor.js, updated meteor , have problem. rest of error details: error: database names cannot contain character '.' w20130828-09:52:22.049(1)? (stderr) @ validatedatabasename (/users/jumpingcode/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/db.js:216:59) w20130828-09:52:22.050(1)? (stderr) @ new db (/users/jumpingcode/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/db.js:90:3) w20130828-09:52:22.050(1)? (stderr) @ mongoclient.connect.connectfunction (/users/jumpingcode/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/mongo_client.js:238:29) w20130828-09:52:22.050(1)? (stderr) @ f...

javascript - jQuery show/hide for multiple elements without specific classes / id's -

i have following html , js code show / hide div. @ moment working fine. use more 1 box on page , need have function know box-header clicked. is possible trigger box-content div after box-header div clicked? great if don't have use specific id's every box. here code: html: <div class="content-box"> <div class="box-header open-close"> title </div> <div class="box-content"> content </div> </div> js: $(document).ready(function(){ $(".box-content").hide(); $(".open-close").click(function () { $(".box-content").slidetoggle("slow"); }); }); you can find box-content element in relation clicked open-close element. from given markup, next element of clicked element $(document).ready(function(){ $(".box-content").hide(); $(".open-close").click(function () { //as @in...

android - An error occurred while collecting items to be installed -

when tried update android sdk, got following errors. should do? an error occurred while collecting items installed session context was:(profile=profile, phase=org.eclipse.equinox.internal.p2.engine.phases.collect, operand=, action=). no repository found containing: osgi.bundle,com.android.ide.eclipse.adt,22.0.5.v201307292155--757759 no repository found containing: osgi.bundle,com.android.ide.eclipse.adt.package,22.0.5.v201307292155--757759 no repository found containing: osgi.bundle,com.android.ide.eclipse.base,22.0.5.v201307292155--757759 no repository found containing: osgi.bundle,com.android.ide.eclipse.ddms,22.0.5.v201307292155--757759 no repository found containing: osgi.bundle,com.android.ide.eclipse.gldebugger,22.0.5.v201307292155--757759 no repository found containing: osgi.bundle,com.android.ide.eclipse.hierarchyviewer,22.0.5.v201307292155--757759 no repository found containing: osgi.bundle,com.android.ide.eclipse.traceview,22.0.5.v201307292155--757759 no repository foun...

performance - Conversion between different implementations of Seq in Scala -

from have read, 1 should prefer use generic seq when defining sequences instead of specific implementations such list or vector . though have parts of code when sequence used full traversal (mapping, filtering, etc) , parts of code same sequence used indexing operations (indexof, lastindexwhere). in first case, think better use linearseq (implem list ) whereas in second case better use indexedseq (implem vector ). my question is: need explicitly call conversion method tolist , toindexedseq in code or conversion done under hood in intelligent manner ? if use these conversions, penalty performance when going , forth between indexedseq , linearseq ? thanks in advance vector out-perform list . unless algorithm uses :: , head , tail , vector faster list . using list more of conceptual question on algorithm (data stack-structured, accessing head/tail, adding elements prepending, use of pattern matching (which can used vector , feels more natural me use list ))...

ruby - Unable to run Selenium script on IE -

i've run selenium test on ie 10 browser. in order run following script, did following: downloaded iedriverserver(64 bit since machine 64 bit) here put (.exe) file in 'c://drivers' folder set path 'c://drivers' in environment variables run script require 'selenium-webdriver' driver = selenium::webdriver.for :ie driver.get "http://www.google.com" button = driver.find_element(:id, "gbqfba") puts button.text driver.quit running aboe script result following error: c:/ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:51:in `assert_ok': unable find element id == gbq fba (selenium::webdriver::error::nosuchelementerror) c:/ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize' c:/ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:59:in...

uninstall - Wipe AppData/Roaming after ClickOnce application uninstalled -

i have .net application operates sensitive content. after uninstalled want data has been removed device' storage. data app stores placed c:\users[username]\appdata\roaming[application] , persists after application uninstalled shall not. my application distributed within clickonce installer. how make wipe data when user uninstall via control panel? i found few words on how clear application cache stored in c:\users[username]\appdata\local, isn't looking for. see article: http://www.codeproject.com/articles/506162/clickonce-application-autostart-and-clean-uninstal - use it, , it's quite helpful. using code article, can write own "uninstall" procedure , remove whatever data want.

ios - UIButton titleEdgeInsets -

Image
this question has answer here: aligning text , image on uibutton imageedgeinsets , titleedgeinsets 9 answers titleedgeinsets used align title , picture on button. did image on left , title on right.but when click on button, title shifting left. thank uiimage *image = [uiimage imagenamed:imagename]; [self setimage:image forstate:uicontrolstatenormal]; cgsize imagesize = self.imageview.frame.size; cgsize titlesize = self.titlelabel.frame.size; self.imageedgeinsets = uiedgeinsetsmake(0, 10, 0, 0); self.titleedgeinsets = uiedgeinsetsmake(0, ((self.frame.size.width-titlesize.width)/2)-imagesize.width, 0, 0); self.contenthorizontalalignment = uicontrolcontenthorizontalalignmentleft; this example way setting title , image in straight ----> :) try way, uibutton *abutton = [uibutton buttonwithtype:uibuttontypecustom]; abutton.frame = cgrectmake(0, 0...

c# - how to continue a foreach loop -

i have each loop below , know how able continue after exception has been thrown goes onto next next array index, , system doesn't fail. try { //making name array , other checks foreach (string s in namearry) { var timelinedata = oauthtwitterwrapper.getmytimeline(s); twitterdata.timelinedata(timelinedata, s, int.parse(dr["clientid"].tostring())); // var followersid = oauthtwitterwrapper.getfolowersid(s); // var loc = oauthtwitterwrapper.getfolowersloc(followersid); // twitterdata.follower(loc, s); } } catch(exception ex) { //logging exception } ideally try avoid exceptions. in case can handle exception within foreach loop. in following examples have added necessary checks avoid exception occuring in first place. this foreach (string s in namearry) { try { var timelinedata = oauthtwitterwrapper.getmytimeline(s); if(timelinedata!=null) { int clientid; ...

android - Correct image drawable folder for Galaxy tab -

my android application not loading correct graphic images when running on galaxy tab 1.0. blurry , pixelated. my guess is loading images mdpi folder, because device density 1.0, small tablet screen. what should in case? don't want increase size of images in mdpi folder, because have tested application in fair quantity of emulators , devices , worked well, still want way of loading bigger images tablet. the device model gt-p7510 , android version 3.1. density of device 1.0, got using code: getresources().getdisplaymetrics().density i have different image sizes placed in folders: drawable-hdpi drawable-ldpi drawable-mdpi drawable-xhdpi i developing in api level 8, platform 2.2. thanks! you should create res/drawable-large-mdpi/ and put resources large screens there. instead of large may evaluate use other qualifiers, such drawable-sw600dp, see http://developer.android.com/guide/practices/screens_support.html , http://developer.android.com/guide...

python - print to print as comma separated values on the same line -

i unable print output on single line without printing new lines, following code shows syntax error: print( "tiers found:"+eval("str.lower(tier.attrib['tier_id'])"), end=', ') ^ syntaxerror: invalid syntax but works fine: print( "tiers found:"+eval("str.lower(tier.attrib['tier_id'])")) the print statement in loop , require print output comma separated list. whats problem here? why using eval on sane statement? from __future__ import print_function print('tiers found: {0}'.format(tier.attrib['tier_id'].lower()), end=',')

c++ - renderDisplayFunc in opengl/glut is calling myfunc more than once -

#include "gl/glut.h" #include "gl/gl.h" #include <iostream> #include <stdlib.h> using namespace std; #define xwidth 700 // clipping window size 700*700 #define yheight 700 void renderfunction() { /*clear information last draw sets current clearing color use in clearing color buffers in rgba mode. */ glclearcolor(0.0, 0.0, 0.0, 0.0); glclear(gl_color_buffer_bit); //set line width gllinewidth(1); //(x,y) coordinates in pixels glmatrixmode(gl_projection); glloadidentity(); glortho(0, xwidth, 0, yheight, -1, 1); //set line color glcolor3f(1.0, 0.0, 0.0); //random num generated for(int i=0;i<4;i++){ int r1 = rand() % 1000; int r2 = rand() % 1000; int r3 = rand() % 1000; int r4 = rand() % 1000; //begin line coordinates glbegin(gl_lines); glvertex2d(r1, r2); glvertex2d(r3,r4); //end line coordinate glend(); cout<<r1<<" "...

pdf generation - border-collapse is not working in flying-saucer? -

Image
in flying-saucer, border-collapse not working if use fs-paginate-table same table. does know workaround on this? use : table { border-spacing: 0; } example: table{-fs-table-paginate:paginate;} td{border:1px solid red} table{-fs-table-paginate:paginate;border-spacing:0} td{border:1px solid red} the result not same (as td's borders don't merge), can fixed setting borders on 1 side of td. #t4{-fs-table-paginate:paginate;border-spacing:0} #t4 td{border-width:0 1px 1px 0;border-color:red} #t4 tr.firstrow td{border-top-width:1px} /* assuming first tr has class firstrow */ #t4 td.firstcol{border-left-width:1px} /* assuming first td of each line has class firstcol */

clang++ - Evaluating constant expressions in clang tools -

i'm writing clang tool , i'm trying figure out how evaluate string literal given access program's ast. given following program: class dholder { public: dholder(std::string s) {} }; dholder x("foo"); i have following code in clang tool: const cxxconstructexpr *ctor = ... // constructs `x` above const expr *expr = ctor->getarg(0); // "foo" expression ??? how can expr representing "foo" string literal actual c++ string in tool? i've tried like: // exprconstant.cpp evaluate(result, info, expr); but don't know how initialize result , info parameters. any clues? the proper way use ast matchers match string literal , bind name can later referenced, this: statementmatcher m = constructexpr(hasargument(0, stringliteral().bind("myliteral"))).bind("myctor"); and in match callback this: const cxxconstructexpr *ctor = result.nodes.getnodeas<cxxconstructexpr("option...

ruby - How to make private and public user's fields in rails? -

i want give public , private options fields user. suppose, want make private "birth date" field, should not appeared on detail page other user. i have customized registration controller in devise. fields saving ,updating , showing don't know how hide private fields other users. confused how start???? if have method e.g. current_user (current logged in user, if use e.g. devise) can like <%= @user.birth_date if @user == current_user %>

c - argv[2] value not passing properly from cmd -

i'm having problem code : #include <stdio.h> #include <stdlib.h> #include <string.h> #define n 20 int main( int argc , char * argv[]) { int giorno , mese , anno , metri , primo_g = 31, primo_m = 12, primo_a = 3000, = 0 ; char tipo , destinazione [n+1] ; float km_arrivo = 0 , costo_tot = 0 ; file * fdati; if(argc != 2) { fprintf(stderr ,"errore nella linea di comando\n"); exit (exit_failure); } if ((fdati = fopen ("viaggi.dat", "r")) == null ) { fprintf(stderr ,"errore nell'apertura del file\n"); exit (exit_failure); } while ((fscanf(fdati , "%s %d/%d/%d %d %c" , destinazione , &giorno , &mese , &anno , &metri , &tipo))!= eof){ if (strcmp (argv[2],destinazione) == 0 ) { if((tipo == 'r')||(tipo =='r')){ i++; km_arrivo = km_arrivo + (float)(metri/1000) ; costo_tot = (i*5) + 0.10 * (km_arrivo); } ...

java - Libgdx: Basic score system -

good day, i've been trying create simple score system game , encountered problem. wondering if me debug code me. first of problem have encountered code repetitively displays current score each time input touch command overlaps previous current score. what wanted program whenever receives touch command adds score , prints current score on screen. can please me in debugging code , give me simple guide me in constructing score system. here code: timer time; spritebatch btch; int score=0,currscore = 0; bitmapfont fntscore = new bitmapfont(gdx.files.internal("fonts/pressstartk16white.fnt"),false); public void score() { if(gdx.input.istouched()) { score += 20; system.out.print("score: " + score + "\n" ); currscore = score; return; } else if(gdx.input.iskeypressed(keys.s)) { score +=30; system.out.print("score: "+ score + "\n"); currscore = score; ...

Handling file uploads with Restler -

what best practice implement file uploads using restler framework? i have api call file save in cdn , return cdn file url caller. best way implement it? file upload cdn using our api this requires 2 steps, first file on api server. add uploadformat supported formats adjust static properties of uploadformat suit need from api method use $_files , move_uploaded_file file desired folder. step common php upload process. now have file on server upload cdn. can use means provided cdn. can ftp or using sdk upload construct cdn url , return client

.net 4.5 razor - pass local variable to partial -

i'd able pass variable defined in 1 template another, included first template: template 1: @{string datetype= "beforethisyear"} @renderpage("template2.cshtml", datetype) template 2: <input type="text" data-datetype="@datetype"/> unfortunately, yields error in template 2: "the name 'datetype' not exist in current context" is there way pass variable without binding model first? use viewbag: template1: @{ viewbag.datetype = "beforethisyear"; } template2: <input type="text" data-datetype="@viewbag.datetype"/> this viewbag - passing view-only data around. note if data passing or should part of data model should use property of model it. given names of variables i'm guessing should part of model. note model isn't data class (i.e. entity representing row in table), model view in mvc conceptually represents data in view.

sql - Postgres: How to form a query with 2 unrelated table column? -

i have 2 tables here: table 1 name | longname1 | longname2 'john' | 'johnny' | 'johnson' 'kate' | 'katie' | 'kathryn' i have table table2 name | area1 | area2 'john' | 'texas' | 'alabama' 'kate' | 'california' | 'virginia' actually table1.longname1 , table2.area1 should linked together, table1.longname2 , table2.area2. not related in postgres. here trouble how add relationship in table? if form single query will a) input 'johnny' (table1.longname1) , output 'texas'(table2.area1) b) input 'johnson' (table1.longname2) , output 'alabama'(table2.area2) which query link relationship me? possible? thanks in advance you can pivot columns rows this: with cte1 ( select "name", 1 k, "longname1" longname table1 union select "name", 2 k, "longname2" longna...

unable to print one pdf fonts text to another pdf? -

i have pdf in telufu pdf (replace anils.com 123.176.47.55) want extract text pdf (like in pdf page no 3 firtst block data need read) download fonts page using mupdf-1.3-windows it downloads fonts pdf uses when write text using fonts pdf of texts not redered code //output file name public static string pdf1 = "c:\\documents , settings\\administrator\\desktop\\itextpdf\\anil.pdf"; public static void main(string[] args) throws ioexception, documentexception { try { pdfreader reader = new pdfreader(new url("http://anils/draftrolls/pdfgeneration.aspx?urlpath=d%3a\\ssr_2013_final+rolls\\ac_238\\telugu\\s01a238p038.pdf"),null); system.out.println("this pdf has "+reader.getnumberofpages()+" pages."); // reading page no 3 string page = pdftextextractor.gettextfrompage(reader, 3); // fonts had checked total of 7 fonts didn't fonts basefont f = basefont.createfont(...

php - URL validation using eregi() but now with preg_match -

eregi() deprecated , need replace preg_match. how can convert following syntax preg_match? suppose following url , it's required regex pattern: $url = "https://james.wordpress.com/2013/05/13/my-product-final"; $urlregex = "^(https?|ftp)\:\/\/([a-zåäöÃ…ÄÖæÆøØ0-9+!*(),;?&=\$_.-]+(\:[a-zåäöÃ…ÄÖæÆøØ0-9+!*(),;?&=\$_.-]+)?@)?[a-zåäöÃ…ÄÖæÆøØ0-9+\$_-]+(\.[a-zåäöÃ…ÄÖæÆøØ0-9+\$_-]+)*(\:[0-9]{2,5})?(\/([a-zåäöÃ…ÄÖæÆøØ0-9+\$_-]\.?)+)*\/?(\?[a-z+&\$_.-][a-zåäöÃ…ÄÖæÆøØ0-9;:@/&%=+\$_.-]*)?(#[a-z_.-][a-zåäöÃ…ÄÖæÆøØ0-9+\$_.-]*)?\$"; following code works fine: if (eregi($urlregex, $url)) { echo "valid"; exit; } i tried convert 'preg_match' couldn't work: if (preg_match("#$urlregex#i", $url)) { echo "valid"; exit; } also tried this: if (preg_match('/'.$urlregex.'/i', $url)) it doesn't work because char you're us...

xml - Java SAX parser, How do I prevent character references entirely? (DoS attack) -

the xml files of incoming request needs validated. 1 requierement character references prevented entirely because of possible dos attacks. if configure saxparserfactory below: saxparserfactory spf = saxparserfactory.newinstance(); spf.setfeature(xmlconstants.feature_secure_processing, true); then parer still resolves 100.000 entity expansions. the parser has encountered more "100.000" entity expansions in document; limit imposed application. the prevention of external references done via entityresolver works fine. how prevent character references? character references cannot cause denial of service attack, there no reason prevent them.

EF and TransactionScope for both SQL Server and Oracle without escalating/spanning to DTC? -

can update me on topic? i want support both sql server , oracle in application. is possible have following code (in bl) working both sql server , oracle without escalating/spanning distributed transactions (dtc) ? // dbcontext created before, same dbcontext used both repositories using (var ts = new transactionscope()) { // create order - make use of dbcontext, possibly call savechanges here orderrepository.createorder(order); // update inventory - make use of same dbcontext, possibly call savechanges here inventoryrepository.updateinventory(inventory); ts.complete(); } as of today, end of august 2013, understand works sql server 2008+ ... oracle? found thread ... looks oracle promoting distributed transactions still not clear me. does have experience writing apps support both sql server , oracle entity framework enlighten me? thanks! update: noticed ef6 comes improved transaction support . this, in addition remus' recommendations soluti...

android - How to use multiple ListView/GridView in same UI? -

i want use multiple listview / gridview within same user interface; don't want them expanded full length , placed under scrollview . if want learn listview, here nice tutorial . question, here similar one! question might duplicate of this.

seo - Google SiteLinks Issue -

i've read faqs , searched center. url is: http://marcusvbsiqueira.com hello , morning, after research , no solution found problem, have decided contact google support , open post google webmasters forum, maybe can me out. problem 1 single page shown internal link personal website, photo gallery page, although have other pages one, , made using same coding technic. if search on google name "marcus v. b. siqueira" or search website "marcusvbsiqueira.com" you'll see shows website, , photo gallery internal link. if of you, can check out inspecting element on site, , see if there's weird other pages, appreciate it, because have checked more 1 time, , seems fine links. have on top of website, links other pages, can see, 1 of being indexed. i'm sure have not put on robots.txt exclude other page website. site xhtml 4.1, none html 5 (for w3c validation), , way access other pages on website cliking on internal links @ top of page. hope can me out. ...

java - Android Listview not refreshing -

hi program should update listview based on radiobutton selected , show records of 1 of 2 tables. as far can tell records in fact populated, seems not refreshing listview itself. please me solve problem. in advance here code: in oncreate: radiogroup rg = (radiogroup) findviewbyid(r.id.radiogroup1); rg.setoncheckedchangelistener(new oncheckedchangelistener() { @override public void oncheckedchanged(radiogroup group, int checkedid) { radiobutton rb1 = (radiobutton) findviewbyid(r.id.radio0); radiobutton rb2 = (radiobutton) findviewbyid(r.id.radio1); switch(checkedid) { case r.id.radio0: { rb2.setchecked(false); // populatelist(); // listview lview = (listview) findviewbyid(r.id.listview1); // lview.invalidateviews(); ...

asp.net mvc - how to bind datatable to webgrid using MVC? -

this first post. me. how bind datatable webgrid? code: sqlconnection con = new sqlconnection(cs); sqlcommand cmd = new sqlcommand("select * candidate", con); sqldataadapter da = new sqldataadapter(cmd); datatable dt = new datatable(); da.fill(dt); return view(dt); i want bind datatable webgrid..help me... this best solution found :) hope can you: sqlconnection con = new sqlconnection(cs); sqlcommand cmd = new sqlcommand("select * candidate", con); datatable dt = new datatable(); sqldataadapter = new sqldataadapter(cmd) a.fill(dt); var result = new list<dynamic>(); foreach (datarow row in dt.rows) { var obj = (idictionary<string, object>)new expandoobject(); foreach (datacolumn col in dt.columns) { obj.add(col.columnname, row[col.columnname]); } result.add(obj); } webgrid grid = new webgrid(model, canpage: true, rowsperpage: 15); then in view can use: @grid.gethtml(htmlattributes: new { id = "...

vb.net - How to Update DataTable -

Image
i have main dataset contains several datatables . these different datatables bound datagridview's datasource respectively. my problem whenever modify in display area such description textbox below , click on save.... <<< >>> the datagridview doesn't have replicated changes, seen here: i need way update datatable ... save button saves information. quite new datasets , datatables first time trying update datatable. doubt need reload information in datatable, there must more efficient? updating datatable unknown indexes for more information: how to: edit rows in datatable in order edit existing row in datatable, need locate datarow want edit, , assign updated values desired columns. update existing records in typed datasets (row index not known) assign specific datarow variable using generated findby method, , use variable access columns want edit , assign new values them. dim description string = "hello world modified...

What is the correct Device Definition for Google Glass (for a simulator in Eclipse or Android studio)? -

yes test on actual device (when arrives) nice know now: how setup device definition can run emulator glass. critical are: size: size glass "report" as: small, normal, large, xlarge screen ratio: notlong or long? density bucket: xxhdpi? or what? other: setting dpad input @ or come close nav on glass? other tips? note : yes know mirror api playground, i'm developing apks not mirror-api. displaymetrics gives output on glass explorer edition: displaymetrics{density=1.5, width=640, height=360, scaleddensity=1.5, xdpi=180.62222, ydpi=169.33333} so indeed hdpi. also screen size small: .... else if ((getresources().getconfiguration().screenlayout & configuration.screenlayout_size_mask) == configuration.screenlayout_size_small) { log.d(tag,"small screen"); } and "notlong"

How to get a facebook page's picture in this 168 pixels squared format? -

it should not full page picture redimensioned, cutted 1 facebook shows on pages. example https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c21.21.259.259/s160x160/197503_163174873737023_6138040_n.jpg if compare original page picture, https://fbcdn-sphotos-f-a.akamaihd.net/hphotos-ak-ash4/197503_163174873737023_6138040_n.jpg you see different. need know 168x168 stored in graph object. if have page name or page id, can make request picture endpoint , specify type parameter. for example, here request cocacola picture: https://graph.facebook.com/cocalcola/picture?type=large

open source - What to consider opensourcing a Google Appengine application -

we've made monitoring tool @ our company. it's not in our line of business might opensource tool, , maybe else likes well, maybe they'll contribute. the tool runs on appengine, there paths in appengine configuration, might idea keep hidden. unless else wants start using our appengine qouta. is there best practice open-sourcing appengine applications? have experience share regarding opensourcing appengine sites? you can ideas excellent gae-init . way working in order avoid exposing sensitive information, moving in stand alone project, can use gae-init ;) as part of model config class holds information concerns service , dependencies. there default values there can customized web interface called admin. have look.

parent - Find top level li with jQuery -

let's have menu this... <ul class="main_menu"> <li class="item-1"> first top level item <ul> <li class="item-2">item 2</li> <li class="item-3"> item 3 <ul> <li class="item-4">item 4</li> <li class="item-5">item 5</li> </ul> </li> <li class="item-6">item 6</li> </ul> </li> <li class="item-7"> second top level item <ul> <li class="item-8">item 8</li> <li class="item-9">item 9</li> <li class="item-10">item 10</li> <li class="item-11">item 11</li> </ul> ...

jquery - Website slide or whatever it's called -

Image
i need simple horizontal slide website functions i've poorly drawn on image:enter image description here so, when press little arrow page doesn't load up, changes it's on screen position... just give me page examples, or put question right (because have no idea how such sliding called) this commonly done jquery , css positioning. css: .rightslide { position: fixed; top: 0; left: 90%; } and slide in: $('.rightslide').animate({left: "10%"});

Issue Injecting dataSource into Grails Service -

i running issue when trying following in serivce: class sendingmailservice { def datasource // spring-bean "datasource" auto-injected def sendxlsmail() { def db = new sql(datasource) //additional code such query, execution follows } } when execute code error: "must specify non-null connection". have read believe code above should work (this not unit test)...so missing respect grails services? thank here, ok months later had time one. i tried couple of things datasource autoinject service kept getting null connection. landed on passing datasource controller not elegant @ least works. hope helps else out have seen similar issues out there. still know why autoinject not work think have dig deeper grails understand that. class mycontroller { def datasource def somecontrollermethod() { myservice myservice = new myservice() myservice.servicemethodquery(datasource) } } ////////////////////// class myservice { def servicemethodque...

Quick ways to optimize PHP code -

i'm curious if there's low hanging fruit speed php script. for example, 1 of these better/faster other? //code 1 echo 'hello ' . 'world'; //code 2 echo 'hello '; echo 'world'; are there other ways clean code , make tad faster? worth it? http://hungred.com/useful-information/php-micro-optimization-tips/ but have balance how readable , understandable code is.

c# - Watermark for Textbox -

this question has answer here: watermark textbox in winforms 5 answers watermark in system.windows.forms.textbox 2 answers my program: has 1 textbox only. writing code using c# language. my aim: display text/watermark in textbox: 'please enter name'. so, when user clicks on textbox, default text/watermark gets clear/deleted user can enter name in textbox. my problem: tried various codes available online none of them seem work me. so, thought should ask here simple code. have found code online doesn't seem work: using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; namespace windowsformsapplication1 { public partial class for...

ember.js - Handlebars helper for date parsing not getting the value -

i started playing around emberjs , handlebars recently, please accept apologies silly question. trying format date shown in template. date in isostring format , trying is: my template code: {{parsedate todate}} //todate holds 2013-12-02t22:00:00.000z and handler code: handlebars.registerhelper('parsedate', function(value) { console.log(value); //print string "todate" not value of "todate" - isostring return datestring(value) }); i sure simple, not figure out. have looked around did not find solution. thanks help! i don't know datestring function does, helper works fine: http://jsbin.com/odosoy/143/edit i've changed little, added ember namespace in front bevor handlebars , converted bound helper make rerender when todate property changes: ember.handlebars.registerboundhelper('parsedate', function(value) { console.log(value); // formatting value // i've commented out since it's not clear //...

PHP sorting a multidimensional array from JSON -

php multidimensional array sorting bit confusing me. what have array formed json_decode() .jsonp file. it has several variables in each primary array entry. include "year", "month", "day", "hourtimestart", , "minutetimestart", along other information. i'd sort array date, i'd first sort "minutetimestart", "hourtimestart", "day", "month", "year", they're in chronological order. the array looks this: array ( [0] => array ( [year] => 2013 [month] => february [day] => 5 [hourtimestart] => 5 [minutetimestart] => 0 [name] => tht ) [1] => array ( [year] => 2013 [month] => january [day] => 6 [hourtimestart] => 2 [minutetimestart] => 0 [name] => gregre) [2] => array ( [year] => 2013 [month] => march [day] => 4 [hourtimestart] => 1 [minutetimestart] => 15 [name] => gregre) ) essentially i'm doing th...

c# - Cast string to date and change year 0001 to 1900 -

i receive string following value: 0001-01-01t12:30:00 i need time portion when saving database. but can't save 0001 year in mssql server (field smalldatetime type) requires 1900+ . currently check year , recreate date using following code: ... datetime = convert.todatetime("0001-01-01t12:30:00"); datetime d = new datetime(1900, 1, 1, i.hour, i.minute, i.seconds); is there easier way use date format year set 0001? i don't know of fields i'm importing might have value , don't want add code of fields. you can use datetime.add() method in conjunction datetime.timeofday property. if regular sql datetime use sqldatetime.minvalue helper, , add datetime it. sqldatetime.minvalue.value.add(convert.todatetime("0001-01-01t12:30:00").timeofday) for smalldatetime can create own. new datetime(1900, 1, 1).add(convert.todatetime("0001-01-01t12:30:00").timeofday)

memcached - Rails + Dalli memcache gem: DalliError: No server available -

hi i'm having trouble setting rails project on server because apache keeps complaining dallierror: no server available . i installed memcached on ubuntu machine, still doesn't work. rails project has config.cache_store = :dalli_store, 'localhost:11211', { :namespace => "production" } in environments/production.rb. how debug this? my log shows before each request: localhost:11211 failed (count: 6) dallierror: no server available telnet 11211: root@s2:/usr/local/www/production/current/log# telnet localhost 11211 trying 127.0.1.1... telnet: unable connect remote host: connection refused i had same problem. first installed memcached gem gem install memcached , got error "dallierror: no server available" then installed memcached doing sudo apt-get install memcached . works fine now.

javascript - converting .live() to .on() or .click() functions jquery -

i'm following tutorial uses old version of jquery create mvc built in todo list using ajax calls. original code went follows: $(function() { $.get('dashboard/xhrgetlistings', function(o) { (var = 0; < o.length; i++) { $('#listinserts').append('<div>' + o[i].text + '<a class="del" rel="'+o[i].id+'" href="#">x</a></div>'); } $('.del').live('click', function() { delitem = $(this); var id = $(this).attr('rel'); $.post('dashboard/xhrdeletelisting', {'id': id}, function(o) { delitem.parent().remove(); }, 'json'); return false; }); }, 'json'); $('#randominsert').submit(function() { var url = $(this).attr('action'); var data = $(this).serialize(); $.post...

Linux-Check Linux process history -

is there way check linux process history? there's program here link no longer available. process accounting it possible history of executed processes. take @ program gnu acct: http://www.gnu.org/software/acct/

Building Web-Service client from existing WSDL file using java -

i've been tasked building web service in java, , i've been given existing wsdl file seems define everything. need build java around/using (not consuming though) . how go using in eclipse? i've tried going "new web service client" , selecting wsdl code generates doesn't include of methods (which 1) or parameters wsdl. you can use apache cxf wsdl java doing thing.look @ here click here , google more details also can use soapui doing this. think soapui way more easy previous method click soapui tutorial wsdl consist every detail how web service should , functionality

java - Deserialize an empty list in Web Services -

i'm having trouble deserializing empty list xml. xml message i'm sending <dataobj> <roleassignments /> </dataobj> java class i'm deserializing into public class dataobj { @xmlelementwrapper(nillable=true) private list<roleassignmentdataobj> roleassignments; } what's happening i'm getting dataobj list of size 1 single object nulls values. if omit <roleassignments /> , null in class. how can empty list in java? this blog posting gives examples of how jaxb xmlelementwrapper supposed work. according it, have written should give empty collection; see "mapping #3". so think real problem somewhere else. maybe schema not allow list empty. maybe input xml not think should be.

ios - Disposing of View Controller resources -

i having trouble understanding of arc. breakdown of program http://i.stack.imgur.com/tfrah.png i wrote emphasize vc1 more of 'master screen'...that doesn't have variables change. type in values , pass them music player instantiated problem when leaving vc2 , going startup screen select different values memory keeps going higher , higher cycle continues. is how it's supposed work? notice when go startup screen, of values have been reset tells me drawing things new. why memory keep increasing every time switch between these 2 screens? "why memory keep increasing every time switch between these 2 screens?" probably because you're not switching between 2 controllers -- fact values reset when "go back" vc1 tells me instantiating new instance of vc1 when "go back". when using segues, should use unwind segue go previous controller. other types of segues instantiate new controllers .

playframework 2.0 - Is there a file size limit to the Scala templates? -

i have scala template contains embedded hard coded images (eg <img src="data:image/gif;base64,ivborw0k... ). testing used same image. when compile application following error java.io.ioexception: invalid constant type: 106 @ 119 @ javassist.bytecode.constpool.readone(constpool.java:1044) @ javassist.bytecode.constpool.read(constpool.java:984) @ javassist.bytecode.constpool.<init>(constpool.java:125) @ javassist.bytecode.classfile.read(classfile.java:770) @ javassist.bytecode.classfile.<init>(classfile.java:114) @ javassist.ctclasstype.<init>(ctclasstype.java:95) @ javassist.classpool.makeclass(classpool.java:728) @ javassist.classpool.makeclass(classpool.java:706) @ play.core.enhancers.propertiesenhancer.rewriteaccess(propertiesenhancer.java:145) @ sbt.playcommands$$anonfun$postcompile$1$$anonfun$apply$32.apply(playcommands.scala:327) @ sbt.playcommands$$anonfun$postcompile$1$$anonfun$apply$32.apply(playcomm...

Android audio delay -

i have problem when playing mp3 in android, delay or lag, ex: if have reproduce following: "hello, how you?", plays "how you?" or says low "hello". it happens in viewsonic v220 22" tablet, in of other devices, works fine, in 1 seems fail. its weird, becouse other apps(like youtube or media player) works fine. this code, maybe doing wrong: public class soundmanager implements mediaplayer.onpreparedlistener, mediaplayer.oncompletionlistener { private parent mparent; private mediaplayer mediaplayer; string[] mp3_array; int counter = 0; public soundmanager(parent parent) { mparent = parent; } public void playsound(string[] url) throws illegalargumentexception, illegalstateexception, ioexception { mp3_array = url; mediaplayer = new mediaplayer(); mediaplayer.setaudiostreamtype(audiomanager.stream_music); if (mediaplayer.isplaying()) { mediaplayer.reset(); } mediaplayer.setdatasource(url[0]); ...

ajax - Dynamically Included Javascript and Dependencies -

so, sort of exercise myself, i'm writing little async script loader utility (think require.js, head.js, yepnope.js), , have run across little bit of conundrum. first, basic syntax this: using("models/somemodel", function() { //callback when dependencies loaded }); now, want know, when call made, file i'm in. ajax call, can mark flag after content loads, before eval mark using calls going specific file, unset flag after eval (i know eval evil, in case it's javascript in first place, not json, it's not evil). i'm pretty sure need, prefer script tag few reasons: it's semantically more correct easier find scripts debugging (unique file names easier through anonymous script blocks , debugger statements) cross-domain requests. know try use xdomainrequest, servers aren't going set that, , want ability reference external scripts on cdn's. i tried got me needed. keep list of every time using called. when 1 of scripts loads, take of usi...

EXCEL VBA using FOR LOOP that will disregard the step +1 LOOP COUNTER -

i in search of solution disregard or take 1 step loop counter. here code better understanding. sub downarrow5_click() dim c integer dim copyfromrow integer copyfromrow = 1 c = 1 20 if activesheet.rows(copyfromrow).hidden = false , range("a" & c & "").value <> "" 'start copy paste activesheet.range("a" & copyfromrow & ", c" & copyfromrow & "").copy sheets("sheet2").select activesheet.range("a1").select activecell.offset(1, 0).select activesheet.paste activecell.offset(1, 0).select sheets("sheet1").select application.cutcopymode = false else c = 'disregard +1 loop end if next c end sub i can't decrement counter since have negative (-) result returning unending loop. note: need copy , paste 20 unhidden rows sheet2. why need max counter (20). brief code working on. use type of lo...

java - Having trouble with Boolean. Making a test if an integer is greater/less than another... How to output saying that he/she is right/wrong? -

import java.util.random; import java.util.scanner; public class boolean { public static void main(string[] args){ string zz; scanner keyboard = new scanner(system.in); random r1 = new random(); random r2 = new random(); random greatless = new random(); int x = r1.nextint(10) + 1; int y = r2.nextint(10) + 1; int z = greatless.nextint(2) + 1; if (z == 2) { zz = "<"; } else { zz = ">"; } system.out.println("is " + x + " " + zz + " " + y + "? (y/n)"); string ans = keyboard.nextline(); } } i don't know write after keyboard input. want tell them if they're right or wrong using boolean class... want if else after. guess like... if (ans.equalsignorecase("y") { -insert code- } else { - insert code- } the logic is: if x < y, , z == 2 , ans "y", correct if x < y, , z == 2 , a...

How do you unit test an algorithm in C#? -

i've ran situation i'm not sure how test: algorithms. specifically, i'm attempting write adler32 method , create unit test it, hit brick wall @ point. my first attempt ended being shortened version of same code had in method, seems wrong do. next attempt have table of input values expected results, compare expected results actual results... seemed idea until realized way know how populate table running algorithm. i'm pretty stuck. how 1 go unit testing algorithm without reusing algorithm in unit tests (directly or indirectly)? use table of inputs , known outputs described. need outputs implementation of same algorithm source know accurate. if you're implementing algorithm doesn't have readily available input/output data, re-implement algorithm way, such in excel, , generate data know accurate. statistical calculations reports can generate data in excel.

php - Check if a username and email already exists in my database -

i new php , check whether or not username or email exists in database. if does, redirect signup page. code have works add users cannot figure out how check if username , email exist. don't want make either primary key please help!!! code have book using: <?php require_once "app_config.php"; require_once "database_connection.php"; $upload_dir = host_www_root . "uploads/profile_pics/"; $image_fieldname = "user_pic"; //potential php errors $php_errors = array(1 => 'maximum file size in php.ini exceeded', 2 => 'maximum file size in html form exceeded', 3 => 'only part of file uploaded', 4 => 'no file selected upload'); $first_name = trim($_request['first_name']); $last_name = trim($_request['last_name']); $username = trim($_request['username']); $password = trim($_request['password']); $email = trim($...

Objective-C algorithm to find largest common subsets of arrays? -

i'm in need of efficient solution finding largest common subsets of multiple arrays. for example: let's user, chris, wants find other users common interests (from common least common); we'd have compare array of interests other users' arrays , find largest common subset smallest common subset. chris {bowling, gaming, skating, running} and other users in database. brad {bowling, jumping, walking, sitting} john {bowling, gaming, skating, eating} sarah {bowling, gaming, drawing, coding} so chris has common interests, respectively, john, sarah, brad. how i, in objective-c, able this? pointers great. you looking algorithm find cardinality of set intersection. depending on set representation, choose different ways of doing it. performant representation using bits in integer, if number of possible interests exceeds 64 may not easy implement. a straightforward way of implementing nsmutableset , this: // prepare individual lists nsar...