Posts

Showing posts from July, 2010

php - about regex, you find {else} and allow nested -

i created pattern: {if ([^}]*)}((?:[\w\s]+[^}]*)){\/if} but have done long time ago now, pattern is, example: {if $module=admin} {/if} but want find: {if $module=admin} {else} {/if} as far possible find both same pattern. any ideas? thank :) /{if ([^}]+)}([\w\w]*?)(?:{else}([\w\w]*?))?{\/if}/g {if literal text. ([^}]+) if condition : 1 or more non-closing-curly-brace ( } ) characters, captured. } literal text. ([\w\w]*?) inside if : 0 or more characters. match until next part found. (very inefficient; can rewrite make more performant.) (?:{else}([\w\w]*?))? optional group. {else} else : literal text. ([\w\w]*?) inside else : 0 or more characters. match until next part found. (very inefficient; can rewrite make more performant.) {\/if} closing : literal text.

gradle - Thymeleaf views not found with springboot -

Image
i trying follow tutorial adding thymeleaf springboot app can't seem work. tutorial: http://spr.com/part-2-adding-views-using-thymeleaf-and-jsp-if-you-want/ i able springboot work fine when started app using @restcontroller in logincontroller when changed @restcontroller @controller i'm getting error page saying: there unexpected error (type=not found, status=404). no message available i set breakpoint in controller , confirmed hitting index method in logincontroller. feel has how i've added thymeleaf since haven't done else application i've tried far results in same error page. my build.gradle buildscript { repositories { maven { url "http://repo.spring.io/libs-snapshot" } mavenlocal() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.release") } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'spring-boot' jar { bas...

ms access - Show all records in a list box -

i'm making database records teachers , students , when scheduled have lessons. have list box taking data query being filtered combo box taking data table. the filter working there no way display records query. is there way add option combo box pull records query through list box instead of filtered few? ps. preferably using embedded macros, vb if necessary the row source of combo box ('teachers' table): select [teachers].[teacherid], [teachers].[forename], [teachers].[surname] teachers order [surname], [forename], [teacherid]; the row source of list box ('todaylessons' query, 'teacherid' using criteria of combo box on form): select [todaylessons].[lessonid], [todaylessons].[slotid], [todaylessons].[lesson date], [todaylessons].[lesson time], [todaylessons].[teacherid], [todaylessons].[studentid] todaylessons order [lesson date], [lesson time], [teacherid]; row source causing problem (i've tried adding 'from teacher...

if statement - Swift - How to check to see if sprite is assigned to certain image -

currently, in code, have skspritenode named ball randomly changes texture when makes contact anything. there 4 different textures/images each different colored ball. want use if else statement check see if ball equal specific texture can action. i have code far, not check texture of ball sprite func didbegincontact(contact: skphysicscontact) { if ball.texture == sktexture(imagenamed: "ball2") && platform3.position.y <= 15 { print("color matching") } else { print("not matching") } } the if platform3.position.y <= 25 part works, ball.texture part of code not check see texture ball has. set user data when assign color ball. ball.userdata = ["color": 1] // later can check if (ball.userdata["color"] == 1) { that proper way do. comparing integer faster.

orientdb2.2 - Performance tuning for loading Gigabytes of data in OrientDB -

i used etl tool insert bunch of csv data orientdb. system configuration used trial purpose ec2 m3 large ( 7.5 gib of memory, 2 vcpus, 32 gb of ssd-based local instance storage, 64-bit platform ). the data(masked) i'm trying upload of below format : "101.186.130.130","527225725","233 djfnsdkj","0.119836317542" "125.143.534.148","112212983","1227 sdfsdfds","0.0465215171983" "103.149.957.752","112364761","1121 sdfsdfds","0.0938863016658" "103.190.245.128","785804692","6138 sdfsdfsd","0.117767539364" the schema contains 2 node classes , 1 edge class. when tried loading data using etl tool in plocal option speed 2300 rows / second. etl configuration mentioned below : { "source": { "file": { "path": "/home/ubuntu/labvolume1/orientdb/bin/0001_part_00" } }, "extractor...

twitter bootstrap - Image is not passing in carousel in yii2 -

Image
i'm using pretty url. slider working fine can see imgage not sliding. i'm not sure if it's due prettyurl or i've missed source of images - c:\xampp\htdocs\amitopticals\frontend\images. code of index file - <?php /* @var $this yii\web\view */ $this->title = 'amit opticals'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="site-index"> <div class="body-content"> <div id="mycarousel" class="carousel slide" data-ride="carousel"> <!-- indicators --> <ol class="carousel-indicators"> <li data-target="#mycarousel" data-slide-to="0" class="active"></li> <li data-target="#mycarousel" data-slide-to="1"></li> <li data-target="#mycarousel" data-slide-to="2"></li> <li data-target=...

unix - Why wont the plus work properly with this sed command? -

i can't ([^/]+) sed regex work properly. instead of returning non-forward slash characters, returns one. command: echo '/test/path/file.log' | sed -r 's|^.*([^/]+)/(.*)$|\1.\2|g' expected: path.file.log result: h.file.log also tried got same result: echo '/test/path/file.log' | sed -r 's|^.*([^/]{1,})/(.*)$|\1.\2|g' the problem not [^/]+ , preceding .* . .* greedy, , consume maximal amount of input. usual suggestion use .*? make non-greedy, posix regexes don't support syntax. if there slash, add 1 regex stop consuming much. $ echo '/test/path/file.log' | sed -r 's|^.*/([^/]+)/(.*)$|\1.\2|g' path.file.log

c++ - Boost::program_options - print usage if no inputs provided -

i trying use boost program_options in order parse program inputs. in general docs provide necessary info parsing. however, make program print usage instructions when no inputs provided , can't seem figure out. there not seem "default" options nor can find how count number of inputs provided (to test). this code @ moment: boost::program_options::options_description help("usage"); help.add_options() ("help", "print info"); boost::program_options::options_description req("required inputs"); req.add_options() ("root", boost::program_options::value<std::string>(&images_root), "root directory") boost::program_options::options_description opt("option inputs"); opt.add_options() ("verbose", boost::program_options::value<bool>(&verbose)->implicit_value(1), "verbose"); boost::program_options::variables_map vm; boost::program_options::store(boost::p...

How do I format <select> tags and <form> tags in HTML/CSS? -

Image
this current layout and trying figure out how have of information "inline" following i've never worked forms before have no idea how format it, tried googling couldn't come useful information because every example had tag instead of multiple example you can use without table this. li label { float: left; width: 100px; margin-right: 10px; font-size: 14px; } li { list-style: none; margin-bottom: 5px; } <ul> <li><label for="name">first name:</label></li> <li><input type="text" name="name" placeholder="name"> </ul>

java - System.getProperty("line.separator") not working - Android Studio -

currently have code retrieve website plain text , store inside text file. managed when want enter new line in text file doesn't work. my result this article titlethis starting of first paragraph what want this article title starting of first paragraph my source code public void storehtml(context context, arraylist<string> storehtml, string address) { try { file root = new file(environment.getexternalstoragedirectory().getabsolutepath()+ "/voicethenews"); if (!root.exists()) { root.mkdirs(); } address = address.substring(address.lastindexof("/") + 1); file gpxfile = new file(root, address + ".txt"); filewriter writer = new filewriter(gpxfile); //fileoutputstream fileoutputstream = new fileoutputstream(gpxfile); //bufferedwriter bufferedwriter = new bufferedwriter(new outputstreamwriter(fileoutputstream)); for(int = 0; < storehtml.size(); ...

python - OCR Hand written data showing error in svm.train() -

i using opencv3.1.0 python2.7 . have implemented code of ocr hand written data here . responses = np.float32(np.repeat(np.arange(10),250)[:,np.newaxis]) svm.train(traindata,cv2.ml.row_sample, responses) and getting these error svm.train(traindata,cv2.ml.row_sample, responses) cv2.error: c:\builds\master_packslaveaddon-win64-vc12-static\opencv\modules\ml\src\svm.cpp:1618: error: (-5) in case of classification problem responses must categorical; either specify vartype when creating traindata, or pass integer responses in function cv::ml::svmimpl::train note: since working on opencv3.x have used cv2.ml.svm wherever necessary , rest same and if using responses = np.int32(np.repeat(np.arange(10),250)[:,np.newaxis]) getting 0 accuracy try using pytesseract . better training svm classifier. if want check out, follow link . advanced example check out site well.

