Posts

Showing posts from July, 2015

sass - Is there a way to make Prepros NOT minify the CSS output? -

Image
i want process sass files, don't want minify css. i didn't find config option that. there way? yes, can. need turn off lib-sass option or uncheck compress css option.

html5 - CSS to format SSN form input -

i have form, written in html5 , css3, has specific fields (ssn, phone number, initial) varying lengths. trying figure out how format input field x characters long depending on input (11 ssn, 1 initial, 5 zip... etc) i know used able put size="11" , input field (not label) set size, seems disabled or being overwritten bs3. any suggestions on how accomplished? what have code @ moment is: <div class="form-group"> <label class="control-label" for="ssn">ssn:</label> <input type="email" class="form-control" id="ssn" placeholder="###-##-####" size="12"> </div> but not seem work, , if try class="col-sm-2" (or other number matter) format gets goofy (does not line in cases). thanks in advance. since tagged html5 can use: <div class="form-group">

c# - Use Operator from array in IF statement -

i trying use operator selected array in if statement. code below cannot compile it. there anyway around ? string[] operators = new string[]{"<",">","=","!="}; decimal value = convert.todecimal(values[j]); var operator1 = (operators[convert.toint32(iquerytypelist[k])]); int jjj = convert.toint32(ntestvaluelist[k]); if (value operator1 jjj) { isactive = true; } else { isactive = false; } one way perform string comparison either if-else chain or switch statement. don't know exact syntax c#, consider following pseudocode: if (operator1.equals("<")) isactive = value < jjj // etc.

Joining - Merge Multidimentional Array with a key value as identifier in PHP -

