Posts

Showing posts from June, 2012

html - Layering iframe and video -

i have video want play on top of iframe , remove when finishes can't make video appear above iframe. there trick it? i've tried css z-index doesn't help. have code this: <html> <head> <title>enormous wedding iii</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class = "container"><span> <div id = "game"><iframe src='...'></div> <div id = "video"><video autoplay> <source src="menu.mp4" type="video/mp4"> </video></div> </span></div> <script> var video = document.getelementsbytagname('video')[0]; var game = document.getelementsbytagname('iframe')[0]; video.onended = function(e) { video.style.display = "none"; }; </script> </body></html> and css file: htm

rest - Does MailChimp have a sandbox API with dummy data in it for testing? -

i'd start using mailchimp api create utility pulls metrics user's account, such subscribers, last campaign date (not sure if 1 available yet), open rate, etc. one critical issue i'm facing that, while have free mailchimp account, there no data in whatsoever (no lists, subscribers, campaigns, etc.), makes less ideal testing. so i'd know best option here, i.e.: should create dummy data manually (like add myself subscriber list , send myself emails?), or (mailchimp) provide "sandbox" account has richer test/dummy data in it? or, some other alternative... ps - i'm using mulesoft integration task (i mention because perhaps info answer). mailchimp doesn't provide 'sandbox' account api testing. think best bet subscribe , play around. i've found mailchimp's api super easy use , mighty documented, imagine won't have trouble figuring out without sandbox play in. btw: last campaign date pulled campaigns/list output

oracle - SQL Creating New Table that is based of a column in an already created table -

here example of need, different values: have table 1 created in database. table 1: person columns: pk->id, name, favorite color, favorite sport, etc.. table in database , filled values. now want create second table, table 2 has primary key of favorite sport column table 1 , 1 more column description. ex: table 2: sports columns: pk->favorite sport, description i want make sure creating table correctly, don't mess up. correct syntax use? (i fill data separately after table created.) create table sports ( favorite_sport varcher(25), description varcher(100), primary key(favorite_sport), foreign key(favorite_sport) references person; ) thanks! there several ways this, think i'd go with create table sports (sport varchar2(25) constraint pk_sports primary key using index, description varchar2(100)); (i changed name of primary key column on sports table sport). you don't want nor can have sports.sport reference pers

python - Caffe: Extremely high loss while learning simple linear functions -

i'm trying train neural net learn function y = x1 + x2 + x3 . objective play around caffe in order learn , understand better. data required synthetically generated in python , written memory lmdb database file. code data generation: import numpy np import lmdb import caffe ntrain = 100 ntest = 20 k = 3 h = 1 w = 1 xtrain = np.random.randint(0,1000, size = (ntrain,k,h,w)) xtest = np.random.randint(0,1000, size = (ntest,k,h,w)) ytrain = xtrain[:,0,0,0] + xtrain[:,1,0,0] + xtrain[:,2,0,0] ytest = xtest[:,0,0,0] + xtest[:,1,0,0] + xtest[:,2,0,0] env = lmdb.open('expt/expt_train') in range(ntrain): datum = caffe.proto.caffe_pb2.datum() datum.channels = xtrain.shape[1] datum.height = xtrain.shape[2] datum.width = xtrain.shape[3] datum.data = xtrain[i].tobytes() datum.label = int(ytrain[i]) str_id = '{:08}'.format(i) env.begin(write=true) txn: txn.put(str_id.encode('ascii'), datum.serializetostring()) env = lm

php - Insert csv values into MySQL database using Column Name -

