Posts

Showing posts from March, 2014

Fine-uploader in iOS and iPad -

i checked if fineuploader worked on ipad, , mostly, ipad gets single file "image.jpg" returned, every file that's uploaded keeps overwriting previous file. (or uploads 1 file) in case, can behavior fixed on either chrome or safari on ipad? we using library uploaded images different business requirement , works dream. developing one. krishna here code: i creating endpoint dynamically , uploading files different folders. getting uploaded other platform except ios. $(document).ready(function () { $('#s3-fileuploader').fineuploader({ request: { endpoint: '', inputname: 'filename', forcemultipart: true, paramsinbody: true, params: {}, }, faileduploadtextdisplay: { mode: 'custom', maxchars: 40, responseproperty: 'error', enabletooltip: true }, cors: { expected: t...

c# - Format a double to two digits after the comma without rounding up or down -

i have been searching forever , cannot find answer, none of them work properly. i want turn double 0.33333333333 0,33 or 0.6666666666 0,66 number 0.9999999999 should become 1 though. i tried various methods like value.tostring("##.##", system.globalization.cultureinfo.invariantculture) it returns garbage or rounds number wrongly. please? basically every number divided 9, needs displayed 2 decimal places without rounding. i have found nice function seems work numbers 9.999999999 beyond starts lose 1 decimal number. number 200.33333333333 going display 200 instead of 200,33. fix guys? here is: string truncate(double value, int precision) { string result = value.tostring(); int dot = result.indexof(','); if (dot < 0) { return result; } int newlength = dot + precision + 1; if (newlength == dot + 1) { newlength--; } if (newlength > result.length) { newlength = result.length;...

ios - UITableView Mix of Static and Dynamic Cells? -

i know cannot mix static , dynamic cell types in single uitableview couldn't think of better way describe issue. i have several predetermined cells fixed content, have unknown number of cells dynamic content sits in middle. want table this: fixed fixed fixed dynamic dynamic dynamic dynamic dynamic fixed fixed so how recommend approach in cellforrowatindexpath method? thanks. as stated can't mix static , dynamic cells. however, can break content different data arrays correspond each group. break table difference sections , load data correct array in cellforrowatindexpath:. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellid = @"cellid"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellid forindexpath:indexpath]; switch (indexpath.section) { case 0:{ cell.textlabel.text = self.arrayofstaticthings1[indexpath.row]; ...

c# - What does Button.PerformClick do? -

i know might trivial question, wondering whether there advantage of calling button.performclick rather invoking click event of button directly. msdn documentation says: generates click event button. does mean same thing calling click event of button or there other special advantage? an external caller knows nothing of subscribed events cannot call click handler - , events not allow obtain information subscribers. method allows separation of concerns, external callers can "play nice". additionally: it ensures polymorphism on virtual method applied it applies rules - example: button disabled if know event-handler, , aren't using polymorphism, , don't care whether disabled, , don't need worry event-handlers don't know - means : call event-handler method.

chrome extension - alternative to externally_connectable? -

it seems externally_connectable feature allows website communicate extension still in dev channel , not yet stable. there other ways allow specific website communicate extension, while wait feature become stable? how have chrome extension developers traditionally done it? thanks rob w pointing me in direction of html5 messaging. benefit of other chrome extension developers, i'm writing general problem trying solve , solution worked in end. i making chrome extension can control music playback on tab via popup player. when user clicks on play/pause/etc on popup player, extension should able convey message webpage , response stating whether action accomplished. my first approach inject content script music player page. problem is, though, content scripts operate in "sandbox" , cannot access native javascript on page. therefore, content script pretty useless (on own), because while receive commands extension, not effect change on webpage itself. one thing w...

jQuery $.post function not hitting the server? failed error response -

i'm trying access control processor has built in web server. based on specific values programmed controller able trigger actions through website resides on built in server using jquery or js. i'm having issue though jquery post command. when use goggle's rest plugin works , response. ideas? function getvariablevaluesbyname(name) { $.post("http://10.10.254.11/rpc/", { method: "getvariablevaluesbyname", param1: name, encoding: "2" }).done(function (data) { data = string(data); var info = data.responsetext; alert(info); }).fail(function (data) { data = string(data); alert("error " + data) }).always(function (data) { data = string(data); alert("just in case " + data); }); } some additional examples last function example assumes i've created xmlhttp object. function getvariablevaluesbyname(name) { $.ajax({ type: ...

ransack - Rails page search form: default parameters -

i have 2 rails sites, bargain stock funds ( http://www.bargainstockfunds.com ) , doppler value investing ( http://www.dopplervalueinvesting.com ). bargain stock funds has search feature allows users obtain list of funds meeting criteria. (the url http://www.bargainstockfunds.com/funds .) doppler value investing has search feature allows users obtain list of stocks meeting criteria. (the url http://www.dopplervalueinvesting.com/stocks/ .) both sites use ransack gem provide search feature , kaminari gem paginate results. is there way can configure search engines pre-loaded criteria set? bargain stock funds, want search engine pre-configured exclude funds load_front or load_back value greater 0.0%, , want results sorted respect value of pcf parameter. doppler value investing, want search engine pre-configured exclude funds pass_legit value of false or pass_quality value of false, , want results sorted respect value of dopeler_pb parameter. these pre-configured settings sa...

clojure - How to remove duplication in request validation? -

i have compojure app set of routes , handlers. (defroutes app-routes (get "/stuff/:id" [:as request] (stuff/get-stuff request)) (post "/stuff/" [:as request] (stuff/create-stuff request)) each handler validates input, so (defn create-stuff [request] (my-validation/validate-request request my-validation/create-stuff-validator stuff-ok-fn)) the validation code based on metis, , looks this: (metis/defvalidator :create-stuff-validator [:db :presence]) (defn validate-request [request request-validator ok-function] (let [validation-result (request-validator request)] (if (empty? validation-result) (ok-function request) (bad-request validation-result)))) my problem code in create-stuff duplicated across each of route handlers; i.e get-stuff function looks create-stuff handler. thing differs validator function , the-validation-went-well-function. how can abstract duplication in idiomatic clojure manner? s...

.net - Issue trying to ordering using LINQ -

i have directory files named "artist [style] number.ext" an example: atomix [dubstep] 01.avi atomix [rock] 02.wmv atomix [rock] 03.avi lacuna [rock] 01.mp4 lacuna [rock] 02.avi i want use linq list files group them artists, in ordering want include 1 "[style]" , sort each artist file extension, example have included "[rock]" style: atomix [rock] 03.avi atomix [rock] 02.wmv lacuna [rock] 02.avi lacuna [rock] 01.mp4 "a" goes first "l" , "avi" goes first "wmv", that's desired result when trying ordering kind of sort: atomix [rock] 03.avi lacuna [rock] 02.avi lacuna [rock] 01.mp4 atomix [rock] 02.wmv the artists mixed extensions sorted, "avi" goes first "mp4" when sorting "a" of "atomix" goes first "l" of "lacuna", don't know how correct this. this instruction i'm using filenames i've said before: dim videos list(of io...

javascript - No audio playback on mobile device -

here link http://breakingbadbutton.com/ basically hit button , plays audio file. can't figure out why doesn't work on iphone/ipads... the script: <script type="text/javascript"> $(document).ready(function() { var sounds = [ "audio/basement.mp3", "audio/half.mp3", "audio/science.mp3", "audio/tone.mp3", "audio/minerals.mp3", "audio/sticks.mp3", "audio/gatorade.mp3", "audio/roll.mp3", "audio/right.mp3", "audio/knocks.mp3", "audio/hotdogs.mp3", "audio/keys.mp3", "audio/heil.mp3", "audio/money.mp3", "audio/ours.mp3", "audio/pass.mp3"], picksound = 0; $("button").click(function()...

Using Variables for Column Names when Querying Parse.com Database -

i have 2 parse.com classes. retrieve array of values class1. values names of parse.com columns in class2. after retrieving desired object class2, want loop through getting appropriate columns in class2 this: parse.initialize("ksuhcunt9pkskvyrwxael", "yklwdybk6wamopc"); var checkwait = parse.object.extend("checkwait"); var query = new parse.query(checkwait); query.equalto("objectid", "omp9qf7maj"); query.first({ success: function(object) { $(".success").show(); var test = object.get("myarray[1]"); }, ok. so, if replace myarray[1] appropriate column name, retrieved desired data. tested value contained in myarray[1] , contain correct column name. if set variable = myarray[1] parse.com still returns "undefined". if contents of myarray[1] string "nickname", following equivalent: var nick1 = object.get("nickname...

continuous integration - How can I pass checkout rules to TeamCity for SVN? -

i have script extracts .sql files svn , creates build package can deployed on database. script reads in text file in specify .sql files needs fetch svn , reside in svn. teamcity executes script me without issues. however, teamcity manage svn interaction , extract required .sql scripts form build package. teamcity still run same (modified) script form build package structure - script have been edited not connect svn anymore. i have read checkout rules in teamcity not sure if need. note, .sql files form build package live in same vcs root, under many different folders under root , may need obtain 1 .sql file vcs folder may contain several .sql files. thanks in advance!

Meteor on collection change update Template select element -

i using bootstrap-select make select elements better in meteor app. however, running issue upon submitting changes meteor collection, reactivity pushes out changes templates, rewriting select elements , destroy original select element, take away bootstrap-select stuff. i wonder if there's way me prevent happening somehow. tried listen changes , recall selectpicker upon update doesn't work. applications.find().observe({ changed: function() { console.log('something changed'); $('.selectpicker').selectpicker(); } }); i try delay things little bit, no avail. applications.find().observe({ changed: function() { console.log('something changed'); settimeout(function(){ $('.selectpicker').selectpicker(); console.log('trying update select picker'); }, 1000); } }); has run problem before , know how fix it? edit: here's template code <div class="form-group"> ...

node.js - Jade code block format -

while defining code block in jade, not sure whether dash - in front of code required. for example, see below code works (from http://naltatis.github.io/jade-syntax-docs/#if ): if name == "bob" h1 hello bob else h1 name #{name} this works: - if (name == "bob") h1 hello bob - else h1 name #{name} in second if parentheses needed. prefer first, wanted make sure both correct. jade official docs shows in second form. as can find on jade reference page in "conditionals" section, can use both says : jade's first-class conditional syntax allows optional parenthesis, , may omit leading - otherwise it's identical, still regular javascript

actionscript 3 - remove this child and add new child AS3 -

i've been stuck on quite while, i'm working main.as , livrmscreen.as , livrmscreen.as game screen other movieclip actions going on... have button on livrmscreen wish remove livrmscreen , show homescreen (all homescreen functions in main.as) var homescreen: homescreen; public function livrmscreen() { backhomebtn.addeventlistener(mouseevent.click, onbackhomebtnclicked); } function onbackhomebtnclicked(evt:mouseevent) { homescreen = new homescreen(); stage.addchild(homescreen); parent.removechild(this); } this have right now, added parent.removechild because won't remove when removechild ... , because of added stage.addchild home screen show properly. but when homescreen shows button's don't work ... showing dead movieclip. why that??? i tried put onbackhomebtnclicked function in main.as thinking homescreen functions there , maybe buttons work... in case cant screens remove , add properly there's...

amazon web services - Unreliable discovery for elasticsearch nodes on ec2 -

i'm using elasticsearch (0.90.x) cloud-aws plugin. nodes running on different machines aren't able discover each other ("waited 30s , no initial state set discovery"). i've set "discovery.ec2.ping_timeout" "15s", doesn't seem help. there other settings might make difference? discovery: type: ec2 ec2: ping_timeout: 15s not sure if aware of blog post: http://www.elasticsearch.org/tutorials/elasticsearch-on-ec2/ . explains plugin settings in depth. adding cluster name, cluster.name: your_cluster_name discovery: type: ec2 ... might help.

python - AttributeError: instance has no attribute, within __init__ -

i can't seem figure out problem is, error: traceback (most recent call last): file "./miningscreensaver", line 171, in <module> miningscreensaver().loop.run() file "./miningscreensaver", line 81, in __init__ self.rxaddress = self.getrxaddress attributeerror: miningscreensaver instance has no attribute 'getrxaddress' code: #! python class miningscreensaver: def __init__(self): dbusgmainloop(set_as_default=true) self.mem='activechanged' self.dest='org.gnome.screensaver' self.bus=sessionbus() self.loop=mainloop() self.bus.add_signal_receiver(self.catch,self.mem,self.dest) self.pipe = "" #if specify different rx address # change rxaddress desired rx address self.rxaddress = self.getrxaddress() #<--------------------error here line 81 #self.rxaddress = "18x3teigc6pvtsf9atx5br7rexfuzrqxez" def...

c++ - Trouble in showing SUM() value of a column -

hello fellow colleagues stackoverflow! i brief, , cut point: i work on windows xp, in c++, using ado access ms access 2007 database. i have table in ms access 2007 contains 2 columns of interest titled typeofobject , instaledpower. the actual table looks this: | typeofobject | instaledpower | ------------------------------- | type1 | 1000 | ------------------------------- | type2 | 2000 | ------------------------------- | type3 | 450 | ------------------------------- | type4 | 800 | ------------------------------- | type1 | 800 | ------------------------------- i need query displays typeofobject , sum( instaledpower ) type, in manner: if value of typeofobject type1 or type2, show it's value in table unchanged, else mark othertypes. result should this: | typeofobject | sum(instaledpower) | ------------------------------------- | ...

In Eclipse Java EE servlet does not output to console -

i have simple servlet creates html printwriter , writes console via system.out.prinln() in same doget() method. i see html part in eclipse (java ee perspective) there nothing in console view . should stdout servlet appear in eclipse? code looks this: protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { printwriter out = response.getwriter(); out.println("<h2>hello applet<h2>"); system.out.println("doget"); } if makes difference here versions, eclipse juno, java ee 7, glassfish 4 server. you find system.out.println outputs in web container logs i.e in galssfish logs. eclipse prints sysout in own console standalone applications , not web applications. reason that, web applications deployed in web containers , run under containers. eclipse helps process of deploying applicaitons not deploy webapps within it. hence find logs in web container i.e glas...

python - Leap Motion + Pygame | Displaying text in window -

i'm trying use pygame library leap motion. i'm trying display of data leap motion in window, when try retrieve variable samplelistener class , feed main method, error: attributeerror: 'function' object has no attribute 'avg_pos' is there i'm misunderstanding class > method > variable structure? here code i'm working with: import leap, sys, pygame #window windowwidth = 800 windowheight = 600 #leap motion settings class samplelistener(leap.listener): def on_init(self, controller): print "initialized" def on_connect(self, controller): print "connected" def on_disconnect(self, controller): # note: not dispatched when running in debugger. print "disconnected" def on_exit(self, controller): print "exited" def on_frame(self, controller): # recent frame , report basic information if not self.frame.hands.empty: ...

php - Why does foreach increase refcount by 2 instead of 1? -

nikic stated in another thread : right before [a foreach] iteration $array "soft copied" use in foreach. means no actual copy done, refcount of zval of $array increased 2. however, test code showing different result: $array = array(0, 1, 2); xdebug_debug_zval('array'); // refcount=1, is_ref=0 // far foreach ($array $key => $value) { xdebug_debug_zval('array'); // refcount=3, is_ref=0 } // why refcount 3 instead of 2? just looking @ code, can see @ 2 array variables. why refcount 3 ? why isn't refcount 2 after foreach run? the xdebug_debug_zval() looking @ $array variable , not $key variable. if change code to: foreach ($array $key => $value) { echo $key . " : " . $values . "<br>"; //xdebug_debug_zval('array'); } the correct values of array returned. don't have xdebug function can't test value put in...

php - How to retrieve and display image base on URL and Product-ID? -

i re post code here.. keep getting error of : notice: undefined index: image url in c:\wamp\www\mysql1.php on line 35.. my url value in pimage table : 'c:\wamp\www\toy1.jpg' . may know correct?? appreciate kind response , help.. <html> <head></head> <body> <?php //open connection mysql server $connection = mysql_connect('localhost','root', '') or die ('unable connect !'); // select database use mysql_select_db('we-toys') or die ('unable select database!'); $query = 'select * product p, pimage p2 p.pid=p2.imagepid'; $result = mysql_query($query) or die ('error in query: $query. ' . mysql_error()); if (mysql_num_rows($result) > 0) { echo '<table width = 100% cellpadding = 10 cellspacing = 0 border = 1>'; echo '<tr><td><b>id</b></td> <td><b>pname</b></td> <td><...

javascript - Change back color of several contiguous HTML tags when user selects them -

i'm developing extension google chrome. has text highlighting facility when user select text area. when comes single tag can use <span> tag inside particular tag. far have done below. var divs = document.getelementsbytagname("p"); for(var d in divs) { // highlight part of <p> tag divs[d].addeventlistener('mouseup',function(){var str= document.getselection() ;alert(str); this.innerhtml =this.innerhtml.replace(str,'<span style="background-color: '+'yellow'+' ">'+str+'</span>'); }); } but if user select several tag areas (contiguous tags) how can it. can't put single <span> tag there. have use <span> tag each of selected tags. 1) how detect , user selected tags. , starting points , end points.? 2) how change color of them @ once.? 3) want add listeners , if how should ? any appreciate . i have understood fol...

Get tabledata from webpage into Excel using macro -

i use excel sheet calculation, assessment of incometax returns. need pull data website excel sheet. did using vba step step create internet explorer application in vba navigate website url , login fill form automatically unique id in excel sheet now submit form , result page has data in table form now using getelementsbyid("tableid") copied , pasted data in excel sheet. my question all tables don't have id or name there lot of tables now want pull data table without id third table top. how this? tried hard. don't want tables because rows in these tables changed when copy tables data. start macro recording, go data -> web, open required web page in import dialog, select required table, set import options needed, , import data. stop recording. you boiler plate auto generated macro code, trivial fine turn needs. i did many times , easy haven't stored snipped share right now. update: how import question page sub macro1() ...

java - Can a 2D array hold an array within a given point? -

i newbie programmer question on arrays in java. consider 2d array, [i][j]. value of determined @ run time. value of j known 7. @ [i][6] , [i][7] want able store deeper array or list of values. possible have array within array, there x , y axis , z axis @ point of [i][6] , i[7] or need full 3d cube of memory able store , navigate data? the details: goal run query takes information 2 tables (target , attacker) query fine , can resultset. want able store data resultset , present in table in more useful format while using in data visualization program. fields are: server_id, target_ip, threat_level, client_id, attacker_ip , num_of_attacks. 20 records have same server_id, target_ip, threat_level, client_id different attacker_ip , num_of_attacks because machine got attacked 20 times. third dimension allow me 3rd axis/array empty server_id, target_ip, threat_level, client_id update after reviewing answers , doing more thinking i'm wondering if using arraylist of objects best me,...

c++11 - Can I move the contents of one vector to the end of another? -

i want following ( a , b both vector<my_moveable_type> ): a.insert(a.end(), b.begin(), b.end()); but want operation move b 's elements a instead of copying them. have found std::vector::emplace single element, not range. can done? you can use std::make_move_iterator , accesses iterator returns rvalue references instead of lvalue references: a.insert(a.end(), std::make_move_iterator(b.begin()), std::make_move_iterator(b.end()));

Cost-based pricing in Magento -

i want implement following in store, using magento. any product under £10 cost price sell @ rrp any product above £10 cost price priced follows – cost price + 69% this not tax rule say, want add 69% of price above £10. my way doing listen catalog_product_prepare_save event , write function in observer.php sets price of product. can find illustrative tutorial on events , observer here .

scala - Referencing vals in method returning new trait instance inside trait -

in following, have trouble referencing trait's offset value within + method (line 4). as written this.offset zero. want offset lhs of + operation. how should done? trait side { val offset: int // <- want refer def +(side: side) = new object side { val offset: int = this.offset + side.offset // instead `this.offset` 0 } } case object left extends side { val offset = -1 } case object right extends side { val offset = 1 } (left + right).offset // -> (0 + 1) -> 1 (right + left).offset // -> (0 + -1) -> -1 the following works because side.this not refer anonymous class under construction. anonymity has privileges. scala> :pa // entering paste mode (ctrl-d finish) trait side { val offset: int def +(side: side) = new side { val offset = side.this.offset + side.offset } } // exiting paste mode, interpreting. defined trait side scala> new side { val offset = 1 } res0: side = $anon$1@7e070e85 scala> new side {...

c - Get real path of a symlink -

suppose want real path of symlink. know both readlink , stat system calls can dereference link , give me real path. operate in same way (only regarding dereferencing, know stat lots more)? should prefer 1 on other? use stat() tell file @ end of chain of symlinks; not path in way. use lstat() information symlink, if any, referred to; acts stat() when name given not symlink. use readlink() obtain path name stored in symlink named argument (beware — it not null terminate string). if want full pathname of file @ end of symlink, can use realpath() . gives absolute pathname not cross symlinks reach file.

Hbase table sizes on hdfs are X 4 of actual input file -

i'm new forum , hdfs/hbase. i have created table in hbase on hdfs. file loaded had 10million record's size of 1gb on windows disk. when file loaded on hdfs, size of table in hdfs is:- root@narmada:~/agni/hdfs/hadoop-1.1.2# ./bin/hadoop fs -dus /hbase/hdfs_10m hdfs://192.168.5.58:54310/hbase/hdfs_10m 4143809619 can 1 plz reduce size? table details. description enabled 'hdfs_10m', {name => 'v', data_block_encoding => 'none', bloomfilter => 'none', replication_scope => '0', true versions => '3', compression => 'none', min_versions => '0', ttl => '2147483647', keep_deleted_cells => 'fa lse', blocksize => '65536', in_memory => 'false', encode_on_disk => 'true', blockcache => 'true'} 1 row(s) in 0.2340 seconds ...

qt - Intercepting Tab key press to manage focus switching manually -

i want intercept tab key press in main window prevent qt switching focus. here's i've tried far: bool cmainwindow::event(qevent * e) { if (e && e->type() == qevent::keypress) { qkeyevent * keyevent = dynamic_cast<qkeyevent*>(e); if (keyevent && keyevent->key() == qt::key_tab) return true; } return qmainwindow::event(e); } this doesn't work, event isn't called when press tab . how achieve want? the elegant way found avoid focus change reimplement in class derived qwidget method bool focusnextprevchild(bool next) , return false . in case want allow it, return true . like other keys key qt::key_tab in keypressevent(qkeyevent* event)

Access denied for connecting MySql server in livecode -

i trying connect livecode app mysql server.i works when use on localserver.but when try connect live mysql database. gives error access denied user 'myusername'localhost'(using password='yes'). i using connecting: put "localhost" tdatabaseaddress put "dbname" tdatabasename put "myusername" tdatabaseuser put "mypassword" tdatabasepassword put revopendatabase("mysql", tdatabaseaddress, tdatabasename, tdatabaseuser, tdatabasepassword) tdatabaseid please help. how can resolve this? many web hosting companies don't allow direct remote access mysql database. need use php intermediary.

maven - how to build and deploy sakai cle 2.9.x in eclipse -

i have imported "sakai" project eclipse. how build , deploy automatically in "sakai 2.9.x" in eclipse? building within eclipse not recommended. suggest build maven command line. however, think answered here: how build , run maven projects after importing eclipse ide

c# 3.0 - insert a data to particular cell in a wpf datagrid in c# -

hi new wpf datagrid. don't know how insert data in particular cell in row of wpf datagrid. in normal windows form application can achieve binding list datagridview datagridview.columns["username"].datapropertyname = "username"; datagridview.columns["role"].datapropertyname = "role"; bindingsource bs = new bindingsource(); bs.datasource = userlist; datagridview.datasource = bs; for(int i=0; i<userlist.count; i++) { datagridview.rows[i].cells["company"].value = "default"; } now want achieve same in wpf datagrid can 1 provide sample code. sorry bad english , in advance. first need class containing various properties want displayed. assume, since have userlist, class user (and implements inotifypropertychanged), , userlist list containing data. first, if want add new users userlist, , make datagrid update, userlist variable needs of type observablecollection. then, in xaml, bind userlist datag...

ios - Incompatible pointer types sending 'const CFStringRef' (aka 'const struct __CFString *const') to parameter of type 'id' -

i trying in cocoa app information of directory/files in system. method return me dictionary key attribute listed -(nsdictionary *) metadataforfileatpath:(nsstring *) path { nsurl *url = [[[nsurl alloc] initfileurlwithpath:path] autorelease]; mditemref itemref = mditemcreatewithurl(null, (cfurlref)url); nsarray *attributenames = (nsarray *)mditemcopyattributenames(itemref); nsdictionary *attributes = (nsdictionary *) mditemcopyattributes(itemref, (cfarrayref) attributenames); cfrelease(itemref); // leaking memory (attributenames , attributes), better check instruments return attributes; } another method.... nsdictionary *dict = [self metadataforfileatpath]; nsstring *date = [dict objectforkey:kmditemfscreationdate]; when got warning message " incompatible pointer types sending 'const cfstringref' (aka 'const struct __cfstring *const') parameter of type 'id' " trying type cast them string still exist. didn't...

css - MooTools slide jumps around in wrapping div -

i'm using slide effect 'closing' div , works fine, except before sliding, jumps diagonally in wrapping div , next floating div that's above it. making ugly... this illustrates i'm talking about: http://jsfiddle.net/elxpf/ when floated div not floated, well, has float. think wrapper applied non-floating div when slide effect initiated, not clear: both; or effect, causing leap diagonally. what's best way resolve this, retaining floatability of floating div - , preferably without using wrapper elements? i suggest use .dissolve() instead. $('slide').addevent('click', function () { $('two').dissolve() }); demo and can use .reveal() bring back. $('slide').addevent('click', function () { $('two').dissolve(); }); $('one').addevent('click', function () { $('two').reveal(); });

How to write this Ruby function using a loop? -

is there more elegant way write in ruby, maybe using loop? def save_related_info update_column(:sender_company_name, user.preference.company_name) update_column(:sender_address, user.preference.address) update_column(:sender_telephone, user.preference.telephone) update_column(:sender_email, user.preference.email) update_column(:sender_url, user.preference.url) update_column(:sender_vat_number, user.preference.vat_number) update_column(:sender_payment_details, user.preference.payment_details) end thanks help. def save_related_info %w[company_name address telephone email url vat_number payment_details] .each{|s| update_column("sender_#{s}".to_sym, user.preference.send(s))} end

cordova - How to save a camera picture from Phonegap to HTML local storage -

i want capture , save image in phonegap app.i've looked around loads cant find i'm looking for. want have function take image camera, , save local storage, either image or base 64, doesn't matter. need quick way of getting image again after quitting , reloading application without interaction user. know how this, appreciated. you can refer here: phonegap camera

c# - How can I make a class both implement an Interface and inherit from another class -

i want class implement interface , additional properties auditable table. can both? have tried here getting error in ide. public partial class objectivedetail : iequatable<objectivedetail>, auditabletable { ... } public abstract class auditabletable : iauditabletable { ... } you must change public partial class objectivedetail : iequatable<objectivedetail>, auditabletable to public partial class objectivedetail : auditabletable, iequatable<objectivedetail> in c#, can inherit one class , implement multiple interfaces , must put class first .

The difference between geom_density in ggplot2 and density in base R -

i have data in r following: bag_id location_type event_ts 2 155 sorter 2012-01-02 17:06:05 3 305 arrival 2012-01-01 07:20:16 1 155 transfer 2012-01-02 15:57:54 4 692 arrival 2012-03-29 09:47:52 10 748 transfer 2012-01-08 17:26:02 11 748 sorter 2012-01-08 17:30:02 12 993 arrival 2012-01-23 08:58:54 13 1019 arrival 2012-01-09 07:17:02 14 1019 sorter 2012-01-09 07:33:15 15 1154 transfer 2012-01-12 21:07:50 where class(event_ts) posixct . i wanted find density of bags @ each location in different times. i used command geom_density(ggplot2) , plot nice. wonder if there difference between density(base) , command. mean difference methods using or default bandwith using , like. i need add densities data frame. if had used function density(base) , knew how can use function approxfun add these values data frame, wonder if same when use geom_density(ggplot2) . a quick...

android - Why it says there's error "No resource found that matches" even though it exists? -

error message error: error: no resource found matches given name (at 'style' value '@style/rightbehindmenuscroll'). layout/activity_behind_right_simple.xml <scrollview xmlns:android="http://schemas.android.com/apk/res/android" style="@style/rightbehindmenuscroll" > <linearlayout style="@style/behindmenuscrollcontent" android:paddingtop="25dp" > <textview style="@style/behindmenuitemtitle" android:text="right" /> <textview style="@style/behindmenuitemlabel" android:text="item0" /> <textview style="@style/behindmenuitemlabel" android:text="item1" /> <button android:id="@+id/behind_btn" style="@style/behindmenuitemlabel" android:text="button" /> ...

intellij idea - Rake routes for Java web apps? -

i'm longtime desktop developer (c/c++) that's been doing web development rails since ~2005. i've been thrust onto java web application @ work , not understand how developer can grok of uri's being directed. i'm working in intellij, , there 6 different projects contribute artifacts war. know mappings defined in web.xml, it's impossible tell there uri's directed beans or whatever. as write have sinking feeling there's no answer, there ability straight answer of routes exposed application , point in source code la rake routes ? update @dave: it's mix of jersey rest , icefaces. vaguely understand icefaces is. is there ant script or other script anywhere contains details how projects pulled , built/packaged war? ultimately constructed base directory containing files, directories , /web-inf directory. /web-inf protected , it's contents accessible via uri's via web.xml. outside of /web-inf in root directory accessible via uri...

javascript - jasmine-node says "0 tests" when there *are* tests -

i expect "1 test", says "0 tests". idea why? on os x. $ jasmine-node --verbose my.spec.js undefined finished in 0.001 seconds 0 tests, 0 assertions, 0 failures, 0 skipped $ cat my.spec.js describe("bar", function() { it("works", function() { expect("foo").toequal("foo"); }); }); $ jasmine-node --version 1.11.0 $ npm --version 1.3.5 $ node -v v0.4.12 even if try create syntax error same output: $ cat my.spec.js it( $ jasmine-node --verbose --captureexceptions my.spec.js undefined finished in 0.001 seconds 0 tests, 0 assertions, 0 failures, 0 skipped but if try specify file doesn't exist, complains: $ jasmine-node no.spec.js file: /tmp/no.spec.js missing. you should upgrade latest version of nodejs (currently 0.10.15)

XPath statement to assign an integer variable to the position() function in a powershell script -

i working on powershell script takes input xml file, searches inner text associated specific element/tag in xml file, , returns position of element/tag, if exists, position of element can used replace inner text other data. example, there may xml file looks following . . . <root> <category> <fruit>apple</fruit> <vegetable>broccoli</vegetable> <fruit>pear</fruit> <vegetable>brussel sprouts</vegetable> <fruit>orange</fruit> </category> </root> so, let's in 1 part of powershell script have code find inner text, "orange". store in variable "position" integer of "fruit" element contains "orange" it's inner text. so, in above xml file, position integer 3 (or 2 if starting @ base zero). how write proper xpath statement access 3rd "fruit" location through variable? maybe want access location ca...

emacs - A `query-replace` that asks for a new replacement string for each occurrence -

i'm looking function works similar query-replace instead of using same replacement string on , on again, asks replacement string each time match found. say, once match found, can either skip match or enter replacement mode, can specify string used replacing match (with history of previous replacements). even more useful query-replace-regexp variant, allows use groupings of search string. i have written piece of code used non-regexp version, however, i'm stuck @ part of replacing , repeating whole search after replacement done/the match skipped. code far is: (defun query-replace-ask (search) (interactive "squery replace: ") (if (search-forward search nil t) (let ((beg (match-beginning 0)) (end (match-end 0)) (if (y-or-n-p "replace?") (replacement (read-string "replacement: ")) ( ;; next search ))) ;; replace beg end replacement ...

performance - Datastructure : hashmap vs linkedhashmap vs treemap -

i saw there lot of questions differences between these three. tell me if wrong, if sum read: hashmap : more efficient in general; o(1) (normal case), o(n) (worst case, bad hash algorithm) linkedhashmap : maintains insertion order of elements, take more memory hashmap treemap : maintains elements sorted, o(log(n)) (when balanced) my question : why need maintain insertion order or elements sorted, if @ end performance insert, lookup.. better hashmap ? we need main insertion order because need insertion order solve problem @ hand. sounds bit tautological, that's pretty reason. data ordered benefits random access. likewise sorting. gives way find "next" or "previous" item cheaply, while still being reasonably efficient arbitrary lookup. 1 example approximate lookups, say, know entry you're looking starts foo don't know rest of key is. hashmap exists make things faster , simpler (no concept of order) when don't need of thes...

osx - C++ + SDL + OpenGL 3.3 doesn't work on Mac OS X? -

i'm starting developing opengl 3 (i'm used 1, it's quite change), , i'm using sdl windowing/image/sound/event-framework. have following code(taken opengl.org , modified): #include <stdio.h> #include <stdlib.h> /* if using gl3.h */ /* ensure using opengl's core profile */ #define gl3_prototypes 1 #include <opengl/gl3.h> #include <sdl2/sdl.h> #define program_name "tutorial1" /* simple function prints message, error code returned sdl, * , quits application */ void sdldie(const char *msg) { printf("%s: %s\n", msg, sdl_geterror()); sdl_quit(); exit(1); } void checksdlerror(int line = -1) { #ifndef ndebug const char *error = sdl_geterror(); if (*error != '\0') { printf("sdl error: %s\n", error); if (line != -1) printf(" + line: %i\n", line); sdl_clearerror(); } #endif } void render(sdl_window* win){ glclearcolor(1.0,0.0,0....

No file available under C:\Users\Prabodh\.m2\repository after installing Apache Maven -

i have installed maven (latest version available in internet) in system. using windows 7. in command prompt, version showing correctly (through mvn -version command); there no file available in c:\users\prabodh.m2\repository.... not sure why problem occurring... please let me know files should present there in typical/standard installation; , possible reason not being able access them... maven starts empty plugin execution framework. long maven hasn't done thing, local repository stay empty. try mvn help:help on commandline (any directory do). way description of maven-help plugin. warned, first time it'll download quite lot. if execute mvn help:help second time, required code available in local repository, it'll display fast.

ruby - Install less compiler with gemfile/bundler -

just title suggests, possible install less compiler using gemfile , bundler the less compiler installable in ruby through less gem. to install through bundler need add following gemfile: gem 'less' then can install running: bundle install note less compiler node.js program need javascript runtime run it. if try running lessc , don't have javascript runtime installed throw error explains this. in case want install therubyracer gem. means want add: gem 'therubyracer' to gemfile.

java - How to get all milliseconds of a day? -

i store number of rows in db timestamp of moment in milliseconds. if need retrieve rows of given day, today, how correctly create starting , ending milliseconds of day? i know simpledateformat , calendar.getinstance() briefly, need string manipulation (which want avoid) todays date only, add hours part , convert milliseconds, or there better way it? since didn't provide code in question, please allow me give general answer in response.. what you're looking 2 date/times, today , tomorrow , both specified "0 hours, 0 minutes, 0 seconds". today <= date , date < tomorrow note 2 different comparisons.

c# - Resizing images to a fixed size -

i need resize images multiple dimensions same size . profile images , can crop width or height of image if needed make aspect ratio similar . need add watermark image . suggest library image manipulation. thanks image magick good, has bindings language , available operating systems - free.

How do I put several <div>s in the middle of my webpage with css? -

Image
i'm not sure how ask it. want create webpage has top, left, right or close, want know how put center content in divs. have attached image clarity. http://demo.xoops-theme.com/?xoops_theme_select=smashingmagazine i think asking how use css/divs layout highlighted part. if here go: <html> <head> <style> .content { margin:100px; } .row { clear:both; } .half { width:50%; float:left; } /* used manage desired padding without affecting size of .half */ .inner { padding:20px; } </style> </head> <body> <div class="content"> <div class="row"> <div class="half"> <div class="inner"> <h4>the title</h4> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostru...