Posts

Showing posts from March, 2011

android - Recyclerview selected item highlight not works -

i have used recyclerview swipe delete undo library . works fine,but recycler view item selection not works. tried change background color of selected list item.but not works. how show selected item without affecting swipe delete option? mistake have done on following code? myactivity.java: mylistadapter = new mylistadapter(this,null); mrecyclerview.setadapter(mylistadapter); final swipetodismisstouchlistener touchlistener = new swipetodismisstouchlistener( new recyclerviewadapter(mrecyclerview),new swipetodismisstouchlistener.dismisscallbacks() { @override public boolean candismiss(int position) { return true; } @override public void ondismiss(viewadapter viewadapter, int position) { //mrecyclerview.removeviewat(position); } }); mrecyclerview.setontouchlistener(touchlistener); // setting scroll listener required ensure during listview scrolling, // don't swipes. mrec...

redis - How to determine number of clients listening for broadcasting? -

i using laravel 5.1 , want know how many clients listening particular channel test-channel. want number on server? there way can it? further using broadcasting redis. the link broadcasting document follows: laravel 5.1 event broadcasting there command in redis. check out pubsub numsub: returns number of subscribers (not counting clients subscribed patterns) specified channels. and pubsub numpat: returns number of subscriptions patterns (that performed using psubscribe command). note not count of clients subscribed patterns total number of patterns clients subscribed to. edit: it's worth noting publish command returns number of receivers: return value integer reply: number of clients received message.

java - Validation on Redirect -

validation.java try { conn = dsevent.getconnection(); string usercheck = "select * customer"; stmt = conn.createstatement(); rs = stmt.executequery(usercheck); while(rs.next()){ if((email.equals(rs.getstring("email")))&&(password.equals(rs.getstring("password")))) { requestdispatcher rd = req.getrequestdispatcher("/success.jsp"); rd.forward(req,res); } else { req.getsession().setattribute("error", "the email or password entered incorrect. please try again"); res.sendredirect(this.getservletcontext().getcontextpath() + "/index.jsp"); } } } catch (sqlexception ex) { system.err.println(ex); } } index.jsp <body> <h2>system</h2> <p style ="color:red"><%=session.getat...

android - Cardview not allowing child views -

Image
anyone know why not allowed put child views in card view? lint (i think) throwing fit when try fill cardview content. a bit late party i've had same problem , fix seems to add line in build.gradle file, sync project. way gradle/android studio knows cardview , how provide hints: compile 'com.android.support:cardview-v7:26.0.+'

Old school ascii shellcode -

this part of ascii shellcode set eax @ 0 , instruction (%...). in debugger , in pratice pic code work time why? , instruction algorithme is: operand target ← operand target ∩ operande source flag cf ← 0 flag of ← 0 it's possible eax register not set 0 if previous value of eax not good? #include <stdlib.h> int main() { asm("\ , eax, 0x454e4f4a;\ , eax, 0x3a313035;\ "); return 0; } compilation line: gcc -m32 -w -wall -std=gnu99 -masm=intel -g eaxzero.c -o eaxzero gdb instruction: (gdb) b 5 .. (gdb) r .. (gdb) x/i $eip .. (gdb) x/x $eax .. (gdb) nexti .. (gdb) x/x $eax .. (gdb) nexti .. (gdb) x/x $eax ..

python - How to use numpy.random.choice in a list of tuples? -

i need random choice given probability selecting tuple list. edit: probabiliy each tuple in probabilit list not know forget parameter replacement, default none same problem using array instead list the next sample code give me error: import numpy np probabilit = [0.333, 0.333, 0.333] lista_elegir = [(3, 3), (3, 4), (3, 5)] np.random.choice(lista_elegir, 1, probabilit) and error is: valueerror: must 1-dimensional how can solve that? according function's doc, a : 1-d array-like or int if ndarray, random sample generated elements. if int, random sample generated if np.arange(n) so following that lista_elegir[np.random.choice(len(lista_elegir),1,p=probabilit)] should want. ( p= added per comment; can omit if values uniform). it choosing number [0,1,2], , picking element list.

c# - Most efficient way of writing multi-select data to a SQL Server backend -

i've got multi-select listbox in asp.net front end using c#. want store data sql server table. do parse out data in code-behind , send data looping through insert statement c#? or more efficient send comma-delimited string sql server, use table-valued function , insert data table on end? if it's former, can provide sample code if multi-select field called "matchgender", i'm using userid , table it's being inserted called tblmatches? i'm not sure of c# code necessary loop through selected values in multi-select listbox.

dictionary - Jekyll - Scss map has not a valid value -

this scss map cause jekyll build fail (jekyll 2.5.3): $content_width: ( mobile: 100%, tablet: 500px, desktop: 800px ); i've got error: error: (mobile: 100%, tablet: 500px, desktop: 800px) isn't valid css value. afaik, it's valid scss map, why wouldn't jekyll accept it? first thought mixing percents , pixel point, i've got same error pixel values. where starts driving me crazy have map, accepted: $sq-breakpoints: ( mobile: 320px, tablet: 768px, desktop: 992px ) !default; i can copy/paste map, i'll error... any idea? oooookay... bad, stupid answer stupid question. it's written "valid css value" , , not "valid scss value". there hidden use of $content_width in scss files: img { max-width: $content_width; } this fail changed variable pixel value map. need use: img { max-width: map-get($content_width, desktop); }

unity3d editor - How to check unknown number of booleans c# -

i need check unknown number of booleans.. depending on result appropriate function. here example of i'm searching: if(bool[x] && bool[y] && bool[z] ...) myfunc(); you can use linq that. if need bools true, can use any : if (bools.all(b => b)) if need, example, 4 of them true, can use count : if (bools.count(b => b) == 4) or @ least one, there's any if (bools.any(b => b))

.htaccess RewriteRule url to new -

bonjour, i try redirect urls of website example : www.exemple.net/?p=2 www.exemple.net/index-2.html www.exemple.net/?p=35 www.exemple.net/index-35.html etc... so add lines .htacess : rewritecond %{query_string} ^(?)p=(.*)$ [nc] rewriterule .* /index-%1.html [l,r=301] but i'm redirected http://www.exemple.net/index-2.html?p=2 my .htaccess : rewriteengine on rewritecond %{http_host} ^exemple.net$ rewriterule ^(.*) http://www.exemple.net/$1 [qsa,l,r=301] rewritecond %{query_string} ^(?)p=(.*)$ [nc] rewriterule .* /index-%1.html [l,r=301] rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] can me please ? you need add question mark @ end of destination discard query string: rewriterule .* /index-%1.html? [l,r=301] alternatively, use qsd flag: rewriterule .* /index-%1.html [qsd,l,r=301]

SQL server Delete script order -

Image
my tables have following relations as can see firstentity can have multiple transactions related record. transaction divided 2 tables because represents inheritance hierarchy (table per type in entity framework). i need create script delete record firstentitytransaction , transaction given firstentityid . delete should follow following order: delete records firstentitytransaction delete records transaction delete record firstentity the problem when execute first delete ( firstentitytransaction ) not have way find related transactions transactionid. there way can save ids , execute second delete? edit: have modified post have more meaningful diagram below example inserts deleted entity transactions table variable, subsequently used delete transaction rows. declare @deletedmyentitytransaction table ( transactionid int ); delete dbo.myentitytransaction output deleted.transactionid @deletedmyentitytransaction myentityid = @myentityid; delet...

for loop - Index of an array from a 2d np.array in Python? -

this question has answer here: numpy index value true 2 answers i have problem find index 2d np.array() . if-loop computing time high algorithm. need numpy func find index array. function np.where() doesn’t me.. abstraction: >>> conditions = [[0 0 0 0 4] [0 0 0 0 3] [0 0 0 0 2] ..., [2 1 3 4 2] [2 1 3 4 1] [2 1 3 4 0]] >>> = [0, 0, 0, 0, 2] >>> index = np.where(conditions==a) if use so, although have column , row indices, can not interpret them. need concrete index value, example index = 2 . >>> np.where((conditions == a).all(axis=1))[0] array([2])

c# - Is there any good alternative struct for using inside switch case? -

i have switch case showing text in program. wonder can use dictionary or enum numbers , texts? or using switch case this? string result; int number = int.parse(console.readline()); switch (number) { case 1: result += "ten"; break; case 2: result += "twenty"; break; case 3: result += "thirty"; break; case 4: result += "fourty"; break; case 5: result += "fifty"; break; case 6: result += "sixty"; break; case 7: result += "seventy"; break; case 8: result += "eighty"; break; case 9: result += "ninety"; break; default: result += ""; break; } it's little less verbose use dictionary{int,string} in scenario: var dictionary = new dictionary<int, string>(9) { {1, ...

design patterns - Where to apply domain level permissioning -

permissioning/authorization (not authentication) cross-cutting concern, think. in onion architecture or hexagonal architecture, should permissioning performed? examples of permissioning required be: filtering data returned front end (ui, api, or otherwise) validating business operation can performed @ all ideally, via single responsibility principle, code performs business operations , returns data shouldn't need aware of user's permissions @ all. implementations of functionality should know how perform business operations or query repository or domain service - that's it. would wrapper/facade implementing same interface class performing business operation or returning data place put permissioning? or there better way? also, if best practice permission activity, not role, still valid permissioning should performed service purpose return data? one argue access checking should close code performs operation possible reduce chance can find side-channel...

python - SQLAlchemy-friendly UPDATE instead of INSERT trigger -

i have authtoken table associated authtokenhist table record state changes in authtoken. make transparent model's user there archiving going on however. so, ideally, create new authtokens using same pk of existing authtoken , database update row in authtoken , create new row in authtokenhist when authtoken has entry pk. i realize i'm asking close upsert, i'm on old postgresql version no support upserts. also, sqlalchemy's point of view, user think they're constructing new authtoken when they're update-ing existing one. i've tried doing insert trigger deletes existing authtoken, inserts row authtokenhist , returns new. can't past sqlalchemy session though prohibits having 2 objects same pk in same session flusherror: new instance <authtoken @ 0x3f51150> identity key (<class 'models.authtoken'>, (15l, u'c41ffcc3-5dbc-4042-a990-0c 18020cf77b')) conflicts persistent instance <authtoken @ 0x3f61350>

regex - How do I JSON_encode a dictionary in python? -

value = re.findall(b,'some regex',respdata) keywords = re.findall(b,'some regex',respdata) #empty dictionary dictionary = {} x=0 eachvalue in value: dictionary[eachvalue] = keyword[x] x+=1 print(dictionary) after this, want json encode dictionary in "value:keyword" format, suggestions on how this? thank in advance python has module json : value = re.findall('some regex',respdata) keywords = re.findall('some regex',respdata) print json.dumps(dict(zip(value, keywords)))

javascript - jquery cycle divs randomly then add class and remove after delay -

i'm trying cycle through series of div @ random. each time selects div adds class of .active-key removes again , moves onto div after amount of time. there way in jquery? <div id="keyboard"> <div class="key"> <div class="key active key"> <div class="key"> <div class="key"> <div class="key"> <div class="key"> </div> var divs = $('#keyboard .key ').addclass('active-key'), = 0; (function cycle() { divs.eq(i).show(0) .delay(1000) .removeclass('active-key'); = ++i % divs.length; })(); if working svg have use attr instead of class. js fiddle final working svg example for random items selection can try this: var divs = $('#keyboard .key'); (function cycle() { settimeout(function() { var index = math.floor(math.random() * divs.length); divs.removeclass(...

c++ - Instance Variables Not Updating -

when run little game, battle commences after every turn, players attack health doesn't go down (i.e. game never ends , keeps printing same health on , over). know has inflictdamage system. can see error? #include <iostream> #include <string> #include <iomanip> #include <cmath> #include <ctime> #include <cstdlib> #include <vector> #include <limits> using namespace std; class hulk { private: string playername; string color; double weight; //in kilograms double height; //in centimeters double health; int strength; int speed; vector<char> moveset; public: hulk(const string& playername, string color): playername(playername), color(color) { this->weight = 500.0; this->height = 200.0; this->health = 110.0; this->strength = 200; this->speed = 50; moveset.push_back('p'); movese...

winapi - Get the position of the control in the Windows openfile dialog -

i application, have added dropdown box standard windows file open dialog. works fine, position drop box below file name , file mask edit controls, , label below labels these controls. how can positions of these controls , corresponding labels (it depends on windows version , maybe on theming, using constants make dialog fine on computer won't do)? on vista+, should using ifiledialog , ifileopendialog , ifiledialogcustomize interfaces: common item dialog customizing dialog you can use ifiledialogcustomize::addtext() , ifiledialogcustomize::addcombobox() methods add drop-down list , label dialog, , if needed use ifiledialogcontrolevents::onitemselected event react user selecting items in drop-down list. however, cannot decide custom controls displayed when customizing dialog. ui layout controlled dialog itself: the common item dialog implementation found in windows vista provides several advantages on implementation provided in earlier versions: .....

javascript - get select value angularjs without ng-repeat -

<select ng-model="list"> <option value="1">first</option> <option value="2">next</option> </select> how selected option using angularjs? of case see use ng-repeat how selected option when didn't use ng-repeat? i console.log($scope.list) got undefined. here example angular documentation: plunker it shows how done. <select ng-model="model.id" convert-to-number> <option value="0">zero</option> <option value="1">one</option> <option value="2">two</option> </select> link updated!

android - Restoring state of TextView after screen rotation? -

in app have textview , edittext . both have data in it. when screen orientation changes data in edittext remains, textview data cleared. can 1 me out find way retain data in textview too? if want force textview save state must add freezestext attribute: <textview ... android:freezestext="true" /> from documentation on freezestext : if set, text view include current complete text inside of frozen icicle in addition meta-data such current cursor position. default disabled; can useful when contents of text view not stored in persistent place such content provider

Updating a record using a class object with Entity Framework in C# -

i have entity class includes many fields. make simple, let's assume class defined following: public partial class branches { public int num { get; set; } public string name { get; set; } public string street { get; set; } public string city { get; set; } in api class, want define function updating record of type. creating function update each field separately seems quite overhead application, decided define 1 function updates fields. can assign object received function directly object used update following? void updatebranch(branches branch) { using (var dbcontext = new entitiescontext()) { var result = dbcontext.branches.singleordefault(b => b.num == branch.num); if (result != null) { **result = branch;** dbcontext.savechanges(); } } } i'm using entity framework version 6.0 yes can use it, following code void updatebranch(branches...

SoapUI (Ready! API) uses same HTTP Authorization for Proxy -

when setting proxy settings manually in soapui (ready! api) smartbear, uses same settings http authorization server, leading 407 - auth required proxy server. the same test using curl works perfectly: takes proxy username / password proxy-authorization header , params in --user authorization header. is bug or missing something? it known bug in both soapui , ready! api. workaround exists however. set proxy credentials. skip setting credentials on request. instead open header tab , add new header called authorization . take username , password in form username:password , base64 encode it. set value of header basic base64string . example: if username user , password pass value should basic dxnlcjpwyxnz . this make request correct proxy-authorization , authorization headers.

javascript - Simplest BACKGROUND SCREEN ON-CLICK PICTURE CHANGE malfunction -

hey have found , adapted best simple script onclick background image change. works dream - highly recommended, reason cannot solve background picture rotation stops. it works fine 2 pictures, when added second 'function updateindex' add more pictures shows onclick following jpeg sequence: 100 - 101 - 102 - 100.. once goes first picture onclick doesn't work anymore. i able ad many pictures want picture rotation line up. any appreciated. <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>index</title> <style type="text/css"> html, body, #body { height: 100%; width: 100%; overflow-y: hidden; overflow-x: hidden; -webkit-background-size: cover no-repeat left top fixed; -moz-background-size: cover; -o-background-size: cover; background-size: cover; margin-top: 0px; margin-left: 0px; } #body.imageone { background-image: url("100.jpg...

c++ - boost spirit: how to instruct the parser to read whole input and then report the result -

i have minimal example of expression grammar (arithmetic expressions only) should succeed when complete input valid arithmetic expression. seems me parser reporting success when subsequence results start symbol of parser. template <typename iterator> struct expparser : qi::grammar<iterator, expression_ast(),ascii::space_type> { expparser() : expparser::base_type(aexp) { using qi::_val; using qi::_1; using qi::_2; using qi::_3; using qi::uint_; using qi::lit; using qi::alnum; aexp = tm >> +((lit("+") >> aexp)) | (tm >> +(lit("-") >> aexp)) | (tm >> +(lit("*") >> aexp)) | (tm >> +(lit("/") >> aexp)) | tm; tm = (uint_)[_val=_1]; } qi::rule<iterator, expression_ast(),a...

solr - Solr5 search not displaying results based on score -

i implementing solr search, search order not displaying on basis of score. lets if use search keywords .net ios it's returning results based on score. have field title holds following data keyskills:android, ios, phonegap, ios keyskills:.net, .net, .net, mvc, html, css here when search .net ios search keyword net, .net, .net, mvc, html, css should come first in results , score should higher because contains .net 3 times, getting reverse result. is there setting needs done in solr config file or in schema.xml file achieve or how can sort results based on max no of occurrence of the search string. please me solve this. following result get { "responseheader": { "status": 0, "qtime": 0, "params": { "indent": "true", "q": ".net ios", "_": "1434345788751", "wt": "json" } }, "response": { "numfound": 2, "start": 0...

android - I've got to create sound if you click the button. With my music file -

i've got create sound if click button. music file try one. button 1 = (button)this.findviewbyid(r.id.button1); final mediaplayer mp = mediaplayer.create(this, r.raw.soho); one.setonclicklistener(new onclicklistener(){ public void onclick(view v) { mp.start(); } });

php - drupal 8 error to render template twig with controller -

i trying render template controller not work show me error : logicexception: controller must return response ( hello bob! given). in symfony\component\httpkernel\httpkernel->handleraw() (line 163 of core/vendor/symfony/http-kernel/symfony/component/httpkernel/httpkernel.php). my function : public function helloaction($name) { $twigfilepath = drupal_get_path('module', 'acme') . '/templates/hello.html.twig'; $template = $this->twig->loadtemplate($twigfilepath); return $template->render(array('name' => $name)); } in drupal 8 either return response object or render array controller. have 2 options: 1) place rendered template response object: public function helloaction($name) { $twigfilepath = drupal_get_path('module', 'acme') . '/templates/hello.html.twig'; $template = $this->twig->loadtemplate($twigfilepath); $markup = $template->render(array('name' => $name)); ...

I've got audio samples; how to play them correctly with the SDL? -

i'm in process of writing simple frontend libretro cores, , i'm attacking audio part, hardest (i never ever dealt sound-related before, it's possible got totally wrong). the way works, libretro cores regularly call function prototyped such, have implement myself: typedef size_t (*retro_audio_sample_batch_t)(const int16_t *data, size_t count); the data parameter array of interlaced stereo data ( { left, right, left, ...} ), , count number of samples (so array element count count * 2). here these data: when libretro core sending me samples i concatenate them audio buffer when sdl calling audio callback method, i copy as requested , available audio buffer stream buffer if not enough data available, fill rest of stream buffer 0's if buffer has more data requested, remove played , keep rest however, isn't right. despite being recognizable, sound garbled , full of noise. i'm not sure might missing : seems retroarch frontend (the official fr...

php - Empty XPath result when it shouldn't be -

i have following simple html: <span class="myclass"> <strong>number</strong> : 9 </span> i want parse return: : 9 i'm trying following xpath i'm pretty sure correct i'm not getting text returned: $dom = new domdocument(); $dom->loadhtml($htmlasabove); $xpath = new domxpath($dom); $result = $xpath->query("normalize-space(//span/text()[last()])"); if($result->length > 0) { echo 'here '.$result->item(0); } else { echo 'nothing'; // returns every time } nothing wrong xpath, domxpath::query() unable return other node-set. executing xpath expression doesn't return node-set*, use domxpath::evaluate() instead : $result = $xpath->evaluate("normalize-space(//span/text()[last()])"); echo 'here '.$result; *: xpath normalize-space() function returns string eval.in demo output : here : 9

php - Please help me: modify iframe content -

i want modify iframe of source http://www.mtel.ba/imenik/index.php i want hide , choose 1 selected default value list. <div class="menu-list"> <select name="administrative_unit_id"> <option value="" selected="selected">svi gradovi</option> <option value='262'>banja luka (051)</option><option value='301'>bijeljina (055)</option> i want made phone book 1 city. possible? , how? try jquery , file contents .... thanks if site on cross domain use proxy page. create new php page that <?php echo '<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>'; //insert jquery here $file = file_get_content('http://www.mtel.ba/imenik/index.php'); echo $file; echo "<script>"; echo "";//jquery script here e...

c# - Bind datagrdview combobox when manually added -

bind datagrdview combobox column when manually added in datagridview the following code example demonstrates how bind collection of objects datagridview control each object displays separate row. how to: bind objects windows forms datagridview controls combobox datagridview in c#

ios - prepareForSegue UICollectionView not working (swift) -

i’ve tried push segue using uicollectionview (show image form masterview deatilview) not working. xcode doesn’t show error message. what’s wrong code. need advice. override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if segue.identifier == "showdetail" { if let indexpath = self.collectionview?.indexpathforcell(sender as! uicollectionviewcell) { let detailvc = segue.destinationviewcontroller as! detailmenuviewcontroller detailvc.picfood = self.collection[indexpath.row] collection empty array data form json [title = self.namefood.title], working in detailmenuviewcontroller.swift not image on code above. you need add uicollecitonviewdelegate func collectionview(collection: uicollectionview, selecteditemindex: nsindexpath) { self.performseguewithidentifier("showdetail", sender: self) } after add override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if ...

ios - how to add Hours to date in swift in this format "2015-06-11T00:00:00.000Z" as in one string while parsing in SWIFT -

how add hours date in swift in format "2015-06-11t00:00:00.000z" in 1 string while parsing in swift. i trying add time date in ons string parsing in swift. have 2 texfields representing date , time date picker, when parse string date displays. want combine date , time in string , send server. please me in swift language you can using nscalendar method datebysettinghour follow: xcode 8.2.1 • swift 3.0.2 let df = dateformatter() df.calendar = calendar(identifier: .iso8601) df.locale = locale(identifier: "en_us_posix") df.dateformat = "yyyy-mm-dd't'hh:mm:ss.sss'z" if let date = df.date(from:"2015-06-11t00:00:00.000z") { let hour = 4 if let datewithtime = calendar.current.date(bysettinghour: hour, minute: 0, second: 0, of: date) { let resultstring = df.string(from: datewithtime) print(resultstring) // "2015-06-11t04:00:00.000z" } }

three.js transparent sphere glitch -

i have transparent sphere , spot light , that's it. sphere displays visual glitches, striations. see: http://jsfiddle.net/blwoodley/tvcogqkg/3/ (note grid not necessary manifest bug. put in there show transparency working otherwise fine). any thoughts on how rid of these glitches? seem depend on relative position of camera , spot light. using three.js, r71. here code fiddle since seems want it: var screen_width = window.innerwidth - 100; var screen_height = window.innerheight - 100; var camera, scene, _planemesh; var canvasrenderer, webglrenderer; var container, mesh, geometry, plane; container = document.createelement('div'); document.body.appendchild(container); scene = new three.scene(); camera = new three.perspectivecamera(30, window.innerwidth / window.innerheight, 1, 100000); camera.position.set( 380, 80, 100 ); var spotlight = new three.spotlight( 0xffffff ); spotlight.position.set( 180, 160, 0 ); var grid = new three.gridhelper(400, 40); grid.po...

ruby - How does Rails know my timezone? -

how rails know time zone? don't have set in application.rb : # config.time_zone = 'central time (us & canada)' i searched whole app time_zone , instance of it. don't see environment variables time zone set either. i'm on windows. c:\users\chloe\workspace\mybestbody>rails runner "p time.now" dl deprecated, please use fiddle 2015-06-12 23:38:33 -0400 it prints utc time when deployed heroku. c:\users\chloe\workspace\mybestbody>heroku run rails console running `rails console` attached terminal... up, run.1949 loading production environment (rails 4.2.1) irb(main):001:0> time.new => 2015-06-13 03:28:34 +0000 rails 4.2.1 from gettimeofday(), or ruby mri source have me believe: int __cdecl gettimeofday(struct timeval *tv, struct timezone *tz) { filetime ft; getsystemtimeasfiletime(&ft); filetime_to_timeval(&ft, tv); return 0; } per comment, c function, called ruby date routines under hoo...

fullcalendar - Fullcalender customizing the Agenda display -

i want make 3 changes fullcalendar agenda view. remove start time events, want display title in each slot. change height of timeslots, have tried adjusting contentheight had no apparent effect. show 30min slots on y-axis, know axisformat option still displays full hours. if can give me suggestions on how accomplish these 3 changes? fullcalendar have rich callback set configure: you should use eventrender modify (hide title in constructed best way of it). not try construct new element , replace original the same eventrender can add css or class , change per event or direct css agenda view not have time slots @ all, time-ordered list not represent proportion of time-lenght between events. if wan't time based view, try singe day view , set slotduration close want, on fly buttons or keybind. + when setting slotduration , if wan't support adding events, change snapduration

java - When I create an object and pass arguments my class's constructors fail -

new programming, constructors seem straight forward concept. can't figure out why when create object , pass arguments in test class fail initialize polygon class's fields. public class polygon{ private int numsides; private double sidelength, xcoord, ycoord, apothem, perimeter; public polygon(){ this.numsides = 4; this.sidelength = 10.0; this.xcoord = 0.0; this.ycoord = 0.0; this.apothem = 5.0; this.perimeter = 20.0; } public polygon(int numsides, double sidelength, double xcoord, double ycoord, double apothem, double perimeter){ this.numsides = numsides; this.sidelength = sidelength; this.xcoord = xcoord; this.ycoord = ycoord; this.apothem = apothem; this.perimeter = perimeter; } public static double getarea(double apothem, double perimeter) { double area = .5 * apothem * perimeter; return area; } public static string t...

How is the Layer Order is decided in leaflet map? -

when use following code go through layers in leaflet map, map.eachlayer(function (layer) { console.log(layer); }); i wants rule used create order. because of zindex of layer? or because layer added in different time? if layer added early, in bottom. thanks, good question, seems leafletjs docs don't ordering of layers via eachlayer , so... looking @ code on github, l.map.eachlayer loops through l.map._layers object (not array). technically layers come in order ... that said, individual layers added _layers object in order added map. in likelihood, eachlayer iterating on layers in same order (whatever order added map).

ios - Select Cells on viewdidload in UITableView, based on String Array (Swift) -

how can select multiples cell in uitableview based on match string value within core data array? i have saved previous selected rows (as string), when load table again, want selected again. can't find or think of solution this. array: var category:[string] = ["news", "sport", "weather", "earth", "future", "shop", "tv", "radio", "food", "music", "travel", "local", "nature", "venue", "money"] i try figure out selectrowatindexpath didn't see in swift. here how fetch data core data func fetchdata(){ let entitydescription = nsentitydescription.entityforname("usersettings", inmanagedobjectcontext: context!) let request = nsfetchrequest() request.entity = entitydescription var dataobjects: [anyobject]? { dataobjects = try context?.executefetchrequest(request)...

multithreading - CoreData: warning: Unable to load class named -

Image
i duplicating existing objective-c tv show app new swift version using xcode 6.1 , having issues coredata. i have created model of 4 entities, created nsmanagedobject subclass (in swift), , files have proper app targets set (for 'compile sources'). i still getting error whenever try insert new entity: coredata: warning: unable load class named 'shows' entity 'shows'. class not found, using default nsmanagedobject instead. a few comments: when saving core data, use parent-child context way allow background threading. setting managedobjectcontext using: lazy var managedobjectcontext: nsmanagedobjectcontext? = { // returns managed object context application (which bound persistent store coordinator application.) property optional since there legitimate error conditions cause creation of context fail. let coordinator = self.persistentstorecoordinator if coordinator == nil { return nil } var managedobjectcontext = nsmanagedobjectc...

algorithm - formula for lotto combinations with fixed numbers? -

usually lottery combinations formula " n! / (k!*(n-k)!) ", e.g., 6/49 game " 49!/(6!*(49-6)!) " is there formula calculate same m fixed values (e.g., numbers 1, 2, 3, , 4 fixed) - 2 numbers free choice i thought formula " (n-m)! / (k!*(n-k-m)!) " doesn't seem ... because m=4 formular wrong (for 6/10) , m=k should 1) what have posted formula nothing combination . it says k-combination set of n elements given n c k or n! / (k!*(n-k)!) . next, number of combinations of n different things taken m @ time, when k particular objects occur n-m c k-m or (n-m)! / (k-m)!*(n-k)!) .

modify remote agent configuration in Bamboo -

i have newly built vm machine configuring bamboo remote agent. can successfully. display name in bamboo shows agent name in caps (perf8) whereas want perf8 did following: 1. stop bamboo service in agent. 2. delete agent in bamboo 3. modify bamboo-agent.cfg perf8 4. start service 5. approve bamboo service in agent but leaves duplicate remote agent in bamboo (perf8, perf8(2)) instead of modifying existing one. since vmware, changing name in bamboo agent edit details going washed out when revert agent. please me fix please? 1. start bamboo service in agent. 2. modify bamboo-agent.cfg perf8 4. stop service 5. start bamboo service in agent

asp.net mvc 4 - SessionTimeout value store in database -

we have need having different sessiontimeouts different departments or roles etc. possible reset sessiontimeout , make input field entry user , store in database? session timeout must maintain values database? can set sessiontimeout in web.config file, dynamic scenario different different users/departments. suggestions good! using asp.net mvc5 , sql server2012 thanks

add - adding an unknown number of numbers in java -

i have following code below: public class classes { /** * @param args command line arguments */ public static void main(string[] args) { int sum = add(10,20); system.out.println(sum); // todo code application logic here } public static int add(int number,int number2){ int c = number + number2; return c; } } in case adding 2 numbers , returning them main method. want alter this, keeping same structure, way of adding unspecified number of numbers. example if wanted add 3 numbers adjust following to public static int add(int number,int number2,int number3){ int c = number + number2 + number3; i cant keep adding int numberx public static int add( so do? you can submit array of integers , loop , summarize them. public static int add(integer... numbers) { int result = 0; (integer number : numbers) { result += number; } return result; }

java - Syntax error on system.out.println? -

this constants type double. i getting syntax error system.out.println code: syntax error on token ";", @ expected thanks! public final class netpay { public static void main(string[] args) { // todo auto-generated method stub public static final double federal_tax_percent = 10.00; public static final double state_tax_percent = 4.5; public static final double ss_percent = 6.2; public static final double medicare_percent = 1.45; public static final double pay_per_hour = 7.25; int hoursperweek = 40; double grosspay = hoursperweek * pay_per_hour; double federaltax = grosspay * federal_tax_percent / 100; double statetax = grosspay * state_tax_percent / 100; double medicare = grosspay * medicare_percent / 100; double socialsecurity = grosspay * ss_percent / 100; double netpay = grosspay - (federaltax + statetax + medicare + socialsecurity); system.out.println("hours per week = 40"); system.out.println("gros...

How do I exclude data from an API call that have a value of nil in Ruby? -

i'm trying pull user data nationbuilder api display on google maps. need latitude , longitude of these users, , if address given, nationbuilder provide 'lat' , 'lng' values in json hash. of users in database don't have lat , lng values, makes me error when ask lat , lng of each user. in api call, want able exclude people have lat , lng value of nil aren't rendered stop me getting error. here's call looks currently: users = client.call(:people_tags, :people, tag: 'mapped')["results"] users.map { |user| new(user) } please let me know if need more information answer question. you reject users lat or long nil : users_with_location = users.reject { |user| user.lat.nil? || user.long.nil? } or reject in place (remove them users variable without making copy): users.reject! { |user| user.lat.nil? || user.long.nil? } so entire code like: users = client.call(:people_tags, :people, tag: 'mapped')["...

c# - How to handle multiple consoles in single application? -

i've done research have no idea how handle this. i'm doing project selenium (important thing selenium using console handle connection browser) , need use third party - console application (it .exe file). can not use console thought, because taken selenium. i'm using c#. as far know, there impossible handle 2 consoles in 1 application. final product winforms application. have ideas how approach this? system.diagnostics.process opens program not communicating - , know i'm doing right implementation.

multithreading - Parallel stream creates only one thread and gives result as fast as normal stream -

below code try process lines read file in parallel stream , in normal stream. surprisingly, parallel stream gives no improvements on normal stream . missing here ? files.walk(paths.get(tweetfilepath + localdate.now())).foreach( filepath -> { if (files.isregularfile(filepath) && !filepath.tostring().endswith(".ds_store")) { long starttime = system.currenttimemillis(); try { files.lines(filepath).parallel().foreach(line -> { try { system.out.println(line); } catch (exception e) { system.out.println("not able crunch"+ e); } }); } catch (exception e) { system.out.println("bad line in file "); }f...

java - How to Close HikariCP JNDI DataSource on Shutdown/Redeploy -

i using hikaricp 2.3.3 spring , jetty 9 , trying resolve fact when hot deploy new war file, of hikari database pool connections mysql left open , idle. using jndi lookup in spring applicationcontext file retrieve datasource jetty context file. since cannot specify destroy-method in jndi-lookup can if define datasource bean, referred question: should close jndi-obtained data source? , mentions can attempt close datasource in contextdestroyed() method of servletcontextlistener. in case using tomcat , c3po i'm not sure how example relates. i have tried following in contextdestroyed method: initialcontext initial; datasource ds; try { initial = new initialcontext(); ds = (datasource) initial.lookup("jdbc/mydb"); if (ds.getconnection() == null) { throw new runtimeexception("failed find jndi datasource"); } hikaridatasource hds = (hikaridatasource) ds; hds.close(); } catch (namingexception | sqlexception ex) { logger.ge...

javascript - Getting application folder path on MeteorJS? -

in meteor i've been looking way home folder of running meteor application in server. for example, if .meteor folder in c:/users/me/repos/mywebsite/.meteor , there way path c:/users/me/repos/mywebsite/ , or ever app running at? the reason asking because running scripts webapp, , if script (let's call script.rb) in folder called util in meteor home folder, have hardcode entire path c:/users/me/repos/mywebsite/utils/script.rb is there better way this? as side note, must made server side. you here: projectroot/.meteor/local/build/programs/server/shell-server.js so, reference script lives in sibling folder of project, it'll this: ../../../../../../scriptfolder/script.rb

php - Laravel - multiple routes -

i'm doing simple project. want minimal possible tried create system can create pages , they're placed @ localhost/{page?} but, here's problem. want routes defined (e.g. route /blog ) below. route::get('/{page?}', ['as' => 'root', 'uses' => 'sitecontroller@getroot']); route::get('blog/{slug?}', ['as' => 'blog.post', 'uses' => 'blogcontroller@getpost']); route::get('blog/page/{page}', ['as' => 'blog.page', 'uses' => 'blogcontroller@getpage'])->where('page', '[0-9]+'); with setup, uses first route. my question is. there way this? or, beyond capabilities of laravel? thank help. yeah, place first route last route. way picked last. may need place blog/{slug?} before 1 blog/slug/{page} first. route::get('blog/page/{page}', ['as' => 'blog.page', 'uses' => '...

VS2015 open/import cordova project -

i need import loaded cordova project vs2015 cordova tools. loading files www folder, , replacing config.xml dont work. ideas? try this: create new project in vs2015 build project make sure there no problem vs2015 installation. copy content old index.html new index.html copy related, e.g. images, html files (if not using spa), js files, css files, under www directory, not copy api. open config.xml in vs2015 double click(do not use view code open), add related api. build project again. it should work unless api not compatible vs2015.

javascript - How to target the second to last child's child? -

i have html this <ul class="menu"> <li> <a href="#1"></a> </li> <div></div> <li> <a href="#2"></a> </li> <div></div> <li> <a href="#3"></a> </li> <div></div> <li> <a href="#4"></a> </li> <div></div> </ul> i want target last link (#4) , store variable called tab. here's wrote know it's wrong var tab = $(".menu").is(":nth-last-child(2)").children().attr("href"); if want anchor of second last child, var children = $('.menu').children(); var childcount = $('.menu').children().length; var secondtolast = children[childcount - 2]; var anchor = $(secondtolast).find('[href]'); var href = anchor.attr('href'); var child...

oop - Inheritance tree: should undirected graph be subclass of directed graph? -

i implementing simple graph library practice. have created base class graph , have derived directedgraph. wondering if should derive undirectedgraph class directedgraph or should derive graph class itself. undirected graph directedgraph in edge u v implies edge v u. please let me know best way implement graph hierarchy. also , graph class has list of graphvertex. should graphvertex class hold data edges going vertex or should graph class hold data edges. yeah, ideally should structure inheritance in way make sense in real world application. undirected , directed graphs both graphs, best bet inheriting there. your graph class include -> (c++) vector<node*> nodes; whereas directed graph hold edges itself. also, have implemented this, personal , humble suggestion store dictionary<int, dictionary<int, int>> (c++ dictionary unordered_map). this dictionary list of pairs of nodes pair of node connected weight. that weighted graph. hopefu...

python - dealing with dimensions in scikit-learn tree.decisiontreeclassifier -

i trying decision tree using scikit-learn 3 dimensional training data , 2 dimensional target data. simple example, imagine rgb image. lets target data 1's , 0's, 1's represent presence of human face, , 0's represent absence. take example: red green blue face presence 1000 0001 0011 0000 0110 0110 0001 0110 0110 0110 0000 0110 an array of rgb data represent training data, , 2d array represent target classes (face, no-face). in python these arrays may like: rgb = np.array([[[1,0,0,0],[0,1,1,0],[0,1,1,0]], [[0,0,0,1],[0,1,1,0],[0,1,1,0]], [[0,0,1,1],[0,0,0,1],[0,0,0,0]]]) face = np.array([[0,0,0,0],[0,1,1,0],[0,1,1,0]]) unfortunately, doesn't work import numpy np sklearn import tree dt_clf = tree.decisiontreeclassifier() dt_clf = dt_clf.fit(rgb, face) this throws error: found array dim 3. expected <= 2 i ha...