Posts

Showing posts from June, 2015

Replacing a CSS class using PHP? -

i'm building backend web application, possible change design of page. once user has setup design way it, should able save , new design written specific file. for reason, need replace characters between { , } after string, name of class. so simple concept, following class in seperate file load view, style.php. need go from: from <style> .bonus { bottom: 6px; left: 247px; } </style> to <style> .bonus { bottom: 20px; left: 450px; } </style> could recommend me on best way to a) find string in file, b) when found, replace between 2 strings right after first string. thank you. i don't concept of user making changes actual file much. there lot of safer methods user create , maintain custom template without them making changes php file. what storing user's css in field in database? you'd need like: <?php $css = getcssbyuserid($userid); //function runs query on db user-specific css /* $css

c# - Log4net doesn't write to file -

i want add new log file.this appender: <appender name="rollingfileappender" type="log4net.appender.rollingfileappender"> <file value="mylogfile.txt"/> <appendtofile value="true"/> <rollingstyle value="size"/> <maxsizerollbackups value="5"/> <maximumfilesize value="10mb"/> <staticlogfilename value="true"/> <filter type="log4net.filter.stringmatchfilter"> <stringtomatch value="test"/> </filter> <filter type="log4net.filter.stringmatchfilter"> <stringtomatch value="error"/> </filter> <filter type="log4net.filter.denyallfilter"/> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%date [%thread] %level %logger - %message%newline%exception"/> </layout> </appender> <root&g

no matching functions for call to constructor (c++) -

this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers edit ok, i've done bit of reading again few hours , think understand c++ oop bit better (at least basics). decided rewrite entire program , code bit @ time , test more. think narrowed errors bit more time. namedstorm.h #include <string> #include <iostream> #ifndef namedstorm_h_included #define namedstorm_h_included // never use using namespce in header, use std instead. class namedstorm{ private: std::string stormname; std::string stormcategory; double maxwindspeed; double stormpressure; static int stormcount; public: // constructor namedstorm(std::string, double, std::string, double); namedstorm(std::string); // destructor ~namedstorm(); // functions int getstormcount(); doub

javascript - Why do my singular-named routes, with plural equivalents no longer work in Ember.js RC6? -

why singular-named routes, plural equivalents no longer work in ember.js rc6? after upgrading ember.js rc4 ember.js rc6, of routes continue work couple of exceptions: app.router.map -> @route 'note', {path: 'note/:id'} @route 'notes', {path: 'notes'} @route 'attendee', {path: 'attendee/:id'} @route 'attendees', {path:'attendees'} the note , attendee singular routes, stop functioning. i've attempted setup custom controller method using transitiontoroute instead of using linkto helper in handlebars, neither approach works anymore. rolling rc5 or rc4 corrects issue, can assume has router facelift, can't seem find documentation on should doing instead.

html - clear both and divs -

this css #site-content{ margin:25px 0 0 260px; } .site-content{ width:740px; margin:auto; } #site-menu{ float:left; width: 260px; padding: 20px 0; overflow:hidden; } html <div id="site-menu"> <ul> <li class="menu"><a id="menu-glxavor" class="menu" href="/"></a></li> <li class="menu"><a id="menu-mermasin" class="menu" href="/arm/about-us"></a></li> <li class="menu"><a id="menu-usucich" class="menu" href="/arm/for-teachers"></a> <ul id="menu-usucich-sub"> <li class="sub-menu"><a class="a-sub-menu usucich" href="/arm/for-teachers/teacher-schedule">Դասացուցակ</a></li> <li class="sub-me

android - Displaying custom objects in ArrayAdapter - the easy way? -

