Posts

Showing posts from March, 2012

sql server - update existing column values and insert new in record doesn't exist in SQL when importing from CSV -

can please me on following? we have payroll software runs on sql server. have update payroll category sql server can reflect on software. this excel file: employee number payroll category rate ------------------------------------------ 111111 011 32.21 111111 012 56.23 111111 013 12.52 111111 021 45.21 111112 011 36.21 111112 012 56.23 111112 013 42.54 111112 021 85.21 these current values in database table masterpaycard employee number payroll category rate ------------------------------------------- 111111 011 0.00 111111 012 0.00 111111 013 10.25 111112 011 36.21 111112 012 12.50 111112 013 41.25 11111

Doxygen docs for 'extern' variables in C -

i have extern variable in c code: /** * key. */ extern key_t key; however, according doxygen, style of documentation wrong: extern.h:29: error: parameters of member key not (all) documented (warning treated error, aborting now) what proper way of documenting extern variables?

java - Akka : How to assign an Actor an alias path -

i working on poc trying implement device server using akka java. same wondering how can create alias path symbolic link actor after actor created. i reading article ( http://doc.akka.io/docs/akka/snapshot/general/addressing.html ) blockquote in real file-systems there “symbolic links”, i.e. 1 actor may reachable using more 1 path, 1 involve translation decouples part of path actor’s actual supervision ancestor line; these specialities described in sub-sections follow. if can example great. that section of docs little misleading: fact cases actor may have multiple paths implementation detail, not mean aliases can created deliberately. in particular, remote deployment way can happen. so short answer is: in practice impossible.

beagleboneblack - Debian: jessie / sid -

perhaps silly question following mean i'm running sid? returned when running jessie non-sid? happens on beaglebone device. i'm asking because i'm working on new project , i'm concerned our devices have 'unstable' version of debian. $ cat /etc/debian_version jessie/sid

python - Scrapy installed, but won't run from the command line -

i'm trying run scraping program wrote in python using scrapy on ubuntu machine. scrapy installed. can import until python no problem , when try pip install scrapy requirement satisfied (use --upgrade upgrade): scrapy in /system/linux/lib/python2.7/dist-packages when try run scrapy command, scrapy crawl ... example, get. the program 'scrapy' not installed. what's going on here? symbolic links messed up? , thoughts on how fix it? i tried following sudo pip install scrapy , promtly advised ubuntu 16.04 installed. had first use sudo pip uninstall scrapy , sudo pip install scrapy install. should able run scrapy.

python - How to match strings with possible typos? -

i have multiple pdf converted text files , want search phrase might in files. problem conversion between pdf , text file not perfect there errors appear in text (such missing spaces between word; mix-up between i, l, 1's; etc.) i wondering if there common technique give me "soft" search, looks @ hamming distance between 2 terms example. if 'word' in sentence: vs if my_search('word',sentence, tolerance): you can use this: from difflib import sequencematcher text = """there 3rrors in text cannot find them""" def fuzzy_search(search_key, text, strictness): lines = text.split("\n") i, line in enumerate(lines): words = line.split() word in words: similarity = sequencematcher(none, word, search_key) if similarity.ratio() > strictness: return " '{}' matches: '{}' in line {}".format(search_key, word, i+1) p

php - Typo3/TCA create new tab with fields of another tab inside -

i need in typo3/tca. im trying modify backend layout of extension, cant work. i try make context of "firma" new tab (see image). firma1 i fugured out context of "firma" defined in tca.php in $tca['tx_jobsystem_domain_model_job'] column 'address'. (l. 328 ): 'address' => array( 'label' => $languagefile . ':tx_jobsystem_domain_model_job.address', 'config' => array( 'type' => 'inline', 'foreign_table' => 'tt_address', #'foreign_field' => 'uid', 'symmetric_field' => 'address', 'appearance' => array( 'collapseall' => true, 'expandsingle' => true ) ) ), i did copy $tca['tx_jobsystem_domain_model_advertisement'

angularjs - Communication between controllers through $window.location.href -

i have following statements in controller 1: $scope.field1 = "abcd"; $window.location.href = 'main.html'; then, in main.html have controller 2, , need have access value of field1. is possible using service or factory, $window.location.href replace scope? $broadcast/$emit work in case? update i tried singleton service calling set in controller 1 , get in controller 2, variable in controller 2 still null app.service('singleton', function() { var myfield1 = null; this.set = function(f) { myfield1 = f; }; this.get = function() { return myfield1; }; if have 2 different pages, like: <html> page1 </html> <html> page2 </html> then independent, i.e. angular loaded separately in page1 , page2 - can not make javascript connection between them. js objects discarded when change url. can use param page1.html?param=value, cookies, localstorage (2 latest same domain)

css - Multiple html pages v/s Single html page -

i'm trying create website small project. first page reach after launching in browser window landing page provides means pick 1 of multiple options. e.g. pick you'd access - 1. 2. 3. 4. , on i'm using basic html, css , javascript work on this, since ones i'm familiar with. being said, i'm open learning else if makes job easier. but @ moment, problem have designed html page inital landing page , when user picks option, i'm thinking of using links transfer him new webpage. should there separate html page each of these options, given each may little different, not majorly. i'm sorry, tried looking online solution i'm not sure how can word search terms. also, other thing found on stack overflow how display multiple html pages using single index.html any or guidance appreciated. thanks! from easy code perspective: (not recommended) obviously can repeat same html structure in pages , change center content in each page. have link sub

javascript - jQuery appends blank (nothing) when concatenating -

i have html <html> <head> <script src="js/vendor/jquery-1.10.1.min.js"></script> <script src="js/rest.js"></script> </head> <body> <table> <tbody id="list"></tbody> </table> </body> </html> and js $(document).ready(function(){ var url = 'js/context.xml' requestxml(url); }); function requestxml(url){ $.ajax({ type: "get", url: url, datatype: "xml", success: function(xml){ var items = $(xml).find('item'); $.each(items, function(){ var id = $(this).text(); $('#list').append('<tr>'+id+'</tr>'); //$('#list').append(id); console.log(id); }); } }); } when check source generated

javascript - How to get value of child component TextInput of NavigatorIOS in react-native -

Image
i have navigatorios component contains settings view. in settings view list of settings individually open own view when clicked on. when setting clicked on, arrow , right button appear, so: i have function set when right button pressed called onrightbuttonpress inside of navigator's push function, called settings page bind settings page child. push function looks this: navheight(){ this.props.navigator.push({ title: 'height', component: height, rightbuttontitle: 'save', passprops: { units: this.state.units }, onrightbuttonpress: () => { console.warn("hey whats hello"); this.props.navigator.pop()} }) } the height component that's rendered child looks this: class height extends component{ render(){ return( <view style={styles.settinginput}> <text style={styles.inputrow}>height: </text> <text

ocaml - Can't make exercise from Jason Hickey's "Introduction to Objective Caml" book -

i'm trying solve exercise: suppose have function on integers f : int -> int mono- tonically increasing on range of arguments 0 n. is, f < f (i + 1) 0 ≤ < n. in addition f 0 < 0 , f n > 0. write function search f n finds smallest argument f ≥ 0. now wrote this let search f n = let min = f 0 in let rec searchin = if >= n min else if f min > f min = searchin i+1;; but crashes error: error: parse error: "in" expected after [binding] (in [expr]) what wrong? , implementation correct? let search f n = let min = f 0 in let rec searchin = if >= n min else if f min > f min = i; searchin i+1 in searchin 0;; you forgot call function. anyway false, correct search is let search f n = let rec searchin = if i>=n failwith("error not possible") else if f >0 i-1 else searchin (i+1) in searchin 0;; you can sear

jquery - Ajax.BeginForm cannot submit dropdown list selected value -

form: <div id="_searchtab"> @using (ajax.beginform("searchresult", "maintenance", null, new ajaxoptions { insertionmode = insertionmode.replace, updatetargetid = "gridarea", httpmethod = "get", loadingelementid = "loading" }, new { id = "searchbycriteria"})) { <table> <tr> <td> @html.labelfor(model => model.unit_cd) @html.dropdownlistfor(model => model.unit_cd, new selectlist(viewbag.unitlist, "value", "text"), "-- select unit --") </td> </tr> <tr> <td> @html.labelfor(model => model.program_cd) @html.textboxfor(model => model.program_cd) </td> </tr> </table> <div id=" buttonholder"> <input id="search" type="submi

How to output a map color name in sass? -

i have map using following structure: $palette: ( scarlet: ( base: $scarlet, light: lighten($scarlet, $tone-level), dark: darken($scarlet, $tone-level), trans: transparentize($scarlet, $trans-level) ), emerald: ( base: $emerald, light: lighten($emerald, $tone-level), dark: darken($emerald, $tone-level), trans: transparentize($emerald, $trans-level) ), ) @each $color-key, $color-variants in $unicorn-palette { $base-color-value: map-get($color-variants, 'base'); $light: map-get($color-variants, 'light'); $dark: map-get($color-variants, 'light'); $trans: map-get($color-variants, 'trans'); i want able access colour values through following logic , printing key name hex value before , after: &.#{$color-key} { background-color: $base-color-value; &:before { content: "#{$color-key}"; } &:after { content: "#{$base-color-value}"; } &--light {

What is the correct way to use Chef from Ruby (Rails)? -

i'm new chef, maybe search wrong google show lot of quick starts , deployment options, on how deploy app dev's console. need perform recipes rails app. i have stack includes rails+resque master , chef slave. chef added gem chef , chef/shef/ext used inside app run queries. it should several things, create ssh users (which works) , deploy new app stacks (which don't). as chef gem doesn't have lot of docs , ext doesn't feel user (or dev) oriented too, think there should other way work chef server (knife?), or kind of documentation on gem miss work effitiantly this. we got stuck on similar , ended using ridley gem : as per question .

Difference between Java JDK release Version -

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html this link contain java development toolkit. question is: difference between java jdk 8u91 , jdk 8u92 ? which version recommend? the page preceded page linked says it: java se 8u91 includes important security fixes. oracle recommends java se 8 users upgrade release. java se 8u92 patch-set update, including of 8u91 plus additional features (described in release notes) . learn more arrow http://www.oracleimg.com/ocom/groups/public/@otn/documents/digitalasset/163335.gif

PHP variable scoping -

i'm having trouble variable scoping in php. here's structure of code-- <?php $loader = new elload(); $sessionid = ''; $method = $_request['m']; if (strcasecmp($method, "getfile") == 0) { global $loader; $loader->load($file['text']); global $sessionid; $sessionid = $loader->getsessionid(); } if (strcasecmp($method, "extract") == 0) { $extractor = new elextract(); global $sessionid; $extractor->extract($sessionid); //$session id reason still ' ' here } the sequence of requests client load followed extract. can tell me why $sessionid variable may not getting updated right? you don't have declared global $... unless you're in function. block (if, while, ...) have same scope line before. i don't know want do, have keep $sessionid content in real session, like: <?php session_start(); $loader = new elload(); $_session['id'] = ''; $method =

android - Search in Firebase based on distance -

Image
i'm migrating application using mysql firebase, , managed migrate all, missing part of search, did not quite understand how works. i'm trying query below in firebase. select *, (6371 * acos( cos(radians(?)) * cos(radians(latitude)) * cos(radians(?) - radians(longitude)) + sin(radians(?)) * sin(radians(latitude)) )) distance usuario order distance what i'm trying pass latitude , longitude of user firebase , returns me users ordering nearest farthest. note: not same query use in application, find on google , not know if work, can idea of i'm trying do. note ²: english not native language :p the example sql query provided uses capability of sql not exist in firebase: ability calculate expression using column values each row in table , use value of expression filter , sort query result. i don't see way use firebase perform type of query want. you might want take @ geofire library . have not used , capabilities seem related proximity filtering, n

javascript - opacity vs fill-opacity in svg -

what difference in opacity vs 'fill-opacity' in svg? i referred docs fill-opacity , opacity confused meant fill-opacity: opacity of content of current object vs opacity: transparency of object the difference name indicates :). fill-opacity applicable fill of element (or in other words, background), stroke-opacity applicable stroke whereas opacity applicable both. the opacity kind of post-processing operation. is, element (or group) whole (the fill + stroke) rendered , transparency adjusted based on opacity setting whereas fill-opacity , stroke-opacity intermediate steps, transparency individually added stroke , fill. when stroke-opacity , fill-opacity used together, result still not same using opacity (because transparency on fill let fill color show through wherever overlap). can see difference visually in first 2 elements below. also indicated robert (in comments), fill-opacity doesn't apply image whereas opacity work. svg { w

menu - VPython startMenu -

my main program bloxorz-type program working fine. issue have having implement system game shows message on screen if block falls off map, , gamefinished message on screen when block hits hole vertically. i'm thinking way work match coordinates of hole , if coordinates of hole match square-bases of block, show message. first real issue being able display startmenu message, display "press s start" , "press q quit". know how use scene.kb.getkey(), problem displaying text on screen, implement main while true loop. here code: from __future__ import division, print_function visual import * import math, sys visual.graph import * sys import exit """necessary python libraries""" # top, left, bottom, right, front, tlbrfb = ( 2.0, -0.5, 0.0, 0.5, 0.5, -0.5 ) #the area block covers (dimensions) top = 0 left = 1 bottom = 2 right = 3 front = 4 = 5 """modules defining movement of block""" def moveri

How to input a line word by word in Python? -

i have multiple files, each line with, ~10m numbers each. want check each file , print 0 each file has numbers repeated , 1 each doesn't. i using list counting frequency. because of large amount of numbers per line want update frequency after accepting each number , break find repeated number. while simple in c, have no idea how in python. how input line in word-by-word manner without storing (or taking input) whole line? edit: need way doing live input rather file. read line, split line, copy array result set. if size of set less size of array, file contains repeated elements with open('filename', 'r') f: line in f: # here said above to read file word word, try this import itertools def readwords(file_object): word = "" ch in itertools.takewhile(lambda c: bool(c), itertools.imap(file_object.read, itertools.repeat(1))): if ch.isspace(): if word: # in case of multiple spaces y

android - Accessing component within layout inflater -

Image
room b lamp 2 turn on status turn green on room lamp 2 status i created mainlayout using layoutinflater layout. add more control dynamically. can create many sub layout dynamically within mainlayout. problem how access particular textview in current sublayout operation. eg if press button on lamp2 in room b, status next turn green or red. this mainactivity load layouts public class mainactivity extends activity { button buttonadd; linearlayout container; sqlitedatabase db1; string sa; string sb; textview txtsta1; textview txtsta2; //textview txtsta1; //textview txtsta2; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); container = (linearlayout) findviewbyid(r.id.container); createdb(); allcontrol(); layouttransition transition = new layouttransition(); container.setlayouttransition(transition); } public void addlayoutcontrol(string a, string room, string b

Hypotenuse From Shell Script Linux -

this related previous question: making shapes linux shell script i'm trying write shell script program vim given sides , b of pythagorean theorem, provide c. here code: echo -n "enter a: " read echo -n "enter b: " read b bsquared=$(($b**2)) asquared=$((a**2)) csquared=$(($b+$a)) hypot='echo"scale=2;sqrt($csquared)"|bc' echo ' + |\ | \ c | \ | \ +---- b ' echo "a = $a" echo "b = $b" echo "c = $hypot" the triangle part fun. thing wrong script on line: echo "c = $hypot" the output follows: c = "scale=2;sqrt($csquared)"|bc in other words, code script. can tell me i'm doing wrong? for command substitution , must use backticks or $() syntax, not single quotes. you must separate echo command argument adding space after it. replace: hypot='echo"scale=2;sqrt($csquared)"|bc' with: hypot=`echo "scale=2;sqrt($c

r - Paging in Datastax Cassandra ODBC driver -

i installed datastax cassandra odbc driver , configured enable paging option 10000 records. when fetched more 10000 rows rstudio using odbc driver, rstudio session aborted without showing error. when fetched more 10000 rows power bi using odbc driver, giving error attempted read or write protected memory. indication other memory corrupt . so, concluded there problem datastax cassndra odbc driver. whether missed other configurations? how rectify problem?

Does ZeroMQ/czmq fail once creating too many [ inproc:// ] connections? -

i have set of producers , consumers, both of implemented zactors . consumers bind inproc endpoints, , each producer connects every other consumer. at 1 point, seems zeromq cannot create more sockets or connections ( not sure ). minimal working example: #include "czmq.h" void source_t(zsock_t * pipe, void *args); void sink_t(zsock_t * pipe, void *args); int main(int argc, char *argv[]){ zsys_init(); printf("max sockets = %d\n", zsys_socket_limit()); int num_sources = atoi(argv[1]); int num_sinks = atoi(argv[2]); /** create sinks */ zactor_t *sinks[num_sources]; (int = 0; < num_sources; i++){ sinks[i] = zactor_new(sink_t, (void *)(&i)); assert(sinks[i]); } /** create sources */ zactor_t *sources[num_sources]; (int = 0; < num_sources; i++){ sources[i] = zactor_new(source_t, (void *)(&i)); assert(sources[i]); zsock_send(sources[i], "i", num_sinks)

Make an array an optional parameter for a c++ function -

in c++, can make parameter optional this: void myfunction(int myvar = 0); how do array? void myfunction(int myarray[] = /*what put here?*/); the default argument must have static linkage (e.g. global). here's example: #include <iostream> int array[] = {100, 1, 2, 3}; void myfunction(int myarray[] = array) { std::cout << "first value of array is: " << myarray[0] << std::endl; // note cannot determine length of myarray! } int main() { myfunction(); return 0; }

css - middle align svg with inline text -

i have simple svg image inline text pasted here . how middle-align both text , icon vertically? tried usual ways middle align such setting negative martin-top , use table-cell no luck. html: <div class="imagelabel__label___yb88q"> <i class="imagelabel__icon___bfegt"> <svg id="layer_1" data-name="layer 1" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 32 32"> <title>email</title> <path d="..."></path> </svg> </i> john@gmail.com </div> css: svg { width: 25px; height: 25px; margin-right: 3px; } svg { width: 25px; height: 25px; margin-right: 3px; vertical-align: middle; /*----- add property in svg -----*/ }

android - How to get value of current array adapter position other than in getView -

i using cardstack through array adapter. using getter setters display data on card. getting duration of song associated card getsongduration(). problem when loads , in getview method do: songduration = item.getsongduration(); and log value, being called multiple times different positions. i need value song duration current song. use notify dataset changed instance not see how applies. this adapter: public class songpreviewcardsdataadapter extends arrayadapter<songdatabasemappingadapter> { private context mcontext; public songpreviewcardsdataadapter(context context, int resource) { super(context, resource); mcontext = context; } imagebutton onestarrating; imagebutton twostarrating; imagebutton threestarrating; imagebutton fourstarrating; imagebutton fivestarrating; @override public int getcount() { return super.getcount(); } @override public view getview(int position, final view con

intellij idea - Android Studio nullability annoying warning -

Image
the problem: @nullable private view view; public dosomethingwithview() { checknotnull(view); //<- throws npe if parameter null view.showwarningaboutissue(); //<- ide reports possible null here } is there way configure ide, doesn't report possible npe on second line? update: i'm using dagger checknotnull method identical guava ones. if change import dagger guava ide removes warning. update #2 latest update of android studio can not reproduce anymore you need add following comment before view.showwarningaboutissue() statement: //noinspection constantconditions this can performed gui : alt+enter (or "bubblelight" menu), choose assert view!=null , suppress statement :

python - How do I create a DataFrame containing a column where rows are greater than a number? -

i have dataframe these columns: id int64 key int64 reference object skey float64 sname float64 fkey int64 cname object ints int32 i want create new dataframe containing columns commonname , ints ints greater 10, doing: df_greater_10 = df[['commonname', df[df.ints >= 1997]]] i see problem lies expression df[df.ints >= 1997] i'm returning dataframe - how can column of ints values greater 10? you can use 1 of many available indexers . recommend .ix , because seems faster : df_greater_10 = df.ix[df.ints >= 1997, ['commonname', 'ints']] or if need ints column df_greater_10 = df.ix[df.ints >= 1997, 'ints'] demo: in [123]: df = pd.dataframe(np.random.randint(5, 15, (10, 3)), columns=list('abc')) in [124]: df out[124]: b c 0 13 11 14 1 14 10 13 2 7 11 6 3 7

file - Octave installation error on Windows 10 -

i tried installing 1 of 3 versions of octave i.e. 4.0.0 , 4.0.1 , 4.0.2 on windows 10 on 3 installations, first installation starts , in later stages terminates converting the setup file of octave .vir fie . later when rename , try again shows message windows cannot find " path of fie". make sure have typed name correctly , try again.

php - Laravel 5.1 & remember me functionality -

my laravel 5.1 app keeps users logged in. set variables in session.php this: 'lifetime' => 1, 'expire_on_close' => true, i spent lot of time googling , didn't find solution. doesn't matter if pass "true", "false", or nothing @ "remember" parameter auth::attempt(). user stay logged in after 1 minute, or after close browser. remember_token gets written db after log out manually, seems weird me. doesn't seem browser-specific problem checked in both firefox , chromium. in advance help! edit: need session expire when close browser. set lifetime 1 minute see if @ least that's gonna work , didn't. if expire_on_close set true, laravel ignore lifetime. 'lifetime' => 1, 'expire_on_close' => true, and in case, session valid after 1 min - expire after closing browser. change to: 'lifetime' => 1, 'expire_on_close' => false, and session expire after 1 min.

angular - Debugging Angular2 apps in Visual Studio Code -

i'm trying develop basic angular2 app using vsc. code written in typescript. basic todo app, , code (.ts, js, .js.map) in app/ subfolder. this launch.json configuration run: { "name": "run", "type": "node", "request": "launch", "program": "${workspaceroot}/node_modules/lite-server/bin/lite-server", "stoponentry": false, "args": [], "cwd": "${workspaceroot}", "prelaunchtask": null, "runtimeexecutable": null, "runtimeargs": [ "--nolazy" ], "env": { "node_env": "development" }, "externalconsole": false, "sourcemaps": false, "outdir": null

javascript - Node with ejs template files and angular causing double pages to appear -

i working on application built nodejs (express), ejs, , angular. backend render layout ejs template so: app.set('view engine', 'ejs'); app.set('layout', 'shared/layout'); and <div ui-view></div> <%- body %> </body> when 404 error occurs, caught (by node), , 404 template rendered instead: if (req.xhr) { res.status(404).render('shared/404', { title: '404', message: 'page not found' }) } the problem is, when click link on 404 page, new page rendered, 404 page still 'lingers' @ bottom (2 pages shown @ once). should handled frontend instead? or problem backend set (and best practices here?), or need force kind of 'hard refresh' of page when link clicked, 404 template goes away? have tried using angular hard refresh: <a ui-sref="state1" ui-sref-opts="{reload: true}">state 1</a> backend seems inject href="state1" (i presume b

python - Calculate the N IP of a network -

this question has answer here: how calculate how ip addresses have between 2 ip addresses? 3 answers i know n ip of given network ip is. for example 192.168.0.3 3 ip of network 192.168.0.0/20. 256 ip 192.168.1.0 is there way calculate fast in python? know ipcalc not has option this. in ipaddress module in standard library, network object can used iterable of addresses. so, normal find in sequence: >>> import ipaddress >>> addr = ipaddress.ip_address('192.168.0.1') >>> net = ipaddress.ip_network('192.168.0.0/20') >>> net[256] ipv4address('192.168.1.0') >>> next(i i, in enumerate(net) if == addr) 3 see howto more explanation. note works fine addresses in integer form dotted strings, ipv6 ipv4, etc. if you're using python 2.x, you'll need backport on pypi . if you're

java - Display files that have been uploaded to directory (servlet) -

so, followed tutorial upload files servlet: http://www.codejava.net/java-ee/servlet/java-file-upload-example-with-servlet-30-api creates folder (if doesn't exist) , uploads file folder. once upload in complete displays page saying upload successful. i've seen other tutorials, such one: http://www.javacodegeeks.com/2013/08/servlet-upload-file-and-download-file-example.html display download link, file uploaded. want create page uploaded file, displays links download files have been uploaded (or button direct 1 such page). suppose you're uploading files x folder then, iterate on x folder files for(file f:new file("x").listfiles()){ //iterate here create download links each file } you may use http://www.javacodegeeks.com/2013/08/servlet-upload-file-and-download-file-example.html each of file create download link

php - SMTP Connect() failed. Message was not sent.Mailer error: SMTP Connect() failed -

am trying send mail gmail address keeps on getting error "smtp -> error: failed connect server: connection timed out (110)smtp connect() failed. message not sent.mailer error: smtp connect() failed." problem? require 'class.phpmailer.php'; // path phpmailer class require 'class.smtp.php'; $mail = new phpmailer(); $mail->issmtp(); // telling class use smtp $mail->smtpdebug = 2; $mail->mailer = "smtp"; $mail->host = "ssl://smtp.gmail.com"; $mail->port = 587; $mail->smtpauth = true; // turn on smtp authentication $mail->username = "myemail@gmail.com"; // smtp username $mail->password = "mypasswword"; // smtp password $mail->priority = 1; $mail->addaddress("myemail@gmail.com","name"); $mail->setfrom($

Why mipmap folder not show in suggestion of XML Android Studio? -

Image
currently tried use ic_launcher mipmap folder. used suggestions, pressed ctrl + space after @ didn't suggestions mipmap is there problem or miss suggestions? help? i had same problem upgrade android studio version 1.5.1 2.1.1 , can show mipmap folder in suggestion.

mobile - How to retrieve IMSI using PhoneGap? -

i'm working on cross platform mobile app using phonegap , need retrieve imsi code. here's question: there way via phonegap? i appreciate comments. hi android can find via native code , phonegap need write plugin, java code given bellow public string finddeviceid() { string deviceid = null; string servicename = context.telephony_service; telephonymanager m_telephonymanager = (telephonymanager) getsystemservice(servicename); int devicetype = m_telephonymanager.getphonetype(); switch (devicetype) { case (telephonymanager.phone_type_gsm): break; case (telephonymanager.phone_type_cdma): break; case (telephonymanager.phone_type_none): break; default: break; } deviceid = m_telephonymanager.getdeviceid(); return deviceid; } for creating phonegap plugin check http://docs.phonegap.com/en/edge/guide_platforms_android_plugin.md.html#android

javascript - Codeigniter ajax form validation error -

i have researched code make validation ajax. my controller is: public function create(){ $data = array('success' => false, 'messages' => array()); $this->form_validation->set_rules('province','province name','trim|required|max_length[30]|callback_if_exist'); $this->form_validation->set_error_delimiters('<p class="text-danger"','</p>'); if($this->form_validation->run($this)){ $data['success'] = true; }else{ foreach ($_post $key => $value) { # code... $data['messages']['key'] = form_error($key); } } echo json_encode($data); } and javascript is: <script> $('#form-user').submit(function(e){ e.preventdefault(); var me = $(this); // perform ajax $.ajax({ url: me.attr('action'), type: 'post

ios - Swift How to update url of video in AVPlayer when clicking on a button? -

i have video player in ios app , want update video when click on button, not see how manage this. (note : it's not list of video within queue) here code adding avplayer: let url = nsurl.fileurlwithpath(path) let player = avplayer(url: url) let playerviewcontroller = avplayerviewcontroller() playerviewcontroller.player = player .. .. self.viewforvideo.addsubview(playerviewcontroller.view) self.addchildviewcontroller(playerviewcontroller) player.play() i have done : each time want change video create new avplayer , affect playerviewcontroller.player let url = nsurl.fileurlwithpath(path) let player = avplayer(url: url) playerviewcontroller.player = player if thinks there better way, not hesitate answer

POSIX compliant path joining -

i want write posix compliant function join paths. i've read pathname resolution section . i'm not sure should result when first path starts "..". if join "../abc/def" , "xyz", of following, should result in opinion? why? abc/def/xyz /abc/def/xyz ../abc/def/xyz something else? .. actual file system entry referring parent of directory contained in. joining 2 paths should not depend on context, such identity of current directory. ../abc/def/xyz correct answer lacking such context.

c++ - Qt for Desktop and Mobile application -

this first time need make program runs on different platforms, i.e. windows 10 , android, ios , maybe sometime later on os x. i discovered qt seems best solution problem. have never used before, so: can write code desktop application , compile windows, android, ios , os x (i know need xcode etc. apple platforms not question) , run fine on device? can make changes depending on platform on program gets started? example want blue background on windows, red 1 on ios? you need aware of platform limitations, qt limitations of features available on platforms, , of course, specific features of each platform (i.e: display size different overall experience change, etc). yes, can check current platform , make changes according. there's set of macros defined identify platform afaik if you're using qml macros not available, can send them qml using c++ class , integrating qml .

Sending bulk emails with unique attachments (service or java or api) -

hello stackers :-) , i have been asked send out approx. 2000 emails unique attachments unique email addresses. background: users registered event , supposed send out tickets unique qr code , seating. what have: list of email addresses generated attachements (jpg, 400kb in size each) what no problem me: use external paid service this code if needed in java (there skill ends) i looking kind of solution reliable , not problematic implement. have little knowledge of email-tech background. ends pop3 / smtp :) could please ask tips or tricks on this? here has struggled before similar please? thankful useful info since im totally lost thank you oliver dear all, https://www.mailgun.com/ with api helped me wanted. closing question. oliver

node.js - Upload zip file contents to S3 -

i'm trying upload zip file s3. these zip files uploaded user , can range file size. first approach using unzip-to-s3 great, project using out of date library ( unzip ) keeps crashing "invalid signature 0x80014" error. extracting zip , uploading s3 not idea because packages vary in sizes. , extracting files disk , uploading expensive task. (unzip-to-s3/unzip did job of since auto drain memory once file has been uploaded). now question, how can upload zip file via node.js , extract in s3 without using aws lambda?

Kendo UI grid widget XML data source content not displayed -

Image
i bit knew kendo stuff hence seeking help. trying display kendo grid using xml data. rows of grid shown empty.i trying fetch data url( http://demos.kendoui.com/service/northwind.svc/products ) , set data source on kendo widget. once run sample ( http://jsfiddle.net/visibleinvisibly/c3qsdjq0/19/ ) shows empty grid. believe happening not able set "data" property in "schema" object of datasource.i wouldnt use json sample below sample xml data <feed xml:base="http://demos.telerik.com/kendo-ui/service/northwind.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/atom"> ............................. ........................... <entry> .................. .................... <content type="application/xml"> <m:properties> <d:producti

javascript - Is Document.cookie's setter asynchronous in web browsers? -

i under impression document.cookie = "mysessioncookie=mysessiontoken" not set right away in browser. more precisely, here's situation: i logged in. i want logout using javascript. so set, instance document.cookie = "mysessioncookie=; path=/; expires=thu, 01 jan 1970 00:00:00 gmt" . then call window.location.reload() confirm have been logged out. it works, but, quite often, appears browser not have enough time set new cookie value before calling window.location.reload() . unless doing wrong in code, behaviour suggests document.cookie = "value" not executed on same stack (so, might not asynchronous itself, has unpredictable behaviour when used rest of code). so, question is, document.cookie = "value" executed on different stack? indeed, pointed out @charlietfl comment original question, document.cookie setter set cookie right away. my real problem had error in program, not paying attention fact browsers set co

clojure - Why (= (run 1 [q] (membero 'cat q)) ['(cat . _.0)]) is false? -

i'm doing clojure/core.logic koans , stuck on this one : "here give run specific number control how many answers get. think carefully. there 1 list in universe satisfies relation? there infinitely many?" (= (run 1 [q] (membero 'cat q)) [__]) running (run 1 [q] (membero 'cat q)) in repl said me answer ((cat . _.0)) . i'm not quite sure dot in middle means, anyway, sticking '(cat . _.0) instead of __ placeholder in original koan doesn't (assertion still fails). please point me right direction? , explain dot between cat , _.0 means? guess means what follows (i.e. _.0 ) tail of length , i'm not 100% sure. === update amalloy pointed me right direction (thank you, sir!). lcons trick: (= (run 1 [q] (membero 'cat q)) [(lcons 'cat '_.0)]) and bit of repl: user=> (lcons 'cat '_.0) (cat . _.0) user=> '(cat . _.0) (cat . _.0) user=> (= '(cat . _.0) (lcons 'cat '_.0)) fa

javascript - bootstrap tabs inside accordion -

i'm using tabs inside accordion make categories menu. when user click on category gets list of subcategories , when click on subcategory gets list products. managed write jquery i'm getting error in console: uncaught typeerror: cannot read property 'tab' of undefined <div class="container container-pad"> <div class="col-md-12"> <div class="row"> <div class="col-md-3"> <ul class="list-group category" role="tablist"> <li class="list-group-item"> <a role="button" data-toggle="collapse" href="#collapseone"> categories 1 </a> </li> <ul id="collapseone" class="panel-collapse collapse"> <li class="list-group-item" role="presentation"> <a href="#cat