Posts

Showing posts from August, 2010

LDAP authentication in asp.net MVC 5 application -

i have asp.net mvc 5 applicationand want add ldap authentication. have form page startup page tell user enter name , password. form page redirected after submit home page without testing anything. don't know how verify if user exists or not using ldap authentication. is ms activedirectory ldap? if want take @ asp.net identity: http://www.asp.net/identity/overview/getting-started/introduction-to-aspnet-identity

java - LibGDX, Need click event in portable application and in Stage, how? -

i creating video game libgdx, need have 2 click events, 1 on stage object, other on window. when add stage on init method : gdx.input.setinputprocessor(stage); the event onclick inherited portable application disabled... is there solution problem ? thank ! use gdx.input.setinputprocessor(new inputmultiplexer(otherinputprocessor, stage)); swap order of 2 if want stage take precedence.

c++ - What problems are solved by holding a Temporary using `const T &`? -

like, if write code looks following: const int & const_value = 10; what advantage gaining on code instead this: int value = 10; or const int const_value = 10; even more complicated example, like const enterprise::complicated_class_which_takes_time_to_construct & obj = factory.create_instance(); thanks copy elision, both of following code snippets shouldn't faster or less memory consuming. enterprise::complicated_class_which_takes_time_to_construct obj = factory.create_instance(); or const enterprise::complicated_class_which_takes_time_to_construct obj = factory.create_instance(); is there i'm missing explains use of construct, or hidden benefit i'm not accounting for? edit: the answer provided @nwp supplied example of factory method looks following: using cc = enterprise::complicated_class_which_takes_time_to_construct; struct factory{ const cc &create_instance(){ static const cc instance; return instance;

wix - Bootstrapper and Setup in Add/Remove Programs -

i have custom bootstrapper customba , application setup appsetup. i want appsetup visible in add/remove programs removed name of bootstrapper. ensures not there in add/remove programs. i have custom uninstaller appsetup called program menu shortcut. not remove bootstrapper entry in registry. should add custom action remove bootstrapper registry entry or there more direct approach? the documentation says this, have set these attributes (disablemodify & disableremove) in bundle? if "disablemodify" attribute "yes" or "button" bundle not displayed in progams , features , mechanism (such registering related bundle addon) must used ensure bundle can removed. disableremove yesnotype determines whether bundle can removed via programs , features (also known add/remove programs). if value "yes" "uninstall" button not displayed. default "no" ensures there "uninstall" button remove bundl

java 7 - How to include HtmlUnit in a Kotlin project -

i'm trying use htmlunit in kotlin project following error when compile: error:kotlin: supertypes of following classes cannot resolved. please make sure have required dependencies in classpath: class com.gargoylesoftware.htmlunit.html.domelement, unresolved supertypes: elementtraversal this because elementtraversal java 7 feature. how can solve this? the org.w3c.dom.elementtraversal part of xml-apis dependency of xerces:xercesimpl . xerces:xercesimpl in turn dependency of htmlunit . make sure add transitive dependencies of htmlunit project. with gradle needed is: compile 'net.sourceforge.htmlunit:htmlunit:2.22'

regex - redirect http to https OS X Server 5.0.15 -

i have 2 domain names: users.newsite.com , users.oldsite.com. have users.newsite.com hosted on mac os x 10.10.5 using server version 5.0.15. have records setup in dns both domain names (users.newsite.com , users.oldsite.com) point same ip address os x server machine. we have wildcard ssl cert of *.newsite.com , cert installed on os x server machine. have redirect configured in os x server (i believe uses apache) traffic http version of users.newsite.com going https version of users.newsite.com. working properly. the problem if uses http version of users.oldsite.com. warning connection not secure because browser trying redirect https version of users.oldsite.com. not have ssl cert oldsite.com. is there way setup redirect traffic coming http://users .* (newsite or oldsite) gets redirected https version of users.newsite.com? i can enter url matching regular expression , direct in server app, don't know enter redirect work http versions of users.newsite.com , users.ol

php - Here is my code when; I run it with xamp a blank page appear -

