Posts

Showing posts from January, 2014

javascript - Forcing mobile devices to activate :hover CSS properties on first touch and activate link on second touch -

: ) so, i'm trying solve hover effect issue. have tooltips on of links. code looks this: <a href="https://wikipedia.org/wiki/space_shuttle_atlantis"> <h6 class="has-tip">space shuttle <p class="tip">the space shuttle invented santa claus</p> </h6> </a> and css bit more involved: .tip { display: block; position: absolute; bottom: 100%; left: 0; width: 100%; pointer-events: none; padding: 20px; margin-bottom: 15px; color: #fff; opacity: 0; background: rgba(255,255,255,.8); color: coal; font-family: 'ubuntu light'; font-size: 1em; font-weight: normal; text-align: left; text-shadow: none; border-radius: .2em; transform: translatey(10px); transition: .25s ease-out; box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28); } .tip::before { content: " "; display: block; position: absolute; bottom: -20px; left: 0; height: 20px; width: 100%; } ...

SSIS: How to change metadata on flat file connection manager -

i working in bids. have ssis package loops on files in given directory , imports of them table. so, control flow has foreach loop container data flow task inside of it. data flow task goes straight flat file source ole db destination. because directory can change, have made foreach directory dynamic (i.e., gave package variable, can change when directory changes). files field has stuff*.pip, such files in directory match pattern imported. variable mappings tab has file name variable, same variable used in expressions of flat file connection manager. when set flat file connection manager, had point existing file pick file's metadata. changed file connection manager dynamic (i.e., added file name variable in expressions property) such foreach loop container pick files (that match pattern). since then, metadata on file has changed. so, when open solution file, throws warning on flat file source in data flow task. resolve this, have temporarily change flat file connect...

iOS: Debugging memory leaks for UILabel in swift -

i new profiling , using instruments in xcode. facing of problem of memory leaks in tableviewcell uilabel(calayer). in code tableviewcell have fixed view called bottomview. bottomview may or may not contain uilabel can either directly within bottomview or within subview of bottomview. every time within init method cell check bottomview , remove superview , set nil. reinitialise bottomview (using uiview(frame: ) ) , switch case follows adds contents bottomview required. i've set other uilabels within cell nil , remove superview in deinit fixed. my questions , doubts: is there way particular uilabel created in code allocations screen or other way trace object in code? because i'm still assuming leaks bottomview have variable uilabels. other i've removed other uilabels superview in both cell , viewcontroller containing tableview. how use "record reference counts" setting in allocation record setting? read @ many places can used address problem i'm facing...

javascript - How to remove ellipsis if element isn't wide enough -

i have html element has css properties of text-overflow: ellipsis , overflow: hidden . these work great in truncating text when it's wider width of div it's in , displaying ellipsis. however, if div resized smaller point ellipsis shown ( or when it's small can't show ellipsis , reverts 1 character of text ), want remove ellipsis altogether , not display anything. possible? i don't want have check width of text seems hackish. i'd prefer cleaner.

Laravel 5.1 access event object in listener -

i trying out laravel 5.1's queue, having problem working $event object in listener. authcontroller.php public function postgenerateresettoken() { try { $admin = admin::where( 'email', '=', input::get( 'email' ) )->firstorfail(); $token = bus::dispatch( new generatepasswordresettoken( $admin ) ); event( new passwordresettokenwasgenerated( $admin, $token ) ); return success(); } catch( modelnotfoundexception $exception ) { return fail(); } } passwordresettokenwasgenerated.php class passwordresettokenwasgenerated extends event { use serializesmodels; public function __construct( $admin, $token ) { $this->admin = $admin; $this->token = $token; } public function broadcaston() { return []; } } sendforgottenpasswordemail.php class sendforgottenpasswordemail implements shouldqueue { public function __construct() ...

Get the type of field in django template -

i using django forms , want use twitter bootstrap's css in html. template looks this: {% field in form %} <div class="form-group"> {{ field.label_tag }}<!--same thing : <label for="{{field.id_for_label}}"></label> --> <input type="{{field.type}}" class="form-control" id="{{field.auto_id}}" placeholder="email"> </div> {% endfor %} i can't figure out out type value. {{field.type}} . is there way type of input field in django templates? thanks in advance update: reason asking question because want able apply bootstrap classes input element. in bootstrap3, use default css input types have add form-control class input element so: <input type="text" class="form-control" id="{{field.auto_id}}" placeholder="">. if use django's field {{field}} can't add form-control class. hope clarifies thing...

Groovy Sql Execute Statement won't accept closures -