[{ "title" = > "ceo", "name" = > "george", "columns" = > [{ "display_name" = > "salary", "value" = > "3.85", }, { "display_name" = > "bonus", "value" = > "994.19", }, { "display_name" = > "increment", "value" = > "8.15", }] }] data2 = [{ "title" = > "ceo", "name" = > "george", "columns" = > [{ "display_name" = > "address", "value" = > "albany", }, { "display_name" = > "phone", "value" = > "47123", }, { "display_name" = > "mobile", "value" = > "7

sql - difference between Not In and <> or <> -

is there difference in below 2 codes, getting huge difference in output. 1) sum( case when lientype.id not in (-1, -3) ((a.floatingspread + dbo.maxfloat(a.floatingspreadfloor, al.liborrate)) * pos.marketvalue) else 0 end)/nullif(sum( case when lientype.id not in (-1, -3) (pos.marketvalue) else 0 end),0) averagecoupon 2) sum( case when ( lientype.id<>-1 or lientype.id<>-3 ) ((a.floatingspread + dbo.maxfloat(a.floatingspreadfloor, al.liborrate)) * pos.marketvalue) else 0 end)/nullif(sum( case when ( lientype.id<>-1 or lientype.id<>-3 ) (pos.marketvalue) else 0 end),0) averagecoupon the not in case should translate <> -1 , <> -3 . having <> -1 or <> -3 translates not in (-1) or not in (-3) , outputs different.

java - Sapce Error in Intelliji IDE - Intellij.ide.SystemHealthMonitor - Low disk space on a IntelliJ IDEA system directory partition -

intelliji consistently throwing pop error "low disk space error in intellij ide."(repeatedly) version - intellij idea community version 14 tried few suggestions official site https://www.jetbrains.com/idea/help/tuning-intellij-idea.html none of size increasing techniques solved particular error. (note - there 100+ gb of free space intelliji installed partition.) also tried solution suggested in forum - add parameter -didea.no.system.path.space.monitoring=true in /bin/idea.vmoptions file(located inside < intellij installed directory >) , restarted intellij, but issue still persists. suggestions welcomed. its resolved after adding parameter - idea.no.system.path.space.monitoring=true in /bin/idea.properties file. source - https://youtrack.jetbrains.com/issue/idea-118718

python - Using PIL to create thumbnails results in TextEdit Document extension -

Image
using pil, able create thumbnail of picture according computer (running mac os x ), image has extension of textedit document instead of png or jpeg . wondering how can fix result in correct extension. here code ran: >>> pil import image >>> import glob, os >>> size = 128, 128 >>> pic = glob.glob("cherngloong1.jpg") >>> im = image.open(pic[0]) >>> im <pil.jpegimageplugin.jpegimagefile image mode=rgb size=2048x1365 @ 0x100a63bd8> >>> im.thumbnail(size, image.antialias) >>> im.save("cherngloong_thumbnail", "png") >>> im.save("cherngloong_thumbnail1", "jpeg") thumbnail extensions: this happening because aren't saving filename extension. most modern operating systems use file extensions determine program should open file. since called: >>> im.save("cherngloong_thumbnail", "png") >>> im.

python - Select query fails in sqlalchemy -

please having issue first sqlachemy app. trying query db posgres , return row matches . below code. app.py from sqlalchemy.orm import sessionmaker models.models import base,user,product,productitem,database, initialize engine = database base.metadata.bind = (engine) dbsession = sessionmaker(bind=engine) session = dbsession() .... @app.route('/login', methods = ['get','post']) def login(): form = registerform.loginform() if request.method == 'get': return render_template('login.html', form=form) return authenticate(form = form) def authenticate(form): if form.validate_on_submit(): try: user = session.query(user).filter(user.email == 'xxxx@yahoo.com') if session.query(exists().where(user.email == form.email.data)).scalar() : return user.name except :# models.doesnotexist: flash("your email or password not match !", "erro

android - Recognize Device Position In User's Hand -

i need recognize how user hold device. tried use in couple accelerometer , magnetometer in way: public void onsensorchanged(sensorevent event) { switch(event.sensor.gettype()) { case sensor.type_accelerometer: mgravity = event.values.clone(); log.d("sensor","accel"); break; case sensor.type_magnetic_field: log.d("sensor","magnet"); mmagnetic = event.values.clone(); break; default: log.d("sensor","default"); } if(mgravity != null && mmagnetic != null) { //float[] temp = new float[9]; float[] r = new float[9]; //load rotation matrix r sensormanager.getrotationmatrix(r, null, mgravity, mmagnetic); //return orientation values float[] values = new float[3

ios - How to open a modal with UITabBarController and on close, display last tab bar view? -

so have uitabbarcontroller on 1 storyboard has 3 buttons. 2 of them open standard views associated tab bar standard view association segues... third item issue. i open form lives in storyboard (shared other views in app) in modal view, , upon close or submit, return whatever tab active in tabbed view. i've seen few "options" out there, none of them seem looking do. any ideas? edit: got edited out of original question mod, writing in swift...not obj-c. so have potential solution works using blank view controller, shouldselectviewcontroller , uitabbarcontroller delegate. issue is, i'm not particularly happy how brittle is. func tabbarcontroller(tabbarcontroller: uitabbarcontroller, shouldselectviewcontroller viewcontroller: uiviewcontroller) -> bool { // bit dangerous if move 'newcontroller' located in tabs, break. let newcontroller = viewcontrollers![1] as! uiviewcontroller // check if view load second tab , if is, load

html - Make all elements of <ul> element visibile -

in <ul> , first descendent <ul> element not shown if has descendent <ul> element itself. i.e. "level ii" elements visible if there no "level iii" elements. i'd elements in child <ul> show of <li> elements within it, unordered list rendered without css. nav { background: black; position: fixed; left: 0; top: 0; width: 120px; height: 100%; } nav ul { margin: 3rem 0 0 0; padding: 0; list-style: none; } nav ul li { padding-top: 4rem; margin-bottom: 1rem; text-align: center; } /** nav level ii **/ nav ul li > ul { position: fixed; width: 300px; height: 100%; top: 0; left: 120px; background: red; display: list; margin: 0; padding: 3rem 1rem; } nav ul li > ul li { padding: 0; text-align: left; background: green; display: inline; } /** nav level iii **/ nav ul li &

chef - Knife does not detect winrm when called from Jenkins -

my knife winrm command works when called command prompt knife winrm 'blrvm5' 'chef-client -c c:/chef/client.rb' -m -x domain\user -p mypassword if fire knife command in command prompt responce shows knife options including winrm. but same thing when called jenkins (jenkins slave on same machine) not working. getting below responce : fatal: cannot find sub command for: 'winrm blrvm5 chef-client -c c:/chef/client.rb -m -x domain\user -p mypassword if call knife jenkins slave - options shows commands till vault commands winrm command not detected. full error log below : c:\opscode\chefdk\bin>knife winrm 'blrvm5' 'chef-client -c c:/chef/client.rb' -m -x domain\user -p mypassword' fatal: cannot find sub command for: 'winrm blrvm5 chef-client -c c:/chef/client.rb -m -x domain\user -p mypassword' available subcommands: (for details, knife sub-command --help) ** bootstrap commands ** knife bootstrap fqdn (options) ** client

ios - Predicates and combined filters in core data? -

i'm not using core data currently, i'm switch realm, if i'm sure thing work, vital way application works. have model 2 objects: message: date - nsdate text - string images - one-to-many > image image: imageurl - string message - many-to-one > image i have table view displays both images , messages. need know should go @ index path, when uitableview wants know. need able perform query akin to: "give me ordered list of images , messages, messages sorted date , images sorted message.date ". how this? as far know can't sort mixed array messages , images during coredata fetch request. here 1 possible way: fetch messages , images separately merge 2 arrays one sort 1 array - (nsarray *)sortedarrayusingfunction:(nsinteger (*)(id, id, void *))comparator context:(void *)context the function nsinteger sort(id item1, id item2, void *context) { int v1 = [item1 iskindofclass[message class]]?item1.data:item1.message.date;

c# - Keep UI responsive using Tasks, Handle AggregateException -

i have problem handling aggregateexception if winforms application starts task keep responsive while task performing. the simplified case follows. suppose form has slow method, instance: private double slowdivision(double a, double b) { system.threading.thread.sleep(timespan.fromseconds(5)); if (b==0) throw new argumentexception("b"); return / b; } after pressing button want form show result of slowdivision(3,4). following code hang user interface time: private void button1_click(object sender, eventargs e) { this.label1.text = this.slowdivision(3, 4).tostring(); } hence i'd start task processing. when task finishes, should continue action display result. prevent invalidoperationexception need sure label1 accessed thread created on, hence control.invoke: private void button1_click(object sender, eventargs e) { task.factory.startnew ( () => { return this.slowdivision(3, 4); }) .continuewith( (t) => {

php - Get the locations of selected user -

here query, $query=mysql_query("select * quiz_grades grade, user_info_data info, user user user.id=grade.userid , user.id=info.userid , grade.quiz=12 , info.fieldid=1 , info.data='ap' order data asc, grade desc"); from following table, $user->id current logged in user variable. if userid = $user->id belongings ap, ap should display. if userid = $user->id belongings tl, tl should display. info.data storing ap , tl records. <table> <tr> <th>userid</th> <th>data</th> </tr> <tr> <td>1</td> <td>ap</td> </tr> <tr> <td>2</td> <td>tl</td> </tr> <tr> <td>3</td&

jQuery plugin vertical scroll fullheight page -

someone know name of plugin or way perform vertical page per page 1 in site? http://karimrashid.com/overview#about these application single page applications: try plugin: http://alvarotrigo.com/fullpage/#firstpage

javascript - Invoking parent function with instance from child in Reactjs -

i have 2 components, parent component creates dom using child component. more , 2 child component created. while creating child component click event declared in parent passed props. expect child evoke function instance. but problem face when click event evokes child; instance last child. please have on code , let me know going wrong var accordioncontrol = react.createclass({ handleclick: function (event) { event.preventdefault(); this.refs["accordionheadercomponent"].toggleheaderdisplay(true); }, createmenuelement: function (menucontentprops, index) { var boundclick = this.handleclick.bind(this, index); var headercontent = <menuheader key = {index} clickevent = {boundclick} ref = "headercomponent" menuheaderprops = {menuitemprops} />; }, render: function(){ for(var index=0; index<menudata.length; index++) { wrapp

How to get all array values in php? -

i've been trying create new pages using template strings in replaced values arrays. page creation working fine specific array number. however, i'm expecting create new pages values arrays, not 1 or 2 specific value. this code far: <?php $dom= file_get_html($url); $array_title = array(); $array_details = array(); foreach ($dom->find('div[class=main]') $results) { foreach ($results->find('title') $title) { $array_title[] = $title->alt; } foreach ($results->find('div[class=details]') $details) { $array_descript[]= $details->innertext; } } { $page = str_replace("{title}", $array_title[3], $template); $page = str_replace("{descript}", $array_descript[3], $page); //create name new page $pagename = $array_title[3].".php"; //put created content file file_put_contents("article/".$pagename,$page); } ?> the a

sql server - T-SQL string email format issue -

i trying build email , have run issue. when stored procedure runs, following error message. msg 14624, level 16, state 1, procedure sp_send_dbmail, line 242 @ least 1 of following parameters must specified. "@body, @query, @file_attachments, @subject". my code below adding each of requested items. have narrowed down breakdown happens. if pull out concatenation "+" works expected. have done before concatenation not sure different. declare @respperiod varchar(20) declare @subjectline varchar(100) declare @contactemail varchar(100) declare @aaeapvsupplierid int declare @key varchar(50) declare @formattedurl varchar(100) declare @emailbody varchar(max) declare curs cursor select theid #temptbl open curs fetch next curs @theid while @@fetch_status = 0 begin select * #temptbl tblmaintbl theid = @theid declare @iscomplete bit = 1 if exists (select * #temptbl complete = 0) begin set @iscomplete = 0 e

php - Change the value of SendBufferSize in apache 2 -

i wondering how change value of sendbuffersize in apache2. not find variable in apache2.conf file also. trying follow steps here http://fplanque.com/dev/linux/why-echo-is-slow-in-php-how-to-make-it-really-fast in order make php script faster.

XSD to C# Converter -

i have used jaxb , ant script convert xsd java classes. after have used java c# code converter tool. below 1 of c# code generated comments //java c# converter todo task: java annotations not have direct .net equivalent attributes: //original line: @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "java.city") public class adxpcity extends adxp public class javacity : java { } should convert commented @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "java.city") (or) can use above class is? the better thing convert xsd c# directly via xsd.exe gets installed visual studio. the basic form be xsd.exe yourfile.xsd /classes however if review documentation can customize further options default namespace class generated inside. there other 3rd party code generators listed in question have more features xsd.exe , have used xsd2code , found use.

ibm mobilefirst - Worklight 6.2 SSL configuration -

i'm trying configure ssl on local development machine adapters able connect bank-end service. our back-end service team provided following information: ssl.keystore.path=conf/mobile.p12 ssl.keystore.type=pkcs12 ssl.keystore.password=passa ssl alias = alias ssl password = passa they send use "mobile.p12" file. i added configuration worklight.propeties: # worklight ssl keystore ####################################################################################################################### ssl.keystore.path=conf/mobile.p12 #ssl certificate keystore type (jks or pkcs12) ssl.keystore.type=pkcs12 #ssl certificate keystore password. ssl.keystore.password= passa in adapter.xml added following: <sslcertificatealias> alias </sslcertificatealias> <sslcertificatepassword> passa </sslcertificatepassword> when deploy project on local machine , try login in app through 1 of our adapters, i'm getting error: [error ] fwl

awk - To take only the number in Size in unix -

i trying identify file contributing more in directory structure. doing following steps manually example: du -sh * [0-9]g give me folders inside having gb size. 2.0g images 3.7g files 8.9g audio i want variable take highest sized directory size 8.9, how can in awk or grep i might change bit to: du -sk .??* * | sort -rn | head -1 the interesting difference .??* * catch pesky "hidden" directories. chief among offenders .cache .

python - Join Multiple Files Dictionary -

i have master table contains fields. want join bunch of other csvs. current data looks like: file 1: key attrib1 attrib2 attrib3 attrib4 file 2: key attrib5 file 3: key attrib6 i want final output like: key attrib1 attrib2 attrib3 attrib4 attrib5 attrib6, etc. not files contain of keys. current code: master = "in.csv" file1 = "file.csv" file2 = "file2.csv" prime = list() d1 = {} open(master) f: k in csv.reader(f): prime.append(k[0]) k in prime: open(file1,'r') csvfile: rd = csv.reader(csvfile,delimiter=",") row in rd: if row[0] ==k: d1 = dict((row[0],row[1]) rows in rd) open(file2,'r') csvfile: rd = csv.reader(csvfile,delimiter=",") row in rd: if row[0] ==k: d1 = d1+dict((row[0],row[1]) rows in rd) i think close if not want: master = "in.csv" filelist = &

display different content using bootstrap modals -

i want make content different categorized photo, when click 1 of category ,it pop modal(which i'm using bootstrap) contain pictures category.for example: have 2 category, male , female. when click male category, pop modal male photo only. source code: <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">&times;</span></button> </div> <div class="modal-body"> <div id="carousel-example-generic" class="carousel slide" data-rid

Adding a second SQLite db in Ruby on Rails -

i have ror application sqlite3 db. want create new database, , not want delete previous one. how define new db in current project, when run rake db:create referring new one? generally process add new sqlite db in existing project? follow below steps: change database name in database.yml file rake db:create rake db:migrate

How do I prevent '&' to convert in '&amp' while xml serialization in ASP.NET Web API? -

i creating booking service using asp.net web api, for response model this: [xmlroot("ratelist")] public class ratelist { [xmlelement("rate")] public list<rate> rate { get; set; } } public class rate { [xmlattribute("code")] public string code { get; set; } [xmlattribute("errormessage")] public string errormessage { get; set; } [xmlelement("roomrate")] public list<roomrate> roomrate { get; set; } } public class roomrate { [xmlattribute("url")] public string url { get; set; } } response must of xml format, have serialized of below, return request.createresponse<ratelist>(httpstatuscode.ok, objratelist, configuration.formatters.xmlformatter); my global.asax file webapiconfig.register(globalconfiguration.configuration); var xml = globalconfiguration.configuration.formatters.xmlformatter; xml.usexmlserializer = true; the actual response mu

javascript - Setting uniforms in webgl -

can explain or point me in right direction of explaination of different functions used set uniform values. in cheat sheet here this: void uniform[1234][fi](uint location, ...) void uniform[1234][fi]v(uint location, array value) void uniformmatrix[234]fv(uint location, bool transpose, array) but i'd know each of these doing , f's , i's for. 1234 = dimensions f = float i = integer v final character, if present, v, indicating command takes array (a vector) of values rather series of individual arguments for non array uniform difference between v , non v versions of uniform functions how provide data it: uniform1fv(loc,[3.14159]) vs uniform1f(loc,3.14159) . uniform3fv(loc,[.5,1.,.5]) vs uniform3f(loc,.5,1.,.5) but array uniform can set entire array using v functions in shader uniform float somearray[10]; in js // @ init time var location = gl.getuniformlocation(prg, "somearray"); // @ render time var arraywith10values

Why is grails.gorm.autoFlush set to true not working? -

consider following code: class user { static constraints = { email email: true, unique: true token nullable: true } string email string password string token } @testfor(user) @testmixin(domainclassunittestmixin) class userspec extends specification { def "email should unique"() { when: "twice same email" def user = new user(email: "test@test.com", password: "test") def user2 = new user(email: "test@test.com", password: "test") then: "saving should fail" user.save() !user2.save(failonerror: false) } } with following configuration (part of it), application.yml: grails: gorm: failonerror: true autoflush: true why user2.save(failonerror: false) not returning false due not being saved database? output of running: grails test-app *userspec : businesssoftware.userspec > email should u

eclipse - No source attachment in Java -

i trying use external .jar file in project. have put .jar file in project's /lib folder, , have referenced in build path. however, when try use in code, can't javadoc it, nor can see actual code referenced classes. says has no source attachment . meant source attachment? have javadoc folder came it, when attach build path, still reports not found javadoc classes. ideas on that? i want able see javadoc. the .jar file generated packed classes of java code. jars come java doc , code , others won't. for recent eclipse versions: right-click jar in question (in referenced jars, not physical jar) , choose preferences -> javadoc. here give correct location (zip/url) correct javadoc. (select validate!) for older eclipse versions: first: navigate jar in eclipse project explorer (to left) , try open aclass of jar. then, see warning it has no source attachment , , button attach source code. then, push button, select "external folder" , navigate f

postgresql - SQL to work out sales by product taking into account age -

i want work out sales product grouped release date, grouped age of product when sold, this: | 3 months | 6 months 2015-01 | 28.1 | 37.1 2015-02 | 29.3 | 35.6 so 28.1 average number of products sold of each type, 3 months after being released, products released in 2015-01. there more products sold 6 months after release date, 37.1. the following sql gets list of sales: select d.item title, d.quantity, a.firstdate release_date, i.date invoice_date, i.date - a.firstdate age invoices join invoice_details d on i.id = d.invoice_id join (select d.item, d.binding, min(i.date) firstdate invoices join invoice_details d on i.id = d.invoice_id group d.item, d.binding) on a.item = d.item , a.binding = d.binding i.discount != 100 , d.price > 0 , (d.binding != 'hardback' or d.binding != 'ebooks') order title, invoice_date and result lo

c# - How to overwrite default collection on deserialization -

i have class represents bunch of settings: public class settings { public settings() { innersettings = new list<innersettings>(); //this settings want have default innersettings.add(new innersettings()); } [xmlarray] public list<innersettings> innersettings {get; set;} } now, when deserialize object, innersettings xml added list on top of items created in default settings() constructor. there easy way tell deserializer, want overwrite collection instead, removing default items? xml serializer doesn't support callback , deriving xmlserializer class there few methods can override. let's see (dirty) workarounds: 1) change default constructor (the 1 xmlserializer call) not include default item(s). add second constructor dummy parameter , expose factory method: public class settings { private settings() { // called xmldeserializer } private settings(int dummy) { // called factory method

php - Apache server stopped working -

i'm using apache/2.2.16 (debian) server test server. has stopped working. mean whenever try access page @ x.x.x.x/foo/bar.php browsers status bar says waiting x.x.x.x , server never responds. this error logs @ says: [thu jun 25 11:30:22 2015] [error] [client 94.200.27.10] php parse error: syntax error, unexpected t_string in /usr/share/drupal6/abdi-test/index.php on line 28 [thu jun 25 11:30:59 2015] [error] [client 94.200.27.10] php parse error: syntax error, unexpected t_string in /usr/share/drupal6/abdi-test/index.php on line 28 [thu jun 25 11:31:20 2015] [error] [client 94.200.27.10] php fatal error: call undefined method dbconnector::dbquery() in /usr/share/drupal6/abdi-test/index.php on line 31 [thu jun 25 11:57:41 2015] [error] [client 94.200.27.10] directory index forbidden options directive: /usr/share/drupal6/abdi-test/ [thu jun 25 11:59:03 2015] [error] [client 94.200.27.10] directory index forbidden options directive: /usr/share/drupal6/abdi-test/ [thu jun 2

c# - Adorner as popup not working -

i tried create popup in wpf using adorner can greyout background. idea accept kind of uielement, greyout , lock others (like showdialog in forms), , show uielement. it based on tutorial website . i have 1 class called popup: class popup : adorner, idisposable { private static readonly brush _screenbrush = new solidcolorbrush(color.fromargb(0x7f, 0x7f, 0x7f, 0x7f)); private static uielement _childelement; private static window _window; private adornerlayer _layer; public static idisposable overlay(uielement childelement) { _window = application.current.mainwindow; var grid = logicaltreehelper.getchildren(_window).oftype<grid>().firstordefault(); var adorner = new popup(grid, childelement) { _layer = adornerlayer.getadornerlayer(grid) }; adorner._layer.add(adorner); return adorner idisposable; } private popup(uielement parentparentelement, uielement childelement) : base(parentparentelement)

How to make Android understand C# objects -

i'm trying make asp.net webservice android application. here class: public class student { int studentid {get; set;} string name {get; set;} string phonenumber {get; set;} list<grade> grades {get; set;} } the grade class is: public class grade { int gradeid; string grade; } when send student object using json? how can make android understand , use student object? can give me that?

prolog - Generating subsets using length/2 and ord_subset/2 -

i beginner in prolog. tried in swipl interpreter: ?- length(lists, 3), ord_subset(lists, [1, 2, 3, 4]). false. expecting length-3 lists subsets of [1, 2, 3, 4] [1, 2, 3] or [1, 2, 4]. why false? notice: both length , ord_subset builtin functions (or whatever called) in swi-prolog. you don't solution because ord_subset/2 predicate checks if list subset of list; not generate subsets. here 1 simplistic way define predicate seem after: subset_set([], _). subset_set([x|xs], s) :- append(_, [x|s1], s), subset_set(xs, s1). this assumes these "ordsets", is, sorted lists without duplicates. you notice subset happens subsequence. have written instead: subset_set(sub, set) :- % precondition( ground(set) ), % precondition( is_list(set) ), % precondition( sort(set, set) ), subseq_list(sub, set). subseq_list([], []). subseq_list([h|t], l) :- append(_, [h|l1], l), subseq_list(t, l1). with either definition, get: ?- l

php - How can I make data sortable by date in an SQL populated table? -

currently have page displays orders on system on single page, part working fine , not problem. issue occurs when reach amount of orders want make easy digest, max orders show on page @ once 15 , data sortable faster searching. my code below: <?php $servername = "localhost"; $username = "qwe"; $password = "qwe"; $dbname = "qwe"; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "select * orders order id desc";

join - How to merge two collections in mongodb -

i have 2 collections called company_details , company_ranks...comp_id common in 2 collections. how merge these 2 collections complete details of company. please me thanks satyam to make long story short, either on client-side or consider benefits of embedding documents. mongodb not support joins, opposed relational databases. both pro , con. has helped mongodb's developers focus on scalability harder implement when have joins , transactions. you can follow dbref specification. lots of drivers support dbref , composition seamlessly you. can manually. importantly, can take advantage of embedding documents . embedding documents in mongodb unique ability on relational databases. meaning, can create 1 collection consisting of compound documents. you'll enjoy atomicity, there no "partial success", , data locality: spinning disks better in accessing data in sequence.

html - How to change the style of the default WooCommerce sorting selectbox -

i didn't find default styling of selectbox sorting products woocommerce appealing. decided change css. worked half-way. problem: select-element did accept style changes, actual dropdown options didn't. change appearance of dropdown css-changes. this want achieve: http://jsfiddle.net/pioul/2wdgh/ ...for page: http://sandbox.inspirapress.com/kaizen/butikk/ this general markup have work with: <form class="woocommerce-ordering"> <select> <option></option> <option></option> <option></option> </select> </form> the js , css files(jquery.simpleselect.js/css) seem enqueue correctly in header , footer. i'm not quite sure inline script footer though... i've tried everything. please help! :) //andré

jquery - Bootstrap carousel does not display images on the same line -

i developing carousel bootstrap , , aim have 5 images shown , every time slides, advances of 1. the issue having @ moment, elements not aligned here can find complete code someone know how fix issue , put elements on same line? in advance replies! i think need remove margin on this: <div class="col-xs-2" style="margin-right: 15%"> so, it's just: <div class="col-xs-2"> as bootstrap adds own margins overwriting?

javascript - function to mirror insertAdjacentHTML -

i trying write function mirror insertadjacenthtml dom method element.insertadjacenthtml , here is function insertadjacent(targetelement) { 'use strict'; return { insertafter: function (newelement, targetelement) { var parent = targetelement.parentnode; if (parent.lastchild === targetelement) { parent.appendchild(newelement); } else { parent.insertbefore(newelement, targetelement.nextsibling); } }, insertatbegin: function (newelement) { var fchild = targetelement.firstchild; if (!fchild) { targetelement.appendchild(newelement); } else { targetelement.insertbefore(newelement, fchild); } }, insertatend: function (newelement) { var lchild = targetelement.lastchild; if (!lchild) { targetelement.appendchild(newelement); } else { this.insertafter(newelement, targetelement.lastchild); } }

c - cudaEventRecord() Does not time correctly on Visual Studio CPU code -

while doing basic examples of cuda made nvidia copied code test speedup cpu gpu computing matrix multiplication. after 30 minutes looking results , seeing cpu (yes cpu) doing 1000 times faster computations gpu realised timing not working correctly. snipped of code looks (this code nvidia): //create timers cudaevent_t start; cudaevent_t stop; float simplekerneltime; float optimisedkerneltime; //start timer cudaeventcreate(&start); cudaeventcreate(&stop); cudaeventrecord(start, 0); matrixmultkernel<<<grid, block >>>(a_d, b_d, c_d, n); cudaeventrecord(stop, 0); cudaeventsynchronize(stop); cudaeventelapsedtime(&elapsedtime, start, stop); // print time , other things cudaeventrecord(start, 0); matrixmultcpu(a_h, b_h, d_, n); cudaeventrecord(stop, 0) cudaeventsynchronize(stop); cudaeventelapsedtime(&elapsedtime, start, stop); // print time this code works fine on linux machine (i copied same code person next me , getting timing) on windows

Best practices for the OAuth "application server" - Square -

i have application uses personal access token access list of items. want switch using oauth, application use items_read only. my application daemon running on instance of secure ubuntu server dedicated application(s). regarding "application server" there square recommends - typical best practices "application server"? thank you the api documentation extensive, , includes a helpful section oauth . few common pitfalls i've noticed oauth implementations in past lead me call these things out: if building one-off integration own use, not worth using oauth. make sure understand how oauth works. if find asking users' client secrets or personal access tokens, or else requires them open app management dashboard @ connect.squareup.com, need rethink implementation. you, developer, should need understand access tokens , other api credentials. you can ask more oauth scopes bare minimum need. i'd recommend getting merchant_profile_read well. ca

php - smarty include markdown file -

i want include markdown file in smarty template. in php have this: $smarty->assign('text', 'path_to_file/text.md'); in template use: {include file=$text} but returns unformated block of text. i tried using david scherer’s markdown plugin smarty: {markdown text=$text} but returns file path stored in $text variable. how smarty parse included file markdown? you instead read file , assign contents variable, use markdown plugin. $smarty->assign('text', file_get_contents('path_to_file/text.md')); manual page file_get_contents()

mongodb - Missing id JSON - GET -

i've made couple of registries in database (mongodb), when try @localhost:8080/ {for example company} info collection can't see id of documents, entered. any ideas how can fix , show id ? { "name" : "google", "person" : null, "_links" : { "self" : { "href" : "http://localhost:8080/company/2" }

git - Assumed unchanged file changed on pull -

i have file config.properties contains information needed comunication webservice (ie api token etc.) , don't want information become public. i made properties empty , file looked this: accesstoken= domain= then issued git update-index --assume-unchanged config.properties , committed file. after filled properties information needed file looked bit this: accesstoken=xxxxxxxxxxxxxxx domain=http"//xxx.xxx.xx/xx when ran git status after file didn't list changed, far good. did same other users contributing project , worked fine. but here's problem: when pull file gets 'reset' it's 'original' state (ie 'empty' file) , end again: accesstoken= domain= what have done wrong? or idea of git update-index --assume-unchanged wrong?

android - ERROR: Cannot get property 'compileSdkVersion' on extra properties extension as it does not exist -

Image
i using specialcyci/androidresidemenu third party library (github) in android project. have imported residemenu project workspace , made module dependency library project. while build project got following error: error:(7) problem occurred evaluating project ':residemenu'. cannot property 'compilesdkversion' on properties extension not exist if explain more can better problem in gradle. need have extension file top-level gradle. let me explain how works: in app-level gradle file, there should configuration that: def config = rootproject.extensions.getbyname("ext") you can use configurations extension file that: android { compilesdkversion config.getat("compilesdkversion") } but, need add extension file root of project: dependency-versions.gradle ext { compilesdkversion = 25 //... } and need top-level gradle that: def config = rootproject.extensions.getbyname("ext")

asp.net - Blank Json modelState key from UserManager PasswordValidator -

using usermanager set password validation: usermanager.passwordvalidator = new passwordvalidator { requiredlength = 6, requirenonletterordigit = true, requiredigit = false, requirelowercase = true, requireuppercase = true, }; when make call change password via api, response if password not valid is: { "message": "the request invalid.", "modelstate": { "": [ "passwords must have @ least 1 non letter or digit character. passwords must have @ least 1 uppercase ('a'-'z')." ] } } how set blank modelstate key property?

java - performance issue LibGdx Box2d -

Image
i have performance issue while update/render bodies(mobs) can see photo bellow many bodies add memory(private working set) cpu increased example if add 100 bodies move random in map merory(private working set) reach 900.000k going on? doing wrong? image url : http://prntscr.com/7l31tn mob initialization ->> private void initializeentityintoworld() { //initializethemob bodydef bodydef = new bodydef(); fixturedef fixturedef = new fixturedef(); polygonshape boxshape = new polygonshape(); bodydef.position.set(6,3); bodydef.type=bodytype.dynamicbody; bodydef.fixedrotation=true; body = world.createbody(bodydef); body.setuserdata(this); boxshape.setasbox(width_meter, height_meter); fixturedef.shape=boxshape; fixturedef.filter.categorybits = constants.bit_player; fixturedef.filter.maskbits = constants.bit_ground; fixturedef.density = 1; fixturedef.friction = 0f; body.createfixtur