if delete include'classes/actualite.php' app runs correctly. couldn't solve problem, please me. <?php include'classes/actualite.php' ; $actualite=new actualite(); ?> my form code: <form action=""method="post"> titre: <input type="text" name"titre"><br> <textarea name="description"></textarea><br> <select> <option>astronomie</option><br> <option>club</option> </select> </br>date: <input type="date" name="date"></form></section><br> image: <input type="file" name="image"><br> <input type="submit" name="submit" value="submit"><br> </form>

c# - Automapper from SOAP Web Service to View Model -

i want use automapper mapping soap web service response model used return result through web api. mostly of attributes returned in object web service codes, want show in response of our api descriptions related codes. for example: the web service response list of: <charge> <type>abc</type> <qualifier>3</qualifier> <periodcode>004</periodcode> <code>ste</code> </charge> <charge> ... </charge> which encapsulated in class this: class charge { string type { get; set; } string qualifier { get; set; } string periodcode { get; set; } string code { get; set; } decimal rate { get; set; } } our model is: public class rcharge { public string description { get; set; } public bool? includedinrate { get; set; } public decimal? amountvalue { get; set; } public string period { get; set; } } i have stored in database information related codes , descriptions,

python - How to topological sort a sub/nested graph? -

i've created lightweight graph lib, has 3 objects (vertex, edge, graph) , 1 function (topo_sort), looks like: class dagerror(exception): pass def topo_sort(graph): sorted_list = [] def visit(vertex): nonlocal sorted_list if vertex.idle: raise dagerror('graph has @ least 1 cycle.') if not vertex.done: vertex.idle = true neighbor in vertex.vertices(): visit(neighbor) vertex.done = true vertex.idle = false sorted_list.insert(0, vertex) queue = [vertex vertex in graph.vertices() if not vertex.done] while queue: visit(queue.pop(0)) return iter(sorted_list) and working fine, if have flat dag. want achieve add subgraphs (or nested graphs) main graph, can see in illustration draw: nested/sub graph illustration http://f.cl.ly/items/2o0s1c2w1o2c0i0g0l0r/subgraph_illustration3.png this still dag, if ran function on this, normal topo

loops - Python, checking if string consists only of 1's and 0's -

