Posts

Showing posts from March, 2011

ios - Update bottom view of uipagecollectionview's parent page -

i have uiviewcontroller abc, uipageviewcontroller pqr, uiviewcontroller xyz abc has pqr loads xyz, now abc has footer has reflected on click of button in xyz. see screenshot in here here order buttons in xyz, , bottom red color bar in pqr how can reflect values there. i hope clear question, let me know doubts explain again there number of ways can pass information xyz class pqr class. keep reference pqr in xyz, when button pressed can report action pqr. you can make use of various methods of passing information between classes indirectly. take @ answer , other answer on this question examples.

css "Image()" selector is a valid / widely implemented standard? -

i researching company project how repeat in background section of image (a sprite) without repeating image. i found css image() notation in standard . doesn't work on firefox 39 , don't find information of notation on internet. the document found in mdn , deleted in 2014. https://developer.mozilla.org/en-us/docs/web/css/image%28%29 anyone has information of notation? implementors, state of standard, etc. by looks of moved css4, new spec here there open issue on caniuse add image() it's data

java - Which is better: returning a Response object or an Object representing the rest resource? -

in books, rest apis return response object wraps other objects representing payload, status, etc. on other hand many of apis have seen , written return pojo (or call dto) json consumed client. this may opinion based, know better of 2 use on high scalability environment request result in success , others in failure/data not returned. i know if there accepted better practice. me designing apis , put things in perspective before team. ok question being closed if 'better of two' opinion based. thanks. update: 2 rest apis this. avoiding code @path, @get, @pathparam, @produces etc public response mycustomerobject(int id){...} this returns customer object wrapped inside response object. response error well. and approach below return customer entity directly: public customer mycustomerobject(int id){...} i vote api gives response object. allows control response within code , clear going response. , in cases want write response cannot represented pojo no...

php - how to use bindFunc method in redbeanphp? -

i working on project need work spatial object in mysql , choose redbeanphp orm system in project. found redbeanphp terrific , awesome. search in google , found this link bindfunc method can me in working spatial object cannot find example using method. how method work , how can use method? according database part of website linked: as of redbeanphp 4.1 can bind sql function column. useful wrapping values when reading / writing database. instance, use mysql spatial data types need prepare columns this: r::bindfunc( 'read', 'location.point', 'astext' ); r::bindfunc( 'write', 'location.point', 'geomfromtext' ); $location = r::dispense( 'location' ); $location->point = 'point(14 6)'; //inserts using geomfromtext() function r::store( $location ); //to unbind function, pass null: r::bindfunc( 'read', 'location.point', null ); this function added support spatial dataty...

angularjs - Closing a WebSocket properly -