i download data feed supplies property listings real estate websites. converting feed csv files, , have couple of php files insert csv data mysql database. have them working based off of array number (ie '".$mq_out($arr[1])."' , on. problem is, not control feed myself, array numbers change often, when updates made feed. these updates happening frequently, trying avoid having reconfigure arrays every time. is there way import array data based off of column name in csv file? here sample of sql insert script , csv file. $sql = "insert ".$tablename." values ( '', '', '".mq_out($arr[9])."', '".mq_out($arr[5])."', '".mq_out($arr[7])."' , '".mq_out($arr[13])."' , '".mq_out($arr[14])."' , '' , '".mq_out($arr[u_userlastname])."', '".mq_out(.$row->u_loginname.)."', '".mq_out($ar

javascript - Looping through a multidimensional array with jQuery -

i trying use jquery's each function loop through array below. goal find both key ("name") , use underlying array values output in webpage. array ( [e-mail] => array ( [0] => e-mail address spelled incorrectly [1] => error annoy further ) ) there no associative arrays in javscript, means : array ( [e-mail] => array ( [0] => e-mail address spelled incorrectly [1] => error annoy further ) ) you not use array, object instead, , object contain array of messages. here example : var data = { email : [ "your e-mail address spelled incorrectly", "another error annoy further" ] }; now, loop arround data.email array can use $.each of jquery or array.prototype.foreach native method data.email.foreach(function (item, index) { console.log(item); }); using $.each : $.each(data.email, function (index, item) {

How to generate a permutation of list of lists in python -

i have list of lists say [[2, 4, 6], [2, 6, 10], [2, 12, 22], [4, 6, 8], [4, 8, 12], [6, 8, 10], [8, 10, 12], [8, 15, 22], [10, 11, 12]] how generate combination of lists given length? for example if given length 3 then need combinations of 3 list element scenarios given list of list. example : [2, 4, 6], [2, 6, 10], [2, 12, 22] or [2, 4, 6], [8, 10, 12], [10, 11, 12] ... ... , forth and if given length 2 should like [2, 4, 6], [2, 6, 10] or [6, 8, 10], [8, 10, 12] ... ... , forth i dont want permutation of elements inside lists want permutation of lists itself. there 2 options here. first use itertools.permutations . give every permutation (i.e: [1,2] , [2,1] would not same) import itertools lists = [[2, 4, 6], [2, 6, 10], [2, 12, 22], [4, 6, 8], [4, 8, 12], [6, 8, 10], [8, 10, 12], [8, 15, 22], [10, 11, 12]] n = 3 perm in itertools.permutations(lists, n): print(perm) if want unique groupings, no duplicates , use itertools.combinatio

sql - How do i divide by an Alias? -

when run follwing query ora- 00937 error. select apex_utilities.get_invtype(o_code) ,count(c.id) "case count" ,round(sum(billable_time/3600),2) "time(hrs)" ,round(sum(billable_time/count(c.id)),2) "aht(secs)" mytable c c.date_created between :p31_period_start , add_months(:p31_period_start,1) group rollup(apex_utilities.get_invtype(o_code)); if comment out line ,round(sum(billable_time/count(c.id)),2) "aht(secs)" it runs expected, without column appearing. how run including line? if add billable_time group output incorrect many rows groups billable_time invtype. in addition have remove 'sum' line run. the output looking similar following invtype casecount time(hrs) aht(secs) cdcw 1234 308:53:45 909.56 cbcb 100 24:56:34 109.24 it seems want actually: ,round(sum(billable_time)/count(c.id),2) "aht(secs)"` i suspect it's balking because aggr

javascript - Max-height doesn't work as expected on table heading -

i thought might have come on before, if has, can't find it! i'm trying limit height of table heading ( th ) because of style applied jqueryui. unfortunately max-height doesn't appear work. my table stretches maximum height , width available , heading has awful looking strip above , below jqueryui background image. why this, , there workaround doesn't involve re-writing huge chunks of code? making changes way background image displayed isn't solution because end user able control jqueryui theme, , these background images behave differently per theme (basically can break other themes). if want test changes different theme, can find links themes here . here's code (run code snippet in full window see issue): http://jsfiddle.net/cj9t1wdq/ html, body { height:100%; margin:0; padding:0; font-size:90%; } table { border-collapse: collapse; font-size: 1.1em; height: 100%; position: relative; width: 100

java - How to get time for splashscreen -

how time splashcreen? want add 15 second time? how can integrate code? example, direct activity after 15 seconds. package com.trees.activities; import android.app.activity; import android.content.intent; import android.content.sharedpreferences; import android.os.bundle; public class mainslider extends activity{ @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); sharedpreferences settings=getsharedpreferences("prefs",0); boolean firstrun=settings.getboolean("firstrun",false); if(firstrun==false)//if running first time //splash load first time { sharedpreferences.editor editor=settings.edit(); editor.putboolean("firstrun",true); editor.commit(); intent i=new intent(mainslider.this,materialintro.class); startactivity(i); finish();

php fetching data using jquery without refreshing -

i fetching data mysql db using jquery. problem want data php in seprated form, separte field roll number, name , father name php. @ code html , jquery: <div id="name"> </div> <div id="fname"> </div> <script src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script> $('input#rsubmit').on('click', function () { var rnum = $('input#rollno').val(); if ($.trim(rnum) != ''){ $.post('newdata.php', {rnum: rnum}, function(data){ $('div#name').text(data); }); } }); </script> </body> php: if (isset($_post['rnum']) === true && empty($_post['rnum']) === false){ $rollno = $_post['rnum']; $query = $con->query("select * students rollno='$rollno'"); $result = $query->fetch(pdo::fetch_assoc); if ($result == true){ echo "name: ".$result[&

c# - Razor View color row based on one field -

i have ticket list view has tickets can have 3 different statuses: active, deferred, , closed. want able highlight text in each row differently. want active green. closed red. , deferred grey. have found how jquery. don't want learn jquery @ moment if don't have - there other ways directly in view. want add small legend top of each color means. here view code: @model ienumerable<helpdesk.model.ticket> <br /> <div> @html.actionlink("back search query", "techsearchtickets") </div> <h3>@viewbag.title</h3> <table class="table"> <tr> <th> @html.displaynamefor(model => model.ticketnumber) </th> <th> @html.displaynamefor(model => model.opendate) </th> <th> technician </th> <th> @html.displaynamefor(model => model.openuse

email - MailTo with HTML body -

my problem goes this: a client receives email sent exchange server. in mail has formatted body html couple of links have href='mailto:etc...' my question is: can insert html formatted body in mailto: part of href? something like <a href='mailto:me@me.com?subject=me&body=<b>me</b>'>mail me</a> ? note (2016) in ios, fine add <i> , <b> tags simple italic, bold formatting. as can see in rfc 6068 , not possible @ all: the special <hfname> "body" indicates associated <hfvalue> body of message. "body" field value intended contain content first text/plain body part of message. "body" pseudo header field intended generation of short text messages automatic processing (such "subscribe" messages mailing lists), not general mime bodies.

android - View.SurfaceView, why its member, mSurfaceHolder, returns null from getSurface()? -

i studying android game development these days. come across problem surfaceview\surfaceholder. when read source code of view/surfaceview.java in android sdk 22, confused. following code: public class surfaceview extends mockview { ... public surfaceholder getholder() { return msurfaceholder; } private surfaceholder msurfaceholder = new surfaceholder() { ... @override public surface getsurface() { return null; } @override public canvas lockcanvas() { return null; } ... } } i know, msurfaceholder.getsurface()\lockcanvas important, returns null! so, think msurfaceholder may dealt other steps. have learned example surfaceview, didn't figout out special steps deal msurfaceholder, example's code following: public class surfaceviewtest extends activity { string tag = "surfaceviewtest"; fastrenderview surfaceview = null; @override protected void oncreate(bundle sa

trouble with jquery load method -

i have table in 1 html file , div in , both files on same server, same folder. i'm trying use jquery load function folowing. : $('#div').load('game.html #tbl', function(){ alert ("succes on load");}); as can see try target #tbl id of table, , alert succes, no tables loaded. can tables loaded way? look in browser console, have error there. you've got make sure have proper path, relative path. if current doesn't work, try messing around. add ../ before path , see if works. don't know file structure easier you. another problem could don't have right permissions on file, 403 forbidden . so, go check web browser's console. if have following file structure , run code beneath that, should work fine. /project_name ├── index.html ├── game.html index.html <div id="div"></div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script&

java - Setting a Attribute for Every Request (Spring REST) -

i doing rest app in spring , have log out method below. dont have knowledge on spring searched around , made this. @restcontroller public class logoutcontroller { @autowired private databaseservice databaseservice; @requestmapping(value = "/myapp/user/logout", method = get, produces = {"application/xml"}) public users performlogout(@requestheader("authenticationid") string authid, httpservletrequest request) throws datatypeconfigurationexception { return handlelogout(request, authid); } private users handlelogout(httpservletrequest request, string authid) throws datatypeconfigurationexception { logservice.info(this.getclass().getname(), "received logout request"); final usersxmlbuilder usersxmlbuilder = new usersxmlbuilder(); users usersxml = usersxmlbuilder.builddefaultuserstemplate(); httpsession session = request.getsession(); apputilities utils = new apputilities(); try { //checking regex

python - How to get list of subdirectories names -

this question has answer here: how of immediate subdirectories in python 9 answers there directory contains folders files of different formats. import os my_list = os.listdir('my_directory') will return full content of files , folders names. can use, example, endswith('.txt') method select text files names, how list of folders names? try checking directories, while assembling list. import os output = [di di in os.listdir('foo') if os.path.isdir(os.path.join('foo',di))]

android - Overdraw on separator -

when buidling gradle lint report reports following: overdraw: painting regions more once ../../src/main/res/layout/include_divider.xml:4: possible overdraw: root element paints background @color/gray theme paints background (inferred theme @style/apptheme) 1 view xmlns="http://schemas.android.com/apk/res/android" 2 android:layout_width="fill_parent" 3 android:layout_height="1px" 4 android:background="@color/gray" /> i know problem painting on painted part of screen. how can set theme properly? or how can set proper separator rid of issue? the theme using theme.appcompat.light . overdraw should reduced as possible there unavoidably overdraw in screens. in particular case, it's ok draw 1px divider on existing background. lint warnings try best pinpoint possible issues not bulletproof. can safely suppress lint warning particular view.

html - get all javascript timezone as per entered date -

how can time zone detail per date. example : entered date 23/06/2015 , standard time zone detail per dst / non dst date. @ time america/godthab (gmt-03:00) greenland dst , asia/baku ((gmt+04:00) baku, tbilisi, yerevan) non dst. you can use javascript gettimezoneoffset() method: the gettimezoneoffset() method returns time difference between utc time , local time, in minutes. example, if time zone gmt+2, -120 returned. see this information. you can use momentjs , looks perfect.

java - String starts with an empty String ("") -

my program reading text file , doing actions based on text. first line of text problematic. apparently starts "". messing startswith() checks. to understand problem i've used code : system.out.println(thisline + " -- first char : (" + thisline.charat(0) + ") - starts ! : " + thisline.startswith("!")); string thisline first line in text file. it writes console : ! use ! add comments. lines starting ! not read. -- first char : () - starts ! : false why happening , how fix this? want realize line starts "!" not "" collecting mine , others' comments 1 answer posterity, string contains unprintable control characters. try system.out.println( (int)thisline.charat(0) ) to print out numerical code or my_string.replaceall("\\p{c}", "?"); to replace control characters '?'. system.out.println( (int)thisline.charat(0) ) printed 65279 u

Are there fixed memory allocated for Stack and Heap? -

i understand fact stack grows upwards , heap grows downwards or vice-versa (architecture dependent). but, couldn't find details how it's implemented, doubt is, every process memory block allocated, there restriction on, how max chunk can used stack or heap? or there no restrictions till whole allocated memory consumed? yes, processes have predetermined stack sizes. have ever tried recurse method/function much? stackoverflow exception. doesn't mean you've went through entire computer's memory. os controls distribution of stack , heap memory each process.

objective c - Enabling Anti-aliasing for an iOS game -

i developing 3d game iphone , ipad without using game engine. have found edges of 3d elements jagged. after research understood fix issue need enable anti-aliasing in ios. have followed ( https://nicolasgoles.com/blog/2010/07/tutorial-using-anti-aliasing-msaa-in-the-iphone/ ) article enable anti-aliasing using concept of multisampling. after using approach of edges still jagged. have tried increasing sample count approach, there no improvement. have following questions: are there other methods can provide better output compared multisampling approach? any improvement required in current approach? i have seen many 3d games on ios high quality of anti-aliasing. type of anti-aliasing method used these games? i’d appreciate suggestions on issue. thank in advance.

dynamically change javascript source with onclick event -

i’m beginner in javascript , have following problem, have multiple pages in 2 languages. later maybe more. use javascript var set language. either: var language=”de”; or var language=”en”; then used load correct language file: <script src="javascript"+language+".js" type="text/javascript"></script> is there way change variable onclick() event. changes , stays changed until change again? thanks time. you can add scripts dynamically this: var selectorels = document.queryselectorall(".language-select"); var current; function _handleclick ( ev ) { if ( current ) current.parentnode.removechild(current) var language = ev.target.getattribute("data-language"); var newscript = document.createelement("script"); var newsrc = "javascript" + language + ".js"; newscript.setattribute("src",newsrc); current = newscript; document.head.appendch

javascript - D3 axes: aligning dates (x), displaying time (y) -

Image
i have data array of (date, start, stop) tuples, start , stop minutes in day [0, 1440] , 1 a.m. represented 60. plot rectangles, each rectangle horizontally aligned date , height start , stop times. i've got, close has couple errors (which errors question): i want rectangles wide date column, that's not quite i'm seeing. in particular, call x_scale.rangeband() giving me wider column. (note horizontal overlap.) - .5 * x_scale.rangeband()) meant center rectangles. i'd indicate times rather minutes on y-axis, commented calls ticks() , tickvalues() not @ all. pointers appreciated. this code generates this: <!doctype html> <html> <head> <meta charset="utf-8"> <title>d3 page template</title> <script type="text/javascript" src="d3.js"></script> <style> .d3-canvas { background-color: #f1eeff; } .icongray { fill: #5b5852; } .axis path, .a

javascript - HTTP.post() callback in loop -

i've got loop of http.post() on meteor server: for (var = 0; < smsmessages.length; i++) { http.post("https://smsapiaddress/sms.do", smsmesseges[i], function(error, result) { if (error) { seterrorindatabase(smsmessages[i]); } if (result) { setresultindatabase(smsmessages[i]); } }); how can pass proper smsmessages[i] callback function? as http request asynchronous value of i shared requests. use closures inside for loop. keep separate copy of i each iteration. see comments highlighted in code: for (var = 0; < smsmessages.length; i++) { (function(i) { // ^^^^^^^^^^^ http.post("https://smsapiaddress/sms.do", smsmessages[i], function(error, result) { if (error) { seterrorindatabase(smsmessages[i]); } if (result) { setresultindatabase(smsmessages[i]); } }); }(i)); /

scala - How to use spark with existing Hadoop 2.x -

Image
we have hadoop 2.5 installed on server. possible use hadoop deploy spark programs? want spark use existing yarn schedule tasks , able read , write existing hdfs. how can achieve that? you can try using apache spark pre-built downloads available https://spark.apache.org/downloads.html if thats not working out need build spark adding hadoop jars https://spark.apache.org/docs/latest/building-spark.html easy your spark can directly access hdfs adding config in spark-default config. check configurations available in spark https://spark.apache.org/docs/latest/configuration.html your spark can run in yarn local model - https://spark.apache.org/docs/latest/running-on-yarn.html you need not make new changes in existing hadoop setup make spark work , need configure in spark .

gcc - How to setup ycm on centos 6.6? -

recently i'm trying setup ycm on system of centos 6.6,however system doesn't provide gcc of version high enough support work of clang.it quite trouble me update gcc,more directly lib required clang,here log when attempting execute clang. clang: /lib64/libc.so.6: version `glibc_2.15' not found (required clang) clang: /lib64/libc.so.6: version `glibc_2.14' not found (required clang) clang: /usr/lib64/libstdc++.so.6: version `glibcxx_3.4.14' not found (required clang) clang: /usr/lib64/libstdc++.so.6: version `glibcxx_3.4.18' not found (required clang) clang: /usr/lib64/libstdc++.so.6: version `glibcxx_3.4.15' not found (required clang) clang: /usr/lib64/libstdc++.so.6: version `glibcxx_3.4.20' not found (required clang) is there better way setup ycm?

c# - adding datarows from array of datarows to top of datatable -

the array obtained linq query on datatable. when try add datatable gives exception row belongs table. need add row top of table not @ bottom datarow[] recovery_rows = sub_datatable.select("productid = " + last_product_id.tostring() + ""); //sub_datatable datatable (int rev_row = 0; rev_row < recovery_rows.count(); rev_row++) { datarow r_new = recovery_rows[rev_row]; // r_new = recovery_rows[rev_row]; dt_sub.rows.insertat(recovery_rows[rev_row], 0); } you cannot add datarow datatable , has reference it's datatable , throws exception if change table. you can use datatable.importrow imports row , adds end of datarowcollection . next task move first position: for (int rev_row = 0; rev_row < recovery_rows.length; rev_row++) { datarow r_new = recovery_rows[rev_row]; dt_sub.importrow(r_new); dt_sub.rows.removeat(dt_sub.rows.count - 1); dt_sub.rows.insertat(r_new, 0); }

javascript - Click event toggling all classes rather than correct block -

i have collapsed/collapsible blocks whereby first block open , second/third closed. work way want in terms of opening , closing, can't head around how alter function plus , minus icons change correct block. @ moment change @ same time no matter block open or close. how can alter function toggled block updates correct icon? function togglediv(divid) { $("#"+divid).toggle(); $('.product-toggle span.icon').toggleclass('icon-plus icon-minus') } html <p><a href="javascript:togglediv('features');" class="product-toggle"><span class="icon icon-plus" aria-hidden="true"></span><span class="toggle-title">features</span></a></p> <div id="features"> features </div> <p><a href="javascript:togglediv('specifications');" class="product-toggle"><span class="icon icon-plus" aria

html5 - JavaScript Canvas – how to get area used by font -

Image
how area occupied filled ctx.font ? example: all research points baseline , ctx.measuretext(word); gives me width (perfectly, should add) height i'm struggling with, descenders seem included in calculation. can bitmap font , calculate scale way? here (failing) canvas size function using: function textsize(word, size){ var div = document.createelement("div"); div.innerhtml = word; div.style.position = 'absolute'; div.style.fontfamily = 'serif'; div.style.fontweight = 'normal'; div.style.fontsize = size + 'px'; document.body.appendchild(div); var size = { 'width': div.offsetwidth, 'height': div.offsetheight }; return size; // size.height larger required fonts no descenders } try : context.filltext("hello world!", 10, 100); context.stroketext("hello world!", 10, 100); var textmetrics = context.measuretext("hello world!"); var width = textmetrics

html - Sitecore : image size when using <img> in rich text -

Image
i know it's possible when writing code ask sitecore image of specific height , width. if there 1 large/detailed image in sitecore, sitecore return resized image ( instead of using large image , showing in smaller ). but need insert images rich text. if use <img src="somepath" height="100" width="100"> , have same effect , sitecore fetch smaller version of image ( possibly in cache ). or send large image , use pure css show smaller image ? in sitecore 8 if add media library image rich text field , set image height , width editor (see screenshot), sitecore generate image src this <img src="/~/media/.....jpg?h=84&w=149" /> this means image resized server side sitecore before returning client browser. but if edit html of rich text content manually , create image tag <img src="/~/media/...jpg" width="84" height="149" />` sitecore not resize image on server side you.

android - Could not show text shadow of TextView -

i want make text shadow effect text. use shadow attributes of textview. don't know why not show shadow, have checked on both android studio layout preview , on real device galaxy s3 nothing happen. help me. <?xml version="1.0" encoding="utf-8"?> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:background="@color/white"> <textview android:textcolor="@color/black" android:layout_width="wrap_content" android:text="text shadow" android:layout_height="wrap_content" android:padding="2dp" android:shadowcolor="#7f000000" android:shadowdx="3" android:shadowdy="3" android:shadowradius="1" /> </relativelayout> <lin

How to handle dynamic overlay using webdriver -

while executing selenium script, getting overlay (like popup) asking confirm yes or no. in case main problem being overlay popup not come @ constant place,instead comes @ differen places. example :- consider have 4 pages navigate time comes in first page , times comes in second page, , comes in same page while accessing different elements.sometimes not getting overlay. please let me know how solve issue, in advance you can handle through driver options, @ least in internet explorer. how in selenium .net binding var options = new internetexploreroptions { enablenativeevents = false }; options.unexpectedalertbehavior = internetexplorerunexpectedalertbehavior.dismiss; it force close unexpected pop up.

Using Python to count the number of layers in a AutoCAD file -

i've created gui using pyqt5 wich takes shapefiles , 1 .dwg file inputs. in .dwg file, have amount of standard layers should inside. if 1 or more of layers missing, able inform user layers missing. for example, if .dwg files must have these layers ('trees', roads', 'houses', 'lakes' etc.), if 'roads' missing, user inform when launches gui . using python have use python extension/library guess. i've looked , pyacad or pythoncad don't seem implemented yet. if has used python autocad, looking advice/tips. , if have alternative idea problem appreciated ! there complication here: if have .dwg cannot convert .dxf without autocad installed on machine. if have autocad installed, use it's apis open , manipulate drawing. can done .net, c++, javascript or language compatible com (including python). if don't have autocad installed, there cloud api it: autocad i/o. running instance on cloud can use processing .

jinja2 - Append list variable to another list in Ansible -

is possible append variable list static list in ansible? i can define whole list variable: my_list: - 1 - 2 - 3 and use in playbook as something: {{my_list}} but cannot seem find how (pseudo code): list_to_append: - 3 - 4 and in playbook: something: - 1 - 2 - {{append: list_to_append}} if in fact impossible, suggest use case? i have list of items in parameter, of them optional , should modifiable using variables. in other words: have default values + optional values or not added via variables. the optional values not known in advance, add 1, 2 or 100 of them, not static. i have default static list ++ configurable variable list append. edit: found it's with_items , need in normal parameter: with_flattened: - "{{list1}}" - "{{list2}}" if want append content, need use set_fact module. if want use merged lists easy this: {{ list1 + list2 }} with set_fact this: - set_fact: list_merged

javascript - Understanding some jsfiddle code in looking at - need some explanation -

Image
i'm looking @ code in jsfiddle around firebase authentication http://jsfiddle.net/firebase/a221m6pb/ but there things im not quite getting looking @ code... function declared @ top (function (jquery, firebase, path) { is way of injecting services/libraries jsfiddle?, havent seen example before...also can tell me path in method signature is?... understand used in routing in example im not sure is.. sort of routing framework... apologies if these obvious question, im relatively new playing around jsfiddle + javascript way down @ bottom can see whats passed parameters. (window.jquery, window.firebase, window.path) it's way of making sure variables reference correct objects in desired scope. and yes, path routing. around line ~300, you'll see. there's lots of comments & annotation, should keep reading script. side note, has nothing in particular jsfiddle. jsfiddle code editor platform, there many, many it: jsbin , codepen , webdevout , p

c++ - Changing current path of a Qt Application -

i using qt library , want set current path path contained in qstring oldconfigfilename , using setcurrent() setcurrent returning false value indicating failure in changing path. code: qstring path = qdir::currentpath(); std::string currentpath = path.tostdstring(); std::string configpath = oldconfigfilename.tostdstring(); bool res = qdir::setcurrent(oldconfigfilename); if(res) { qdebug() << "path changed"; } else { qdebug() << "path not changed"; } the problem path using full path config file containing file name. when try change directory path command fail because oldconfigfilename file not existing folder. simple way fix use qfileinfo remove filename part path use directory. qfileinfo fi(oldconfigfilename); bool res = qdir::setcurrent(fi.path()); if(res) { qdebug() << "path changed"; } else { qdebug() << "path not changed"; }

qt - How to stop ListView for "jumping" when model is changed -

what need do : need create chat window using listview in qml stores chat-messages. set listview.positionviewatend() in order follow last messages. disable positionviewatend when scroll upwards such can read past messages without jumping @ end every time receive new message. the problem : after scrolling up, every time i receive new message jumps @ beginning of list. solve manage store contenty of list , reset every time oncountchanged handler called (see code below): listview { id: messageslist model: contact? contact.messages: [] delegate: delegate anchors.fill: parent anchors.bottommargin: 20 height: parent.height anchors.margins: 10 property int currentcontenty onmovementended: { currentcontenty = contenty } oncountchanged: { contenty = currentcontenty } oncontentychanged: { console.log(".....contenty: " + contenty) } } the problem though set last contenty had, before mo

regex - Mod rewrite everything except specific subfolder -

i'm trying redirect except subfolders admin , api admin , so: / - redirects /admin /some-url - redirects /admin /admin - doesn't redirect /admin/1 - doesn't redirect /api - doesn't redirect /api/v1/etc - doesn't redirect but i've got far doesn't redirect correctly. here's mod_rewrite: <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_uri} !^/(admin|api) rewriterule ^ /admin [r,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !=/favicon.ico rewriterule ^ ./index.php [l] </ifmodule> you should use the_request variable instead of request_uri request_uri changes value due last rule , in next iteration of mod_rewrite rewrite condition in first rule returns true. <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{the_request} !/(admin|api) [nc] rewriterule ^ /admin [r,l] rewritecond %{request

html - Inline css is not working in my pdf -

i have used tcpdf in codeignter.i want give inline css td. mycode is: <table style="float:left;width:100%; border:1px solid #c2c2c2; margin-top:10px;"> <tr style="float:left;width:100%;"> <td style="float:left;width:50%;"> <tr style="float:left;width:260px;"> <th style="float:left;width:20px;color:#2f70a8;"><span style="border-right:1px solid #c2c2c2;">sr no</span></th> <thstyle="float:left;width:80px;color:#2f70a8;"><span style="border-right:1px solid #c2c2c2;">date</span></th> <th style="float:left;width:80px;color:#2f70a8;"><span style="border-right:1px solid #c2c2c2;">credit amount</span></th> <th style="float:left;width:80px;color:#2f70a8;"><span style="border-right:1px

c - how to convert wchar_t to string in swift -

i'd wchar_t array c library, , convert swift data structure, code here: func getresults(recognizer: unsafemutablepointer<void>, stroke: unsafemutablepointer<int32>, touchstate: int32) -> [string] { var buflen : int32 var buf = unsafemutablepointer<wchar_t>.alloc(int(buflen)) getrecognition(recognizer, stroke, touchstate, buf, buflen) var results = string.fromcstring(buf)! //this line has error, cause buf wchar_t*, not char* } how convert buf swift data structure? know if buf unsafemutablepointer<int8>.alloc(int(buflen)) , can use string.fromcstring(buf) ! convert it. if println(buf[0]), it's print integer 67, ascii value of 'c', how can println(buf[0]) 'c' instead of 0? thanks! wchar_t alias int32 , contains utf-32 code point in host byte order (which little-endian on current ios , os x platforms). therefore can convert buffer swift string follows: if let str = nsstring(bytes: un

php - Laravel select form default value -

i'm having problem on setting default value of "please select" on select form laravel. here comes code. $user = \app\user::where('role_id','=','3')->orderby('name', 'asc')->lists('name','staff_id'); and here's on blade {!! form::select('requestby', $user, input::old('requestby'), array('class' => 'form-control')) !!} i have tried put array_merge seems overwriting <option> value staff_id index value. should now? array_merge re-index array when merging. can use + - $user = array('' => 'please select') + $user; the index s not changed.

ios - Flag Annotation overlap and interchange to each other -

i facing problem show multiple annotation on mkmapview . question that, have 3 type annotation as( select_starflag , simple_flag , currentlocation_flag ). flag show on map there interchange position between them, when scroll map, flag overlap each other. using following code func mapview(mapview: mkmapview!, viewforannotation annotation: mkannotation!) -> mkannotationview! { if (annotation.iskindofclass(mkuserlocation)) { //if annotation not mkpointannotation (eg. mkuserlocation), //return nil map view draws"blue dot" standard user location return nil } if (annotation.iskindofclass(mkpointannotation)){ let reuseid = "test" var anview = mapview.dequeuereusableannotationviewwithidentifier(reuseid) mkannotationview! if (anview == nil) { anview = mkannotationview(annotation: annotation, reuseidentifier: reuseid) anview.canshowcallout = true var data = double(annotation.coordinate.lat

.net - Efficient way of creating lots of winforms (about 50) for a vb.net application -

Image
i working on vb.net application winforms , need create lots of forms (about 50) user interface. the layout of forms schould same in terms of size (1920x1080), background colours, fonts, size of controls etc. is there way of creating winforms efficient without creating every form designer? i define somekind of template other forms based on. should create forms code without using designer or there better way? ideas or best practices welcome. you can create form specification size, background colours, fonts etc base form. act template. now when add new form inherits form class default. instead of form inherit form baseform . to have uniformity controls, can create user controls , use them instead windows form controls.

.net - C# Serialization issues while mapping one version of a type to a different version of a type -

background have encountered strange situation in application uses 3rd party component. quite few classes in application implements iserializable interface persist object state , forth. face compatibility issues during course of serialization when serialize app classes in 1 version , try deserialize different version of 3rd party component. issue latest release of 3rd party component saw major shuffling w.r.t types , assemblies. i.e. ex : earlier type t1 found under assembly a1 . . post new release, assembly a1 has been split 2 different assemblies ex: a11 , a12 . , type t1 housed in a12 the type t1 on deserialization, trying find assembly a1 . since has been moved different assembly a12 throwing serializationexception stating not able find assembly a1 . things tried: 1. serializationbinder: used serializationbinder class checked incoming assemblyname , typename information , suitably routed correct assembly on deserialization. 2. assemblyresolve event usi

python - Define True, if not defined, causes syntax error -

i have found following construct today in elses code: try: true, false except nameerror: true = 1==1; false = 1==0 as understand this, defines true , false if not defined already. if defined shouldn't throw nameerror -exception, right? i have tryed myself in shell , shows me syntaxerror: can't assign keyword my question why shot syntax error if true , false defined? if true , false available on system, shouldn't go past exception handling , not show syntax error? this code written python 2.x , won't work on python 3.x (in true , false true keywords). since true , false keywords in python 3, you'll syntaxerror cannot catch. this code exists because of old versions of python. in python 2.2 (released in 2001!), true , false did not exist predefined names, code provide compatible definitions later code use true , false . when converting python 2.x code python 3.x, remove these lines; historical , have no use in python 3.x. if see the

mysql - How to create Category Wise Serial Number in PHP -

how can create category wise serial number. suppose have 3 category a,b & c. has 3 subcategories x,y & z while b has 2 subcategories x,y , c has no subcategory. on submit if have selected , subcategory x generate ax0001 , on selecting b subcategory y by0001 , on selecting c generate c0001. how can generate serial number without checking @ database level duplicacy?

ios - How do I add a view underneath a Table View, but it scrolls with the cells? -

Image
i want table view has basic cells. however, @ end of cells (if any), want show button , labels (let's call infoview). want infoview follow scroll of table view. if there 20 rows, example, infoview wouldn't shown until user scrolls way down. act cell. is there way achieve in simple manner? should infoview cell? what need tablefooterview uitableview . if using storyboard, have prototype cells there well. pick view , place below cells shown in following image: this view act tablefooterview . can resize , add whatever want to, , components come @ bottom of uitableview when user scrolls way bottom.

c# - Method running another method -

is possible run method using run() ? public void a(int a) { // method1 } public void b(int b) { // method2 } //how run code below public void run(? b(23)) <--can change or b { b(23); } edit: if want return value methods? public static int a(int a) { // method1 } public static int b(int b) { // method2 } //how run code below public static int run(? b(23)) <--can change or b { b(23); } there's few ways this. 1 way define run method this: public void run(action action) { action.invoke(); } then execute 1 method or other using: run(() => a(3)); run(() => b(5)); if want return value, can either in 2 steps: int r = 0; run(() => r = b(3)); or switch func<> : public t run<t>(func<t> method) { return method.invoke(); } and call likewise: var r = run(() => b(3));

sql - How can compare between times in while loop in stored procedure? -

Image
please me on this, have been working conditions time within 24 hours only. so have this. can me or tell me if conditions correct. my @displaystarttime = 11:00pm basically @nextstarttime = 11:00pm open cphoslinetimeslot fetch next cphoslinetimeslot @parameter, @displaystarttime, @displayendtime, @codeendtime, @frequency, @tolerance while @@fetch_status = 0 begin declare @nextstarttime nvarchar(30) set @nextstarttime = @displaystarttime --insert #actualtimeslot --select @parameter, @displaystarttime, @displayendtime, @codeendtime, @frequency, @tolerance while (convert(varchar, convert(time, @nextstarttime), 100) < dateadd(day, -1, getdate())) begin set @displaystarttime = @nextstarttime select @nextstarttime = ltrim(right(convert(nvarchar(100), dateadd(minute, @frequency, @nextstarttime)), 8)) insert #actualtimeslot select @parameter, @displaystarttime, @nextstarttime, @codeendtim

javascript - Datalist arrow not coming in ie and firefox -

hi using datalist tag dropdown in fiddle. getting arrow dropdown in chrome only. , arrow not coming in ie , firefox. in firefox search lazy search ie; not based on first letter the fiddle is:: https://jsfiddle.net/v7fg0zc8/ pleas specify styling if achieve this <!doctype html> <html> <body> <input list="browsers" name="browser"> <datalist id="browsers"> <option value="internet explorer"></option> <option value="firefox"></option> <option value="chrome"></option> <option value="opera"></option> <option value="safari"></option> </datalist> </body> </html> check this. i've tried may ways not worked well. may solution input::-webkit-calendar-picker-indicator { display: none;/* rem

javascript - history.back() not working for li element -

Image
i used history.back() or history.back(-1) navigate previous screen clicking on li element in mvc application. not working. found similar problem here cant use solution cant give li type='button' ? function gobackscreen() { window.history.back(); return false; } if back id added li $(document).ready(function(){ $('#back').click(function(){ if(document.referrer.indexof(window.location.hostname) != -1){ parent.history.back(); return false; } }); });