i'm trying write function checks if given string binary or not. i'm using while loop browse characters in string 1 one. if of them 0's or 1's it's going return true, if not - break loop , return false. i've written tiny part of code, doesn't run. why? def fnisbin(string): count = 0 while count < len(string): character = string[count] if character == '0' or character == '1': print (count, character[count], "ok") count = count+1 continue else: print (count, character[count], "error") return false break edit: tried using 'set' elude iterating loop, don't quite how "set(string)" work. got error cant consider list. how can compare elements 0 & 1? def fnisbin(string): characterslist = set(string) if len(characterslist) > 2: return false else: if (characterslist[0] == '0&#

windows - Official way to get the Thread Information/Environment Block (TIB/TEB) -

in windows, it's long been common, if undocumented, knowledge thread information block (tib) of current thread can found @ fs:0. works on intel cpus, fs register exists in first place. wanna tib on arm-based windows system (windows phone , maybe windows rt). there api that, please? edit: want thread stack base crash reporting purposes. information tib/teb: http://www.microsoft.com/msj/archive/s2ce.aspx the macro ntcurrentteb() available in winnt.h supported architectures, including arm (windows rt): #if defined(_m_arm) && !defined(__midl) && !defined(_m_cee_pure) __forceinline struct _teb * ntcurrentteb ( void ) { return (struct _teb *)(ulong_ptr)_movefromcoprocessor(cp15_tpidrurw); }

R & dplyr's select not removing columns after various transforms? -

this question has answer here: dplyr: getting group_by-column when not selecting it 1 answer it looks select isn't removing un-selected columns data-set.. quite odd. here simple example : library(nycflights13) library(dplyr) dly <- flights %>% group_by( year, month, day) %>% summarise( arr_mean = mean(arr_delay, na.rm=true), dep_mean = mean(dep_delay, na.rm=true) ) %>% mutate( dt = as.date(isodate( year, month, day ) ) ) > glimpse( dly, 50 ) observations: 365 variables: 6 $ year (int) 2013, 2013, 2013, 2013, 2013... $ month (int) 1, 1, 1, 1, 1, 1, 1, 1, 1, 1... $ day (int) 1, 2, 3, 4, 5, 6, 7, 8, 9, 1... $ arr_mean (dbl) 12.6510229, 12.6928879, 5.73... $ dep_mean (dbl) 11.548926, 13.858824, 10.987... $ dt (date) 2013-01-01, 2013-01-02, 201... so... simple.. mean day, , add r date. (yes, know there time_

stripe payments - How to save credit card data in a database? -

i working on application in required store whole credit card numbers. possible using api? i have read authorize.net 's customer payment profile option, gives last 4 digits when try retrieve payment profile. i have checked braintree 's v.zero api gives first 6 , last 4 digits , stripe 's customer creation option gives last 4 digits. if there no api available, way store credit card numbers store in house using pci dss?? disclosure: work stripe yes, way store customer card information in-house in pci-compliant system. place store them, , way handle them, must pci compliant. one of biggest gains using payment processor, stripe example, take care of (very, incredibly, terrifyingly) hard work of pci compliance you. part of commitment, they're not going release credit card details work tirelessly keep secure. if you're willing go through rigors of becoming - , remaining - pci compliant, collect , store card numbers in pci-compliant way , use st

multithreading - VB.NET Compare each item in collection to every other item in collection - Threading -

this first time posting please accept apologies if im not doing right , please feel free correct me formatting or posting guidelines. doing in vb.net .net framework 4.5.2. i have large collection called gboard in class. private gboard collection it contains 2000 instances of class. what trying achieve each item in class, want @ each other item in class , update first item based on variables in second. currently have following code: in main class: private gboard new collection ' populated elsewhere in code private sub checksurroundings() integer = 1 (xboxes) j integer = 1 (yboxes) x = 1 integer (xboxes) y = 1 integer (yboxes) tile(new point(i, j)).checkdistance(tile(new point(x, y))) next y next x next j next end sub private function tile(byval apoint point) clstile return gboard.item("r" & apoint.y & "c" & apoint.x) end functio

php - change csrf token after form submission in codeigniter -

in config file have following csrf setting: $config['csrf_protection'] = true; $config['csrf_token_name'] = 'csrf_test_name'; $config['csrf_cookie_name'] = 'csrf_cookie_name'; $config['csrf_expire'] = 7200; $config['csrf_regenerate'] = true; $config['csrf_exclude_uris'] = array(); problem after form submission session doesn't deleted.if session doesn't destroyed after form submission ,it create security risk.i mean that's how should work submit form , after form submission token gets deleted session. how can solve issue? $config['csrf_regenerate'] = false;

Makefile target multiple sources but only one target -

while working on makefile need write rule executes: $(grit) $(gritflags) inputfile -ff $(addsuffix .grit,$(basename inputfile)) -o grit.c whereas inputfile list of xxx.png files. in same directory there xxx.grit file needs passed via -ff option. pairs of .png , .grit files provide same output file, grit.c (grit uses file appending). tried use rules patterns when wanted rule grit.c: %.png %.grit, seems not allowed use patterns target not contain pattern. any idea how solve problem? edit: major problem is, can not pass lits of input files (as done in example above) towards grit. show problem. need call grit every single .png/.grit-file combination grit.c: $(images) png in $?; \ $(grit) $(gritflags) $$png -ff $${png%.png}.grit -o $@; \ done

Profile popups in JavaScript or Jquery -

new web design , working on project charity , looking add profile popup div's or windows preferably 1st... not sure whats best way go it!! can advise please. thank your question little vague, beginners in web design, might want use iframe. html tag creates inline panel/window thing , pretty easy use. looks this: <iframe src="profile.html" width="300" height="300"> <p>text here displayed on browser doesn't support iframe</p> </iframe> i have not played around them can pull off showing profile little bit of jquery this: $(document).ready(function(){ $(".avatar").mouseenter(function(){ //the .avatar element of place person clicks on profile or whatever. $("iframe").fadeto("fast",1); }); $("iframe").mouseleave(function(){ $("iframe").fadeto("fast",0); }); }); something should work. i'm not sure looking hope h

python - numpy Boolean array representation of an integer -

what's easiest way produce numpy boolean array representation of integer? example, map 6 np.array([false, true, true], dtype=np.bool) . if n integer, expression (n & (1 << np.arange(int(floor(log(n, 2) + 1))))) > 0 create boolean array representing bits, least significant bit in first position. for example, in [224]: n = 5 in [225]: math import floor, log in [226]: n = 5 in [227]: (n & (1 << np.arange(int(floor(log(n, 2) + 1))))) > 0 out[227]: array([ true, false, true], dtype=bool) in [228]: n = 8 in [229]: (n & (1 << np.arange(int(floor(log(n, 2) + 1))))) > 0 out[229]: array([false, false, false, true], dtype=bool) in [230]: n = 514 in [231]: (n & (1 << np.arange(int(floor(log(n, 2) + 1))))) > 0 out[231]: array([false, true, false, false, false, false, false, false, false, true], dtype=bool)

How Does Composite Column PartitionKey Work in Cassandra -

i trying figure out advantages compound partition key can provide. @ famous weather station example below. create table temperature ( state text, city text, event_time timestamp, temperature text, primary key ( (state, city) ,event_time) ); now, of time query 1 single state on set of cities , range of dates. query like select * temperature state = 'ny' , city in ('mahattan', 'brooklyn','queens') , event_time > '2016-01-01' . assuming have large data set, in sense have few states (# < 1000) each state have many many cities ( # > 100m). replicate data , distribute them different nodes. question: can compare differences using primary key (**(state, city)**,event_time) primary key (**(city, state)**,event_time) primary key (state, city,event_time) primary key (zipcode, event_time) thank you! composite key primary key (**(state, city)**,event_time) primary key (**(city, state)**,event_time) are functionally

javascript - Sortable panels, removing draggable functionality from certain elements within -

Image
i have jquery ui sortable list multiple panels within. unfortunately due draggable functionality, it's impossible highlight/copy text within panels. therefore, need header (green bar of course) of panel draggable , panel body excluded functionality. anyone have experience this? current code out-of-box standard: $('.ui-dropzone').sortable({ connectwith: ".ui-dropzone", placeholder: "ui-state-highlight" }) use handle option define selector can used drag with $( ".selector" ).sortable({ handle: ".handle" });

Is there a way to pull an instagram feed with PHP without logging in? -

it seems solution no longer works - how user's instagram feed the new api requires access token dynamically assigned after passing through login page. there way still pull feed programmatically through php without jumping through new oauth hoops? useful setting crontab automatically save new posts database. yes can. don't need login or access_token latest 20 posts. need parse json content https://www.instagram.com/[username]/media/ . replace [username] instagram user_name . eg. $instaresult = file_get_contents('https://www.instagram.com/'.$username.'/media/'); $insta = json_decode($instaresult); update: instagram has changed user media rss url. in order rss feed have use https://www.instagram.com/[username]/?__a=1

javascript - How do I get rid of model attached to view after using Backbone's model#destroy? -

i'm seeing success callback in debugger chrome dev tools, i'm still seeing model when type in this.model . know it's destroyed on server side, can explain why it's still attached view? how rid of it? delete: function () { this.model.destroy({success: function () {console.log("success in destroy");}}); debugger; } what seeing correct. looking @ the documentation on model.destroy (or looking the code ) can see 2 things: http deletes server representation of model removes model containing collections note nothing happens model or objects model may attached to. we can see behavior simple example: var foo = new backbone.model({foo: 'bar'}); var foos = new backbone.collection([foo]); var fooview = new backbone.view(); fooview.model = foo; foo.destroy({success: function () { console.log('success'); }}); console.log(foo, foos, fooview); <script src="https:/

elf - Can't parse DWARF - Tricore CPU's DWARF info -

i struggling parse elf file - dwarf contents of *.elf after compilation tasking compiler infineon's tricore cpu. can't match .debug_abbrev , .debug_info, me looks contents corrupted. can guys guide me how parse .debug_info contents? .debug_abbrev; ... 04 (code) 05 (dw_tag_compile_unit) 00 (no child) 03 08 (dw_at_name, dw_form_string) 3a 0f (dw_at_decl_file, dw_form_udata) 3b 0f (dw_at_decl_line, dw_form_udata) 39 0f (dw_at_decl_column, dw_form_udata) 49 13 (dw_at_type, dw_form_ref4) 00 00 (end) 05 (code) 35 (dw_tag_volatile_type) 00 (no child) 49 13 (dw_at_type, dw_form_ref4) 00 00 (end) 06 (code) 0f (dw_tag_pointer_type) 00 (no child) 49 13 (dw_at_type, dw_form_ref4) 00 00 (end) ... with above .debug_abbrev contents tried parse .debug_info contents, it's weird, maybe wrong parsing made, , further parsing not match, make weird result. i guess wrong made parser cannot understand why. .debug_info; 04 (04, code) 75 77 56 61 6c 75 65 00 (uwvalue, dw_form_string) 01

imagemagick - Percentage of pixels that have changed in an image in PHP -

Image
currently have single image retrieving background color. making background color transparent, attempting compare original image determine percentage of image comprised of said background color. here code attempting use: $image = new imagick($file); // make bg transparent comparison $tpimage = $image->clone(); $tpimage->setformat('png'); $tpimage->setimagepage(0, 0, 0, 0); $swatch_pixel = $tpimage->getimagepixelcolor(1, 1); $tpimage->painttransparentimage($swatch_pixel, 0, 65535 * 0.1); $image->setoption('fuzz', '2%'); $result = $image->compareimages($tpimage, imagick::metric_absoluteerrormetric); echo $result[0]; currently returning 0... i'm not sure if need use different comparison method or what, or if doing else wrong, i've spent quite time on , of resources i've found pretty old. updated answer actually, point out explicitly, absolute_error metric not work when difference transparency. to answer ques

scala - Accessing a protected member of a base class -

i'm not using inheritance often, i'm not sure why doesn't work. in project have following stuff: base sealed class protected member: sealed class theroot { protected def some: string = "theroot" } and it's descendant logic: final case class descendant() extends theroot { def call: unit = { val self: theroot = self.some // <<- throw compilation error } } compiling above gives me following error: error: method in class theroot cannot accessed in theroot access protected method not permitted because prefix type theroot not conform class descendant access take place self.some i'm not sure what's problem call protected member super class... it's getting more interesting if wrap companion object, magically fixes problem: sealed class theroot { protected def some: string = "theroot" } object theroot { final case class descendant() extends theroot { def call: unit = { val self:

Undefined reference to (error) in C++ Eclipse but working in Visual Studio 2015 -

i trying integrate ampl c/c++ using ampl-api on windows-7 in eclipse mars 2.0. created makefile project in eclipse uses mingw cc compile firstexample code given in example directory. firstexample.cpp: #include <iostream> #include "ampl/ampl.h" using namespace std; int main() { ampl::ampl ampl; // read model , data files. std::string modeldirectory = "models"; ampl.read(modeldirectory + "/diet/diet.mod"); ampl.readdata(modeldirectory + "/diet/diet.dat"); // solve ampl.solve(); // objective entity ampl name ampl::objective totalcost = ampl.getobjective("total_cost"); // print std::cout << "objective is: " << totalcost.value() << std::endl; // objective entity ampl name ampl::objective totalcost = ampl.getobjective("total_cost"); // print std::cout <<

c# - Why is Entity Framework creating a discriminator column for my View Model? -

i've read quite few posts on table per type /tpt , discriminator column, but, i'm not wiser in situation. taking example: have mvc app has model called foo . has 1 property called bar stored 1 many elsewhere. i 1 using app , didn't want spend lot of time on it, wanted quickest way add items list in bar . because of this, made new class called fooviewmodel derived foo , , had string property called bartemp . the basic idea can type 111, 222 , 333,444 in standard text field , have edit/create controllers clear whitespace , split list on comma. what can't figure out view model never written ef, so, why creating discriminator column. it looked when tried scaffold migration, event tried adding bartemp db. i have since created new type called same, instead of deriving, have foo , bartemp properties in works expected, but, still don't happened , learn more. it's because entityframework parses hierarchy. because current code doesn't ev

sql server - List row count of each view and table -

Image
i have database named test has 2 views , 2 tables in schema dbo this: i want create table named report lists row numbers of each view , each table. concept this: select table_name, table_type, "select count(*) table_name" rowcount test.dbo.report test.information_schema.tables; the test.dbo.report should this: however, have no idea how implement. dynamic sql way go, confusing. i using sql server 2014. you can use dynamic sql build giant chain of union select statements: declare @sql nvarchar(max) = '' -- use undocumented(?) trick string concatenation in select statement select @sql = @sql + 'union select ' + '''' + table_name + ''' table_name, ' + '''' + table_type + ''' table_type, ' + '(select count(*) ' + table_name + ') [count]' + char(13) + char(10) information_schema.tables -- remove leading "union all" set @sql

c - PTY/TTY -Unix: Unable to open Slave FD -

i trying create separate pty terminal. trying achieve using following code. slave fd turns out -1. can please point me doing wrong. /* open available pty */ master_fd = posix_openpt(o_rdwr | o_noctty); if (master_fd == -1) { return -1; } /* give access slave */ if (grantpt(master_fd) == -1) { perror("unable provice access slave"); goto error; } /* unlock slave pty */ if (unlockpt(master_fd) == -1) { perror("unable lock slave pty"); goto error; } /* slave device name */ slave_device_name = ptsname(master_fd); if (slave_device_name == null) { perror("unable name slave device") goto error; } slave_fd = open(slave_device_name, o_rdwr|o_noctty); if (slave_fd == -1) { perror("unable retrieve fd slave"); goto error; } error: close(master_fd); return -1;

javascript - How To Scroll Inside Fancybox after Keydown Event -

i using fancybox 2.1.5 in asp.net mvc4 web application display list of string data in <ul> . in attempt make things easier user have enabled keypress events navigate , down resulting <li> . user can use mouse scroll & select or keyboard select items , continue on. what have found if data shown greater amount , vertical scrollbars created (note: fancybox has maxheight property set), when using keyboard navigate down list, if selected item goes off fancybox window/dialog scrollbars not moving track if scroll mouse-wheel. does know how can fancybox scroll manually when use keyboard? i have tried messing overflow css settings , fancybox scroll properties isnt helping. im sure need trigger event when i'm navigating manually.. html <div id='mydiv'> <ul> <li>apple</li> <li>orange</li> <li>pear</li> </ul> </div> fancybox js inc. keyboard setup $.fancybox.op

mysql - How to make a table's specific column unique to another table -

i have 2 tables: tag | song _________|___________ tagname | songtitle song_id | i want make tagname unique song_id using mysql. in database add unique key the tagname column.so not allow duplicate entry.

How to finish an activity from BaseAdapter in android? -

explanation: know repeated question.understand flow of application. have multiple fragments in navigationdrawer when in 1 of fragment.this fragment call baseadapter adapter , select value fragment.after selected item fragment goes mainactivity here adapter code package com.angelnx.angelnx.holidays.adapter; import android.app.activity; import android.content.context; import android.content.intent; import android.support.v7.app.appcompatactivity; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.radiobutton; import android.widget.textview; import android.widget.toast; import com.angelnx.angelnx.holidays.handler.databasehandler; import com.angelnx.angelnx.holidays.mainactivity; import com.angelnx.angelnx.holidays.r; import com.angelnx.angelnx.holidays.model.state; import com.angelnx.angelnx.holidays.model.users; import java.util.list; public class stateselectionadap

android - TextInputLayout issue at Login time -

i have textinputlayout in login, when click on login button if username empty show error same password when password empty show error if username empty , password non empty @ time error not shown how can solve problem? code below!!! @override public void onclick(view v) { intent mintent; switch (v.getid()) { case r.id.txtsignin: hidekeyboard(mactivity, v); if (etusername.gettext().tostring().equals("")) { etusername.requestfocus(); etusername.setcursorvisible(true); tilpassword.seterrorenabled(false); tilusername.seterrorenabled(true); tilusername.seterror(getstring(r.string.username_required)); } else if (etpassword.gettext().tostring().equals("")) { etpassword.requestfocus(); etpassword.setcursorvisible(true); tilusername.seterrorenabled(false); tilpassword.seterro

asp.net - My query works in Access, but not in Visual Studio -

this question exact duplicate of: query returns no records show on webpage 1 answer i have query have run in access doesn't seem run when execute on website site. here's code webpage want database populate content for: <asp:accessdatasource id="accessdatasource1" runat="server" datafile="~/app_data/traveljoansdb.accdb" selectcommand="select * [table2] inner join blogentryitems on table2.id=blogentryitems.blogid , table2.id=@id"> <selectparameters> <asp:querystringparameter name="id" querystringfield="table2.id" type="decimal" /> </selectparameters> </asp:accessdatasource> <asp:dat

PHP: Building an array of dates with two types of sorting -

i have array of appointments need order in special way. let's current date 30 may 2016 , current time 11:00h: $currenttimestamp = strtotime("05/30/2016 11:00"); // results in 1464620400 first, here comes array of appointments contains timestamps end of each appointment: $alldates = [ '2016-05-24' => [ [ 'end' => 1464086700 ] ], '2016-05-27' => [ [ 'end' => 1464349500 ] ], '2016-05-30' => [ [ 'end' => 1464606900 ], [ 'end' => 1464614100 ], [ 'end' => 1464623100 ] ], '2016-05-31' => [ [ 'ende' => 1464705900 ] ] ]; here come requirements resorting array: all appointments end later current timestamp must ordered descending. all appointments end earlier current timestamp must ordered ascending. my desired output following: $desiredfinalarrdates = [ &

linux - Mongodb not start because of polkitd -

i've install mongodb mongo official repo. when want start mongo fail. when run journalctl -xe got this: jun 02 11:34:21 mongo systemd[1]: mongod.service: unit entered failed state. jun 02 11:34:21 mongo audit[1]: service_start pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=mongod comm="systemd" exe="/usr/lib/systemd/syste jun 02 11:34:21 mongo systemd[1]: mongod.service: failed result 'exit-code'. jun 02 11:34:21 mongo polkitd[736]: unregistered authentication agent unix-process:2218:1110034 (system bus name :1.28, object path /org/freedesktop/policykit1/authenticationage i using fedora 23 server. how fix unregistered auth error? after lot of search find link . add rule selinux: semanage port -a -t mongod_port_t -p tcp 27017 no success. after set selinux=permissive in /etc/selinux/config , reboot, worked.

android - Unexpected Response Code 404 Instagram API -

i trying send request user feed - https://api.instagram.com/v1/users/self/feed?access_token={} but getting 404 code means server not understand request. built app before updated api , in sandbox mode new api guidelines in effect used work before 1st june, 2016.any appreciated. instagram yesterday on 1. june update policy, in brief before 1. june can api , explore whole instagram without checks instagram team, after 1. june instagram team check each app before go live, need login in instagram.com/developer , create app, choose type of data need , describe what, , send instagram team check, answer in 3 working days ...

java - Spring Security lgoin always redirecting to authentication failure URL -

i rather new programming please me out bit here. i have configured spring security fetch user details database , when try login following accounts: user1 - password1 admin - password1 the authentication fails redirect me home.jsp/ops=999 login page. user record exists in database cannot seem log in. this security config xml file. <http auto-config="true"> <form-login login-page='/home.jsp?ops=9999' default-target-url='/secure/user.jsp' always-use-default-target='true' /> <logout logout-success-url="/home.jsp" logout-url="/j_spring_security_logout" /> </http> <authentication-provider> <jdbc-user-service data-source-ref="application.datasource2" users-by-username-query="select username, password user lower(username) = lower(?)"/> </authentication-provider> i doing without authentication/authorities login not working. of possible reaso

json - Solr - How to get search result in specific format -

while exploring example indexing wikipedia data in solr, how can expected result (i.e. same data imported)? is there process can achieve through configurations not group query, because have data having lots of inner tags. i explored xslt result transformation, looking json response. imported doc: <page> <title>accessiblecomputing</title> <ns>0</ns> <id>10</id> <redirect title="computer accessibility" /> <revision> <id>381202555</id> <parentid>381200179</parentid> <timestamp>2010-08-26t22:38:36z</timestamp> <contributor> <username>olenglish</username> <id>7181920</id> </contributor> </revision> </page> solrconfig.xml: <dataconfig> <datasource type="filedatasource" encoding="utf-8" /> <document> <entity name=

Re-render only on button press in react-native -

i have react native screen 2 text inputs added default, while 2 text inputs added on button press only. i able add text first 2 text inputs, other 2 not accepting text, accept text when "add car" button pressed again. what missing? why view not re-rendered when add text. carreg.js 'use strict'; import react, { component } 'react'; import { stylesheet, text, view, textinput } 'react-native'; var button = require('./button'); var parse = require('parse/react-native'); class carreg extends component { constructor(props) { super(props); this.state = { carnumber1: "", carstate1: "", carnumber2: "", carstate2: "", errormessage: "", carentry: <view/>, }; } render() { const { page } = this.state; return ( <view style={styles.container}> <text style={[styles.titlecontainer, {marginbottom: 30}]}> please register cars

Controls in iOS for quiz app with differing number of answers to questions -

i'm working on quiz app. the thing i've noticed questions may not have fixed number of answers. instead of say, 4 possible answers , 1 correct answer, have 6 possible answers 2 correct answers. is there way deal this? what don't want have buttons not in use. at moment i'm wondering if there way of having multiple view controllers depending on how many possible answers there are, or have buttons become inactive if there no answer selected? it possible. should use tableview / collectionview achieve that. you able change number of items, according answers count, , allow user select 0 n answers. moreover, it reusable components, have design ui 1 question, , following reuse same layout

scala - How to print $ using String Interpolation -

this question has answer here: escape dollar sign in string interpolation 1 answer i have started learning scala .i want print $ using string interpolation def main(args:array[string]){ println("enter string") val inputstring:string=readline() val inputasdouble:double=inputstring.todouble printf(f" owe '${inputasdouble}%.1f3 ") } input 2.7255 output .you owe 2.73 while want owe $2.73 pointers of great help just double it printf(f" owe $$${inputasdouble}%.1f3 ") result: 16/06/02 10:16:04: owe $2,73

When do javascript closures get cleared from memory -

let's have application(in it's rudementary form) +function($) { var appname = "foobarbaz"; var appid = appname.replace(/[^a-z]+/gi, '').replace(/(.)([a-z])/g, "$1-$2").tolowercase() var application = function($elem) { this.$el = $elem; this.appname = appname; this.appid = appid; } application.prototype.getid = function() { return this.appid; } application.prototype.setid = function(newid) { this.appid = newid; } $.fn.appthing = function () { var $this = $(this); var app = $this.data('app.'+appname); if(!app) { $this.data(oc, (data = new application(this))); } } }(window.jquery); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> now if reload happens , $.fn.appthing gets overwritten new(exact same code, freshly loaded) application function , dom elements linked replace

jquery - Navbar become transparent and fixed to top when scroll down -

Image
i want nav bar site. http://bootstraplovers.com/templates/assan-v2.3/main-template/index.html when i'm scrolling, nav bar of template becomes transparent , becomes fixed top. want nav bar same. i'm new html , css , bootstrap. can give me ideas how or clues? this nav bar: .navbar-header{ height: 74px; } .navbar-toggle{ position: relative; top: 15px; } .navbar-default .navbar-nav > li > { font-weight: 590; color: #949494; display: block; padding: 5px 35px 2px 45px; border-bottom: 3px solid transparent; line-height: 70px; text-decoration: none; transition: border-bottom-color 0.5s ease-in-out; -webkit-transition: border-bottom-color 0.5s ease-in-out; } .nav.navbar-nav > li > a:hover, .nav.navbar-nav > li.active a{ color:#a92419; border-bottom-color: #a92419; } .navbar-default .navbar-nav>.active>a, .navbar-default .navbar-nav>.active>a:focus, .navbar-default .navba