Posts

Showing posts from January, 2013

android - Problems with layout -

i trying create own phone dialer scratch in eclipse android, did simple phone layout in xml numbers 0-9 , buttons/imagebuttons. basically put button s , imagebutton s , understand need call setonclicklistener() on them in java code. like: button no1 = (button) findviewbyid(r.id.button1); no1.setonclicklistener(new view.onclicklistener() i did <edittext on top of numbers (buttons , imagebuttons) display numbers. nothing come out when click. not sure miss out cause problem. i did "settings" button in same xml file, upon clicking on button, toast pop out have couple of clickable icons. not sure on how it. did read tutorials mine seems not quite right. hopefully if above-mentioned points can rectified, hope can try make sms characters unicode, can limit lets 50 characters etc.. that's still far-fetched me though. i'll in later part. i did google research don't quite correct info bits , pieces here , there... actually want create customized phone ...

c++ - why compiler is not eliding away copy construction in this case -

class test { public: int data; test(int var = 0):data(var){cout<<"constructor"<<endl;} ~test(){ cout<<"destructor"<<endl; } test(const test& var) { cout<<"copy constructor"<<endl; this->data = var.data; } test& operator=( const test& var) { cout<<"assignment op"<<endl; this->data = var.data; return *this; } }; test passbyref_returnbyval(test& obj) { return obj; } int main() { test o1(5); test o2 = passbyref_returnbyval(o1); cout<<"=========================="<<endl; test o3; o3 = passbyref_returnbyval(o1); } output: constructor copy constructor constructor copy constructor assignment op destructor in given example , object o2 directly copy constructed without using temporaries. but in second case want o3 assigned re...

apache - Mediawiki can't display images or styles -

i`m using mediawiki v1.19.1. my wiki works when use locally. when access on network (from computer, or different ip), displays text only. there no images. it seems classic skin it`s not. reason there no layout on wiki (other public wiki pages show ok). my wiki uses monobook skin now, can see text on page. i have changed permission 777, including on directories ( /var/www/kj/* ), still no images. help me, please... i got same issue time ago , following worked fine me. issue might related localsettings.php file , general setting $wgserver . the following link can provide more details : manual of $wgserver since 1.18 mediawiki has supported setting $wgserver protocol-relative url. eg, //www.mediawiki.org this used supporting both http , https same caches using links work under both protocols. so try removing localhost , provide url; eg ; $wgserver = "//mywebsite.com";

Eclipse + JBoss Tools won't run webapp to configured JBoss AS -

i using eclipse 3.7.2 jboss tools 3.3 under ubuntu 12 , have configured locally installed copy of jboss 7.1.1 in eclipse under " preferences::server::runtime " environments. however, when trying run java ee application double-clicking on project or .xhtml page see " run / run " on server option , http 404 apache tomcat/7.0.26 @ localhost:8080 . is, seems eclipse trying deploy tomcat server opposed jboss have configured in " preferences::server::runtime " , don't option "run on jboss" or anything. when export application war , manually deploy jboss app runs fine. the idea add application specific server have configured. additionally; adding server runtime isn't enough. you need open servers view, , there right click on background , select new , , server . if choose jboss community -> jboss 7.1 here, can select created server runtime in server runtime environment , or optionally create new one. then comes mental tw...

hybridauth - How to solve this This sample requires a Mysql database. Please edit the configuration file: application.config.php? -

i using hybridauth userinformation social web sites facebook,twitter, etc. php lib connect configured using install.php available in lib itself. when tried use examples available following errore this sample requires mysql database. please edit configuration file: application.config.php i don't know file application.config.php available. also got error! hybridauth library needs curl php extension. since new php blinking next. please me solve this. regards tony firstly, need php-curl.. repo's php installs include this, it's odd haven't gotton it. have specified os you're working on, quick google search give instructions on installing this. if you're working on rhel-based system, do; yum install php-common yum install php-curl the former installing php common packs, , latter installing curl. likewise, you'll need find application.config.php - again, on rhel-based systems, can run; find -name application.config.php - otherw...

css - IE8 embedded font dissapears on refresh -

Image
i using embedded font via @font-face , works fine... until on ie8 (haven't tried on newer versions) when crazy refresh or use backward , forward buttons reload page. what's worse doesn't default font in font stack, appears go straight arial (with serious spacing issues). a live example can seen here: http://rcnhca.org.uk/sites/first_steps/ an image comparison viewing pleasure: the relevant css perusing pleasure: @font-face { font-family: 'droidserifregular'; src: url('droidserif-regular-webfont.eot'); src: url('droidserif-regular-webfont.eot?#iefix') format('embedded-opentype'), url('droidserif-regular-webfont.woff') format('woff'), url('droidserif-regular-webfont.ttf') format('truetype'), url('droidserif-regular-webfont.svg#droidserifregular') format('svg'); font-weight: normal; font-style: normal; } an interesting note: som...

html5 - What is the HTML equivalent of #define in C/C++? -

i have multiple html files vary little - few bits of text , javascript constants here , there. want make easy maintain 1 master version , make generating variants simple. something compile time substitution in c/c++ simple , perfect: #define constant 1.23456 how? ideas? additional info: using html 5 these html files use in phonegap, no server-side stuff allowed. you can use templating engine that. 1 content 1 twitter http://twitter.github.com/hogan.js/

JQuery - Having problems formatting using JQuery -

i'm in process of learning jq , have created div when hovered on opens , when cursor leaves opened div closes. which works perfect problem... when cursor goes on div div freaks out , opens , closes several times quickly. any advice appreciated. andy script type="text/javascript" $(document).ready(function(){ $(".tagshow").hover(function(){ $(".panel").show("fast"); },function(){ $(".panel").hide("fast"); }); }); </script> <div class="tagshow"> <div class="panel"> <?= $tagcloud ?> </div> <p class="flip">select category <span class="scategory"></span></p> </div> css: div.panel,p.flip { margin:0px; padding:5px; text-align:center; background-color: #edf7f9; border:1px solid #24b4e0; position: absolute; z-index: 2; } div.panel { padding: 50px; height...

asp.net mvc - Getting message “Store update, insert, or delete statement affected an unexpected number of rows (0)” ? -

another big problem, here. i have model: public class lead { [system.componentmodel.dataannotations.column("le_codlead")] public int leadid {get; set; } [system.componentmodel.dataannotations.column("le_descr1")] [required(errormessage="inserire nome del lead")] [display(name="nominativo lead")] public string name1 {get; set;} [system.componentmodel.dataannotations.column("le_descr2")] [display(name = "nominativo secondario")] public string name2 { get; set; } ... ... ... } controller (for create method): [httppost] public actionresult create(lead lead) { if (modelstate.isvalid) { db.leads.add(lead); db.savechanges(); return redirecttoaction("index"); } return view(lead); } and v...

Maven: The Definitive Guide - POM for 'asm:asm-commons:pom:3.2:runtime' is invalid -

i'm trying go through examples in maven: definitive guide. in chapter '4.3. creating simple weather project' has me run following command. mvn archetype:create -dgroupid=org.sonatype.mavenbook.ch04 -dartifactid=simple-weather -dpackagename=org.sonatype.mavenbook -dversion=1.0 i think these errors problem. [warning] pom 'asm:asm-commons:pom:3.2:runtime' invalid. ignored artifact resolution. reason: failed validate pom project asm:asm-commons @ artifact [asm:asm-commons:pom:3.2:runtime] [warning] pom 'asm:asm-util:pom:3.2:runtime' invalid. ignored artifact resolution. reason: failed validate pom project asm:asm-util @ artifact [asm:asm-util:pom:3.2:runtime] [warning] pom 'asm:asm-analysis:pom:3.2:runtime' invalid. ignored artifact resolution. reason: failed validate pom project asm:asm-analysis @ artifact [asm:asm-analysis:pom:3.2:runtime] [warning] pom 'asm:asm-tree:pom:3.2:runtime' invalid. ignored artifact resolution. reason: faile...

linq - "Cannot Convert Lambda Expression to Delegate type" Error in RavenDB query -

i have ravendb document looks this: { "parentid": null, "order": 10, "url": "/sandbox", "rows": [ { "instanceid": "2771a0d7-7f3f-4854-a3ba-27f25f88a45e", "cssclass": null, "columns": [ { "instanceid": "b91495f5-b770-4da7-8073-ad3bd8221ca8", "cssclass": null, "span": 3, "cmsmoduleinstancesettings": [ { "$type": "modulehtml.models.modulehtmlinstancesettings, modulehtml", "isactive": false, "showauthor": false, "showdate": false, "showcommentscount": false, "showlast2comments": false, "cmsmoduleinstanceid": 417, "containerclass": "de...

iOS loadHtmlString in UIWebView doesn't work with Javascript -

i have ios app load html string refer external css file , javascript file in same directory. here html file: <html> <head> <meta name="viewport" content= user-scalable="no", width="device-width" /> <meta http-equiv="content-type" content="text/html"; charset="utf-8"/> <link rel="stylesheet" type="text/css" href="mystyle.css" /> <script type="text/javascript" src="myjavascript.js"></script> </head> the css file works fine seems js file never loaded. reason? by way i'm using loadhtmlstring: baseurl method load html string. thanks this question bit old, since has not been answered, point out if web view load javascript file residing in bundle, way is: [webview loadhtmlstring:html baseurl:[nsurl fileurlwithpath:[[nsbundle mainbundle] bundlepath]]]; if don't specify bas...

java - Need demos of using hadoop cloudera -

i begineer in hadoop. understand basic workflow of using map reduce. have written few basic stand alone programs in eclipse using hadoop apis. want real stuff , have hands on. of have downloaded cloudera vmdk , installed on vmware fusion. can point me right location can find crystal clear info how continue forward. want use hdfs on 2 or more machines , write stand alone applications uses these system resources parallel computing solve task. oven internet have found understanding of map reduce , many advanced topics nothing specific looking for. kindly direct me right place can find tutorial or video lecture me move forward kindly direct me right place can find tutorial or video lecture me move forward this question keeps on popping again , again in forums. here consolidated list of hadoop material found interesting on time. mapreduce can used solve lot of interesting algorithms. check this , this various algorithms can implemented on top of mapreduce. pic...

android - AsyncTask: not modified from a background thread -

asynctask: removed possible ui operation in background thread, still got kind of exception after run 5 or 6 times. please me. java.lang.illegalstateexception: content of adapter has changed listview did not receive notification. make sure content of adapter not modified background thread, ui thread. [in listview(2131427449, class android.widget.listview) adapter... try call notifydatachanged() or requestlayout(); ui thread.

facebook - Comment plugin - mobile attribute? -

on developer page (http://developers.facebook.com/docs/reference/plugins/comments/) can see facebook comment social plugin has following attributes. attributes href - url comments plugin. news feed stories on facebook link url. width - width of plugin in pixels. minimum recommended width: 400px. colorscheme - color scheme plugin. options: 'light', 'dark' num_posts - number of comments show default. default: 10. minimum: 1 mobile - whether show mobile-optimized version. default: auto-detect. for mobile gives me default value, others? false/true, yes/no, on/off, none/ ???? you can turn behavior off setting mobile parameter false. see mobile version ignores width parameter, , instead has fluid width of 100% in order resize in portrait/landscape switching situations. may need adjust css mobile site take advantage of behavior. if preferred, can still control width via container element.

sms - Send and receive SMSes in PHP -

i have 2 questions. i want send smses web-site in php user giving information orders. need sms displayed 'td-company-name' big e-commerce web-sites. how achieve this? pointers how done? going round , round on googling. also, there several other operators sending smses application in specific format parsed , respective updates done in database. how achieve this? note: application designed work in india locally. , backend php , mysql . send , receive smses in php check out nexmo , twilio . i've used both. think twilio has shallower learning curve. nexmo offers free incoming messages. depending on application, play huge factor (for example, sms voting system). both have excellent documentation , php code samples.

How can I write into a file within an Eclipse bundle? -

i have xml configuration file located plugin resources. want update file whenever in plugin happens event. found methods find , read contents of file located plugin classpath, i'm looking way write such file. there way? many thanks. that location (the install directory) intended read-only since may shared in network install scenario. suggest instead write xml file plugin's state location intended purpose: string path = activator.getdefault().getstatelocation().tostring(); i should add gives qualified path directory created eclipse files plugin wants store. directory unique plugin.

motorola - How can I make a windows mobile browser beep? -

i've developed barcoding app runs in web browser on example motorola mc65 (wm 6.5) , cipherlab cp30. works ok giving clear visual indication of ticket status - let them in or don't. what make different go / no go sounds depending on status of barcode i've scanned being returned server. having different beeps, user doesn't have read screen, can move straight on next ticket scan, speeding massively. whilst we're it, vibrating phone great if pda supports - useful outisde rock concert, it's beep that's necessity. any ideas? or developing native wm app way go. will consider installing different browsers / software if it'll cheaper custom app. yes, can play wav files on device controlled html code. here snippet post @ http://www.hjgode.de/wp/2010/02/26/the-pocket-or-mobile-internet-explorer/ : --> <object type="audio/x-wav" data="file://\windows\asterisk.wav" width="1" height="1...

c# - search a DataGridView and then highlight the cell[s] in which the value is found? -

i have datagridview i'm feeding list the datagridview populating perfectly, i'd able search within grid (any column) value user enters. i've been flailing trying sneak way solution, can't find datagridview.cells[x,y] type of property. i tried this: string searchval = textboxvaluetofindingrid.text.trim(); (int = 0; < datagridviewplatypuselements.rowcount; i++) { (int j = 0; j < datagridviewplatypuselements.columncount; j++) { if (datagridviewplatypuselements.text.contains(searchval)) { datagridviewplatypuselements.goto*(cells[j,i]); } } } ...but, of course, datagridview.text not contain useful. need cells[x,y] property. i not consider harmful in case. how about datagridview.rows[x].cells[y].value

R sorting column -

i have file several column loaded in r. want achieve order column of file respect minimal value in each of column. e.g. input(mina=0,minb=3,minc=1) b c 4 8 1 2 3 4 0 3 1 output b c 4 1 8 2 4 3 0 1 3 you might try apply() way: mins <- apply(mydata, 2, min) o <- order(mins) mydata <- mydata[,o]

how can i use a json output in python -

i trying figure out how json output in python . here url: http://maps.googleapis.com/maps/api/distancematrix/json?origins=vancouver+bc|seattle&destinations=san+francisco|victoria+bc&mode=bicycling&language=fr-fr&sensor=false whose output this { "status": "ok", "origin_addresses": [ "vancouver, bc, canada", "seattle, État de washington, États-unis" ], "destination_addresses": [ "san francisco, californie, États-unis", "victoria, bc, canada" ], "rows": [ { "elements": [ { "status": "ok", "duration": { "value": 340110, "text": "3 jours 22 heures" }, "distance": { "value": 1734542, "text": "1 735 km" } }, { "status": "ok", "duration": { ...

java - Invoke methods with different arguments in a generic way -

im trying write generic code, can invoke methods @ runtime different number & type of arguments. have class & different methods @ disposal reading file, along arguments passed particular method. so, here's object array contains values of different type - object[] args = new object[]{"astring", 1, true}; /* based on object java.lang.reflect.method.invoke(object obj, object... args) , have written following method */ //"executingmethod" references method executed, 1 can class.forname("classname").getdeclaredmethods(); , traversing particular method. executingmethod.invoke(methodclassobject, args); //and doesn't execute because @ runtime doesn't know(can't downcast) param "type". i don't want pass args[0], args[1], args[2] inside executingmethod.invoke(..), case number of arguments may vary. any suggestions pls?? here 1 way deal problem: create following interface import java.util.arraylis...

logging - Create log file for Java program -

i have java program created batch file schedule after period run. want generate log file program whenever loaded, log file must contain date time , error if thrown. how create log file java program? do study log4j logger, implement configurations.

javascript - Regex replace unterminated parenthetical -

i want replace unnecessary breaks in string. have written regex replace throws error: syntaxerror: unterminated parenthetical var str = "<h1>sdflk</h1><br><br><br><br><p>test</p><br><br><br><br>"; str.replace(/((</[a-za-z0-9]+>)(<br>)+)/,"\$2"); but don't see missing parenthese. you must add \ before / in re: /((<\/[a-za-z0-9]+>)(<br>)+)/ another option use regexp : re = new regexp("((</[a-za-z0-9]+>)(<br>)+)"); "<h1>sdflk</h1><br><br><br><br><p>test</p><br><br><br><br>".replace(re,"\$1");

PHP include files are making JSON data invalid -

i'm relatively new php development not web development in general. i have following php file: <?php class dialogresult{ var $message; var $title; var $height; var $genericdata; function __construct(){ $this->height = 10; } } header("cache-control: no-cache", true); header("content-type: application/json; charset=utf-8", true); $dr = new dialogresult(); $dr->message = "a test message encoded"; $dr->height = 10; $dr->genericdata = "empty"; $dr->title = "my message"; echo(json_encode($dr)); ?> this returns json data expected, if move class separate file , add include, include_once, require, or require_once returns invalid json data. can tell me why be? it doesn't have moving class, if have included file makes data invalid. thanks, keith here include class, i've tried removing ?> <?php class dialogresult{ var $message...

ColdFusion PDF file search using cfsearch and SOLR extremely slow -

i have functional working adobe coldfusion application indexing 2k pdf files via solr search , providing expected results - each search query collection takes 25-30 seconds. this how indexed 2k pdf files solr: <!--- query database files ---> <cfset getfiles = application.file.getfiles()> <!--- create solr query set ---> <cfset filesquery = querynew(" fileuid , filepath , title , description , fileext , added ")> <!--- create new file query key path , download url ---> <cfoutput query="getfiles"> <cfset ext = trim(getfiles.fileext)> <cfset path = expandpath('/docs/#fileuid#.#ext#')> <cfscript> newrow = queryaddrow(filesquery); querysetcell(filesquery, "fileuid","#fileuid#" ); querysetcell(filesquery, "filepath","#path#" ); querysetcell(filesquery, "title","#filename#" ); querysetcell(filesquer...

php - Any performance issues with passing in a db connection object each time I instantiate a class? -

many of classes require access database work. while i've been doing following: // create (one) database object $mysqli = new mysqli("host", "username", "password", "db"); // pass database object each new object requires database interaction follows $car = new car($data, $mysqli); $plane = new plane($data, $mysqli); // etc then each class has private $mysqli member passed in mysqli object assigned in construct follows: class car { private $mysqli; public function __construct($data, $mysqli) { $this->mysqli = $mysqli; } } then class methods can use mysqli object this: public function fuellevel() { $this->mysqli->query("select fuel_level fuel_tank"); } my question is, run performance issues if create few thousand of these objects? correct in thinking there technically 1 database connection in entire application doing so? or should using references (pointers?) below avoid feared p...

vbscript - How to Display images 100x75, and on click, display them in original size. ASP classic -

the code below first displays folders hyperlinks, can click these folders , if contain jpg's display them. is possible make these images display attributes width="100" height="75" still allow me click them , have them display original size? <% const forreading = 1, forwriting = 2, forappending = 3 const tristateusedefault = -2, tristatetrue = -1, tristatefalse = 0 qfolder = request.querystring("f") if qfolder = "" folderspec = server.mappath(".") set filesys = createobject("scripting.filesystemobject") set demofolder = filesys.getfolder(folderspec) set folcoll = demofolder.subfolders each subfol in folcoll folsize = left((subfol.size/1000000), 3) folist = folist & "<a href='?f=" & subfol.name & "'><strong title='view'></strong> " & subfol.name & "" & vbcrlf folist = folist & ...

javascript - Disable header click on jQuery tabs -

how can disable header click jquery tabs. i want change tabs elements inside tab, building component work wizard. $(tab).click(function(){ return false; }); will prevent default action of tab

Continuous data streaming Arduino to Python -

i trying python gui window using tkinter continuously display data streaming arduino uno board acting voltmeter. code i've got, window display 1 data point, , once window gets closed, new window opens next available data point. here's code i've been using: import serial tkinter import * ser = serial.serial('/dev/tty.usbmodem621') ser.baudrate = 9600 while 1 == 1: reading = ser.readline() root = tk() w = label(root, text = reading) w.pack() root.mainloop() i'm using macbook pro , , pyserial package serial communications. how window refresh itself? i think problem you're creating new root every loop iteration. try code: import serial tkinter import * time import sleep ser = serial.serial('/dev/tty.usbmodem621') ser.baudrate = 9600 def update(): while 1: reading.set(ser.readline()) root.update() sleep(1) root=tk() reading = stringvar() w = label(root, textvariable = reading) w.pack...

is there a way to move shapes by x and y in Allegro 4.2? -

i'm newbie allegro may simple question. i'm wondering if there way move allegro shapes x,y without filling circle made black circle , making new circle. currently have while loop moves circle moving filling current 1 black circle , making new 1 x , y little different i'd know if there way move allegro shapes x,y because seems make game slow. here current while way: int x=100; int y = 100; int tempx,tempy; while(1) { tempx=x; tempy=y; circlefill ( screen, tempx, tempy, 20, makecol( 0,0, 0)); circlefill ( screen, x, y, 20, makecol( 0, 0, 255)) x+=10; y+=10; } thanks you need use buffer. after set graphics mode, create bitmap screen_w,screen_h big. on every frame, clear bitmap, draw blue circle @ x, y , draw buffer screen. i suggest take @ many examples come allegro or read tutorials, because there many elementary important things need learn. also, highly recommend using allegro 5 since actively developed , has api far more suitable mode...

Rails style guide for render using double or single quotes -

i've been reading few books, blogs , open source code , have rails style guide question. is popular consensus using single quotes when using the rendering partials. <%= render 'posts' %> or <%= render "posts" %> some books use both on coding examples. thanks everyone. the thing mention here single quote strings more efficient double qoute strings. double quote strings interpolated: "hello #{@name}!" # => "hello chris!" single quote strings don't: 'hello #{@name}!' # => 'hello #{@name}!' this gives single quote strings slight edge in speed during execution. don't worry much: speed gain really small.

python - 404 error on unique page creation with google app engine -

i asked similar question here: create permenant unique links based on user id couldn't quite answer. trying give every user on site unique profile page. have set keep getting 404 error. not sure if problem handler or whole way doing it. here app code: app = webapp2.wsgiapplication([('/', mainpage), (r'/profile/(.+)', profilepage)]) and here profilepage handler class: class profilepage(webapp2.requesthandler): def get(self, profile_id): profileowner = user.get_by_id(profile_id) if profileowner: #get posts user , render.... #theid federated_id theid = profileowner.theid personalposts = db.gqlquery("select * post theid =:1 order created desc limit 30", theid) #i collect can have username in top of page global visits logout = users.create_logout_url(self.request.uri) currentuser = users.get_curren...

c# - Group users by age for a range -

i have data need make statistics. need group users age. var byage = displayresult.groupby(x => x.age); which can above. however, gives me ages 19, 20, 21 etc. want grouping age 10 years, such users between 10-20 yearsold, 20-30 years old, 30-40 years old etc. how can that? you can truncate trailing digit dividing ten using integer division, , multiplying ten. var byage = displayresult.groupby(x => 10*(x.age/10)); everyone between 0, inclusive, , 10, exclusive, in bucket 0. 10 20 under key 10 , 20 30 - under key 20 , , on.

asp.net - ESQL aggregation `COUNT()` in nested query -

i have asp.net page request url parameter of sql ajax json response. e.g.: url: 'gridservice.aspx?query=select value s.name, s.email modelcontainer.studentset s' information of name , email . in order implement paging jqgrid , have add total count of query json response. but following query not work esql: select value count(0) (select value s.name, s.email modelcontainer.studentset s) this because 2 columns selected in child query. , following work: select value count(0) (select value s modelcontainer.studentset s) since i don't want select unnecessary columns , i'm wondering if give example of making former 1 work. note neither name nor email pk.

javascript - if I create jquery ui dialog on the fly , is there any clean up beside calling dialog("close") in a single page app? -

in single page web app, if create jquery ui dialog on fly this: $("<div>hello</div>").dialog({ buttons : { "cancel" : function() { $(this).dialog("close"); } } }); do need special clean after each closing? need call dialog's "destroy"? you should call destroy if plan re-create dialog each time it's opened, happen code above called more once. if dialog gets opened once, doesn't matter.

java - @RequestBody and @ResponseBody annotations in Spring -

can explain @requestbody , @responsebody annotations in spring 3? for? examples great. there whole section in docs called 16.3.3.4 mapping request body @requestbody annotation . , 1 called 16.3.3.5 mapping response body @responsebody annotation . suggest consult sections. relevant: @requestbody javadocs, @responsebody javadocs usage examples this: using javascript-library jquery, post json-object this: { "firstname" : "elmer", "lastname" : "fudd" } your controller method this: // controller @responsebody @requestmapping("/description") public description getdescription(@requestbody userstats stats){ return new description(stats.getfirstname() + " " + stats.getlastname() + " hates wacky wabbits"); } // domain / value objects public class userstats{ private string firstname; private string lastname; // + getters, setters } public class description{ private string descript...

Scala - finding sequence members that are of a certain type's child type -

i have following situation: java lib class: class libclass { arraylist<libclass> children; } my program scala code: abstract class myclass extends libclass { def boom { } def boommyclassinstances // ??? } class lala extends myclass class hoho extends myclass the question is: in method boommyclassinstances scala-ish way children of myclass , stored in children arraylist can call common boom method upon them all? my try is: def boommyclassinstances { children.toarray.map { case mc: myclass => mc.boom } } is correct approach? pick children of myclass , right scala way that, or have type bounds? check out gentraversablelike.collect . signature traversable[a].collect[b <: a](f: ~> b): traversable[b] , is, takes collection elements of type a , partial function f a b , , returns collection of static element-type b , b subtype of a . val myclassinstances: list[myclass] = children.tolist.collect{case mc: myclass => mc} si...

c# - how to fill webGrid through dropdown selection in mvc 3? -

Image
hi; want fill webgrid after selection dropdownlist. can not. i've been selected drb1 , filling drb2. bu can not fill webgrid1 after selection drb2. can not fing sample googling.how fill webgrid? aim descripted below: you can achieve call action on selecteditem change of dropdown inside action can use selectedtext of dropdown , use entity framework calling sql once data return tranform model , return in view the view need @model ienumerable<product> <div> @{ var grid = new webgrid(model, defaultsort:"price"); } @grid.gethtml() </div> some nice example : http://msdn.microsoft.com/en-us/magazine/hh288075.aspx http://weblogs.asp.net/andrebaltieri/archive/2010/11/01/asp-net-mvc-3-working-with-webgrid.aspx

visual studio - Incremental link of x64 assembly function -

i have x64 assembly file in c++ dll project. reasons beyond scope want linker generate entry in jump table function other c/c++ function in project. when call function c++ code jumps assembly function instead of going through jump table. ideas? assembly code isn't relocatable compiler. doesn't have jump table entry.

Can I define new attributes in XMP for PDF? -

i know there attributes in xmp pdf files such as: <xap:modifydate>2009-12-10t09:54:47-05:00</xap:modifydate> <xap:createdate>2009-12-10t09:42:54-05:00</xap:createdate> <xap:metadatadate>2009-12-10t09:54:47-05:00</xap:metadatadate> <xap:creatortool>adobe indesign cs4 (6.0.4)</xap:creatortool> but want define custom attributes example: <xap:viewtitle>2009-12-10t09:54:47-05:00</xap:viewtitle> <xap:guid>2009-12-10t09:42:54-05:00</xap:guid> can it? yes, can. according xmp specification new properties may added existing namespaces without “breaking” applications. the definitions of properties in existing namespaces should remain same; otherwise, applications may produce incorrect behavior. if necessary change meaning of property, new property should created (and old 1 declared deprecated). and can create new custom schemas. it's better appro...

php - Checkbox is selected and not assigning a new value -

no matter selected still assigning value of 1 checkboxes , not changing selected checkbox value of 0. here code correct syntax standpoint defaults 1 no matter not see why not changing selected box value '0' //correct answer variables $chkbox1 = '1'; $chkbox2 = '1'; $chkbox3 = '1'; $chkbox4 = '1'; $chkbox5 = '1'; if (isset($_post['chkbox1'])) { if ($chkbox1 == 'chkbox1selected') { $chkbox1 = '0'; } }//end of chkbox1selected logic if (isset($_post['chkbox2'])) { if ($chkbox2 == 'chkbox2selected') { $chkbox2 = '0'; } }//end of chkbox2selected logic if (isset($_post['chkbox3'])) { if ($chkbox3 == 'chkbox3selected') { $chkbox3 = '0'; } }//end of chkbox3selected logic your if statements never evaluate true . take @ 1 checkbox: $chkbox1 = '1'; if (isset($_post['chkbox1'])) { if ($chkbox1 == 'chkbox1selected') { ...

Using a Java Filter to change locale not working -

i'm trying change locale using java filter following code not work jsp page still rendered in english: public class preferencefilter implements filter { public void dofilter(servletrequest request, servletresponse response, filterchain chain) throws ioexception, servletexception { httpservletrequest req = (httpservletrequest) request; httpservletresponse res = (httpservletresponse) response; locale locale = stringutils.parselocalestring("fr"); res.setlocale(locale); chain.dofilter(req, res); } } i using spring mvc , using own translation system translations different locales: <bean id="messagesource" class="com.mycompany.web.translations.databasedrivenmessagesourceimpl" scope="singleton"> <property name="cacheseconds" value="3"/> <property name="defaultencoding" value="utf-8"/> </bean> if ...

linux - Python Redhat version issue -

possible duplicate: upgrade python without breaking yum i'm running redhat vm (2.6.18-274.el5 64 bit). installed nodejs on vm in order use browserstack. nodejs running had upgrade python 2.6 or above. installed 2.7 source using make altinstall. createda hard-link point 2.4 2.7. checking python -v shows 2.7 being default. worked out fine , node , running. there problem importing 1 of python modules required run yum. error leading problem was: no module named yum please install package provides module, or verify module installed correctly. it's possible above module doesn't match current version of python, is: 2.7.2 (default, jul 2 2012, 23:35:52) [gcc 4.1.2 20080704 (red hat 4.1.2-51)] if cannot solve problem yourself, please go yum faq at: http://wiki.linux.duke.edu/yumfaq my problem yum. it's no longer working looking older version of python 2.4? there anyway can have both of them working in yum , node both using different versions? ...

time - PHP Count Down Expiry Button or Link -

i'm trying create button or link expire after 1 hour. i'm setting time visitor hit page cookie. most of code examples have seen give time has passed , not time left. example: link expire in 0 hours, 30, mins , 34 seconds this rough code : //setting cookie example setcookie('previous_time', time(), time()+3600*1); $current_time = time(); $previous_time = $_cookie['previous_time']; $time_diff = $current_time-$previous_time; this i'm stuck, have no idea how convert $time_diff timestamp format "expire in 0 hours, 30, mins , 34 seconds" many thanks. to format time difference, math, since $time_diff number of seconds between 2 times: $hours = floor( $time_diff / 3600); $minutes = floor( ($time_diff / 60) % 60); $seconds = $time_diff % 60; echo "$hours hours, $minutes minutes, $seconds seconds\n"; so, value of 20712 would produce : 5 hours, 45 minutes, 12 seconds

php - header location delay -

i have following php code want add delay too: <?php echo "message has been sent."; header("location: page2.php", true, 303); exit; ?> the above code happens fast can't see message: i have tried: <?php sleep(5); echo "message has been sent."; header("location: page2.php", true, 303); exit; ?> this doesn't display message either, sleep 5 seconds, waste of time. how display message 5 second before redirecting? you cannot http location redirect, redirect happen browser gets header. instead, use refresh redirect in header: header( "refresh:5; url=http://www.example.com/page2.php", true, 303); this should work on modern browsers, not standardized, equivalent functionality use meta refresh redirect (meaning you'd have output full html too): <meta http-equiv="refresh" content="5;url=http://www.example.com/page2.php"> from the wikiped...

python - How to find the count of a word in a string? -

i have string " hello going hello am ". want find how many times word occur in string. example hello occurs 2 time. tried approach prints characters - def countword(input_string): d = {} word in input_string: try: d[word] += 1 except: d[word] = 1 k in d.keys(): print "%s: %d" % (k, d[k]) print countword("hello going hello am") i want learn how find word count. if want find count of individual word, use count : input_string.count("hello") use collections.counter , split() tally words: from collections import counter words = input_string.split() wordcount = counter(words)

database design - Should a data warehouse ever be a primary data repository? -

typically data warehouse means consolidate multiple source systems, reporting purposes. there situations idea use data warehouse primary database in own right (i.e. capturing , managing data, not loading system)? the short answer - no, don't think so . should first designing good, normalized database structure production database - , later worry data warehouse part. keeping warehouse , production database separate considered "best business practice", perhaps importantly it's design consideration. data warehouse , production database serves 2 different purposes. perhaps important function of production database capture transactions reliably, consistently , unambiguously. matters both when designing database , when choosing software, i.e. database engine. the design part of shouldn't underestimated - i'd in projects, database design 1 first thing 1 should doing. getting table structure right more important choosing technology. if you...

dotnetnuke - Dot Net Nuke Multiple Sites -

there current install of dnn on 1 of local webservers - installed before took on position. trying add second site, instructions following appear attaching existing site. run installer create new site in addition current? i've never used dnn before, going @ blind. all information finding referencing same instructions link provided. assistance appreciated. to add little bit more information, here area confused. referencing link, states #2 add binding site, #3 add new portal. trying create new dnn site - 1 not yet exist, cannot step 2 until new portal created. said, i've never used dnn. tasked today have done july 4th (nice, huh) today first looking @ dnn ever. what have done added new portal , assumed create new bare-bones site me, not happened (obviously). so, instead of adding existing site dnn, how add new 1 (that why asked if needed reinstall)? understand, there initial website setup installation of dnn. basic site served needed - need same thing again, but, can se...

php - Creating a perfect form with validation -

on website have plenty of form , fields, have system works painful , , running. this system does, once send form info sent class possesses data , validates it. stores value of field $_session['userupdate']['firstname'][1] = $firstname; if there error creates session variable $_session['userupdate']['firstname'][0] = 1; 1 tells field empty. if there no error session variable @ 0. if no errors found in validation process data sent database. after form page reloaded : header( 'http/1.1 303 see other' ); header( 'location: '.curpageurl().'' ); i use cannot resend data when reloading page. reason i'm using these session variables. then lot of it/else if/else check values of session variables , output errors , populate form data entered previously. let me show example firstname field. this html code : <label for="firstname" class="block">first name</label> <span>your fi...

regex - php string replacement performance -

i know suggested avoid using regular expressions wherever possible, if there list of 20 or characters need strip form string? would more cost effective $string = "..."; $a = array('a', '1', '!' ...); foreach($a $char){ $string = str_replace($char, '', $string); } or better go regular expression $string = preg_replace('#[a1!...]#', '', $string); thank you! first off str_replace() supports arrays both needle , haystack running through loop process.. i'd in reply regex vs string vs string. i'd go string string in cases. regex can give false positives, , positive negatives. if not formulated correctly, , in such can become frustrating quickly. using sparingly, regex has adds more process has match or not match rule given. string string if matches matches. but opinion on matter.

push - Git verify changes brefore they committed to online repository? -

i started using git vcs , created repository on bitbucket when pushed project committed couple changes , pushed them remote repository. then wanted test how collaboration goes , created user on bitbucket , added him main repository read/write access repository. then renamed user name , email in git bash , cloned project new user credentials. when added commit , pushed put in online repository. when tried give read access did not allow push @ all. i thought can see changes other users make , can either approve or reject them main account (account owns repository) before added master repository, how can set up? edit: super admin , have 3 random developers working me developing project. how can check code created before allowing written on repository on bitbucket? if don't code can reject , make them come better one. – john smith 24 secs ago so, if give read access of course can pull, not push. in scenario workflow be... user b work , commits locally user ...

mysql - SQL sub queries with WHERE NOT EXISTS -

i want select characters character has not challenged in past 24 hours. select * challenges usercharid = 642 , chaltime > date_sub(curdate(), interval 1 day) this returns few rows challenges character has initiated in past day select characterid characters not exists (select * challenges usercharid = '610' , chaltime > date_sub(curdate(), interval 1 day)) am using not exists wrong? am using not exists wrong? yes. want using not in rather not exists. if use not exists , non-existential sub-query returns rows, condition false , no data returned main query. if no rows returned, condition true , rows returned main query (since, in example, there no other criteria in main query). often, sub-query in not exists correlated sub-query, sub-query has evaluated each row. here, don't have correlated sub-query (which performance). query means 'return information characters unless there exists character...

arm - How do I make an embedded Android OS with just one app? -

i make own embedded system built on android (arm) using devices distributed android without launcher. or i want start android application launched on top , refuse close , shutdown android app. essentially you're trying have custom build of aosp "home" application. if /packages/apps/launcher2 you'll find code default home screen. if @ androidmanifest.xml file in there, you'll see this: <activity android:name="com.android.launcher2.launcher" android:launchmode="singletask" android:cleartaskonlaunch="true" android:statenotneeded="true" android:theme="@style/theme" android:screenorientation="nosensor" android:windowsoftinputmode="stateunspecified|adjustpan"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="...

html5 - How to place two <g> side by side in an svg? -

hello new html5 , svg tag.i want ask question svg html element. here code <html> <div> <svg width = "1335" height = "400"> // want have 2 svg:g side side 1 of more width , second of less width such width of svg = first g + second g <g> // elements inside g should have same width g </g> <g> </g> </svg> <div> </html> i have tried using transform.but failed. possible have 2 g elements side side can't set x , y of g ? can 1 guide me of doingthis way. you can use transform, problem how such values make transformed g @ right place. possible way (the simplest, really) difference between coordinates of bounding boxes. have bounding box bb1 group g1 , bb2 g2, compute translation applied g2. of course need script computation runtime. such script use var bb1 = document.getelementbyid("g1").getbbox() here code <svg> ...

Retrieve memory iPad information in iOS app -

is there way retrieve information memory of ipad during running? for example, print in console use of memory @ t instant. thanks you should instrument instead of trying print number. number not useful. care application's dirty memory footprint memory pressure on device , how code/mapped ro mem you're evicting see if you're thrashing , causing performance problems due memory pressure. the other info can get, device inboard memory , how many pages app has allocated not useful because don't know how of memory wired other devices or kernel , don't know how many of allocated pages faults @ point.

javascript - Which is the best available tool for measuring browser reflows in FireFox? -

i have looked this article nicole sullivan , mentions quite few tools can in measuring browser reflows : lindsey simon @ google wrote bookmarklet tests reflow times on browser. fantastic. (note: shaking normal!) john resig wrote bookmarklet visualize paint events. kyle scholz created tool visualize paint events before onload. alex @ yoono has created xul profiler . i tried use first tool did not lead me anywhere .then tried second tool couldn't find info that.then installed third tool add on ff doesn't give me in screen shot tab. fourth 1 gives me 404 error . so question gurus here in best available tool measure browser reflows ? hoping new tools out there since article published. the chrome developer tools ctrl+shft+i have guess... click timeline tab , click record button in footer, see happens page! on right records shown , when hover on record highlights element on page.

linux - Copyright and pound sterling symbol in Bash script -

what proper way of inserting copyright symbol © , pound sterling symbol £ bash script. i using nano editor , running debian squeeze. if copy , paste symbol windows, works seems paste hidden characters nano cannot display , makes hard edit code in shell script then. so example want able this:- text="£15.00" text2="© john doe" it seems using locale doesn't support these symbols (in olden days have been bad font). since using utf-8 characters (default on windows), need in utf-8 aware environment on linux. can check locale command: $ locale lang=en_us.utf-8 lc_ctype="en_us.utf-8" lc_numeric="en_us.utf-8" lc_time="en_us.utf-8" lc_collate="en_us.utf-8" lc_monetary="en_us.utf-8" lc_messages="en_us.utf-8" lc_paper="en_us.utf-8" lc_name="en_us.utf-8" lc_address="en_us.utf-8" lc_telephone="en_us.utf-8" lc_measurement="en_us.utf-8" lc_id...

concurrency - Writing scaleable code -

can describe in simple terms how scale service (lets assume service simple , function x() ). to make scalable fire off new node (upto maximum depending on hardware) each client wants run x? so if had 4 hardware boxes, may fire 4 nodes run service x(), on 5th client request run x() on first node, 6th client on second node etc? following on this, know how spawn processes locally, how both 1st , 5th clients use same node 1- spawning process remotely on node client each time? any simple examples welcome! this depends on x is. if x independent, instance x() -> 37. don't need connect nodes. place standard load balancer in front of system (haproxy, varnish, etc) , forget kind of distributed communication. in fact, there no need use erlang that. replace erlang other language of choice. equally good. where erlang shines when several x functions have dependencies on each others result , when x might live on physical machine. in case erlang can communicate other x s...

ios - MKAnnotation display all pin titles without clicking -

i adding multiple annotations programmatically this: - (void)addannotations{ nsinteger i; cllocationcoordinate2d location; ( = 0 ; < [storelatitude count] ; ++ ){ location.latitude = [[storelatitude objectatindex:i] floatvalue]; location.longitude = [[storelongitude objectatindex:i] floatvalue]; mapviewannotation *newannotation = [[mapviewannotation alloc] initwithtitle:[listofstores objectatindex:i] andcoordinate:location]; [self.mapview addannotation:newannotation]; [newannotation release]; } } is possible display title pins without clicking on them? declare array store annotation , use mkmapview's setselectedannotations:(nsarray *) method - (void)addannotations { nsmutablearray *annotationarray = [[nsmutablearray alloc]init]; nsinteger i; cllocationcoordinate2d location; ( = 0 ; < [storelatitude count] ; ++ ) { location.latitude = [[storelatitude objectatindex:i] floa...