Posts

Showing posts from July, 2014

ios - Swift Parse - Method doesn't stop executing -

i have following code query parse class , return result set. after returning results, pass array function check if elements set or not. i used print statements on code try , debug, , found query executes , within if error == nil i getting results array empty. hence when pass function below, never gets out of it: func emailorusernameistaken(results: [pfobject])->int { /*check if username taken or if email taken*/ var preferencetaken: int = 0 if(results[0]["email"] as! string != "" && results[0]["email"] as! string == self.userobject.email!) { preferencetaken = 1 }else if(results[0]["appusername"] as! string != "" && results[0]["appusername"] as! string == self.userobject.username!){ preferencetaken = 2 } return preferencetaken } and code query taking place: let query = pfquery.orquerywithsubqueries([user

java - 2d arrays and tic tac toe rows and columns method -

hello trying make tic tac toe program, , having trouble having turns ending, , winner being declared, please take @ method , see might problem. far diagonals work, don't think rows, , columns thanks. public string checkwin() { string results = ""; (int r =0; r <3;r++) { if(board[0][0]== "1" &(board[1][1]== "1") &(board[2][2]== "1")) { results = "player 1 wins"; } else if(board[0][0]== "2" &(board[1][1]== "2" )&(board[2][2]== "2")) { results = "player 2 wins"; } else if(board[0][2]== "1" &(board[1][1]== "1") &(board[2][0]== "1")) { results = "player 1 wins"; } else if(board[0][2]== "2" &(board[1][1]== "2") &(board[2][0]== "2")) { result

How to group Time Series data into round intervals of 5 minutes in R? -

i have time series data frame looking this: time source value 1 2016-01-20 15:10:04 c04 open 2 2016-01-20 15:09:57 m04 true 3 2016-01-20 15:09:53 m02 true 4 2016-01-20 15:09:53 m03 true 5 2016-01-20 14:44:54 m04 true now group them in intervals of 5 minutes starting 00:00:00, intervals of 0-5-10-15-20... , on. intervals shall used later group identifier: time source value group 1 2016-01-20 15:10:04 c04 open 10 2 2016-01-20 15:09:57 m04 true 5 3 2016-01-20 15:09:53 m02 true 5 4 2016-01-20 15:09:53 m03 true 5 5 2016-01-20 14:44:54 m04 true 40 i tried cut() dates using breaks="5 min" instead of getting round start , end values, result looks this: > table(cut.posixt(df.formatted$time, breaks="5 min"))[1:5] 2015-12-31 12:49:00 2015-12-31 12:54:00 2015-12-31 12:59:00 2015-12-31 13:04:00 2015-12-31 13:09:00 4 0

standards - iCalendar UNTIL rule must be of the same type as DTSTART property? -

in icalendar rfc 5545, section 3.3.10 , see following until parameter description: the value of until rule part must have same value type "dtstart" property. furthermore, if "dtstart" property specified date local time, until rule part must specified date local time. if "dtstart" property specified date utc time or date local time , time zone reference, until rule part must specified date utc time. however, in 3.8.5.3 recurrence rule paragraph, until specified in utc, regrdless of dtstart property: dtstart;tzid=america/new_york:19970902t090000 rrule:freq=daily;until=19971224t000000z dtstart;tzid=america/new_york:19970902t090000 rrule:freq=weekly;until=19971007t000000z;wkst=su;byday=tu,th there 5 of such examples in total. i found @ least 2 caldav clients (ios , mozilla lightning) submit until parameter in utc, regardless of dtstart property. the place until must in utc rrul

python - Connecting from psycopg2 on local machine to PostgreSQL db on Docker -

i have used following commands create docker image postgres running on it: docker pull postgres docker run --name test-db -e postgres_password=my_secret_password -d postgres i created table called test , inserted random data couple of rows. trying make connection database table through psycopg2 in python on local machine. used command docker-machine ip default find out ip address of machine 192.168.99.100 , using following try , connect: conn = psycopg2.connect("dbname='test-db' user='postgres' host='192.168.99.100' password='my_secret_password' port='5432'") this not working error message of "operationalerror: not connect server: connection refused (0x0000274d/10061)" . . everything seems in order can't think why refused. according documentation postgres image, (at https://hub.docker.com/_/postgres/ ) image includes expose 5432 (the postgres port) , default username postgres. i tried ip address of imag

javascript - window.addEventListener('message', myFunction(event)) doesn't work -

i'm trying understand why following not work. var myfunction = function(event) { // event }; window.addeventlistener('message', myfunction(event)); i following error: "referenceerror: event not defined". however, following works , event able used. window.addeventlistener('message', function(event) { // event }); how can use event in first situation? why event accessible in second situation? you seeing error because invoking function immediately. need pass reference function instead. in other words, change this: window.addeventlistener('message', myfunction(event)); to this: window.addeventlistener('message', myfunction); when using addeventlistener() method, event object passed first parameter default when event fired.

c++ - Awesomium WebView doesn't display page -

i've made 2 simple classes use displaying uis awesomium. creating awesomium webview , setting parent window win32 window causes program hang , page never displayed. classes simple , creating window simple there isn't can think of going wrong. perhaps there else required i've done display webview? to clarify: creating win32 window without creating webview works fine, window functions including drag code etc... hang happens when call set_parent_window. ui.h #pragma once #include <windows.h> #include <windowsx.h> #include <awesomium/webcore.h> #include <awesomium/stlhelpers.h> using namespace awesomium; lresult callback loginuicallback(hwnd hwnd, uint message, wparam wparam, lparam lparam); class ui { public: //window variables hinstance instance; hwnd window; bool drag_window = false; short mouse_x, mouse_y, mouse_x_prev, mouse_y_prev; //awesomium variables webcore* webcore = 0; webview* webview; stati

config.xml file of Magento extension -

i got below code in config.xml file of magento extension. <admin> <routers> <brandlogo> <use>admin</use> <args> <module>mconnect_brandlogo</module> <frontname>brandlogo</frontname> </args> </brandlogo> </routers> </admin> i know <frontname> tag is? all magento extensions expose controller routes need define frontname. in particular example, it's adminhtml controller, , frontname "brandlogo". this means if go /index.php/admin/brandlogo/index magento admin router route request mconnect_brandlogo's indexcontroller, i.e. mconnect_brandlogo_indexcontroller::indexaction . if <area> frontend rather admin , how define frontend (customer facing) routes. please aware way of configuring admin routes deprecated. there security issues found (such type in "your

swift - How can I make an NSViewController topmost in Xcode? -

i know if there way make 1 of nsviewcontrollers stay on top of rest of them in xcode or swift 2. working os x cocoa. thanks! i assume have nsviewcontrollers in multiple windows, , it's 1 of windows want keep on top of others. done setting window.level : window.level = int(cgwindowlevelforkey(.floatingwindowlevelkey))

c++ - Improving Time Hackerrank [terminated due to timeout] -

i've created code based of information given me below. "the first line have integer n denoting number of entries in phone book. each entry consists of 2 lines: name(either first-name or first-name last-name) , corresponding phone number. after these, there queries. each query contain name of friend. read queries until end-of-file." also if name not found supposed print "not found" the problem on hackerrank.com , cant submit because program "terminated due timeout" can please me improve code , make run faster?! barely figured out how make run i'm out of ideas on how improve it. #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <string> #include <vector> using namespace std; class number{ public: string name; string lname; long number; }; class phonebook{ public: void findnumber(){ string tempname; w

python - Multiple Selenium instances on same machine? -

what best way run multiple selenium instances in parallel if tests for: same browser type same machine i've read this: https://code.google.com/p/selenium/wiki/scalingwebdriver , seems there systemic problem regarding running multiple selenium instances on same machine. i'd ask community if there way i'm not seeing. i have working selenium instance run e2e tests. however, run 5 of selenium instances in parallel using same browser type. i've looked selenium grid 2 , i'm not sure if fits use case. seems main point of selenium grid 2 able distribute test according browser version / operating system. in case, each test same type, same browser version. running standalone test works great! running multiple firefox processes: but try scale spawning multiple firefox processes, errors involve http , requests error, including badclient , statuserror , exception: request cannot sent : webdriver.firefox() using grid i've dug webdriver.firefox(

c# - Azure Search SDK Create DataSource -

i've been created datasource azure search sdk. the datasource azure sql view. i tyr setting datachangedetectionpolicy , datadeletiondetectionpolicy, can't understand how set 2 property. when think 2 property doesn't supported on preview sdk,so try use rest api solve this. i read article: msdn create data source (azure search service rest api) and use chrome extension postman set data change detection policies. url : https://domain.search.windows.net/datasources/temp1?api-version=2015-02-28 body : { "@odata.type" : "#microsoft.azure.search.highwatermarkchangedetectionpolicy", "highwatermarkcolumnname" : "modifieddatetime" } then 400 bad request . error message: { "error": { "code": "", "message": "the request invalid. details: datasource : incompatible type kinds found. type 'microsoft.azure.search.highwatermarkchangedetectionpolicy'

How to have applescript perform more than one process at a time? -

so have script in apple script takes string of text , repeats amount of times. wondering if possible have script read text aloud while @ same time inputting text. repeat set readtext "hello world" readtext without waiting until completion --read in next line of text end repeat do u idea? other not think there way run tasks in parallel. hope helps.

node.js - mongoose: how query a model with conditions on a property of type reference -

var userschema=new schema({ username: { type: string, required: 'username required' } }); var postingschema=new schema({ creator: { type: schema.objectid, ref: 'user', required:true } }); i want retrieve postings given username. doing in below way, not working. posting .find({ 'creator.username': req.params.username }) .populate('creator', 'firstname lastname fullname username profile_pic') .exec(function(err, postings){ if (err){ res.status(501).json({ error: err}); } else { res.json(postings); } }); i got empty results array. may wrong query conditons. how apply conditions on ref objects. can correct this? refer query populate .populate({ path: 'creator', match: { use

vb.net - Get image file name from PictureBox control -

Image
i have image in folder able display onto picturebox in following manner: picturebox1.image = nothing 'clearing picturebox1 dim bmphotos new bitmap("c:\photos\imagename.gif") picturebox1.image = bmphotos i obtain additional information image. image title. possible in .net? thank you. if want read image metadata such title, author, camera make, model, etc., stored in image header exif. they can retrieved using propertyitems . every property tag identified hexadecimal value , can find them here , here . 'create image object. dim img image = image.fromfile("c:\ashish\apple.jpg") 'get propertyitems property image. dim propitems propertyitem() = img.propertyitems dim encoding new system.text.asciiencoding() dim title string = encoding.getstring(propitems(0).value) dim manufacturer string = encoding.getstring(propitems(1).value) a simple implementation read exif metadata available here .

javascript - Fullpage.js - Setting value for 'setFitToSection' option based on if a div has a certain class -

i have code partially written not sure put after if , else parts. i'm trying - whenever section has class "four" , "active" want disable fittosection option fullpage.js. fullpage.js has built in setfittosection boolean i'm using. have far, else need? $(document).ready(function () { if ($('.four').hasclass('active') === true) { $.fn.fullpage.setfittosection(false); } else { $.fn.fullpage.setfittosection(true); } }); just use callbacks fullpage.js provides, such afterload or onleave : $('#fullpage').fullpage({ autoscrolling:false, onleave: function(index, nextindex, direction) { var destination = $('.fp-section').eq(nextindex - 1); if(destination.hasclass('four')){ $.fn.fullpage.setfittosection(false); console.log("setting fittosection off"); }else{ $.fn.fullpage.setfittosection(true);

Python: Sqlite3 query output to .csv file -

i execute query: select datetime(date/1000,'unixepoch','localtime') date, address received, body body sms; and save it's output .csv file in specified directory. in ubuntu terminal far more easy manually give commands save output of above query file. not familiar python-sqlite3. know how execute query , save it's output custom directory in .csv file. please me out ! quick , dirty: import sqlite db = sqlite.connect('database_file') cursor = db.cursor() cursor.execute("select ...") rows = cursor.fetchall() # itereate rows , write csv cursor.close() db.close() rows list matching records, can iterate , manipulate csv file. if want make csv file, @ csv module. following page should going https://docs.python.org/2/library/csv.html you can @ pandas module create file.

javascript - Merge two svg path elements programatically -

Image
i rendering map out of svg paths (using jvectormap ). there cases 1 region has merged neighboring region. unfortunately both regions don't touch each other , have interpolate fill space in between. jvectormap uses simple svg paths m set the absolute startpoint , l connect relative points. does of svg libraries cover such operation? i haven't tried this, may around running the converter @ jvectormap following parameters: --buffer_distance=0 --where="iso='region_1' or iso='region_2'" where region_1 , region_2 2 regions need merge. solving problem way means generated svg paths true original coordinates, whereas following fix may lead (probably minor) inconsistencies.

uibutton - Creating button panel in iOS -

Image
we plan create wechat -like ui in our app, , we'd know how create such button panel . please @ screenshots below: so behaviour is: screen shot 1 - chat ui , , there bar @ bottom containing text field . screen shot 2 - clicking on text field brings virtual keyboard . screen shot 3 - note there + button in bar , , clicking button dismisses virtual keyboard, revealing button panel contains buttons below bar, , these buttons provides features uploading images, shooting photos , etc. how implement such ui, more specifically, how implement button panel ? thanks! you can use uicollectionview purpose. in brief collection view contain n numbers of item in n numbers of rows. see below example more detail : part1 part2

java - MOXy DynamicEntity with JSON? -

i'm trying use dynamicentity unmarshal simple json, , it's totally bombing on me. docs rather sparse, possible this? i'm doing this; jaxbcontext jaxbcontext = jaxbcontext.newinstance(dynamicentity.class); dynamicentity entity = (dynamicentity) jaxbcontext.createunmarshaller().unmarshal(entitystream); this straight xml docs here: https://wiki.eclipse.org/eclipselink/examples/moxy/dynamic/xmltodynamicentity and get; caused by: com.sun.xml.internal.bind.v2.runtime.illegalannotationsexception: 1 counts of illegalannotationexceptions org.eclipse.persistence.dynamic.dynamicentity interface, , jaxb can't handle interfaces. problem related following location: @ org.eclipse.persistence.dynamic.dynamicentity has managed work? i'm trying avoid building pojos since backend store doesnt care them anyway, want deserialize generic object , pass along. in .net i'd use dynamic i'm pretty stumped on how moxy. in order dynamicentity , necces

jasmine - Reset an ES6 module with SystemJS (for unit tests)? -

our workflow includes using es6 modules. includes unit tests. import modules under test. problem original authors decided have every module return objects, , have global singletons (because of how es6 imports work) throughout code base---a classic unit testing problem. is there way "reset" said modules systemjs after each test? sample unit test (loaded karma-systemjs): import mut './mut' // module under test describe('mut', () => { it('should stuff', () => { mut.value = 'foo' }) it('should more stuff', () => { // value should not 'foo' here. how reset mut? }) check out this issue on github, , particularly this comment . try deleting , re-importing module in beforeeach block so: describe('mut', () => { let mut; beforeeach((done) => { // remove previous version system.delete(system.normalizesync('./mut')) // re-import module

javascript - jquery datepicker onclose event not firing -

i have added jquery 1.11 in footer jquery ui 1.11. added ui css @ header. datepicker events not working $('.datepicker_default').datepicker({ dateformat: 'dd/mm/yy', onclose: function (datetext, inst) { alert('working'); //$(this).datepicker('option', 'dateformat', 'dd-mm-yy'); } }); html <input type="text" class="form-control datepicker_default" placeholder="dd/mm/yyyy" name="datepicker"> here head section , footer https://gist.github.com/anonymous/9a6ed80380612e5cfb82 i think conflic between bootstrap-datepicker , jquery-ui-datepicker <script type="text/javascript" src="<?php echo base_url('assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js'); ?>"></script> bootstrap-datepicker , jquery-ui-datepicker have same $( "#div" ).datepicker(); http://w

reactjs - How to upload a file from local in React? -

i tried using filereader html5 api, in react needs npm module , corresponding npm module filereader isn't working , showing error after file upload. without doing require('filereader'), webpack shows error. with npm module filereader shows: "uncaught error: cannot read file: {"preview":"blob:http%3a//dev.myntra.com%3a3000/cfb8a917-b3df-46b2-b055-21da34f253f2"}" can use other npm module kind of file or there way can use filereader api directly react? code: { ondrop(files) { this.setstate({ files: files }); console.log(files[0]); var reader = new filereader(); var contents; reader.onload = function(event) { contents = this.result; console.log(contents); $.ajax({ type: 'post', url: '/api/csv', async: true, data: json, crossdomain: true, contenttype: "application/json; charset=utf-8", processdata: false, timeout:5000, succe

java - How to create Vaadin tabsheet without components? -

i need functionality of vaadin tabsheet. don't need component each tab. instead, have 1 component (separate table) , manipulated tab sheet actions. now, have assigned hidden labels tabs. is there better way this? if 1 ran same scenario, here how solved it. instead of adding hidden labels, added labels without captions.so no need hide them, because have nothing show. :). don't set visibility hidden. cause problems since vaadin doesn't send hidden components client.

npm - Error while installing xml2json using node.js -

Image
i tried install xml2json package node.js gives me error. error below : my system configuration below : node.js version - v5.4.1 npm version - 3.3.12 operating system - windows 10 64 bit python - 2.7.11(set environment variable ) after installing microsoft windows sdk v7.1 gives me below error. after added package.json below error given. you have explicitly specify platform toolset when building msbuild ( triggered node-gyp rebuild ) . try command below, prior running npm : call "c:\program files\microsoft sdks\windows\v7.1\bin\setenv.cmd" /release /x64 see meaning of passed arguments below, setenv.cmd usage : /release - create release configuration build environment /x64 - create 64-bit x64 applications additional explanations npm install xml2json require using windows sdk under hood build projects, while installing packages, msbuild . have faced situation windows sdk configuration isn't compatible required node

javascript - Getting a black overlay with text when hovering over an image -

i searched on , found couple of solutions, cannot work in application. trying black-overlay on image when hovered on , text appear. ideally want text have border looks button. i want work scale on hover well. reason on actual page, when hovering on image, nothing scale. doesn't turn parent div gray color. what doing wrong? $('.home-img-block').find('img').each(function() { var imgclass = (this.width / this.height > 1) ? 'wide' : 'tall'; console.log(imgclass); $(this).addclass(imgclass); }); #home-img-blocks { width: 100%; height: 600px; } .home-img-block { width: 33.33%; /*height: 100%;*/ display: inline-block; overflow: hidden; cursor: pointer; } .home-img-block:after { content: attr(data-content); color:#fff; position:absolute; width:100%; height:100%; top:0; left:0; background:rgba(0,0,0,0.6); opacity:0; transition: 0.5s; -webkit-transition: 0.5s; }

Push notification with openfire in Android -

i'm building chat application in android. used both openfire server , mysql , implemented chat between 2 users. have following questions: 1.i want know possible send push notification server. , if yes how achieve it? 2. i'm planning register new user through webservice ,so possible.

php - Connect MySQL database with webservice -

i want connect mysql database webservice. followed tutorial, not work. have no idea, why it's not workiing. table built, should filled vaues database. want diplay it. anybaody have idea? src-code: enter code here <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body> <?php $mysqlhost="localhost"; // mysql-host angeben $mysqluser="root"; // mysql-user angeben $mysqlpwd="webservice"; // passwort angeben $mysqldb="**********"; // gewuenschte datenbank angeben $connection=mysql_connect($mysqlhost, $mysqluser, $mysqlpwd) or die ("verbindungsversuch fehlgeschlagen");

android - what is wrong with this piece of code?i am getting "null pointer exception".code is about drawing route on map -

this question has answer here: what nullpointerexception, , how fix it? 12 answers private string getmapsapidirectionsurl() { string origin; string destination=string.valueof(l.longitude)+","+string.valueof(l.latitude); origin=string.valueof(longitude)+","+string.valueof(latitude); // string url = "https://maps.googleapis.com/maps/api/directions/"+ output + "?" + params; string url="https://maps.googleapis.com/maps/api/directions/json?origin="+origin+"&destination="+destination+"&sensor=false"; return url; } i getting nullpointerexception . know not able identify causing it. assuming outside method correct, wrong syntactically? this entire code: package autogenie.maptrial; import android.manifest; import android.content.context; import android.content.pm.pack

android - How to get the parent of a menu item? -

in click listener public boolean onnavigationitemselected(menuitem item) how can find parent menu of item? want able go through each item of menu contains item , change child elements. far can determine group in int groupid = item.getgroupid(); if (groupid == r.id.group1) { } thanks

java - Android Multiple image upload not send data to server -

hello working android . want send multipart data asp.net server contains text , mulltiple images. can able send 1 image send server. used code for(int i=0;i<captured_imagepath.size();i++) { file file2 = new file("my folder path" + captured_imagepath.get(i)); entitybuilder.addbinarybody(file2.getname(), file2, contenttype.create("image/jpeg"), captured_imagepath.get(i)); entitybuilder.setboundary(boundary); } where captured_imagepath array list of image names in folder.i tried print sending data file , works fine in case when send 1 image, if used more 1 image, means if captured_imagepath has size >1 not print sending data , image not send server.is there problem code ? stucked problem. please me in advance :) you can try this ` ( int i= 0; < size ; i++ ){ try { file file = new file("my folder path" + captured_imagepat

Tracking user on the server-side in Google Analytics after payment on third party site -

i have e-commerce website using google analytics ( async ga.js ) on payment done on third-party service (by french bank) not allow cookies on site. so, when customer goes off-site pay , complete transaction, lose in google analytics. of course may click on "go website" link not 100%, far it. however banking site send server-to-server confirmation of transaction result (payment completed or not), along many variables. among variables text field returned unchanged original request emanating our our server. to rephrase: can send text field (of 3200 characters max) along post request banking server @ time user clicks payment button (this post html form) , transmit text unchanged server (but no longer in browser). so given these parameters how can send signal google analytics visitor has completed transaction (if has) ? there better/simpler ways accomplish this? the environment lamp , can use google apis client library php . you can create unique user id each

c - Passing NULL to printf %s -

this question has answer here: what behavior of printing null printf's %s specifier? 4 answers #include<stdio.h> #include<string.h> int main() { char *ptr = null; printf("%s", ptr);//the output null // printf("%s\n", ptr); //addition of **\n** give segmentation fault return 0; } the first printf outputs: (null) . why second printf 's output is: segmentation fault (core dumped) on adding: \n ? printf("%s", ptr); here printf expects valid pointer, points null terminated string, can't pass null it. if so, trigger undefined behaviour, , can't reason output of program. ps. have found answer might have more details thing might interested in. see here . question seems duplicate of one.

How can we pass any value (selected one) from dialog to activity in android? -

i need pass values custom dialog activity. cannot understand should use. used intent, dialog doesn't support intent value passing . can me here, totally stucked.if have basic example it, excellent. thank you. snippet google documentation: // alert dialog code (mostly copied android docs alertdialog.builder builder = new alertdialog.builder(this); builder.settitle("pick color"); builder.setitems(items, new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int item) { myfunction(item); } }); alertdialog alert = builder.create(); // elsewhere in activity class, have function private void myfunction(int result){ // data has been "returned" (as pointed out, that's not // right terminology) }

installation - Why Open file Security Warning is so slow for mysetup.exe? -

why opening mysetup.exe takes 30 seconds open? delay occurs when click exe explorer , if inside downloads folder. there no delay in other folders. the 30 second delay appears before windows displays security warning dialog "do want run file?" - think delay related open file security warning / aes? the other files (same size setuppers) open within 1-2 seconds after downloading, new inno packed software (5 mb file size) takes 30 seconds open. the mysetup.exe file digitally signed (comodo) this delay down explorer trying verify signature of entire executable. happens on executables far more noticable when size on few hundred mb. stop displaying icon @ point same reason. as entirely explorer bug, thing can in inno setup split setup smaller files using diskspanning directive.

wpf - The application requires that assembly Microsoft.HTMLTrans.Interface version be installed first in the global assembly cache -

i have created wpf application. have used microsoft.sharepoint dll data lists. created deployment package . when run setup following error unable install or run application. application requires assembly microsoft.htmltrans.interface version 12.0.0.0 installed first in global assembly cache. i commented sharepoint method calls , instead accessed sharepoint lists using sharepoint web service approach. resolved issue.

html - How to change the background color of pop up header? -

Image
i getting issue in background color on popup header.i trying change background color of pop header using below code not working. header background color popup not taking below css. please me. html <a href="#openmodal">open modal</a> <div id="openmodal" class="modaldialog"> <div class="pop-header"> <a href="#close" title="close" class="close">x</a> </div> </div> css .pop-header { width: 100%; background-color: #000; height: 50px; padding: 20px; } .modaldialog { position: fixed; font-family: arial, helvetica, sans-serif; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,0.8); z-index: 99999; opacity:0; -webkit-transition: op

ASP.NET how to write code for mail sender? -

i have search many sites. can't understatnd said. refer in internet told create cdo files. please me send mail in project. have 3 textboxes: tomail heading content of message send button use below code sent mail. mailmessage mail = new mailmessage(); smtpclient smtpserver = new smtpclient("smtp.gmail.com"); mail.from = new mailaddress("me@mydomain.com"); mail.to.add("u@urdomain.com,rkrishtring@gmail.com"); mail.subject = "report"; mail.body = "this stack overflow using report"; attachment attachment = new attachment(filename); mail.attachments.add(attachment); smtpserver.port = 25; smtpserver.credentials = new system.net.networkcredential("username", "password"); smtpserver.enablessl = true; smtpserver.send(mail);

javascript - Angular `ng-repeat` - how to filter only two properties? -

at moment, have search box , repeat list. repeat list uses object many properties. json $scope.userlist = [{ firstname: "jack", lastname: "smith", description: "this description" }, { firstname: "luke", lastname: "mcdonald", description: "my name luke, , friend jack" }] and repeat list: <md-list-item ng-repeat="user in userlist | filter: searchinput allresults"> <p>{{user.firstname}} {{user.lastname}}</p> </md-list-item> my search boxes model searchinput , , object saved scope $scope.userlist . if search jack , both results displayed due both objects containing search term. how can limit filter within firstname , lastname properties? use in controller $scope.searchfilter = function (user) { var keyword = new regexp($scope.searchinput, 'i'); return !$scope.searchinput || keyword.test(user.firstname) || keyword.test(user.lastname); }

javascript - Property dependencies on object attributes -

i'd use property dependencies avoid dirty checking on computed properties. since properties on computed property depends no primitives attributes of object don't know how make work. code: import {computedfrom} 'aurelia-framework'; export class person { persondata = { firstname: 'john', lastname: 'doe', // more attributes... } // ... // doesn't work: @computedfrom('persondata.firstname', 'persondata.lastname') // neither does: // @computedfrom('persondata["firstname"], 'persondata["lastname"]') // nor: // @computedfrom('persondata') fullname() { return `${this.persondata.firstname} ${this.persondata.lastname}`; } // ... } the @computedfrom attribute add support expressions- keep eye on https://github.com/aurelia/binding/pull/276 a word of caution- overusing @computedfrom (eg @computedfrom(p1.p

Android WebView Failed to execute 'play' on 'HTMLMediaElement': error playing mp3 file -

in html file when html loading plays mp3 file in background. not playing file give following error. failed execute 'play' on 'htmlmediaelement': got solution. occurs because of playing audio file without making click or not doing action in webview. overcome need set below property webview if (build.version.sdk_int >= build.version_codes.jelly_bean_mr1) { mwebview.getsettings().setmediaplaybackrequiresusergesture(false); }

c# - Create a gridview event who select some elements of the same columns -

i've got gridview cells database. user should able select rows of 1 column @ time. example : 0 1 2 0 b c 1 d e f 2 g h if user drags mouse (while pressing left button) 0/0 = 1/1 = e cells , d should selected. (multi column selection shouldn't allowed) if can help, thank you that's got beginning : private void mydatagridview1_mousedown(object sender, mouseeventargs e) { var hti = datagridview1.hittest(e.x, e.y); coord[0] = hti.rowindex; coord[1] = hti.columnindex; } private void datagridview1_mouseup(object sender, mouseeventargs e) { var hti = datagridview1.hittest(e.x, e.y); coord[2] = hti.rowindex; coord[3] = hti.columnindex; // actions } this example still selects multiple columns. using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq;

c# - POST a variable to a website accepting JavaScript -

as title referring, there website requires key in order authenticate. key processed website , spits out. built program gets key, filters out html response , prints it. all need know how post key javascript variable "key=" onto website " https://www.website.com/serve/credit " javascript on website: key = jquery('#my_key').val(); jquery.post('/serve/credit', "key=" + key); that javascript off of website; console.writeline(resultstring); //resultstring key filter byte[] postbyte = encoding.ascii.getbytes(resultstring); httpwebrequest request2 = (httpwebrequest)httpwebrequest.create("https://www.website.com/serve/credit"); request2.keepalive = true; request2.timeout = 15000; //request2.useragent = @"mozilla/5.0 (windows nt 6.2; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/32.0.1667.0 safari/537.36"; //re

google visualization - Easy way to see if DataView is empty? -

using google visualization api, there easy way see if dataview empty? https://developers.google.com/chart/interactive/docs/reference#dataview i can see perhaps using dataview.getvalue(0, 1) etc check nulls, contains column headings. i'm guessing it's tricky dataview have many different formats, there generic way of checking empty data views? i'm using dataview pie chart. if remember right, can done way var predata = response.getdatatable(); var vals = new array(); var rownum = predata.getnumberofrows(); // make sure our data isn't empty. if (null==predata) // yoda here return; returns data table returned data source. returns null if query execution failed , no data returned.

Getting "No qmlscene installed." warning in "QT CREATOR" on "Ubuntu" -

i added qtstatic qt versions, cant use version build , set in kits tab. i uploaded screenshot below : (plz help) versions tab screenshot kits tab screenshot i had same issue under debian jessie. fixed installing qtdeclarative5-dev package.

corrupt - Clips multiple EnvEval queries invalidate previous result objects? -

i had strange problem solved already. i'm not sure luckily fixed or understand what's going on. have perform query on facts via: data_object decay_tree_fact_list; std::stringstream clips_query; clips_query << "(find-all-facts ((?f decaytree)) true)"; enveval(clips_environment_, clips_query.str().c_str(), &decay_tree_fact_list); then go through list of facts , retrieve needed information. there make "subquery" each of found facts above in following way data_object spin_quantum_number_fact_list; std::stringstream clips_query; clips_query << "(find-fact ((?f spinquantumnumber)) (= ?f:unique_id " << spin_quantum_number_unique_id << "))"; enveval(clips_environment_, clips_query.str().c_str(), &spin_quantum_number_fact_list); this works fine first decaytree fact, no matter @ position start, next 1 crashes, because fact address bogus. traced problem down subquery make. did solve problem save decayt

Implement Authentication for servlet on publish instance CQ5/AEM -

i have scenario , suggestions in implementing of great help. have servlet created on publish have post requests coming lot of other third party applications. servlet stores incoming posted data in jcr. have created servlet requirement make servlet secured applications hitting servlet particular username , password should entertained. what can achieve this? the way go it: ask 3rd party applications send username , password can validate them on servlet, decide if allow or reject request. from servlet calling (the 3rd party application) protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // ... request.setattribute("username", "a_valid_user"); request.setattribute("password", "a_valid_password"); request.getrequestdispatcher("yourapp/yourservlet").forward(req, resp); } on servlet: string username = request.getparam