mysql - php update not working -

i trying change form data , updating data in mysql. data not changing when ever trying update. form page below: while ($list5 = mysql_fetch_array($result)) { $reqitem=$list5['id']; echo "<td width='34%' id='addinput'><input type='text' size='70' id='item_name$i' name='item_name[$i]' placeholder='{$list5['prod_description']}' value='{$list5['prod_description']}'></td>"; } and save page script follows: foreach($_post['id'] $key=>$value) { $item_name= $_post['item_name'][$i]; $q = "update poto_customer_items prod_description='$item_name' tender_id='$tender_id' , id='$value' "; mysql_query($q) or die(mysql_error()); } i know there problem script. new php not able grasp making mistake. can please me on this. following html code: <html> <head> <title></title...

Javascript: How to push multiple image files into array -

i have multiple input files <input type="file" name="file_name[]" id="file_id_0"> <input type="file" name="file_name[]" id="file_id_1"> <input type="file" name="file_name[]" id="file_id_2"> i want each of store in array did, working me var imagecontainer = []; var file_name = document.getelementsbyname('file_name[]'); for(var = 0; i< file_name.length; i++){ alert(i); var fileupload = document.getelementbyid('file_id_'+i); imagecontainer.push(fileupload.files[0]); } var data = new formdata(); for(var b=0; b<imagecontainer.length; b++){ data.append('file_name[]', imagecontainer[b]); } but if 1 of input file empty got error cannot read property 'files' of null. so trying push files in other way not working var file_namearr = []; $('input[name="file_name[]"]').each(function(k,v){ file_namearr...

javascript - jQuery - Using .on and .off for event listeners with nameless functions -

i trying utilize .off() in js handle turning off clicking during ajax request , turning on once done. know code use ajaxstart().ajaxstop() . what running .on('click') uses nameless function work. i.e.: $(document).on('click', '-enter-delegated-elements-here-', function (e) { // click stuff here, click run ajax request }); this creates problem when when, after have turned off event listeners .off ( $(document).off('click', '**'); ), have turn them on. unfortunately, plain $(document).on('click', '-enter-delegated-elements-here-'); not work. to demonstrate point have created this fiddle . (a snippet here:) $('add').on('click', '#add'); //here's zinger!!! var = 0; $('#add span').text(i); $(document).on('click', '#add', function(e) { $('#catcher').append(i); += 1; $('#add span').text(i); }); $(document).on('click', '#st...

android - Extract phone's exact location using GPS and change device settings according to it -

im creating app that'll use gps determine user's exact location. user can manually add locations when he/she on location (something add here),and user can add many entries want. when user goes of predefined locations,app should automatically detect location , execute task user asked (in here,something put phone silent/vibrate or normal mode). how can that? please help. the first comment received along right track sure geofencing. check out free course udacity.com... google location services . course walk through how want. need tweak code , add whatever else want app. i hope helps! if have questions comment!

reporting services - SSRS report while exporting it is giving misterious boarders -

Image
my [ssrs] report exports pdf fine, when exports excel, end these strange , mysterious grids. when checked other server appears export correctly. there, extension .xls, xlsx. in strange , msyterious versions. is there difference in these extensions?

javascript - Prevent user created pages from stealing login cookies -

i have webpage, let's page called: http://www.mypage.this/ in page users can create own html pages , access them through www . mypage . / (creator's_username) / (project_name) . instance, if username "usr" , project called "project" link http://www.mypage.this/usr/project . but there's security problem... i store people's login tokens cookies. , if user's script has function reads cookie , sends else? they can access else's account. token has saved cookie, because need verify user in multiple pages. should prevent user created scripts reading tokens, yet still allow pages read token? thank in advance *the tokens of course regenerated every once in while to clear misunderstanding, not storing passwords in user's side. storing login cookie - randomly generated string, re-generated on every login. , store on user's side. if have verify users in multiple pages, should store login information in session, not in ...

javascript - Angular JS ternary operator inside div tag -

am using div condition shown below <div data-index="5" class="col-xs-12 col-sm-4 col-md-3 col-lg-2 tiles ${ {{myvariable.data}} ? 'hidden-lg hidden-md hidden-xs hidden-sm':''}" data-myapp-detail="somexyz"> where {{myvariable.data}} giving problem when becomes "false". there angular js condition can initiate variable based on {{myvariable.data}} , use variable in div tag ternary condition. where if keep boolean value false directly instead of {{myvariable.data}} works expected. <div data-index="5" class="col-xs-12 col-sm-4 col-md-3 col-lg-2 tiles ${ false ? 'hidden-lg hidden-md hidden-xs hidden-sm':''}" data-myapp-detail="somexyz"> for angular2 <div data-index="5" class="col-xs-12 col-sm-4 col-md-3 col-lg-2 tiles" [ngclass]="myvariable.data ? 'hidden-lg hidden-md hidden-xs hidden-sm':''" dat...

javascript - How to make Facebook live video embed 16:9? -

Image
i'm having trouble embed live fb video because it's transforms 16:9 video 1:1 format , make black lines @ top , @ bottom. there video section on users website have 16:9 proportions. user can change videos via cms pasting iframe tag. when user add simple facebook embed video fit perfect!... when user trying add live video breaks because of square proportion. example how shows live video on fb - 16:9, needed embed iframe.... unfortunately changing width , height of embed iframe tag did not resolved problem - cut bottom of video. so..any ideas how prevent live fb video transforms 1:1 , stay 16:9 original?? had similar issue basic facebook video embed. not sure if related question in here might bottom of issue. my video 4:3 ratio , wanted responsive. had add attributes iframe such, width 400 , height 300 4:3 video. remember specify &height=300 in video href. <iframe src="https://www.facebook.com/plugins/video.php?href=https%3a%2f%2fwww.facebook.com...

sql - Cq5/AEM Query Tool is not fetching results -

Image
query tool in crxde lite page , not fetching results. have passed values given in screen shot in 1 instance showing results. in instance not showing results. what trying kind of full text search. resource type query - select * [nt:base] [sling:resourcetype] = 'your resource type here' , isdescendantnode('your path here')

sql server - Incorrect output from stored procedure -

i using below stored procedure generate crystal report.my report filters data based on 2 possible values, arcade or franchise. i filter data arcade = 1 , franchise = 2 , both = 0.the outlettype parameter these int values. when filter 1 particular value gives me both arcade , franchise values. alter procedure [dbo].[printreceiptcancellationworkflow] @entrytype int, @outlettype int, @requesteduser varchar(50), @fromdate datetime2, @todate datetime2, @outletcode varchar(10), @cancelleduser varchar(20), @status int begin select outlets.outletdesc 'branch', receipt.canceluser 'requestedby', receipt.recdate 'reqdatetime', --receiptcancellationstatus.approvedstatus 'status', receiptcancellationstatus.statusdesc status, workflowrequestqueue.cposreference 'wcrno', receipt.receiptno 'receiptno', receipt.paymentmode 'paymentmode', receipt.applied...

python ctypes windowserror exception access violation reading -

from ctypes import *; import os; import sys; def callappplugin(url): pid = os.getpid(); h=windll('somes.dll') nrst = h.register("18132163","lgsg"); nrst1 = h.init(pid); nrst2 = h.parse_site(url); str = string_at(nrst2); return str; i use python 2.7 call dll(some.dll), , functions in dll,like register, init... the py file run on computer(win10) ok.but cannot run on server(win server 2008), when process init function, throws exception: windowserror: exception: access violation reading 0xfffffff8 why? help~

Comparing array from user to array from database PHP -

i working on adding product module. the user can upload csv file add products. how can create system if there existing product in db, skip product , check again product. if there no such product in db, product added db. so let's //products in db //code //description 1 item 1 2 item 2 3 item 3 //products in user input //code //description 1 item 1 3 item 3 4 item 4 5 item 5 from above example, how can create system add item 4 , item 5 db? here $db_products array contains products db foreach($db_products $prod){ $products[] = array( "code" => $prod['code'], "description" => $prod['description'] ); } here $products_array contains user input foreach($products $v){ $products_array[] = array( "code" => $v['code'], "description" => $v['description'], );...

java - Display Map Markers from Lat Lon -

i learning android. right working on app uses map api. far did following: - long clicked map , opened new activityclickedmap displaying lat , lon of location clicked - clicked save button , added lat , lon, both server , local db the thing want this: - when open map want display marker using lat , lon database retrieve lat , long database. string latfromdb , longfromdb ; and then latlng latlng = new latlng(double.parsedouble(latfromdb),double.parsedouble(longfromdb)) ; markeroptions optionss = new markeroptions() .alpha(1) .flat(false) .position(latlng) .icon(bitmapdescriptorfactory.fromresource(r.drawable.pin)); googlemap.addmarker(optionss); googlemap.movecamera(cameraupdatefactory.newlatlng(latlng)); googlemap.animatecamera(cameraupdatefactory.zoomto(15)); get list of lat long db , add marker in loop multiple marker : markeroptions option...

python - Getting waf to output solution to another directory -

Image
i wrote simple waf build script: #! /usr/bin/env python # encoding: utf-8 def options(opt): opt.load('compiler_cxx') opt.load('msvs') def configure(conf): conf.load('compiler_cxx') def build(bld): print('build') but problem outputed solution file @ root of project (where wscript is); would there way generate ide specific files directory (for instance, ide/msvs) ? you can redirect output of solution using out = os.path.join('my', 'out', 'dir') which relative top_dir ( https://waf.io/apidocs/context.html?highlight=top_dir#waflib.context.top_dir ). so in case: #! /usr/bin/env python # encoding: utf-8 import os out = os.path.join('my', 'out', 'dir') def options(opt): opt.load('compiler_cxx') opt.load('msvs') def configure(conf): conf.load('compiler_cxx') def build(bld): print('build')

ios - Auto-sizing UICollectionView headers -

Image
i'm trying make detail screen to-do list kind of app. here's detail screen looks like: this uicollectionviewcontroller , header. header contains 2 uilabel objects, , uitextview object. layout of these objects managed vertical uistackview . uiview used set white background. i'm having difficulties in defining height of uicollectionreusableview @ runtime. advice appreciated. here how can handle custom uicollectionviewreusableview auto layout without xib file. implement referencesizeforheaderinsection delegate method. in it, instantiate view use header view. set visibility hidden, avoid flashing. add view collectionview's superview. set it's layout using auto layout, match expected visual outcome of header. invoke setneedslayout , layoutifneeded remove view superview caution: not big fan of solution, adds custom view collectionview's superview each time, perform calculations. didn't notice performance issues though. cautio...

c# - DataGridView row index always returns the same value -

i'm trying implement deleteitem functionality on datagridview. have following event: private void btndeletedjelatnik_click(object sender, eventargs e) { int iddjelatnik = -1; int index = djelatnikdatagrid.currentrow.index; int32.tryparse(djelatnikdatagrid.rows[index].cells[0].value.tostring(), out iddjelatnik); r.deletedjelatnik(iddjelatnik); } i'm trying selected rows id column can pass delete method: deletedjelatnik(int slectedid); the following line gives me value of 3: int index = djelatnikdatagrid.currentrow.index; i tried int index = djelatnikdatagrid.selectedrows[0].index; but i'm getting argumentoutofrange exception, yes selectionmode on fullrowselect how work? use datagridview's userdeletingrow event, private void datagridview1_userdeletingrow(object sender, datagridviewrowcanceleventargs e) { int deletingrowindex = e.row.index; } hope helps,

c# - WebClient.DownloadString doesn't return value -

i have 1 url special characters | , & . url returning json data. when trying url in browser run , return json data when trying using webclient.downloadstring() , not work. example : using browser : http://websvr.test.com/abc.aspx?action=b&packetlist=116307638|1355.00 output : [{"column1":106,"column2":"buying successfully."}] using webclient.downloadstring(): using (webclient wc = new webclient()) { var json = wc.downloadstring("http://websvr.test.com/abc.aspx?action=b&packetlist=116307638|1355.00"); } output : [{"column1":-107,"column2":"invalid parametrer required-(refno|jbprice)!"}] you should encode packetlist parameter in url, because includes pipe character, must encoded %7c . browsers automatically encode necessary characters in url, should encode in code manually. var json = wc.downloadstring("http://websvr.test.com/abc.aspx?action=b...

Why does python print version info to stderr? -

why did guido (or whoever else) decide make python --version print stderr rather stdout? curious use case makes standard error more appropriate standard out. python 3.4 modified output stdout , expected behavior. listed bug python here: http://bugs.python.org/issue18338 . comments on bug report indicate while stdout reasonable choice, break backward compatibility. python 2.7.9 largely unchanged, because relies on it. hope helps!

sass - Is it possible to use Icons with css:before without hardcoding the code? -

i using method answered here on stackoverflow use custom police definition other classes. method summarized below: [class^="icon-"]:before, [class*=" icon-"]:before { font-family: fontawesome; } .icon-custom:before { content: "\f0c4"; } when i'm using custom class use it, have use code generated library: i:after { content: '\f0c4'; } in case code f0c4 change in library, avoid reporting change in every custom class 1 one. decided use sass or less able deal problem. below not work. i:after { .icon-custom } with sass or less, possible avoid magic number? i know possible: i:after { content: @custom-code-value } but prefer avoid changing @custom-code-value: : "\f0c4"; solution? you can try group content value in map variable i adapted example scss // map variable $icons: ( facebook : "\f0c4", twitter : "\f0c5", googleplus : "\f0c6", youtu...

c# - What's The Actual Difference Between await XXAsync() And await Task.Run(()=>{XX() } -

by using task.run or task.factory.startnew can convert synchronous actions tasks, can use await , this: await task.run(() => { somemethod(); } in meantime, many methods have asynchronous implements, recommended directly use await somemethodasync(); but what's difference between two? somemethodasync method io work , io work not require thread work . somemethodasync not cause thread thread-pool sit , wait complete. thread-pool threads important resources in server application such asp.net applications. in such applications, each request serviced thread-pool thread , number of active requests can increased saving such threads. await task.run(() => { somemethod(); } uses thread-pool thread execute somemethod method. if somemethod io work, used thread-pool thread unnecessarily.

mysql - I want to get a SQL query for my asp.net -

here's table: firstname |lastname |gender | age fname1 |lname1 | male | 23 fname2 |lname2 | male | 22 fname3 |lname3 | male | 20 fname4 |lname4 | female | 19 fname5 |lname5 | female | 22 fname6 |lname6 | female | 17 i want select 1 value such when set gander = male should first , last name of male lowest age. if want select second lowest age person of gender = male should one, , female. for lowest select * `test` gender='male' order age asc limit 0,1; for second lowest select * `test` gender='male' order age asc limit 1,1;

CMD outputs in the same txt file -

i have batch file multiple commands: xcopy c:\file_path c:\destination rename c:\file_path new_name del c:\file_path i need them write outputs in same text file. in way @ end of process have txt file procedure , can check if has been done correctly. tried following command after each single command/step: command 1> output.txt 2>&1 but rewrites file. not keep output of steps last one. how can it? thanks according ms should using "append" operator - >> . this article: https://technet.microsoft.com/en-us/library/bb490982.aspx

java - Maven Plugin: accessing resources accross multiple modules -

i'm writing custom maven plugin generating xml file in multi-module maven project. my maven structure pretty standard: 1 parent project , module project components in parent project folder: -- parent -- module -- module b -- module c i need list, module, set of classes flagged custom annotation. wrote set of custom annotations , annocation processor create xml file @ compile time in corresponding module output directory (${project.build.outputdirectory}) . now need merge each module xml 1 file, don't know how access each modules within maven plugin except having each path set parameters (i don't method). any idea on how ? maven plugins can traverse project modules ? thank in advance. to list list of projects can use: list<mavenproject> projectlist = mavensession.getprojectdependencygraph().getsortedprojects() if 1 of goals correctly executed need. every mavenproject contains getbasedir() etc.

Creaing a Pyramid shape using only CSS/HTML -

Image
i trying create pyramid shape in css. i doing method read on internet when set width of div 0 px borders join creating 4 triangles. want remove/cut pointed tip of pyramid , have been unable it. tried hiding tip other div not looks right. present shape: below have made far. required shape: want make shape this: here code: #pyramid { width: 0px; border-left: 20px dotted transparent; border-right: 20px solid transparent; border-bottom: 50px solid blue; } <div id="pyramid"></div> adding width div trick. doing so, you'll in fact have 3 connected figures: 2 triangles , 1 rectangle in between. #pyramid { width: 5px; border-left: 20px dotted transparent; border-right: 20px solid transparent; border-bottom: 50px solid blue; } <div id="pyramid"></div>

swift - Open the list of SMS messages on iOS -

in app i'm creating want open messages app, showing list of received messages. know can open app create sms code: if let url = nsurl(string: "sms:") { if uiapplication.sharedapplication().canopenurl(url) { uiapplication.sharedapplication().openurl(url) } } this open messages app, blank new message. there way launch messages app , show received messages? i don't want access them apple documentation sms url scheme states scheme sms: i don't want send 1 using mfmessagecomposeviewcontroller class for mail can let url = nsurl(string: "message://") , open mail app here's usecase: during registration i'm sending verification text using textmagic. want add button on screen user open his/her messages app. you can see here sms scheme url doesn't provide possibility add body mail. to achieve goal should use mfmessagecomposeviewcontroller .

QT QlineEdit Input Validation -

how 1 set input validator on qlineedit such restricts valid ip address? i.e. x.x.x.x x must between 0 , 255.and x can not empty the answer here in short: have set qregexpvalidator appropriate regular expression ip4 adresses.

PHP + MySQL + Spanish -

my system deals spanish data. using laravel + mysql. database collation latin1 - default collation , tables structure looks this: create table `product` ( `id` int(11) not null auto_increment, `name` varchar(100) character set latin1 not null, ) engine=innodb auto_increment=298 default charset=utf8mb4; have few questions: i load data file db. practice utf8_encode($name) before inserting db? doing so, else comparison throw error : sqlstate[hy000]: general error: 1267 illegal mix of collations (latin1_swedish_ci,implicit) , (utf8_unicode_ci,coercible) operation '=' if using utf8_encode way go, need utf8_encode name want search? i.e. select... name = utf8_encoded(name)? is there flaws or better way handle above? doing spanish first time (characters accents). your product.name column has character set latin1 . know that. has collation latin1_swedish_ci . that's default. original developers of mysql swedish. because you're working in spanish, wa...

angularjs - angular ui grid date filter to search the date in column -

i wanted search date in search column, using angular ui date filter. when try search date in column, not showing correct date. want show exact match of user search. example: if user types 22-aug-16, should show date matching date, suppose if users types 25-aug alone should show dates matching 25th august in year present in database. i tried code like, .controller( 'blockadetailscontroller', [ '$scope', '$rootscope','$location','$routeparams', '$filter', 'commonservice', 'blockadetailsservice', '$q', function($scope, $rootscope,$location, $routeparams, $filter, commonservice, blockadetailsservice, $q) { $scope.changeactorgridoptions = { enablefiltering : true, columndefs : [ { { name : 'lldate', ...

c# - SqlDataReader.Read and large records -

i weird behaviour when using sqldatareader.read() when result set contains large column. what happens is: the entire record not read the record remains locked after reader , connection closed. unless explicitly call reader.get* on large column. here test code show mean. create table testxml ( id int not null ,number int not null ,data xml not null ); insert testxml values (1, 0, (select top 100 * sys.objects xml path('objects'))) ,(2, 0, (select top 1000 * sys.objects xml path('objects'))) ,(3, 0, (select top 10000 a.* sys.objects a, sys.objects b xml path('objects'))) the code fetch data const int testid = 1; using (var connection1 = new sqlconnection(connectionstring)) using (var connection2 = new sqlconnection(connectionstring)) using (var command1 = new sqlcommand()) using (var command2 = new sqlcommand()) { command1.connection = connection1; command1.commandtext = "select id, number, data ...

sql server - .NET and Entity Framework Database creation -

i want create sql server database in .net using entity framework, can't find how it. as of have: a simple project (wcf service) default name a database model database model picture a sql file should create database; generated using model (generate database model) a service file ( .svc ) code: public class service1 : iservice1 { public entity1 getdata(int id) { using (model1container ctx = new model1container()) { try { entity1 entity = ctx.entity1set.firstordefault(e => e.id == id); return entity; } catch (exception e) { console.writeline("captain, got error: " + e); return null; } } } public string postdata(string value) { using (model1container ctx = new model1container()){ entity1 newentity = new entity1(); newentity.property1 = value; ctx.entity1set.add(new...

javascript - AngularJS: Service call API and return JSON -

i need pass value input field on view using service. service should call webapi2 , receives valid json response. however, either getting promise object, cannot resolve (even " .then() "), or if i'm using factory won't compile seems not implement $get method. the json object i'm returning valid. view : <div class="input" ng-controller="inputcontroller ctrl"> <input ng-model="inputdata" /> {{inputdata}} <button ng-click="ctrl.gibdaten(inputdata)">senden</button> {{cooledaten}} </div> controller : module googlemapsapp { myapp.myappmodule.controller("inputcontroller", ["$scope", "mapsservicecustom", function ($scope, mapsservicecustom) { $scope.leingabedaten = $scope.inputdata; this.gibdaten = function () { $scope.cooledaten = mapsservicecustom.gibdaten().then(); console.log(...

playframework - Play form verification -

how add validation in play form? below reset password form expects user enter password twice. @(tokenid: string, form: form[resetpassword])(implicit messages: play.api.i18n.messages, request: requestheader) @main("reset password") { @helper.form(routes.application.handleresetpassword(tokenid)) { @helper.inputtext(form("password1")) @helper.inputtext(form("password2")) <button type="submit">submit</button> } } in above form, add validation check if password1 , password2 same or not. thanks pari you do: val userformconstraintsadhoc = form( mapping( "password1" -> text, "password2" -> text )(userdata.apply)(userdata.unapply) verifying("failed form constraints!", fields => fields match { case userdata => form.password1.equals(form.password2) }) ) this untested pseudo code, check out docs purpose

winforms - Display custom message while installation using powershell -

i unable figure out mistake doing.the following script call bunch of batch files , while batch files doing there job, progress shown in progress bar along name of script. want achieve display custom message during installation process. not able find out mistake, appreciated. [system.reflection.assembly]::loadwithpartialname("system.windows.forms") | out-null [system.reflection.assembly]::loadwithpartialname("system.drawing") | out-null set-location $psscriptroot #call scripts installation $scriptshome = get-item '.\test\forps\*' #define form # init form $form = new-object system.windows.forms.form $form.width = 1000 $form.height = 200 $form.text = "** installation in progress-please not close window**" $form.font = new-object system.drawing.font("times new roman" ,12, [system.drawing.fontstyle]::regular) $form.minimizebox = $false $form.maximizebox = $false $form.windowstate = "normal" $form.startposition = "center...

Behavior of <select> tag on chrome -

i set color of select tag red , behaves normal expected, when number of option tag on 300 color not working, behaves browser agent is, what problem , how can fix issue? google developers thought nobody put more 300 items in select dropdown improve performance turned off css styling if exceeded it. after uproar removing restriction in v45. see link

android - getWidth must be called from UI thread -

getwidth must called ui thread..how fix it??im trying create pdf file..but getwidth,getheight , getcanvas coming errors!!! private class pdfgenerationtask extends asynctask<void, void, string> { @override protected string doinbackground(void... params) { pdfdocument document = new pdfdocument(); // repaint user's text page view content = findviewbyid(r.id.pdf_content); // crate page description int pagenumber = 1; pageinfo pageinfo = new pageinfo.builder(content.getwidth(), content.getheight() - 20, pagenumber).create(); // create new page pageinfo page page = document.startpage(pageinfo); content.draw(page.getcanvas()); // final processing of page document.finishpage(page); simpledateformat sdf = new simpledateformat("ddmmyyyyhhmmss"); string pdfname = "pdfdemo" + sdf.format(calendar.getinstance().g...