i trying display list of bluetooth devices in arrayadapter , , want override default functionality of adapter show objects tostring() . know there solutions extend getview(...) method, feel over-complicating things. want override how string display built. bluetooth devices using getname() instead of tostring() . so i've created custom arrayadapter below, , ideally have method getdisplaystring(t value) public class myarrayadapter extends arrayadapter<bluetoothdevice> { ... @override //i wish existed protected string getdisplaystring(bluetoothdevice b) { return b.getname(); } ... } altering behavior of getview doesn't have complicated. madapter = new arrayadapter<mytype>(this, r.layout.listitem, new arraylist<mytype>()) { @override public view getview(int position, view convertview, viewgroup parent) { textview view = (textview) super.getview(position, convertview, parent); // replace tex

html - Text vertically and horizontally centered over a responsive image -

i'm looking center text both vertically , horizontally on image grows when page gets wider. i had image set background div of fixed height, in case relatively easy center it, because background images aren't structural, couldn't set height automatic function of width, , had toss option out when went more responsive design. so i've got div 2 elements in it, img , overlay text. image width set 100% of width of container, , height varies accordingly. consequence, though, can't set overlay text postion:absolute , top:80px or something, because distance top have vary. , doing top:25% or whatever doesn't work, because a) if page width shrinks squeeze text, or if there's more text, vertical centering thrown off when there more/less lines, , b) percentage arbitrary -- it's not 50 or something, because put top of text overlay 50% down image, when want center of overlay there. i've looked, among other things, @ this post , close -- in both sol

build.gradle - How to generate multiple jar files with gradle's java plugin -

i have multi-project gradle build using java plugin setup follows: myproj/ settings.gradle build.gradle util/ build.gradle in util project, generate 2 jars... 1 packagea , 1 packageb. i'm noob gradle here appreciated. here settings , gradle files: myproj/settings.gradle include 'util' myproj/build.gradle subprojects { apply plugin: 'java' repositories { maven { url "http://mymavenurl" } } sourcesets { main { java { srcdir 'src/java' } } } } myproj/util/build.gradle dependencies { . . . } jar { basename = 'packagea' includes = ['com/mycomp/packagea'] } task packagebjar(type: jar) { dependson classes includes = ['com/mycomp/packageb'] basename = 'packageb' } when try build project here output: :util:compilejava :util:processresources up-to-date :util

linux - prompt list of files before execution of rm -

i started using "sudo rm -r" delete files/directories. put alias of rm. i know doing , quite experience linux user. however, when press "enter", before execution of rm, list of files show on screen , prompt @ end ok deletion of files. options -i -i -v not want. want 1 prompt printed files on screen. thank you. ## # double-check files delete. delcheck() { printf 'here %d files said wanted delete:\n' "$#" printf '"%s"\n' "$@" read -p 'do want delete them? [y/n] ' doit case "$doit" in [yy]) rm "$@";; *) printf 'no files deleted\n';; esac } this shell function (when used properly) want. however, if load function in current shell try use sudo , won't expect because sudo creates separate shell. you'd need make shell script… #!/bin/bash … same code above … # script create function , execute it. # it's lazy, functions nice. delcheck &q

math - Spigot algorithm derived from Bellard's formula (pi) -

i have been working on program calculate pi nth digit , have bbp formula implemented efficiently. told bellard's formula 43% faster wanted give try. after researching formula have heard reference can't derive working spigot algorithm formula. explain how spigot algorithm formula?

SQL Server stored procedure that returns a boolean if table exists, c# implementation -

i have created stored procedure takes single argument, name of table, , returns 1 if exists in database, 0 if not. in sql server management studio testing stored procedure works i'd to, i'm having trouble getting value use in c# program. my options seem executescalar() , executenonquery() or executereader() , none of seem appropriate task, nor can them retrieve stored procedure's result. i have tried assigning parameter both cmd.parameters.addwithvalue , cmd.parameters.add again no avail. assuming have stored procedure selects either 0 (table not exist) or 1 (table exist) create procedure dbo.doestableexist (@tablename nvarchar(100)) begin if exists (select * sys.tables name = @tablename) select 1 else select 0 end then can write c# code value - use .executescalar() since you're expecting single row, single column: // set connection , command using (sqlconnection conn = new sqlconnection("your-connection-string-

php - JSON Parse error - iPad/iPhone Only -

i working within codeigniter framework , on page load making following ajax request: $.ajax({ url: '/beta/images/loadimages', type: 'post', datatype: 'json', data: {id: id}, success: function(json, textstatus, xhr) { alert('success'); } }, error: function(json, textstatus, errorthrown) { alert(errorthrown); } }); strong text public function loadimages() { $galleryid = $this->input->post('id'); $data = array('images' => $this->image_gallery->get_slideimages($galleryid) ); echo json_encode($data); } finally model public function get_slideimages($galleryid) { $this->db->select('id'); $this->db->where('galleryid', $id); $query = $this->db->get('image_images'); $result = $query->result(); r

bash - How to decrement a number in each filename in a directory? -

running "ls -lrt" on terminal large list looks this: -rw-r--r-- 1 pratik staff 1849089 jun 23 12:24 cam13-vid.webm -rw-r--r-- 1 pratik staff 1850653 jun 23 12:24 cam12-vid.webm -rw-r--r-- 1 pratik staff 1839110 jun 23 12:24 cam11-vid.webm -rw-r--r-- 1 pratik staff 1848520 jun 23 12:24 cam10-vid.webm -rw-r--r-- 1 pratik staff 1839122 jun 23 12:24 cam1-vid.webm i have shown part of above sample. i rename files have number 1 less current. for example, mv cam1-vid.webm cam0-vid.webm mv cam2-vid.webm cam1-vid.webm ..... .... mv cam 200-vid.webm cam199-vid.webm how can done using os x / linux bash script (perhaps using sed) ? you can plain bash: for in {1..200} mv "cam${i}-vid.webm" "cam$((i-1))-vid.webm" done

c# - How can I change shortcut keys dynamically in form application? -

i have project in windows form application. want implement dynamically shortcut keys in application. user can change shortcut keys per requirement. how can implement dynamically shortcut keys? here might help, know isn't best way can't better. string ii = ""; protected override bool processcmdkey(ref message msg, keys keydata) { if (keydata == (keys.control | keys.c) && ii == "c") { messagebox.show("your shortcut key is: c!!"); } return base.processcmdkey(ref msg, keydata); } private void combobox1_textchanged(object sender, eventargs e) { ii = combobox1.text; } your combobox1 combobox contains shortcut key options. that might some, have add bunch of if statements. hope helps!!

duplicate mvc model property on two jquery ui tabs -

i new mvc , using jquery tabs in mvc4 project. want have duplicate bound property display on 2 tabs. best way handle property can updated either tab? i ended placing duplicate fields in view, 1 on each tab, , using jquery copy value 1 field other using change event. $(function () { $('#job').find('#effectivedate').change(function () { var jobeffval = $('#job').find('#effectivedate').val(); $('#eval').find('#effectivedate').val(jobeffval); }); $('#eval').find('#effectivedate').change(function () { var evaleffval = $('#eval').find('#effectivedate').val(); $('#job').find('#effectivedate').val(evaleffval); }); });

SAS: PROC MEANS Grouping in Class Variable -

i have following sample data , 'proc means' command. data have; input measure country $; datalines; 250 uk 800 ireland 500 finland 250 slovakia 3888 slovenia 34 portugal 44 netherlands 4666 austria run; proc print data=have; run; the following proc means command prints out listing each country above. how can group of countries (i.e. uk & ireland, slovakia/slovenia central europe) in proc means step, rather adding datastep add 'case when' etc? proc means data=have sum maxdec=2 order=freq stackods; var measure; class country; run; thanks @ on this. understand there various things can in proc means command (like limit number of countries doing this: proc means data=have(where=(country not in ('finland', 'uk') i'd grouping in proc means command brevity. thanks. this easy format proc takes class statement. simply build format, either code or data; apply format in proc means statement. proc format lib=work; value $coun

is there a way to move vim windows in this way? -

i have 4 windows this: | | | | | | | | |_________| c | d | | b | | | | | | | so, how can change them way? | | | | | c | |_________|______| | b | d | | | | the ctrl+w/j/k/l thing moving window far other side, can't use them this. thanks! what can think of 2 steps: move cursor c , press c-w c close window move cursor d , press :sp #<enter> the idea is, close 1 window(buffer), , reopen in right place (by sp or vs). glad know if there easier way.

ios - iTunes Connect Edit Metadata broken? -

is else experiencing issue when inputting new metadata app? text put in metadata section being crammed regardless of spacing. 2 seperate paragraphs below become 1 together. this paragraph one. and paragraph two. ... this paragraph one. , paragraph two.

c# - Generic Sqrt Implementation -

i'm using miscutils library (thanks marc g. , jon s.) , trying add generic sqrt function it. problem can reproduced this: class n<t> { public n(t value) { value = value; } public readonly t value; public static implicit operator t(n<t> n) { return n.value; } public static implicit operator n<t>(t value) { return new n<t>(value); } public static t operator /(n<t> lhs, t rhs) { // operator.divide wrapper around // system.linq.expressions.expression.divide return operator.divide(lhs.value, rhs); } } // fails with: no coercion operator defined // between types 'system.double' , 'n`1[system.single]'. var n = new numeric<float>(1f); var x = operator.dividealternative(n, 1.0); // works n<t> first converted // float via implicit conversion operator var result = n / 1.0; now, realize why happening, have not yet bee

ruby on rails - Why is mount_griddler an undefined method? -

i trying use griddler gem, , did bundle install 'griddler' in gemfile. in routes.rb added line: mount_griddler ('/email/incoming') when try running rails s , keep getting error: 'block in <top (required)>': undefined method 'mount_griddler' #<actiondispatch::routing::mapper:0x007fa995bba030> (nomethoderror) i created file in config/initializer/griddler: griddler.configure |config| config.processor_class = emailprocessor # myemailprocessor config.to = :token # :full, :email, :hash config.reply_delimiter = '-- reply above line --' config.email_service = :sendgrid end i'd appreciate if tell me went wrong. my gemfile below: source ' https://rubygems.org ' gem 'rails', '3.2.13' gem 'pg' gem 'mail' gem 'griddler' group :development, :test gem 'quiet_assets' gem 'pry' gem 'rspec-rails' gem 'fak

ruby on rails - Postgres - FATAL: database files are incompatible with server -

i developing rails4-app postgresql , worked fine. after restarting macbook pro unable start database server: could not connect server: no such file or directory server running locally , accepting connections on unix domain socket "/tmp/.s.pgsql.5432"? i checked logs , following line appears on , on again: fatal: database files incompatible server detail: data directory initialized postgresql version 9.2, not compatible version 9.0.4. 9.0.4 version came preinstalled on mac, 9.2[.4] version installed via homebrew. mentioned, used work before restart, can't compiling issue. re-ran initdb /usr/local/var/postgres -e utf8 , file still exists. unfortunately, pretty new postgres, appreciated. if looking nuclear option (delete data , fresh database), can do: rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -e utf8 and you'll need rake db:setup , rake db:migrate rails app setup again.

Issue with Twitter Bootstraps #MyModal reacting with jQuery smooth anchor scrolling -

alright, right using jquery , twitter bootstrap throw site, , wanted when jumped anchor page scroll smoothly, achieved using this: var $root = $('html, body'); $('a').click(function() { $root.animate({ scrolltop: $( $.attr(this, 'href') ).offset().top }, 500); return false; }); which works flawlessly, issue when try open modal using: <a href="#mymodal" role="button" class="btn" data-toggle="modal">learn more</a> it wont work! appreciated , put more info if needed, thanks!

java - How to get resource id from String -

i have database column list of image names. want put in imageview using setimageresource. in other application managed this, in application imageview not showing @ all. string image1 = db.getimage1now(randomindex); imageviewdothis1.setimageresource(getresources().getidentifier( image1, "drawable", getpackagename())); if this: imageviewdothis1.setimageresource(r.drawable.image1); then it's working.. help! use this: imageviewdothis1.setimageresource(getresources().getidentifier( "image1", "drawable", getpackagename())); i think getidentifier supposed take string first parameter.

ios - UIPanGestureRecognizer stops working when when panned up, not when panned down -

i'm creating screen dimmer here. i've put black view on screen , using uipangesturerecognizer adjust opacity based on whether user scrolls or down. here's code: - (ibaction)dimscreen:(uipangesturerecognizer *)sender { //get translation cgpoint translation = [sender translationinview:self.view]; cgfloat distance = translation.y; //add fraction of translation alpha cgfloat newalpha = self.blackscreen.alpha + distance/self.view.frame.size.height; //check if alpha more 1 or less 0 if (newalpha>1) { newalpha = 1; }else if (newalpha<0.0){ newalpha = 0.0; } self.blackscreen.alpha = newalpha; //reset translation incremental change [sender settranslation:cgpointzero inview:self.view]; } if pan down, opacity goes 1.0, , can still adjust it. if pan till opacity 0, can no longer pan @ all. dimscreen: selector stops getting called. can describe causing issue? views alpha values of 0 no lo

php - converting to PDO, problems -

so working on converting old tutorial did while mysql pdo . way can better understand concepts. seem of run wall however. following function giving me error function user_data($user_id, $db) { $data = array(); $user_id = (int)$user_id; $func_num_args = func_num_args(); $func_get_args = func_get_args(); if($func_num_args > 1) { unset($func_get_args[0]); $fields = '`' . implode('`, `', $func_get_args) . '`'; // !! line 12 try { $sql = sprintf('select %s members id = ?', $fields); $stmt = $db->prepare($sql); $stmt->execute(array($user_id)); $data = $stmt->fetch(pdo::fetch_assoc); return $data; } catch(pdoexception $e) { die($e->getmessage()); } } } this calling function <?php session_start(); require 'database/connect_db.php'; require 'funct

Wrong number of arguments(1 for 0) whilst using rails scaffolding -

i generated scaffold code using command rails generate scaffold review title review:text rating:boolean --skip-stylesheets . goes fine, when type in rails server start server, , navigate /reviews error message saying argumenterror @ /reviews wrong number of arguments(1 0) i have not written code myself, have used scaffolding generator. how fix this? your name review title has space in it. try reviewtitle . update try: rails generate scaffold review title:string review:text rating:boolean --skip-stylesheets

java - New ArrayList with same values -

i have arraylist: arraylist<integer> example = new arraylist<integer>(); example.add(1); example.add(1); example.add(2); example.add(3); example.add(3); so want make others 3 arraylists containing in 1 same values (where there 1 value arraylist have one). is possible? here's approach filtering out elements, implemented: using generic map (in generic class) encapsulate values. the key object want, , value determined follows: if key never existed, have list @ 1 element, same key; if key has existed prior, have list @ least 1 element, same key. here's how it's laid out. instantiate type of object want split. public class uniquesplitter<t> { public map<t, list<t>> filteroutelements(final list<?> thecandidatelist) { final map<t, list<t>> candidatemap = new hashmap<>(); for(object element : thecandidatelist) { if(candidatemap.containskey(element)) {

excel - export data onto csv and rename after computer profile name -

i want exportdata excel file onto csv saved in folder s:\froyo\ics. want name csv file after computer profile name. im using below code im not getting naming part right. sub csvfile() dim fs object, object, integer, s string, t string, l string, mn string set fs = createobject("scripting.filesystemobject") suser = environ("username") set = fs.createtextfile("s:\froyo\ics\suser.csv", true) r = 1 range("a65536").end(xlup).row s = "" c = 1 while not isempty(cells(r, c)) s = s & cells(r, c) & "," c = c + 1 wend a.writeline s 'write line next r end sub the s user variable should concatenated string, otherwise, takes part of string , not variable: set = fs.createtextfile("s:\froyo\ics\" & suser &".csv", true)

statistics - Save P values from R ivreg AER package or tsls sem package -

i want extract pr(>|t|) column after using either ivreg "aer" package or tsls "sem" package. both give list of terms similar , not seem provide looking for. ivregest <- ivreg(mdetect~bednet | treat1+treat2, data=simdata) > names(ivregest) [1] "coefficients" "residuals" "fitted.values" "weights" [5] "offset" "n" "nobs" "rank" [9] "df.residual" "cov.unscaled" "sigma" "call" [13] "formula" "terms" "levels" "contrasts" [17] "model" "y" tslsest <- tsls(mdetect~bednet , ~ treat1+treat2, data=simdata) > names(tslsest) [1] "n" "p" "coefficients" "v" [5] "s" "residuals

perl - How to access an added method to my DBIC model -

i using catalyst , dbic web application, trying access method added manually(below comment should edits must in place) in dbic generated catalyst::plugin::configloader . let's method's name permission_to_delete(). i accessed using this: $c->model('db::myapp')->permission_to_delete(somevalue); and error message: can't locate object method "permission_to_delete" via package "dbix::class::resultset am accessing method correctly?

c++ - Accessing variable of class normally or by a function -

this question has answer here: do getters , setters impact performance in c++/d/java? 10 answers class abc{ public : int a; public : int getdata(){ return a; } } void main() { abc abc; cout<< abc.a; //1 cout<<abc.getdata();//2 } now if i'm accessing variable "a" in case compiler take less time access 'a' . guess first case not sure. the 2 methods not strictly equivalent: directly accessing member reads value of member while the method returns copy of variable, read copy such. with regards performance ofcourse #1 should faster since no copy involved, modern compilers apply copy elision remove copy being created. rather performance should consider uniformity of coding guidelines followed in organization/institute.

python - Starting app engine modules in Google App Engine -

app engine "modules" new (and experimental, , confusingly-named) feature in app engine: https://developers.google.com/appengine/docs/python/modules . developers being urged convert use of "backends" feature use of new feature. there seem 2 ways start instance of module: send http request (i.e. @ http://modulename.appname.appspot.com appname application , modulename module), or call google.appengine.api.modules.start_module() . the simple way the simple way start instance of module seem to create http request. however, in case results in 2 outcomes, neither of want: if use name of backend application defines, i.e. http://backend.appname.appspot.com , request routed backend , denied (because backend access defined default private). anything else results in request being routed sole frontend instance of default module, using random character strings module names, such http://sdlsdjfsldfsdf.appname.appspot.com . holds made-up instance ids such in case o

java - Refreshing the Jtable is scrolling the table -

when refresh jtable data using custom refresh button, jtable scroll random position. code used is: jscrollpane jspane = new jscrollpane(); jtable table = new jtable(); jspane.setviewportview(table); getcontentpane().add(jspane, java.awt.borderlayout.center); i want jtable maintain viewport after refresh. how can achieve this? as kleopatra said, wierd. still can force: int scrollposition = scroll.getverticalscrollbar().getvalue(); try { ...do update table... } { scroll.getverticalscrollbar().setvalue(scrollposition); } }

javascript - Compare 2 strings and change color -

i not sure how should go this. 2 string database comma seperated below string1 = "dd,cc,ff" string2 = "dd,xx,ff" i bind string1 html table. you can see 2 strings different. want find string2 in string 1 , highlight changed part of string. so output string1 = dd, cc ,ff so table show whole string highlight value "cc" in table. how should go this? open use jquery or javascript. compare each comma seperated value, if not same, wrap tag of kind : function checkstrings(str1, str2) { str1 = array.isarray(str1) ? str1 : str1.split(','); str2 = array.isarray(str2) ? str2 : str2.split(','); (var i=0; i<str1.length; i++) { if (str1[i] !== str2[i]) str1[i] = '<b>' + str1[i] + '</b>'; } return str1.join(''); } fiddle or if order doesn't matter : function checkstrings(str1, str2) { str1 = array.isarray(str1) ? str1 : str1.split(&

iphone - iOS Crash with name SIGSEGV and reason main -

i'm using crittercism (sdk 3.5.1) crash reporting service catch reports on ios app. i've been getting error many times , i've no idea why it's happening. name: sigsegv - reason: main here full report crittercism: threads _________________________________ thread: unknown name (crashed) 0 libobjc.a.dylib 0x39917526 objc_retain + 6 1 uikit 0x33a92ab3 -[uiviewanimationstate senddelegateanimationdidstop:finished:] + 159 2 uikit 0x33b078ef -[uiviewanimationstate animationdidstop:finished:] + 51 3 quartzcore 0x3383cc01 _zn2ca5layer23run_animation_callbacksepv + 209 4 libdispatch.dylib 0x39d314b7 _dispatch_client_callout + 23 5 libdispatch.dylib 0x39d32dcb _dispatch_main_queue_callback_4cf$variant$up + 227 6 corefoundation 0x31c48f3b __cfrunlooprun + 1291 7 co

html - How to position image in the extjs panel as required.? -

i have panel links other components render on-demand. have background image panel. need display company logo @ bottom-right/top-left/top-right/bottom-left of panel @ run time. due other components rendering in same panel cannot change layout other. want apply css, logo positioned required. your appreciated! thanks much! to set css class panels body can this: panel.body.addcls("logo"); and css needs this: .logo { background-image: url(logo.png); background-position: top right, top left; background-repeat: no-repeat; } this display logos in top right , top left of panels body.

java - Instagram Search query to find an user by firstName and lastName -

i using instgarm java api find user using first , last name. in api have use first name , last name of user find public userfeed searchuser(string query, int count) throws instagramexception { preconditions.checknotnull(query, "search query cannot null."); map<string, string> params = new hashmap<string, string>(); params.put(queryparam.search_query, query); if(count > 0) { params.put(queryparam.count, string.valueof(count)); } userfeed userfeed = createinstagramobject(verbs.get, userfeed.class, methods.users_search, params); return userfeed; } in api have above method. how construct query find user based on first , last name. when pass name means returns lot of users want exact search using first , last name. 1 can me?

javascript - D3JS Group / Prepare transition? -

i'm posting because didn't find nice solution yet , google don't me time. http://jsfiddle.net/cuqan/5/ as can see on jsfiddle link, have lin/area chart. update graph new data. have problem transitions.. 'circle' not move in same time lines/areas , think it's due time running code. i move in same time. how can ? i thought group of transition, mean, prepare every objects/elements , insert them group, , then, when every objects in group, trigger transitions. couldn't find : svg.selectall("circle") .preparetransition() .insertingroup('firstgroup') .attr("cy", dist); ... group('firstgroup'). .transition() .duration(750) ... is can me please ? thank help.

python - Only delimit values with quotes and not the headers -

i using python csv module write csv file. have used following code create object writing csv file writer = csv.writer(stringio, quotechar='"', quoting=csv.quote_all) headers = ['heading1','heading2'] writer.writerow(headers) values=['value1','value2'] writer.writerow(values) but want put double quotes around values , not headers. for example want output follows: heading1,heading2 "value1","value2" but following "heading1","heading2" "value1","value2" please can suggest how can csv file quotes around values , not headers? write headers separately, creating new csv.writer() rows: writer = csv.writer(stringio) headers = ['heading1', 'heading2'] writer.writerow(headers) writer = csv.writer(stringio, quotechar='"', quoting=csv.quote_all) values=['value1', 'value2'] writer.writerow(values) csv.writer() object

jquery - Set SVG as mouse pointer image -

i having svg image .i neet set svg image mouse pointer using javascript. i can able set image mouse pointer using following code: $("div").mouseover(function(){ $(this).attr("style","cursor: url(red_bucket.png), pointer;"); }); is there possiblities set svg mouse pointer...? this should work $("div").mouseover(function(){ $(this).attr("style","cursor: url('red_bucket.svg'), pointer;"); });

constraints - Xcode Auto Layout: Can't resize window -

what want achieve: custom view 1 aligned @ top fixed height = 20px width = window width horizontal split view below custom view width = window width height = large possible custom view 2 aligned @ bottom fixed height = 20px width = window width it's simple layout: header , footer @ top , bottom of window, , split view in between content left , right should resize window. however, apple designed auto layout manager poorly, can't seem work. (i've fumbled around 3 hours now!) the problem is: give custom views fixed height, window height locked, can't resize vertically more. i'm trying following constraints: custom view 1 constraints height = 20px custom view 2 height = 20px constraints leading horiz space custom view 1 superview = 0 leading horiz space custom view 2 superview = 0 leading horiz space split view superview = 0 trailing horiz space custom view 1 superview = 0 trailing horiz space cu

Unable to install TestNG in eclise using eclipse Market place or Install software -

i'm unable install testng in eclipse. i tried eclipse marketplace gave following error: "the following solutions not available: testng eclipse proceed installation?" screenshot: http://i.stack.imgur.com/mj7or.png , yes or no buttons if click yes, gives: "cannot complete request. see error log details." when tried through install new software options, doesn't display testng icon in list supposed to.. is there solution or alternate way install? in advance..

ruby - Using binary data (strings in utf-8) from external file -

i have problem using strings in utf-8 format, e.g. "\u0161\u010d\u0159\u017e\u00fd". when such string defined variable in program works fine. when use such string reading external file wrong output (i don't want/expect). i'm missing necessary encoding stuff... my code: file = "c:\\...\\vlmlist_unicode.txt" #\u306b\u3064\u3044\u3066 data = file.open(file, 'rb') { |io| io.read.split(/\t/) } puts data data_var = "\u306b\u3064\u3044\u3066" puts data_var output: \u306b\u3064\u3044\u3066 # don't want について # want i'm trying read file in binary form specifying 'rb' there other problem... run code in netbeans 7.3.1 build in jruby 1.7.3 (i tried ruby 2.0.0 without effect.) since i'm new in ruby world ideas welcomed... if file contains literal escaped string: \u306b\u3064\u3044\u3066 then need unescape after reading. ruby string literals, why second case worked you. taken answer " is best way unes

java - Android - Custom Array Adapter Not called During In and Out of a Fragment -

got stock problem couple of days now, have launchpadsectionfragment fragment a, on onclick event fragment( b ) separate class called named videoplayerfragment that extends listfragment being called , displayed. the problem: when click fragment opens fragment b, inside fragment b contains listview - populated loadallproducts database, in on oncreateview() calls custom array adapter loads returned records in listview. fragment b displays blank screen if go previous fragment(a) goes b, displays listview. if lucky, first time frag b loads, show listview. i've been struggling this. thank considering. public class collectiondemoactivity extends fragmentactivity { public static class demoobjectfragment extends fragment { public static class launchpadsectionfragment extends listfragment { //onclick event opens class //extends fragment list fragmenttransaction transaction = getchildfragmentmanager(

javascript - how to stop firing an event using java script -

i have "onclick" event , "onclientclick" event. "onclientclickevent" javascript function , "onclick event" runs on server. want way prevent firing on click event javascript function.scenario that- asp:button id="button1" runat="server" text="submit" onclick="button1_click" onclientclick="javascript:anscheck()" /> you can this: <asp:button id="button1" runat="server" text="submit" onclick="button1_click" onclientclick="javascript:return anscheck()" /> javascript funcion anscheck(){ //based on code , condition can return if(condition){ return true // fire server side event } else{ return false; // not fire server event } } or <asp:button id="button1" runat="server" text="submit" onclick="button1_click" onclientclick="javascript:r

list - Reverse Monkey Puzzle sort (Haskell) -

i have repeat in haskell in augest i'm trying practice haskell. 1 of questions is: "a reverse monkey puzzle sort of list performed storing elements of list binary tree , traversing tree nodes of subtree visited in order right child, parent , left child. write reverse monkey puzzle sort in haskell" the question confuses me. know have write function go xr node xl. have output list traversed tree? or repopulate binary tree list or what? also, start down in farthest right element , go that's parent go left, or start @ first root node @ top of tree , go way? also how go writing it, haskell 1 of weak points. appreciate this! here code have module data.btree data tree = tip | node (tree a) (tree a) deriving (show,eq) leaf x = node x tip tip t1 = node 10 tip tip t2 = node 17 (node 12 (node 5 tip(leaf 8)) (leaf 15)) (node 115 (node 32 (leaf 30) (node 46 tip (leaf 57))) (leaf 163)) t3 = node 172 (node 143 (node 92 (node

nosql - Rethinkdb removing data from documents -

i'm trying remove portions of data documents given simple structure, deeper , heavier project goes: { id: "...", name: "...", phone: "...", data: { key1: "val1", ... } ... } i'm aware there no way of updating/removing sections nested parts other replacing whole tree updated tree. for example, if want delete key1 document data, need update documents data section copy of key1 not contained document.update({data: new dict without key1}) is there eaiser way of deleting portion root of document -like name field- without updating whole document copy of not contain name key , value? have deep copy , filter document every time need remove portions of data? below query removes key root of document: r.table('foo').get(document_id).replace(r.row.without('key')) you can multiple documents follows: r.table('foo').filter(condition).replace(r.row.without('ke

javascript - jqGrid get rowid on the first column -

i'd have jqgrid first column rowid number | name | class 1 | | acceptable 2 | b | 3 | c | bad or add first column (picture) https://docs.google.com/file/d/0bxi6bfcyz_mgyti1dujcmwetd0e/edit how rowid in jqgrid on first column setting option? i suppose mean row number instead of rowid. add column row number can add rownumbers: true option jqgrid. if need display rowid, have extend colmodel corresponding column , fill values column fill data of other columns. additionally recommend use height: "auto" option improve visibility of grid or use alternatively scrolloffset: 0 option remove unneeded place on side of grid reserved vertical scroll bar.

Testing a post-merge hooks script for git -

i new git, , have following doubt: how can test if post-merge script doing duty, without having other people pushing fake changes repository? (is post-merge correct script, if want called every time pull repository , modifications found? executed if pull exits error, example because of conflicts?) i ask question related this other problem facing . i rather test post-merger hook pushing fake changes clone of actual repo. register hook in clone same way setup in current repo. that way, don't pollute original repo fake history have clean. if want avoid clone, can: dedicate branch merges push after having changed user.name , user.email ( git config user.name xxx ), in order simulate other authors , committers merges. once test merges done on branch, can delete enough .

javascript equivalent to jquery trigger method -

if equivalent jquery bind method, trigger method. function bind( scope, fn ) { return function () { fn.apply( scope, arguments ); }; } the code above post , looks same proxy method you can comment on too i have take jquery part out off framework, - relevant part if (selector === '') { this.el.bind(eventname, method); } else { this.el.delegate(selector, eventname, method); } } } }); if (includes) result.include(includes); return result; }; exports.controller = mod; })($, window); var exports = this; var events = { bind: function(){ if ( !this.o ) this.o = $({}); this.o.bind.apply(this.o, arguments); }, trigger: function(){ if ( !this.o ) this.o = $({}); this.o.trigger.apply(this.o, arguments); } }; thanks once crossed site how manually trigger events in javascript // here basic generic trigger method function trig

Making File Writable and Readable in Python -

i making find , replace script fix stuff on website. using python 3.3.2. here code: import re f = open('random.html', 'w') strtosearch = " " line in f: strtosearch += line patfinder1 = re.compile('<td>sermon title</td>\ <td><audio preload="none" controls src="http://www.orlandobiblechurch.org/audio/\d{6}ldm.mp3"></audio>\ </td>\ </tr>') findpat1 = re.search(patfinder1, strtosearch) findpat1 = re.findall(patfinder1, strtosearch) in findpat1: print(i) subfound = patfinder1.sub('<td>lord\'s day morning</td>\ <td><audio preload="none" controls src="http://www.orlandobiblechurch.org/audio/\d{6}ldm.mp3"></audio>\ </td>\ </tr>', strtosearch) print(subfound) f.write(subfound) f.close() the problem python tells me file not readable. if ch

asp.net mvc 4 - How do I inject a dependency into non Controller classes? -

i want setting of application (initialisation). in global.asax.cs . i'm going need dependency (perhaps repository) achieve goal. how inject implementation of ifoorepository ? public class mvcapplication : httpapplication { private static ifoorepository _foorepository; protected void application_start() { // ... ifoo foo = _foorepository.get(0); foo.dosomething(); } } i tried failed: public class repositoriesinstaller : iwindsorinstaller { void iwindsorinstaller.install(castle.windsor.iwindsorcontainer container, castle.microkernel.subsystems.configuration.iconfigurationstore store) { container.addfacility<typedfactoryfacility>(); container.register( component.for<ifoo>() .implementedby<foo>() .lifestyletransient(), component.for<ifoorepository>().asfactory()); container.register(classes.fromthisassembly()

screenshot - take screen shot of a transparent image android -

i have main layout , linear layout llsplitpic on transparent image set background. when i'm trying capture screenshot threw code below returns transparent image want main layout image because i'm using llsplitview frame . llsplitpic.setdrawingcacheenabled(true); llsplitpic.builddrawingcache(); llsplitpic.setdrawingcachequality(view.drawing_cache_quality_high); bitmap bmp = llsplitpic.getdrawingcache(); try method- bitmap file = takesnapshot(parentlayout); bitmap takesnapshot(view v) { bitmap b = bitmap.createbitmap(v.getwidth(), v.getheight(), bitmap.config.argb_8888); canvas c = new canvas(b); v.draw(c); return b; }

c - detect temporary ipv6 address crossplatform -

i want detect if address temporary ipv6 address, using getifaddrs list of addresses don't know how info there. , if possible want work linux, osx, solaris , windows. i have seems in linux ifa_f_temporary set in inet6_ifaddr->ifa_flags, not sure if how can ifaddrs returned getifaddrs. seems on osx need octl siocsifinfo_flags, , have no idea solaris or windows. has body sample code that. updated (aug 3, 2016): after searching on , off past couple months on question (because i'm in need of answer myself). believe have found windows-centric answer. i've tested on windows 10, don't know older versions. api shouldn't have changed if wants verify me :-) all _ip_adapter_unicast_address structures have enumeration address prefix , suffix. i've bothered @ them , entire key solving issue! what temporary ipv6 address....it's address random suffix! ipv6 addresses in ip_adapter_unicast_address @ ip_suffix_origin see if ipsuffixoriginrand

java - What is the Jersey 2.0 equivalent of GZIPContentEncodingFilter -

i in progress migrate jerset 1.x client project jersey 2.0. i found gzipcontentencodingfilter not exist longer. there similar? i stumbled on gzipencoder not sure how plug in. in jersey 1.17 use: webresource r = ... r.register(new gzipcontentencodingfilter()); in jersey 2.0 search somethink like: webtarget r = ... r.register(new gzipcontentencodingfilter()); use webtarget r = ... r.register(gzipencoder.class);

PHP convert time, day,month and year to a formatted string -

i have: $date = $this->item->publish_up; echo $date which returns: 2013-07-19 09:28:05 how can convert text, example thursday, 8th of november 2012 @ 00:00? i have tried: $date = $this->item->publish_up; $new_date = date('m-d-y', strtotime($date)); echo date("format",strtotime($new_date)) but returns: f1970thu, 01 jan 1970 02:00:00 +020001am31 any apreciated you must escape o , a , t . can read more here in php manual date function you can prevent recognized character in format string being expanded escaping preceding backslash. if character backslash special sequence, may need escape backslash. <?php echo date( "l, js \of f y \a\\t h:i a", strtotime( "2013-07-19 09:28:05" ) ); ?>