i have statement: sqlinstance.execute(executestring){ dummy, reallist-> debug("real list: "+reallist) } which fails 'invalid column type' but: def bool = sqlinstance.execute(executestring) works. if print bool, prints 'true'. for reference: executestring = "select distinct channel_id guide_sched" for reason, closure isn't working execute method in groovy's sql, although i've checked documentation , it's supposed to. it looks first environment testing on ran groovy 2.4 , second runs groovy 2.1. execute statement using didn't exist until after 2.1 instead, used .rows() function return groovyrowresult parsed information needed, instead of accessing directly in .execute() closure.

javascript - How do you programmatically remove a comment in handsontable? -

i'm using handsontable , need remove comment programmatically, haven't found way it. looking through code, seems should able say: var hot = new handsontable(element, options); hot.getplugin('comment').removecommentatcell(row, column); but hot.getplugin() doesn't seem work. appreciated. of course, figure out right after posting. plugin name "comments" not "comment". comments within handsontable source apparently need updated throw errors in situations , reference plugin name of "comment" got original idea. answer: var hot = new handsontable(element, options); hot.getplugin('comments').removecommentatcell(row, column);

Error on Parameter C# SQL -

i need verify parameter rgp, peixe, data_registro method return true. on peixe parameter giving error: expects 'peixe' parameter, not provided. peixe varchar type on sql, rgp int type , data_registro date type. public bool search_rgp_cadastro(int param_rgp, string param_date, string param_peixe) { sqldatareader objreader; sqlcommand objcmd = null; vsql = "select [rgp], [peixe], [peso], [quantidade], [data_registro] cadastro rgp = @rgp , peixe = @peixe , data_registro = @data_registro"; if (this.conectar()) { try { datetime dtparam = datetime.parse(param_date); objcmd = new sqlcommand(vsql, objcon); objcmd.parameters.add(new sqlparameter("@rgp", param_rgp)); objcmd.parameters.add(new sqlparameter("@peixe", param_peixe)); objcmd.parameters.add(new sqlparameter("@data_registro...

javascript - paging not moving to new data in kendogrid -

Image
please note @ time new asp.net mvc, javascript , kendo. kendo grid paging works first 500 records returned, won't allow paging download more data server past 500. here controller: public actionresult executetestrule(string ruleid, string rulesql, string uwi, list<pdsmatchruleparam> parameters = null) { if (request.url != null) { var query = paginationquery.parse(request.querystring); var upperlimit = query.fromupper; var lowerlimit = query.fromlower; var datasource = new matchdatasource(); list<dataaccess.dbparameter> dbparameters = null; var generatedsql = datasource.generatequerysql(ruleid, rulesql, uwi, parameters, out dbparameters); var results = datasource.executetestrule(ruleid, generatedsql, dbparameters, upperlimit, lowerlimit).select(u => new { uwi = u }); var response = new dictionary<string, object>(); response[...

php - Solving count query issue -

i have following code need select items personabisna table , count items same personalbisnaid table both tables share personalbisnaid $query="select c.businesslogo, c.personalbisnaid, c.account_id, ads personalbisna c inner join myads b on b.personalbisnaid=c.personalbisnaid group c.personalbisnaid limit $itemfrom,$dataperpage"; these tables personalbisna table | personalbisnaid| account_id| businesslogo --------------------------------------------- | 1 | 23 | qwertyu.jpg | 2 | 4 | asdfghjk.jpg | 3 | 12 | 34567gfd.jpg | 4 | 34 | drtyujhv.jpg myads table | myadsid | personalbisnaid| adtype --------------------------------------------- | 1 | 2 | logo | 2 | 2 | business card | 3 | 3 | logo | 4 | 2 ...

sql - Combine Columns with same ID and search the data -

i have table (tblabc) looks like ------------------------------- basicid | filter1 | filter2 | ------------------------------- 100 1 2 100 3 4 101 8 9 what want on - want select basicid has filter1=1 , filter2=4. ie want output 100 can create view of combining basicid. looks similar -------------------------------- basicid | filter1| filter2 | -------------------------------- 100 1,3 2,4 101 8 9 once done can search using simple search query 'select basicid tblnewlycreatedtable filter1=1 , filter2=4' , output 100. to solve issue have tried following methods of have failed me not efficient because have around 12 filter filter on. not of filter applied time, @ times 4 filters, @ times 2 , @ time 12. select * tblabc , basicid in ( select basicid tblabc filter1 in (1) ) , basicid in ( select basicid tblabc filter2 in (4) ) 2. using select finding results...

How to enter data for authentication required pop up using ruby, page-object and watir-webdriver -

i feel problem has simple solution (although not able find relevant answer through researching). using rubymine ruby 2.0.0 automated testing , using watir-webdriver, 0.6.4, , page-object, 0.9.4 gems. when ruby opens site testing. before page loads authentication required pop box displayed. says, "the server http://example.com:80 requires username , password. server says: authentication required." not able inspect element, therefore don't know how interact it. have been bypassing issue manually entering username , password. i think easier fill fields in , click log in rather store cookie, guys know best. you can pass in authentication credentials via url, bypass dialog. there's example on http://watirwebdriver.com/basic-browser-authentication/ : require 'watir-webdriver' b = watir::browser.start 'http://admin:password@yourwebsite.com' b.goto 'https://admin:password@yourwebsite.com/cart' # replace 'cart' appropriate ...

CSS - Showing an error beneath an input -

Image
i looking show error message below text input the message should not extend wider width of input, thinking inherit width of input on span sits below it? something like: <div class="my-form-control-group has-error"> <input type="text" class="my-form-control" > <p style="width:inherit;">some error here</p> </div> my current attempt - http://jsfiddle.net/4eu2qkra/ i know sample above not work, , usage of inherit wrong here since looking use width of parent div. is there pure css way inherit sibling element before target element? maybe i'm going wrong way?! use wrapper div control width of input , error message. make sure input has width: 100%; fill wrapper div. <div class="control-wrap"> <input type="text"> <p>error message. error message</p> </div> * { box-sizing: border-box; } .control-wrap { width: 50%; paddin...

php - .htaccess RewriteRule for long URL is not working -

i new it. may doing silly mistakes. in .htaccess have written rewriterule below: rewriterule ^contactus$ /contact.php [l,b] if url http://localhost/contactus working fine. if url http://localhost/countryname/contactus working fine. when url http://localhost/songs/bob+marley+%26+the+wailers/one+love/contactus page not redirecting please help. the ^ symbol in beginning of match means should begin matching start of string. means second url ( http://localhost/countryname/contactus ) should not match either. if want match urls ending "contactus", remove ^ beginning: rewriterule contactus$ /contact.php [l,b]

JavaScript to highlight XPath matches in webpage? -

we need bit of javascript can sent page (by dumping in url bar) highlight matches of given xpath string. that is, javascript code contain hard-coded xpath string. i know there developer tools need lightweight api-style solution. any appreciated. functioning code preferred. i figured out. (tested in chrome) paste following in omnibox, delete first 'j' ("javascript:" gets erased w/out double j) try @ http://www.w3schools.com/jsref/ jjavascript: var myxpath = "//a[@class='bigbtn']"; var iterator = document.evaluate(myxpath, document, null, xpathresult.unordered_node_iterator_type, null ); try { var thisnode = iterator.iteratenext(); while (thisnode) { thisnode.style.outline = "5px dashed red"; thisnode = iterator.iteratenext(); } } catch (e) { dump( 'error: document tree modified during iteration ' + e ); }

php - Removing Sliding Widgets plugin create include errors -

so updated plugins, uninstalled sliding widgets plugin , following warning messages in admin panel , above header of site: warning: include(shortcodes.php): failed open stream: no such file or directory in /homepages/14/d442309306/htdocs/app572581842/wp-content/themes/shopkeeper/functions.php on line 2 warning: include(): failed opening 'shortcodes.php' inclusion (include_path='.:/usr/lib/php5.5') in /homepages/14/d442309306/htdocs/app572581842/wp-content/themes/shopkeeper/functions.php on line 2 any ideas on how rectify this? update: first few lines in functions.php were: <?php include('shortcodes.php'); // theme textdomain - must loaded before redux load_theme_textdomain( 'shopkeeper', get_template_directory() . '/languages' ); but commented include('shortcode.php'); see happen. made warnings go above header of site, great, on login page following warning appearing on page , can no longer log in: warni...

ios - weakSelf (the good), strongSelf (the bad) and blocks (the ugly) -

i have read when block executed: __weak typeof(self) weakself = self; [self dosomethinginbackgroundwithblock:^{ [weakself dosomethinginblock]; // weakself possibly nil before reaching point [weakself dosomethingelseinblock]; }]; it should done way: __weak typeof(self) weakself = self; [self dosomethinginbackgroundwithblock:^{ __strong typeof(weakself) strongself = weakself; if (strongself) { [strongself dosomethinginblock]; [strongself dosomethingelseinblock]; } }]; so want replicate situation weakself gets nil in middle of block execution. so have created following code: * viewcontroller * @interface viewcontroller () @property (strong, nonatomic) myblockcontainer* blockcontainer; @end @implementation viewcontroller - (ibaction)caseb:(id)sender { self.blockcontainer = [[myblockcontainer alloc] init]; [self.blockcontainer createblockweakyfy]; [self performblock]; } - (ibaction)casec:(id)sender { ...

html - Why is this CSS transition not working as intended? -

this question has answer here: how have multiple css transitions on element? 7 answers i have submit button in form , i'm trying make simple on-hover transition. want swap colors of button's text , button's background color. way have right now, text transitions on time, background color still switching colors instantly. how fix make background color change on time? using google chrome, put in -webkit-transition. once working i'll add others other browsers. here's simplified code: <form method="post" action="processregistration.php"> <input class="submitbutton" type="submit" name="submit" value="create account" /> <form> css: #signupform form .submitbutton { margin: 0 auto; border-radius: 5px; border: solid 2px #66cc66; background-color: ...

angularjs - Angular.js autocomplete with $http.get TypeError: Cannot read property 'success' of undefined -

Image
with code typeerror: cannot read property 'success' of undefined . i've tried .then instead of .success same error. after plus ten hours of googling i'm little bit desperate... html: <div ng-controller="search_interest" layout="column"> <md-chips ng-model="ctrl.selectedvegetables" md-autocomplete-snap md-require-match> <md-autocomplete md-selected-item="selecteditem" md-search-text="searchtext" md-items="item in getinterest(searchtext)" md-item-text="item.name" placeholder="search vegetable"> <span md-highlight-text="searchtext">{{item.name}} :: {{item.type}}</span> </md-autocomplete> <md-chip-template> <span> <strong>{{$chip.name}}</strong> <em>({{$chip.type}})</em> ...

Conditional compilation based on Haxe compiler version? -

what exact syntax conditional compilation in haxe checking against version number? according haxe --help-defines haxedef haxe compiler version "haxe-ver" assume becomes "haxe_ver" in code. so want check if version number @ least 3.2.0. tried: #if (haxe_ver >= 3.2.0) but didn't seem work. tried: #if !haxe_ver < 3.2.0 and seemed compile, want sure. well, it's not answer, see lots of different styles grepping through haxe libs: haxe-3.2.0/std/cpp/zip/uncompress.hx:2: #if (haxe_ver < 3.4) haxe-3.1.3/std/neko/zip/uncompress.hx:2: #if (haxe_ver < 3.2) haxe-3.1.3/lib/openfl/3,0,0-beta,3/openfl/vector.hx:767: #if (haxe_ver > 3.101) haxe-3.1.3/lib/openfl/3,0,0-beta,3/docs/importall.hx:926: #if (haxe_ver >= "3.2") haxe-3.1.3/lib/actuate/1,8,3/motion/actuators/genericactuator.hx:61: #if (haxe_209 || haxe3) and quick test: class ver { macro public static function get_ver():haxe.macro.expr { var rtn = ha...

graphics2d - Java Graphics drawline performance issues -

i having issues speed of drawline method of graphics class. using draw line graph screen linked list. once list large enough (around 150000 values) takes lot longer loop through entire list , redraw lines. wondering can improve performance of program either optimizing drawline method, or abandoning it. @override protected void paintcomponent(graphics g) { ((graphics2d) g).setrenderinghint(renderinghints.key_antialiasing, renderinghints.value_antialias_on); ((graphics2d) g).setrenderinghint(renderinghints.key_stroke_control, renderinghints.value_stroke_pure); ((graphics2d) g).setrenderinghint(renderinghints.key_rendering, renderinghints.value_render_speed); graphics2d scaledg = (graphics2d) g.create(); g.dispose(); super.paintcomponent(scaledg); affinetransform scaletransform = new affinetransform(); scaletransform.scale(graphscale, 1); scaledg.settransform(scaletransform); scaledg.setcolor(new co...

ExtJS set the height of tab panel to 50% -

i'm new extjs , i'm trying position 2 tabpanels within panel. each of panels have 50% height of parent panel. can't seem find way this. how do that? use vbox layout same flex value on both tabpanels. see example .

linux - shell script to rename files in folder keeping order -

in folder have several files like name_1.txt name_2.txt name_12.txt name_13.txt and rename them in name_1.txt -> name_1.txt name_2.txt -> name_2.txt name_12.txt -> name_3.txt name_13.txt -> name_4.txt the following code partially job, doesn't keep order #!/bin/sh num=1 file in *.txt; mv "$file" "$(printf "%u" $num).txt" let num=$num+1 done indeed output is name_1.txt -> 1.txt name_2.txt -> 4.txt name_12.txt -> 2.txt name_13.txt -> 3.txt how fix name , order? thanks! the *.txt expands name_12.txt name_13.txt name_1.txt name_2.txt because makes sense computer. need sort start off in our human way. ls command can nicely natural sort ls -v *.txt . this means code need this... #!/bin/sh num=1 file in $(ls -v *.txt); mv "$file" "$(printf "%u" $num).txt" let num=$num+1 done

asp.net mvc - How do I add a query string parameter to my URL programmatically? -

Image
i'll try explain i'm trying do. have 2 tables in application. 1 project , other bug. 1 proyect can have several bugs. i'm able add/edit/delete projects. each project in database added actionlink if click on name, should show bugs related project. i tell "should show" because i'm able see new page id on url fine, haven't been able assign specific project id bug. for example: bug has description, status, date...and project id (which use filter bugs) so id of project has been clicked, when hit create action, can store projectid in bugdatabase other values stored automatically mvc. are passing value action link? @html.actionlink( "bug", "project", "project", new { projectid = myprojectid, ...

c# - Spawning Player at certain Point in Unity -

i making small 2d click'n'point in unity, , want is: want move towards door , when player steps on game object attached sceneswitcher script shall go through door, scene. works fine far. don't want him appear in middle of room, on door, entered room. using unityengine; using system.collections; using pixelcrushers.dialoguesystem; public class scenswitcher : monobehaviour { public string scenename = ""; void ontriggerenter2d(collider2d other) { switchscene(); } void switchscene(){ levelmanager levelmanager = dialoguemanager.instance.getcomponent<levelmanager>(); levelmanager.loadlevel (scenename); changeposition (); debug.log ("scene wechseln nach: " + scenename); } void changeposition(){ gameobject player = gameobject.find("player"); player.transform.position = new vector3(12,12,0); } } that code, change scenes, not change position. appreciate :) on changeposition() method ...

Excel VBA - Finding the beginning and end of coloured rows -

i trying create code in excel vba, locate beginning (cell address) , end (cell address) of coloured rows in table. table timeline(horizontal axis- dates, vertical axis - general text). coloured rows not start in first column, start in different columns. help? how's this? sub findcoloredrows() dim startcol integer, endcol integer, o integer dim ws worksheet dim integer, k integer dim startrow long, endrow long dim cellcolor string, nocolor string dim cel range nocolor = -4142 ' color index of no coloring k = 3 set ws = activesheet ws startrow = .cells(1, 3).end(xldown).row startcol = .cells(1, 3).column while startrow > 100 ' assume table starts before row 100. so, if there's no data before row 100, check next column k = k + 1 startrow = .cells(1, k).end(xldown).row startcol = k loop 'now, have our starting row - end row. endrow = .cells(startrow, k).end(xldow...

How to open a filedialog within an Eclipse Wizard -

i'm writing eclipseplugin, has create new project. works far, need copy external file projectfolder. intend have 'browse' button on 1 of wizardpages, opens filedialog, user can browse file , after closing dialog can use path file various actions. problem dialog window never opens. right i'm trying way (snippet wizardpage): public void createcontrol(composite composite) { this.container = new composite(composite, swt.none); gridlayout layout = new gridlayout(); this.container.setlayout(layout); layout.numcolumns = 2; button browsebutton = new button(this.container, swt.push); browsebutton.settext("browse"); browsebutton.addselectionlistener(new selectionlistener() { @override public void widgetdefaultselected(selectionevent arg0) { filedialog filedialog = new filedialog(datapage.this.container.getshell(), swt.open); filedialog.settext(...

string - Build Command in build setting in Eclipse C/C++ -

in cdt eclipse, have project own makefile. in properties of project, add configuration. use c/c++ build-> build variable give makefile variable. for example in build variable, declare: name type value _foo string x232 _plop string list blue || red after that, write in c/c++ build-> build command:: make -f pathofmymakefile foo={_foo} plop={_plop} the make command is: make -f pathofmymakefile foo=x232 plop=blue red the makefile doesn't understand red(it's normal..). list of variable . know if possible give string list makefile. add variable in list. thanks lot. as make concerned, setting multi-word value done in same manner single-word value. as matter of fact, in exact same category of variables, no matter if value contains space (2 words or more), or none (one word). you can set values make variables, in 1 of following three: 1. environment 2. makefile 3. command-line in example, values set command-line, long va...

html - Can I really not use table markup to get two elements to have equal height? -

ok, know using table layout unfashionable. need a layout 2 side-by-side elements, 1 usual height can increase if has taller contents, , other containing image. if first 1 grows taller, want 1 image grow match height. this can achieve old table . how can divs? here's i'm trying do: .body { width: 748px; margin: 20px auto; } .breaker { margin: 20px 0; outline: 1px solid purple; } .poll { background: pink; width: 248px; height: 250px; } div.poll { float: left; } .story { float: right; width: 500px; background-size: cover; } <div class="body"> <table class="breaker"> <tr> <!-- have variable height depending on content --> <td class="poll"></td> <!-- height of should match height of .poll --> <td style="width:500px;background-image:url(http://lorempixel.com/output/animals-q-c-600-200-1.jpg);background-size:co...

clojure - How can one achieve introspection in mustache template engine? -

(def template "{{name}}.{{surname}} {{#data}} * {{.}} {{/data}}") (introspect template) => {:name "" :surname "" :data []} is there introspect implementation? if question how build introspect function, instaparse 1 way go: (require '[instaparse.core :as insta]) (def parse (insta/parser "<moustache> = (tagged-block / word / sp)* <tagged-block> = comment | section | var comment = <tag-open> <'!'> (word | sp)* <tag-close> section = section-block-open (current-item / var / comment / word / sp)* <section-block-close> <section-block-open> = <tag-open> <'#'> name <tag-close> section-block-close = tag-open '/' name tag-close var = <tag-open> name <tag-close> current-item = <tag-open> <'.'> <tag-close> <word> = #'[^\\s{}]+' <sp> = #...

php - How to display URI of dynamic pages instead of just example.com -

i have website made using html5, css, php , jquery (with ajax). url, when visit home page http://www.example.com , fine. when visit different page (which loads using ajax of jquery), url still same (so http://www.example.com ). it's not displaying how (example.com/index.php or example.com/partials/somethingelse.php). i display home page (example.com) , other sites inside folder partials example.com/somethingelse.

c++ - Convert (manually) from uint32_t to 4 chars -

i have program special typedef, used in many place assign unique code components in software. typedef uint32_t fourcharcode; at point, have function use such code job. need debug in function extern "c" ___dllexport void a_function(fourcharcode in_type) { fourcharcode x = 'kjfg'; fourcharcode y = 'tdkf'; fourcharcode z = '5vpo'; switch (in_type) { case x: // break; case y: // break; case z: // break; default: break; } return xx::noerror; } obviously, when put breakpoint see value of in_type , obtain unsigned int ('1918980169'). my question: is there way, in msvc 2013 debugger, display uint32_t value readable? or what manually (using calculator, python script or else useful) retrieve 4 chars hidden behind uint (i not against using paper , pen, don't see how can computation)? if want conv...

Java Parsing JSON with GSON -

i new java , json , i'm trying parse following json using gson. however, having problem in don't have errors object empty. { "pac": [ { "customername": "test" } ] } this class im trying make object of: public class customer{ /** customer name. */ private string customername; /** * gets customer name. * * @return customer name */ public string getcustomername() { return customername; } /** * sets customer name. * * @param customername new customer name */ public void setcustomername(string customername) { this.customername = customername; } i'm using try , parse: gson gson = new gson(); customer = gson.fromjson(jsonfile, customer.class); i appriciate if guys had tips. your json show there object have property pac . this property pac array of customer so try : public class customers { public list<customer> pac; // list java.util } and then custo...

swift - Actions executed multiple time iBeacon -

i'm playing ibeacons , execute function or command 1 time when specific beacon in range. here code: https://gist.github.com/silvering/f3dc4edf32eb55afe433 when beacon in range, receive "its purple" x10000 want display message 1 time.. idea? for that, there 2 things can do remove location delegate after locate beacon, not receive more calls remember located beacon (for example, in array) , expand logic condition skip in case should presented multiple time. so like: // create storage located beacons var locatedbeacons = [int]() // adds beacon storage func beaconlocated(beaconid : int) { self.locatedbeacons.append(beaconid) } // located? func isbeaconlocated(beaconid : int) -> bool { return contains(self.locatedbeacons, beaconid) }

config - Best practice to create a .NET configuration file editor application? -

i've develop small wpf (.net fwk 4.5) app allow user edit appsettings section of 5 files differents .config file. these 5 files application configuration file of 4 console applications , 1 wpf composite application. in each file, appsettings hold smtp/pop3 server addresses, configuration , other misc. information. my question : best microsoft best practices available create kind of app? is there way downsize/factorize 5 files single 1 or @ least create xml formatted file holding common appsetting 5 app configure? thanks reply, ok, i've found myself : factorize using file attribute of appsettings element; here i've done : <appsettings file="..\appsettings.config"></appsettings> use xpath query , xmldocument class of .net framework : xmldocument myxmldocument = new xmldocument(); myxmldocument.load('appsettings.config'); xmlnode root = myxmldocument.selectsinglenode("/appsettings"); string attributename ...

javascript - Loop over child objects -

i'm trying loop on child objects within object using $(parent).each() return parent. in below code, console.log() both print same thing. want iterate on children "rectangle", "pointend" , "pointstart" objects , children. moveitemsobjarray = []; moveitemsobj = {}; mobeitemsobj.pointer = guidvarible; moveitemsobj.nodes = {"rectangle":{ "rect_x": linerect_x, "rect_y": linerect_y, "rect_w": linerect_w, "rect_h": linerect_h }, "pointstart":{ "point_x": newpointstart_x, "point_y": newpointstart_y }, "pointend": { "point_x": newpointend_x, "point_y...

java - Centralized catalina properties -

we have service (java, spring-batch, tomcat) runs on number of environments. each environment has have own configuration files, example catalina properties. is there way have centralized system, service knows on environment it's running , automatically gets own properties? maybe using db or active directory? or @ least easier way manage these, without having manually adjust each , every one? take @ spring cloud project. spring cloud config project. exposes config server clients can call obtain environment specific configurations. you can read more spring cloud , config server here: http://projects.spring.io/spring-cloud/

Handsontable custom object data -

i trying fill handsontable objects. example: var data = [ [{title: 'a1', style: '...'}, {title: 'b1', style: '...'}], [{title: 'a2', style: '...'}, {title: 'b2', style: '...'}], ]; now want handsontable renders title attribute cells , not style. style attribute used render cells special fomatting. how tell handsontable use title attribute? handsontable data not intended give style cells. define cell styles recommend wear link http://docs.handsontable.com/0.15.1/demo-conditional-formatting.html but if idea have hidden columns , such code , leave example <script> var options = { columns: cutobject(data) } function cutobject(data){ return data.slice(1);//hide firt column } </script>

php - @dataProvider in Cest format in Codeception -

how shall use "@dataprovider" in cest format? ( http://codeception.com/docs/05-unittests#cest ) example have code. how write in cest format class exampletest extends \codeception\testcase\test { /** * @dataprovider provideradd */ public function testadd($a, $b, $c) { $this->assertequals($c, ($a + $b)); } public function provideradd() { return array ( array (2, 2, 4), array (2, 3, 5), array (3, 5, 8) ); } } the @data p rovdier annotation works me in codeception docs on website (or docs/07-advancedusage.md) - please note annotation case sensitive @data p rovdier not @dataprovdier. http://codeception.com/docs/07-advancedusage#cest-classes

swift fatal error: unexpectedly found nil while unwrapping an Optional value in adMob -

i try ad admob in app. after release of app, admob not worked. tried fix it, have fatal error... problem in line "bannerview.adunitid = ...."? thanks... class viewcontroller: uiviewcontroller, gadbannerviewdelegate { @iboutlet weak var bannerview: gadbannerview! override func viewdidload() { super.viewdidload() //admob self.bannerview = gadbannerview() bannerview.adunitid = "ca-app-pub-...." // line fatal error bannerview.delegate = self self.bannerview.rootviewcontroller = self var request: gadrequest = gadrequest() //request.testdevices = [""] self.bannerview.loadrequest(request) } well, main issue have bannerview set iboutlet gadbannerview . then, set explicitly in line self.bannerview = gadbannerview() so either use iboutlet or don't. if hooked outlet storyboard, don't need initialize , should delete line. or, rid of outlet if you're not hooking anything.

javascript - Error: ESPIPE, write -

im using following code write file fs.writefile('/dev/ttymxc1',"led 1 on",function(err){ if (err) return console.log(err); }); and error { [error: espipe, write] errno: -29, code: 'espipe' } i googled found nothing.. edit: i think reason not work have use fs.createwritestream(); instead of fs.filewrite(); the solution using fs.createwritestream() instead of fs.filewrite();

jquery - How to use a third party js in Angularjs -

i want use third party js file (not written in angularjs) service in angularjs controller. able use js in html inside script> tag want use functions in controller. there way include js file inside controller service or other way? you can create new service in angular this angular .module("app") .factory("jsservice", function () { // here goes code of js (d3 in case) //now return object of service return d3; } and can inject service controller , use it **update : ** click button , can log d3 service ,, , can use inside angular ,, https://jsfiddle.net/rzkku08r/ **update : ** can inject jquery self service ,, , add plugin ,, did d3 ,, can see added d3 service , before returning added code of 2 plugins (word cloud jason davies) , (d3.tip) , returned service containing (d3 , plugins) , can use them every in app ,,

mysql - Get all ages count on a table -

my goal how many users got on database per year. save birthday in timestamp. after reading solution how count 2 different data in 1 query makes me wonder, if oldest member have 120 old, have write 120 cases each count "between" 2 timstamps defines year? that sounds bit odd, there's no other way job done? desired result : age 1 - 0 people age 2 - 1 people . . . age 20 - 314 people age 21 - 30 people . . . age 25 - 47 people . . age 120 - 1 people you don't want 1 query each age. assuming have query can calculate age nearest year, can count with select (..expression..) "age", count(*) users group "age" if you're looking the (..expression..) compute ages, want close to extract(year current_date()) - extract(year birthdate) - if(date_format(current_date(),"%c%d") < date_format(birthdate,"%c%d"),1,0) but there other (probably more efficient) versions might prefer. ...

java - Is it possible to reference a field variable from .ui.xml initialized in constructor? -

i trying pass paramter composite's ( registrationviewer ) constructor via uibinder/ui.xml. my view.ui.xml looks this: ... <ui:with field='registration' type='com.example.dto.registrationdto'/> ... <composites:registrationviewer ui:field="registrationviewer" registration="{registration}"/> ... my view.java looks this: ... @uifield @ignore public registrationdto registration; @uifield registrationviewer registrationviewer; public view(registrationdto registration) { this.registration = registration; initwidget(uibinder.createandbindui(this)); } my registrationviewer.java : private final registrationdto registration; @uiconstructor public registrationviewer(registrationdto registration) { this.registration = registration; initwidget(uibinder.createandbindui(this)); } however, fields of registration parameter null in registration...

axapta - Making Form's RealEditControl field editable in Dynamics AX -

in ecoresproductdetailsextended (released product details) form, want make volume editable in manage inventory fast tab's physical dimensions group. when form opened, in non editable mode. this field should made editable when volume updated in whsphysdimuom (physical dimensions) form. i tried setting property of corresponding field in init() method it's not working. please me. thanks in advance.

javascript - strict mode while using grouped category hichart plugin throws error -

i trying use http://www.highcharts.com/plugin-registry/single/11/grouped-categories i tried include strict mode inside grouped-categories.js following (function() { "use strict"; jquery.mynamespace.declare("viz.thirdparty.plugins.grouped_categories-master.grouped-categories"); // existing plugin code goes here }()); while plugin renders chart correctly while using non strict mode, throws following exception when try use along mode. typeerror: cannot assign read property 'parent' of accessories @ buildtree (plugins/grouped_categories-master/grouped-categories.js:90:18) @ buildtree any way clear error?

symfony - Disable birthdate choice field -

i have form field entering birthdate. $builder->add('birthdate', 'birthday', array('label' => 'birthdate', 'translation_domain' => 'messages', 'required' => false, 'widget' => 'choice')) in cases want disable birhtdate modifications in twig template, like. {{ form_row(form.birthdate.day, {'attr': {'disabled': true}}) }} {{ form_row(form.birthdate.month, {'attr': {'disabled': true}}) }} {{ form_row(form.birthdate.year, {'attr': {'disabled': true}}) }} this works fine, if render complete row in 1 statement like: {{ form_row(form.birthdate, {'attr': {'disabled': true}}) }} this don't disable birthdate field. have same issue? i solve issue , problem attributes not injected date_widget i ovewrite date_widget , fine. before modify it: {% block date_widget -%} {% if widget == 'single_text' %} {{- ...

java - Gson, how to deserialize array or empty string -

i trying deserialize json array of objects: [{ "name": "item 1", "tags": ["tag1"] }, { "name": "item 2", "tags": ["tag1","tag2"] }, { "name": "item 3", "tags": [] }, { "name": "item 4", "tags": "" }] my java class looks this: public class myobject { @expose private string name; @expose private list<string> tags = new arraylist<string>(); } the problem json's tags property can empty string or array. right gson gives me error: com.google.gson.jsonsyntaxexception: java.lang.illegalstateexception: expected begin_array string how should deserialize json? i not have control json, comes 3rd pary api. i not have control json, comes 3rd pary api. if don't have control on data, best solution create custom deserializer in opinion: class my...

vb.net - Exporting to Excel using ClosedXML.Excel and making a header row -

below snippet of function using export gridview excel , code merges range of cells, , formats text. make header row appear on every print page should user elect print worksheet. i'm thinking must configurable item, syntax please? dim xldoc new xlworkbook() xldoc.addworksheet("export") dim xlws ixlworksheet = xldoc.worksheets(0) xlws.row(1).cell(1).value = "some text" xlws.row(1).cell(1).style.fill.backgroundcolor = xlcolor.fromargb(255, 255, 102) xlws.row(1).cell(1).style.font.bold = true xlws.range("a1", "g1").merge() xlws.range("a1", "g1").style.border.outsideborder = xlborderstylevalues.thin xlws.range("a2", "g2").setautofilter()

ruby on rails - How to implement Ransack gem -

i'm trying have search form @ header of every web page search through names of "products" i tried implement ransack gem, not getting products filtered results. through below code, fetches products in database , displays. want display searched products. # routes.rb resources :product collection match 'search' => 'products#search', via: [:get, :post], as: :search end end # application.controller.rb before_filter :set_global_search_variable def set_global_search_variable @q = product.search(params[:q]) @product_search = @q.result end # application.html.erb <% search_form_for(@q, url: /search, method: :get) |f| %> <%= f.label :name %> <%= f.text_field :name %> <%= f.submit %> <% end %> # search_index.erb <% @product_search.each |product| %> <%= image_tag product.image_url %> <%= product.name %> <% end %> <% end %> view code = search_form_for @product...