when close websocket(ws.$close()) in angularjs application takes 40 seconds until closes , receive onclose event. using ng-websocket library . simple test code example: angular.module("mainmodule").controller("maincontroller", function ($scope, $http, $websocket, $rootscope) { $scope.dataimage = "#"; $scope.websocket = null; $scope.testwebsocket = function () { $scope.websocket = $websocket.$new({ url: 'ws://someurl', reconnect: true }); $scope.websocket.$on('$message', $scope.imagearrived); } $scope.closewebsocket = function () { $scope.websocket.$un('$message'); $scope.websocket.$close(); $scope.dataimage = "#"; } $scope.imagearrived = function (imagemessage) { console.log("image arrived"); $scope.dataimage = "data:image/gif;base64," + imagemessage.data; $rootscope.$...

What alternatives are there for creating a REST-full web service API based on JSON? -

we're creating web service , we'd 2 things: - json based - rest-full - how so, haven't decided we've implemented custom apis we'd follow standards, since @ point gets little crazy remember rules, exceptions, , undocumented parts creator forgot. are of using standards you've found useful? or @ least, alternatives? so far know of jsonapi , hal. these don't seem enough though, since we'd optimaly able to: + define, expose , update entities , relations between them + define, expose , invoke operations + small numbers of requests preferable, @ least "makes sense" (i'll leave blank check) [edit] apparently, there's odata too: http://www.odata.org/ are of using standards you've found useful? or @ least, alternatives? between own question , comments of big names have been mentioned. add json hyper schema: "json schema json based format defining structure of json data. document specifies hyperlink- , hy...

c# - Efficient IDE tools for F#? -

i initiated first f# project, using visual studio 2012. rather surprised (or, more precisely, disappointed) @ lack of ide support f#. example, classic ctrl-r ctrl-r shortcut refactor rename appears absent. installed f# powertools extension, provide support - apparently supports renaming in f# part of solution, , not e.g. c# parts of solution (the solution contains both f# , c# projects). are there extensions visual studio provides cross-language refactor rename functionality? in general, loose question, kind of ide and/or ide extensions people find efficient f# programming? i'm used efficient vs2012 refactoring support c# can't find absence considerable blow efficient use of f#...

php - Missing argument 2 error using db:seed -

i received project colleague , writing in laravel don't have experience in. tutorial able make database , tables plus data when using php artisian db:seed received same error twice telling me missing argument 2 illuminate\databas\eloquent\model:setattribute() , cannot find fault why decided ask here , because quite noob. ticket table create table if not exists `ticket` ( `idtickets` int(10) unsigned not null, `reference` varchar(255) collate utf8_unicode_ci not null, `subject` varchar(255) collate utf8_unicode_ci not null, `name` varchar(255) collate utf8_unicode_ci not null, `mail` varchar(255) collate utf8_unicode_ci not null, `content` longtext collate utf8_unicode_ci not null ) engine=innodb default charset=utf8 collate=utf8_unicode_ci; yes ticket table longer , has primary key, showing table in case. migration code: <?php use illuminate\database\schema\blueprint; use illuminate\database\migrations\migration; class createticketstable extends mi...

javascript - Data Not Visible With jqGrid Datatype JSON -

i trying bind json data jqgrid, grid empty. did made mistake code ? script: <table id="grid"></table> <div id="pager"></div> <script type="text/javascript"> var data = '{ "employees" : [' + '{ "firstname":"john" , "lastname":"doe" },' + '{ "firstname":"anna" , "lastname":"smith" },' + '{ "firstname":"peter" , "lastname":"jones" } ]}'; $("#grid").jqgrid({ datatype: 'json', colmodel:[ {name:'firstname', label: 'first name', width: 300}, {name:'lastname', label: 'last name', width: 200} ], caption: "reportingemployees", pager : '#pager', height: 'auto...

java - trim all String values in JsonNode -

i need trim string values { "startdate": "2015-06-29", "enddate": "2015-07-04", "category": "vip ", "name": " govind", age: 10, "place": " goa " } i doing by jsonnode json = request().body().asjson(); classname cl = json.fromjson(json , classname.class); and trimming in setter of classname suggest other approach because know not approach if can confirm json not have quotes within values better performance i'd trimming on raw text rather parsed version: val text = request.body.astext // regex explanation: // space followed asterisk means number of spaces // backward slash escapes following character val trimmed = text.map(_.replaceall(" *\" *", "\"")) import play.api.libs.json.json val json = json.parse(trimmed) java version: import play.api.libs.json.*; string text = request().body()...

reverse proxy - varnish backend VCC-compiler failed -

i want add varnish proxy infront of sx server have 2 droplets ip:192.168.0.100 ip: 192.168.0.101 both works in lan while restarting varnish shows compile error nano /etc/varnish/default.vcl # define our first nginx server backend nginx01 { .host = "192.168.0.100"; .port = "80"; } # define our second nginx server backend nginx02 { .host = "192.168.0.101"; .port = "80"; } # configure load balancer director nginx round-robin { { .backend = nginx01; } { .backend = nginx02; } } # when request made set backend round-robin director named nginx sub vcl_recv { set req.backend = nginx; } while restarting varnish shows error root@sproxy:~# service varnish restart message vcc-compiler: directors in directors vmod. ('input' line 30 pos 1) director nginx round-robin { ########-------------------- running vcc-compiler failed, exited 2 vcl compilation failed * syntax check failed, not restarting it ...

Caching remote files with python -

background we have lot of data files stored on network drive process in python. performance reasons typically copy files local ssd when processing. wish make happen automatically, whenever try open file grab remote version if isn't stored locally, , ideally keep sort of timer delete files after time. files practically never changed not require actual syncing capabilities. functionality to sum looking functionality for: keeping local cache of files/directories network drive, automatically retrieving remote version when unavailable locally support directory structure - is, files stored in directory structure on remote server should duplicated locally requested files ideally keep sort of timer expire cached files it wouldn't difficult me write piece of code self, when possible, prefer rely on existing projects typically give more versatile end result , make of own improvements available other users. question i have searched bit around terms python local file ...

c++ - Can I change the meaning of `int arr[N]` using `typedef` or `using`? -

how can write templated typedef or using , such that int arr[n]; is either std::vector<int> arr(n); /// c++03 or std::array<int, n> arr; /// c++11 i followed this answer . can write similar this template <std::size_t n> using int[n] = std::array<int, n>; or templated typedef template <std::size_t n> typedef int std::array<int, n> [n]; also, want same char[] , std::string . possible ? edit want do int arr[10]; // declare int array use std::vector arr.resize(20); ... // other methods std::vector class if mean want change meaning of int[n] std::vector or std::array … no, can't that. array-declarator notation int[n] fixed language construct , cannot re-purposed.

optimization - Optimize slow mysql query -

i'm using following query select list of users, query slow. explain me how can optimize query? thanks in advance. greetings fred. select crmuser.userid, crmuser.userfirstname, crmuser.userlastname, crmuser.usersekse, timestampdiff(year, crmuser.userbirthday,now()) age, crmuser.usertelephone, crmuser.useremail, crmuser.usercity, crmuser.userplaceofbirth, content_city.province, max(date_format(crmconnect.connectstamp, '%y-%m-%d')) laatstgesolliciteerd, timestampdiff(week, max(crmconnect.connectstamp),now()) laatsteactiviteit, count(distinct crmconnect.connectparent) jobs, sum(if(crmconnect.connectextra = 'interest', 1, 0)) interest, sum(if(crmconnect.connectextra = 'select', 1, 0)) prospect, sum(if(crmconnect.connectextra = 'winner', 1, 0)) winner crmuser left join content_city on (content_city.cityname = ...

Increasing the update rate of gst_element_query_position in GStreamer -

i busy creating wrapper library (for node.js) around gstreamer. have working player, , using interval request pipeline position (with percent formatting) every 200ms. my issue however, receive updated value every 1000ms. i calling gst_element_query_position (and have tried attaching pad gst_pad_query_position same result). is there way increase update rate of value retrieved gst_element_query_position in order present more granular time information? when calling gst_element_query_position , use gst_format_time on gst_format_percent . gst_format_percent deprecated. http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-gstformat.html#gstformat we use position in combination duration (from gst_element_query_duration ) , seems work fine more granular usage.

angularjs - ionic framework on transition of page or navigation displaying black screen -

i have been stuck on problem related ionic framework in , whenever click on slide menu befor page slide, dark black color occurring black box in iphone , ipad, , same happing each , every click of slide or transition or navigation. so body has solution regarding please let me know. thanks shivam add transparency background between view transition: [nav-view-transition][nav-view-direction] { background-color: transparent; } i added above css custom styles.css. also, remove abstract states , should fix black screen issue between navigation(s).

machine learning - OpenCV partition() underlying algorithm -

does know algorithm used here ? i want implement function detection's windows grouping. thank you. if @ opencv source code partition function, see following comments: // function splits input sequence or set 1 or more equivalence classes , // returns vector of labels - 0-based class indexes each element. // predicate(a,b) returns true if 2 sequence elements belong same class. // // algorithm described in "introduction algorithms" // cormen, leiserson , rivest, chapter "data structures disjoint sets" template<typename _tp, class _eqpredicate> int partition( const vector<_tp>& _vec, vector<int>& labels, _eqpredicate predicate=_eqpredicate()) { // ... etc. } this gives both source code, , reference algorithm. so, that's chapter 21 in book .

java - Error occurred in switching view in Fragment Navigation Drawer ,said no view found for fragment PlaceholderFragment -

i had created simple app via android studio using navigation drawer fragment. i trying show view (like layout_about.xml ) when user clicks item of listview . so use setcontentview() in public void onnavigationdraweritemselected(int position) when run it, error occurred : fatal exception: mainprocess: com.akakanch.sample, pid: 28848 java.lang.illegalargumentexception: no view found id 0x7f0c0050 (com.akakanch.sample:id/container) fragment placeholderfragment{250d0b42 #1 id=0x7f0c0050} here's place had change: mainactivity.java @override public void onnavigationdraweritemselected(int position) { // update main content replacing fragments fragmentmanager fragmentmanager = getsupportfragmentmanager(); fragmentmanager.begintransaction() .replace(r.id.container, placeholderfragment.newinstance(position + 1)) .commit(); setcontentview(r.layout.layout_about); } so, how can change view correct...

css - How to stop shrinking effect on header on scroll? -

i consider myself webdev noob , learn better messing around existing examples. i've been looking way of making navbar transparent transforms solid background upon scrolling down. found wanted in free template. has 1 feature dont want though - shrinks navbar upon scrolling , rather keep navbar same height. here code (my first attempt codepen dont laugh!): http://codepen.io/quanticspaz/pen/zgwxym // jquery collapse navbar on scroll $(window).scroll(function() { if ($(".navbar").offset().top > 50) { $(".navbar-fixed-top").addclass("top-nav-collapse"); } else { $(".navbar-fixed-top").removeclass("top-nav-collapse"); } }); // jquery page scrolling feature - requires jquery easing plugin $(function() { $('a.page-scroll').bind('click', function(event) { var $anchor = $(this); $('html, body').stop().animate({ scrolltop: $($anchor.attr('href')).offset().top }, 1500...

performance - Difference in speed between two MySQL servers -

i have 2 mysql servers. 1 master of other (actually master slave of server). both running on similar remote servers (same amount of ram). working fine except slave taking 2-3 times more time master server run same large query. can think of reason problem. if there writes (coming master) a , b , etc, select run slower on slave. how slower depends on far many things predict. to 'prove' that, (in slave) stop slave sql_thread; , run query; start slave sql_thread; . turn off writes select. but "fixing" it? if "writes" inserts, can 'batched'? is, insert multiple rows in same statement. may not 'solve' problem, mitigate it.

ssl - How to create certificate from keystore.jks and truststore.jks files -

i need authenticate two-way authentication. have 2 javakeystore files keystore.jks , truststore.jks use when authentication java client , want use python client needs .cer file . how can create certificate file jks files ? use command: keytool -export -alias keystore_alias -file your_cert.cer -keystore keystore.jks here keystore_alias alias of keystore. prompted keystore password, must know in order generate certificate. this website great reference various things can done java keystore files: https://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html

java - list item does not work in android studio -

after running application using android studio ,when clicked on list item nothing happen, wrong on code? package com.asaad.siag.asaad; import android.app.listactivity; import android.content.intent; import android.os.bundle; import android.view.view; import android.widget.arrayadapter; import android.widget.listview; import static java.lang.string.valueof; public class menu extends listactivity{ string classes[] = {"mainactivity", "example 1", "example 2", "example 3", "example 4" , "example 5", "example 6"}; @override protected void oncreate(bundle v){ super.oncreate(v); setlistadapter(new arrayadapter<string>(menu.this, android.r.layout.simple_list_item_1,classes)); } @override protected void onlistitemclick(listview l, view v, int position, long id) { super.onlistitemclick(l, v, position, id); string cheese = classes [position]; try { class ourclass = class.for...

git - lost local commit when checking out a remote branch -

i checked out master branch, , did changes. committed changes on master branch did not push repository. what did next check out remote master again. not see local commit anymore. how local commit back? you need reset head . use following revert previous commit. git reflog this give list of commits head values. choose head commit made local master branch. then, following, git reset --hard head@<i>

php parse_ini_file error parsing empty Line -

i'm using parse_ini_file long time, gives wired error. config.ini [database] host = "xxx" databasename = xxx user = xxx password = xxx typ = xxx [sql] useragentscountbyclicksnobots = "select ua.user_agent clicks c join user_agents ua on ua.id=c.user_agent_id ua.is_bot = 0;" useragentscountbyclicks = "select ua.user_agent clicks c join user_agents ua on ua.id=c.user_agent_id;" targetcountbyclicksnobots = "select t.url clicks c join target t on t.id=c.target_id join user_agents ua on ua.id=c.user_agent_id ua.is_bot = 0;" targetcountbyclicks = "select t.url clicks c join target t on t.id=t.target_id;" [views] useragents[title] = "useragent" useragents[description] = "benutzte browser in denen der link geklickt wurde" useragents[sql][bots] = "select ua.user_agent name clicks c join user_agen...

android - How to programmatically setting style attribute in a view -

i'm getting view xml code below: button view = (button) layoutinflater.from(this).inflate(r.layout.section_button, null); i set "style" button how can in java since want use several style each button use. generally can't change styles programmatically; can set of screen, or part of layout, or individual button in xml layout using themes or styles . themes can, however, be applied programmatically . there such thing statelistdrawable lets define different drawables each state button can in, whether focused, selected, pressed, disabled , on. for example, button change colour when it's pressed, define xml file called res/drawable/my_button.xml directory this: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/btn_pressed" /> <item andro...

Preemptive Authentication with HttpClient 4.3 and Solr 5 -

i tried doing preemptive authentication basic auth protected solr using class https://subversion.jfrog.org/jfrog/build-info/trunk/build-info-client/src/main/java/org/jfrog/build/client/preemptivehttpclient.java , solr , methods deprecated not know if problem. situation in querying fine in solr indexing getting ioexception occured when talking server at: example.com:8983/solr/core1 . the httpsolrclient constructor requires httpclient parameter preemptive authorization class above since httpclient stored in private variable used getter on variable httpclient , pass httpsolrclient constructor. not sure if did right either. preemptiveauthenticate preemp = new preemptiveauthenticate("username", "password", 1); defaulthttpclient httpclient = preemp.gethttpclient(); system.out.println("made connectsolr after set authentication"); solrclient solr = new httpsolrclient(urlstring, httpclient); i aware of examples http://hc.apache.org/httpcompon...

How can I free automatically multiple malloc in C? -

i'd free automatically multiple malloc ed memory @ end of program in c. for example : str1 = malloc(sizeof(char) * 10); str2 = malloc(sizeof(char) * 10); str3 = malloc(sizeof(char) * 10); i don't want function : void my_free() { free(str1); free(str2); free(str3); } but function free memory allocated during program. but function free memory allocated during program. there's no such function in c. c doesn't memory management automatically. it's responsibility track memory allocations , free them appropriately. most modern operating systems (perhaps, not embedded systems) reclaim memory allocated during execution @ process termination. can skip calling free() . however, if application long running 1 become problem if keeps allocating memory. depending application, may devise strategy free memory appropriately.

haskell - How to insert a list in a list in all possible ways? -

i trying enumerate possible merges of 2 lists. in example inserting "bb" "aaa" like ["bbaaa", "babaa", "baaba", "baaab", "abbaa", "ababa", "abaab", "aabba", "aabab", "aaabb"] what did this import data.list insert'' :: char -> string -> [(string, string)] -> string insert'' _ _ ([]) = [] insert'' h b ((x, y):xs) = (x ++ [h] ++ (insert' (b, y))) ++ (insert'' h b xs) insert' :: (string, string) -> string insert' ([], ys) = ys insert' (xs, ys) = insert'' h b lists h = head xs b = tail xs lists = zip (tails ys) (inits ys) this returns ("aaa", "bb") "bbaaababaaabaababbaababaababbabababb" a concatenated string, tried making list of strings, cannot wrap head around function. seems infinite type construction. how rewrite function, retu...

jquery - Change the class name of a cell in handsontable -

i want change class name of "td" in handsontable. use jquery "addclass". in css file, have specified color class name. my css : .error { background-color : red; color : blue; } and jquery code : <script type="text/javascript"> $(document).ready(function(){ $('#submit_button_essai').click(function(){ var td; td=(hot.getcell(1,1)); $(td).addclass("error"); $.post("ajax_insert_essai.php",{arr:data_essai}, insert_essai_callback); }); }); i don't know how can assign class name 1 cell ! somemone can me please ? there's easy way since handsontable built use case in mind! you want use customrenderer option of cells attribute. apply renderer matching cells , fun stuff inside renderer. here how: start defining renderer: function customrender(instance, td, row, col, prop, value, cellproperties) { ...

ios - Returning from a block - Objective C -

i have class method containing block, of afnetworking in want return 1 dictionary variable, code shown below: +(nsmutabledictionary*) getfromurl:(nsstring*)url parameterspassed:(nsdictionary*)parameters; { afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; __block nsmutabledictionary *resultarray; [manager get:url parameters:parameters success:^(afhttprequestoperation *operation, id responseobject) { nslog(@"json: %@", responseobject); nsmutabledictionary *resultarraytwo = (nsmutabledictionary *)responseobject; resultarray = resultarraytwo; } failure:^(afhttprequestoperation *operation, nserror *error) { nslog(@"error: %@, %@", error, operation.responsestring); uialertview *alertview=[[uialertview alloc] initwithtitle:@"message" message:@"try again" delegate:nil cancelbuttontitle:@"ok" otherbuttontitles: nil]; [a...

c# - EF6 ToListAsync does not run async but blocks the thread -

to increase page performance wanted run few queries asynchronously. upgraded ef6 because natively supports feature exposing async methods. couldn't queries fire simultaneously boiled code down simple example : var sw = new stopwatch(); sw.start(); var dummy = context.set<ca_event_person>().take(200).tolistasync(); sw.stop(); logger.debug("attempt nr 1 : " + sw.elapsedmilliseconds); var result = await dummy; my exception stopwatch instantly stop since i'm doing await @ later point. logger says 5000 milliseconds have passed on stopwatch meaning call performed synchronous instead of asynchronous. got insight in why or doing wrong? anyone got insight in why or doing wrong? is first call ef in application? timing one-off building of internal representation of ef model? with more complex ef model there significant overhead on first call. 1 off (per app domain) cost. better time number of calls (and throw away shortest , longest times). ...

jquery - How to add the `active` class on click of `li` element -

i quite new angularjs. need know how handle scenario using it. i have array values. using ng-repeat iterate array , works fine. requirement how add class( active ) first child of ul , whenever user clicks, clicked element should active class , remove the active class rest of li elements. i've done in jquery like: $('li').addclass('active').siblings().removeclass('active') but how achieve same here? my code : javascript controller var myapp = angular.module("myapp", []); myapp.controller("main", function ($scope) { $scope.items = [1,2,3,4,5]; $scope.activate = function (item) { //how active item? //onload how add class on first li? } }) html <ul> <li ng-click="activate(item)" ng-repeat="item in items"> {{item}} </li> </ul> live demo how this. store current active item in controller , apply class if one. html ...

android - Create one AsyncHttpClient for each request, or to create one client for all requests -

i'm using android asynchronous http client . which 1 true: create 1 asynchttpclient each request, or create 1 client requests. now have 1 singltone requesthelper this: private requesthelper() { mcontext = myapplication.getcontext(); baseurl = mcontext.getstring(r.string.base_url); } public static requesthelper getinstance() { if (instance == null) { instance = new requesthelper(); } return instance; } public void performloginrequest(string username, string password, gsonhttpresponsehandler gsonhttpresponsehandler) { asynchttpclient client = new asynchttpclient(); attachheaders(client); client.post(mcontext, baseurl + "/login", null, "application/json", gsonhttpresponsehandler); } public void getcountries(gsonhttpresponsehandler gsonhttpresponsehandler) { asynchttpclient client = new asynchttpclient(); client.get(mcontext, baseurl + "/countries", null, gsonhttpresponsehandler); } you can...

ruby - How to schedule a worker for a time in an specific Time zone in Rails? -

i have form 3 fields: date time time zone users schedule task customers in country, means, in time zone. so, fill form telling: i want task executed @ 12/08/2015, @ 15:00 in london time zone i have these 3 params , don't mind user @ moment or from. want transform 3 fields information in utc date. how can transform fields in unique utc date? to explicitly specific timezone instance, use activesupport::timezone::[] , call activesupport::timezone#parse create timewithzone instance within timezone: time = activesupport::timezone['london'].parse('12/08/2015 15:00') #=> wed, 12 aug 2015 15:00:00 bst +01:00 or using activesupport::timezone#local : time = activesupport::timezone['london'].local(2015, 8, 12, 15, 0) #=> wed, 12 aug 2015 15:00:00 bst +01:00 calling timewithzone#utc returns time instance in utc: time.utc # => 2015-08-12 14:00:00 utc activesupport provides time::use_zone set time.zone inside block: ...

jquery - Handling inline-block spaces with javascript -

we know ages old problem white spaces between inline-block elements. example: .wrapper div {width:100px; height:30px; display:inline-block; border:1px solid #333;} <div class="wrapper"> <div></div> <div></div> <div></div> <div></div> </div> the best solution in opinion remove spaces between elements: .wrapper div {width:100px; height:30px; display:inline-block; border:1px solid #333;} <div class="wrapper"> <div> </div><div> </div><div> </div><div> </div> </div> can on ready html javascript/jquery, adding script first snippet behave second one? sort of $('.wrapper').minify(); function. edit someone suggested possible duplicate how minify html css , javascript? . question reducing page size editing files on server side. here i'm looking solution minifi...

android - Apache of type java.lang.string cannot be converted to JSON object -

when send request got response in html format 07-08 03:27:56.447: d/log_tag2.0(2383): out side catch error converting result apache tomcat/7.0.55 - error report http status 405 - request method 'post' not supported type status report message request method 'post' not supported description specified http method not allowed requested resource. apache tomcat/7.0.55 07-08 03:27:56.447: d/log_tag3(2383): inside catch error parsing data org.json.jsonexception: value apache of type java.lang.string cannot converted jsonobject how can solve problem ? your question not clear. 405 when not have configured webservice. since use tomcat, might have not defined service in pom.xml probably. make post request through browser first, check if server working or not.

bpel - adding custom workflow extensions to Wso2 API manager -

i have started working on wso2 api manager , have added user signup workflow following on link : https://docs.wso2.com/display/am180/adding+a+user+signup+workflow it pretty simple , straightforward, thing is, in case admin user. once send signup request, manually log on workflow-admin console , approve request , once approve request can login api store. in typical production environment, admin user must kind of email notification can approve/reject login once request approved. how achieve kind of scenario wherein user email notification once his/ request has been approved admin notification once request sent? i have checked adding workflow-extension module in documentation: https://docs.wso2.com/display/am180/adding+workflow+extensions but i'm still trying figure out. looking forward help. as far know current release of business process server doesnt have support email notifications humantasks. available next release of business process server (v3.5). work ar...

javascript - Browswerify compiling to full paths even when fullPaths is set to false -

i have following gulp task: var source = require('vinyl-source-stream'), gulp = require('gulp'), browserify = require('browserify'), reactify = require('reactify'), notify = require('gulp-notify'); var sourcesdir = './react', appentrypoint = "req.jsx", targetdir = './build'; gulp.task('default', function() { return browserify({entries: [sourcesdir + '/' + appentrypoint], fullpaths:false, debug: true}) .transform(reactify) .bundle() .pipe(source(appentrypoint)) .pipe(gulp.dest(targetdir)) .pipe(notify("bundling done.")); }); gulp.task('watch', function() { gulp.watch(sourcesdir + '/' + "*.jsx", ['default']); }); when go build folder , see built file. contains full paths of js files. how prevent that?

C programming for changing all capital letters and changing all lower letters -

this code #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> char chacap(char n); int main() { char ch,a; printf("enter sentence\n"); while((ch=getchar()) != '\n') { chacap(ch); printf("%c",a); } printf(" \n"); return 0; } void chacap(char n) { if(n >= 'a' && n <='z') n-=32; } i need ask user enter sentence convert sentence capital letters , print convert sentence lower case letters , print convert each character if upper lower , vice versa. i made changing capital letters, couldn't make lower , vice versa. when made code 2. , 3, getchar() became nothing... use tolower() function : while((ch=getchar()) != '\n') { printf("%c", tolower(ch)); }

python - Django App - Getting Initial Rows into Database -

i have django application , have few rows want in application @ beginning of time. example system settings table has settings - should setup db instance constructed. in past, had handled making migration script manually inserted records. however, when run tests , database created , deleted, these scripts not run again , database empty. tests assume migrations have schema migrations, don't need run them again, not case. has led me think maybe migrations shouldn't data migrations , should rethink process? not sure do. you maybe use fixtures in tests initial data models. https://docs.djangoproject.com/en/1.8/howto/initial-data/

ios - Error itms 90086 while submitting app to itunes connect? -

Image
i tried changing architectures standard architectures , set build active architectures "no", added armv7,arm64,armv7s valid architectures both project , target.but still error 90086. appreciated. they should set following :

asterisk - Creating a web app on django with phone calls functionality -

so i'm developing piece of software allow user call number wants right website. need in choosing correct platform or semi cheap service use. guess need solution open api because want make db entry (want record duration , date) every call made website. i've started research , stumbled upon couple of open source solutions: asterisk , freeswitch . trying them out right now, still have poor understanding of how sip works. if softphone user have need install on pc or there server solutions one possible solution works sip server use pjsua python bindings , implement in python basic softphone. web application seen sip server regular soft phone , server configuration easier.

Checking how CMake tags different C++ compilers -

since must link different version of libraries depending on compiler, trying figure out how cmake tags different compilers, can write appropriate conditionals. therefore have put these lines @ top of cmakelists.txt : cmake_minimum_required(version 3.2) message(status "using ${cmake_cxx_compiler_id} ${cmake_cxx_compiler_version}") but above lines print just: -- using you have check c++ compiler first. can either add project(myproject cxx) or check_language(cxx)

pointers - Unknown Output of C code -

how following code give answer 2036, 2036, 2036. what output of following c code? assume address of x 2000 (in decimal) , integer requires 4 bytes of memory. int main() { unsigned int x[4][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}}; printf("%u, %u, %u", x+3, *(x+3), *(x+2)+3); } as you've found out, people can bit harsh on if don't post crafted code. print addresses, use either %p or macros <inttypes.h> such prixptr , casts uintptr_t . using %p , code should read: #include <stdio.h> int main(void) { unsigned int x[4][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 } }; printf("%p\n", (void *)x); printf("%p, %p, %p\n", (void *)(x+3), (void *)(*(x+3)), (void *)(*(x+2)+3)); return 0; } now have defined behaviour, though values won't convenient 2000 , 2036. however, x+3 address of fourth array of 3 in...

php - Server responding very slow to PHPMailer gmail SMTP -

i using example code provided in phpmailer. firstly, code executes slow (atleast 1-2 minutes of loading in browser) , gives me errors. <?php /** * example shows settings use when sending via google's gmail servers. */ //smtp needs accurate times, , php time zone must set //this should done in php.ini, how if don't have access date_default_timezone_set('etc/utc'); require 'phpmailer/phpmailerautoload.php'; //create new phpmailer instance $mail = new phpmailer; //tell phpmailer use smtp $mail->issmtp(); //enable smtp debugging // 0 = off (for production use) // 1 = client messages // 2 = client , server messages $mail->smtpdebug = 2; //ask html-friendly debug output $mail->debugoutput = 'html'; //set hostname of mail server $mail->host = 'smtp.gmail.com'; //set smtp port number - 587 authenticated tls, a.k.a. rfc4409 smtp submission $mail->port = 587; //set encryption system use - ssl (deprecated) or tls $mail->...

java ee - Letting the presentation layer (JSF) handle business exceptions from service layer (EJB) -

the ejb method (using cmt) updates entity supplied : @override @suppresswarnings("unchecked") public boolean update(entity entity) throws optimisticlockexception { // code merge entity. return true; } this throw javax.persistence.optimisticlockexception , if concurrent update detected handled precisely caller (a managed bean). public void onrowedit(roweditevent event) { try { service.update((entity) event.getobject()) } catch(optimisticlockexception e) { // add user-friendly faces message. } } but doing makes additional dependency javax.persistence api on presentation layer compulsory design smell leading tight-coupling. in exception should wrapped tight-coupling issue can omitted in entirely? or there standard way handle exception in turn not cause service layer dependencies enforced on presentation layer? by way, found clumsy catch exception in ejb (on service layer itself) , return flag value client (jsf). crea...

c# - Convert format of datetime to another format of datetime -

my code parses raw data , turns datetime string format such below string birthday = "20" + year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + second; so birthday string , converted datetime format such below datetime bdaylater= convert.todatetime(birthday); the result became 1 below 7/8/2015 5:02:05 in wanted convert 1 below 2015/07/08 05:02:05.000 how can achieve such result. thanks. you should format date variable before printing same string birthday = "2015" + "-" + "07" + "-" + "08" + " " + "05" + ":" + "02" + ":" + "05"; datetime bdaylater= convert.todatetime(birthday); console.writeline(bdaylater.tostring("yyyy/mm/dd hh:mm:ss.mmm")); this give o/p 2015/07/08 05:02:05.02 fiddle example if want 000 in millisecond string "yyyy/mm/dd hh:mm:ss.00...

jquery - Onchange 2 fields in JavaScript widget -

Image
i need use onchange function in javascript widget i have 2 fields in javascript widget - 1st(account refer contracts) , - 2nd (task refer customers) , want use onchange between them i want change account field based on task field, when choose customer should load contracts of customer only. anyone face before? give me examples? here javascript code: openerp.net2do_elkamel = function (instance) { var module = instance.hr_timesheet_sheet module.weeklytimesheet = module.weeklytimesheet.extend({ events: { "click .oe_timesheet_weekly_account a": "go_to", "click .oe_timesheet_weekly_task a": "go_to_partner", }, go_to_partner: function (event) { var id = json.parse($(event.target).data("cus-id")); this.do_action({ type: 'ir.actions.act_window', res_model: "res.partner", res_i...

Trying to configure Logstash to use a proxy with LS_JAVA_OPTS but it doesn't seem to work -

elastic running on windows server 2012 r2 vm in azure. vm1: running in hyper-v on workstation windows server 2012 r2. no proxy vm2: setup in protected domain windows server 2012 r2; requires proxy my logstash config (my.config) has output definition: elasticsearch { host => "myhost.cloudapp.net" cluster => "mycluster" document_type => "%{type}" index => "%{index}_%{+yyyy.mm.dd}" template_name => "%{index}" document_id => "%{id}" protocol => "http" } vm1 can load data elastic search host fine zipped logstash folder vm1 , copied vm2 , extracted it. created start.bat file placed in \logstash\bin cls set java_home=d:\jdk set ls_java_opts=-dhttp.proxyhost=myproxy.mydomain.com -dhttp.proxyport=8080 logstash.bat agent -f my.conf when running on vm2, following produced in command prompt window: io/console not supported; tty not manipulated failed install te...

javascript - Converting a Plain JQuery project to Require JS project -

i have developed jquery project multiple pages dozens of js scripts, things became unmanageable , i'm getting lost in thousands of lines of code. i'm cleaning , refactoring whole structure , i'd organize project require js. basically pages depend on jquery.js, bootstrap.js, app.js and each page depends on other specifics scripts (moment.js etc...) let's have structure : / header.html (all css files etc..) footer.html (the global app.js file , other scripts : jquery / bootstrap etc...) page1.html (depends on app.js page2.html page3.html page4.html page5.html js / app.js require.js libs / jquery.js bootstrap.js moment.js knob.js fileuploader.js pages / page1.js (depends on jquery , bootstrap , moment.js) page2.js (depends on jquery , bootstrap , knob.js) page3.js (depends on jquery , bootstrap , fi...

Grails shell not functional in Grails 3.0.2? -

grails builds using gradle --which great-- side effect seems shell no longer works? when run $ grails shell it doesn't appear allow me type input, , cursor stuck on grade's building line. groovy shell (2.4.3, jvm: 1.8.0_45) type ':help' or ':h' help. ---------------------------------------------------------------------------- groovy:000> > building 83% > :shell i've had problem trying make interactive groovy scripts build in gradle - there workaround? grails inherited bug springboot. fixed , packed in grails 3.03 probably. till recommend using grails console instead. open swing ui , have same environment grails shell.

mysql - Error when writing a conditional query (ternary) -

i have 2 parameters $p{param1} , $p{param2}. $p{param1} 1 prompts when query being executed. $p{param2} contains conditional query when $p{param1} null, show records, else choose id matches parameter. here conditional query $p{param2}: $p{param1}.equals(" ") ? "select * tablerecords" : $p{param2}.equals($p{param1}) the problem when try execute query , ask parameter1 , example put 2 (which id), query says "the document has no pages" , when try put 1,2,3 query returns records. this sql query in main report way: select c.id, p.lastname, p.firstname person_tbl p,code_tbl c $p!{param2} , p.id=c.id order 1; the $p{param1} value id