Posts

Showing posts from July, 2014

Rails 5 nested form won't create child records -

i've been stuck on hours. don't understand how nested forms , using 'accepts_nested_attributes_for' supposed work. i have 'form_for' new list, , 'fields_for' it's list_items. here fields_for list_items. fields_for :list_items https://pastebin.com/nxzwgeyj now, 'list_item' :through part of list's has_many_through associations user's 'user_items'. nested form supposed submit information 'user_item' needed build 'list_item' belong new list. seems somewhere along way parameters child items not being delivered... started post "/list" 127.0.0.1 @ 2017-08-17 18:18:04 -0400 processing listscontroller#create html parameters: {"utf8"=>"✓", "authenticity_token"=>"203d1bpqzzku9j0gyupovqnfbkxmreydlmb4idaradnjvx5fqcydg5due/d2ngwocu6afkc+hwl5qcpfu9glqw==", "list"=>{"name"=>"", "list_items_attributes"=>{&qu

Using Square Connect PHP SDK, UpsertCatalogObject fatal error -

i using square connect php sdk, , getting following error, , haven't been able find solution. trying push few new categories have been added on app (within mysql database). building catelogobject foreach ($push_array $key => $cat_name) { $category = $this->products_lib->get_category($cat_name); $idempotency_key = uniqid('',true); $push_obj = new stdclass(); $push_obj->type = 'category'; $push_obj->id = '#' . trim($category->name); $push_obj->category_data = ['name'=>trim($category->name)]; $push_obj->present_at_all_locations = true; $catelogobject = ["idempotency_key" => $idempotency_key, 'object' => $push_obj]; print_r($catelogobject); $response = $square_connect->upsert_category($catelogobject); } produces ( [idempotency_key] => 5996186208eae4.27853833 [object] => stdclass object ( [type] => category

arrays - PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" -

i running php script, , keep getting errors like: notice: undefined variable: my_variable_name in c:\wamp\www\mypath\index.php on line 10 notice: undefined index: my_index c:\wamp\www\mypath\index.php on line 11 line 10 , 11 looks this: echo "my variable value is: " . $my_variable_name; echo "my index value is: " . $my_array["my_index"]; what these errors mean? why appear of sudden? used use script years , i've never had problem. what need fix them? this general reference question people link duplicate, instead of having explain issue on , on again. feel necessary because real-world answers on issue specific. related meta discussion: what can done repetitive questions? do “reference questions” make sense? notice: undefined variable from vast wisdom of php manual : relying on default value of uninitialized variable problematic in case of including 1 file uses same variable name. majo

google maps - Use numbers instead of alphabet for DirectionsRenderer api Markers -

i display direction on google map markers i'm having trouble change alphabet inside of markers numbers. my method looks like, directiondisplay(direction) { this.directionsrenderer = new google.maps.directionsrenderer({ preserveviewport: true }); this.directionsrenderer.setmap(this.props.map); return this.directionsrenderer.setdirections(direction); } and using it directionsservice.route({ origin, destination, waypoints, optimizewaypoints: true, travelmode: this.props.maps.directionstravelmode.driving }, (result, status) => { if (status == this.props.maps.directionsstatus.ok) { this.directiondisplay(result); } else { console.error(`error fetching directions ${result}`); } }); i tried this.directionsrenderer = new google.maps.directionsrenderer({ preserveviewport: true, markeroptions: {label: '1'} }); '1' overlays on alphabets instead of replacing them. does know how figure out? thank you,

postgresql - relative position of digits and ':' in postgres collating sequence -

say have table 't1' string column 'name'. , have names 'n1','n2','n9' , 'n:'. if do select * t1 orderby name asc i expect n1 n2 n9 n: given ':' comes after '9' in ascii, instead, get n: n1 n2 n9 which surprise. there need 'use ascii collating sequence basic ascii chars' from experience, collation issue select * t1 order name collate "posix"; this list of exapmle collations in case collation have listed, sql_latin1_general_cp850_bin not work https://www.postgresql.org/docs/9.1/static/collation.html

java - How do I know if my LinkedList is already ordered? -

this question has answer here: how determine if list sorted in java? 11 answers private static linkedlist<integer> melhormoto1 = new linkedlist<>(); i know can create new linkedlist, use newlinkedlist = melhormoto1; and collections.sort(newlinkedlist); , newlinkedlist.equals(melhormoto1 ); i'm working recursive function, newlinkedlist = melhormoto1; slow attribution. can check if linkedlist ordered method or something? in java 8, can use comparators.isinorder(iterable) achieve list (or other ordered collection). prior java 7, yourself: check list sorted in ascending order, iterate through , check current element cur greater or equal previous element prev each adjacent pair of elements. change less or equal descending order. requires size() - 1 total checks.

php - Im trying to generate a unique hash for all the users -

i'm trying generate unique hash users in database; here code: <?php include("php/connect.php"); $sql = "select id user"; while ($id = mysqli_fetch_assoc(mysqli_query($conn, $sql))) { $new_hash = md5(uniqid(rand(), true)); $sql2 = "insert user (hash) value ('$new_hash') id = $id['id']"; mysqli_query($conn, $sql2); } ?> every time run it, following error: fatal error: maximum execution time of 30 seconds exceeded in regarding query: $sql2 = "insert user (hash) value ('$new_hash') id = $id['id']"; insert doesn't use where clause, update does, insert ... on duplicate key update . however, don't know why you're wanting that. using column set auto_increment should ample have unique id. yet, if want do, need use 1 of methods shown above. mysqli_error($conn) way, have thrown syntax error this. i.e.: if(!$sql2){ echo "error: " .

c - LuaJIT pointers and Garbage Collection -

i trying understand luajit's garbage collector handle ffi , have manage manually sure no leakage. reading luajit ffi semantics docs garbage collector following assertions true?: if array allocated using ffi.new('float[?]',n) gc can track references , collect necessary? using ffi.malloc(sizeof('float[n]')) must manually handled such ffi.free or provide "finalizer" such local p = ffi.gc(ffi.malloc(sizeof('float[n]')), ffi.free) ? if library loaded ffi.load contained function float * example(void); , library loaded namespace ex in local ptr=ex.example() ptr storing pointer , when no references ptr exist, gc collect ptr , memory leaked? ffi.gc(ptr, ffi.free) lets garbage collector know ptr indeed pointer , memory points can reclaimed when ptr has no references? in saying memory areas returned c functions (e.g. malloc()) must manually managed, of course (or use ffi.gc()). pointers cdata objects indistinguishable poin

TypeScript - possibly undefined compilation error when throwing by iterator -

i'm keeping on train ts generators when annoying transpiler behaviour occurred. of course, use --strictnullchecks function* generat(end: number) { (let = 0; <= end; i++) { try { yield i; } catch (e) { console.log(e); } } } let iterat = generat(5); console.log(iterat.next()); console.log(iterat.next()); console.log(iterat.throw()); // error: object possibly 'undefined'. console.log(iterat.next()); console.log(iterat.next()); console.log(iterat.next()); anybody know smart solution? mean smart different in link: https://github.com/microsoft/typescript/issues/14431

javascript - change Dom element based on firebase admin value events -

i have simple html page printed out inside servlet. here have setup firebase admin sdk , have set value event listener path. when events fire, wish change div element , display results there. edit: listener work on further testing logs. but still not know how reflect changes inside div element listeners asynchronous. that's why script isn't working. can please guide me should do. code follows: import java.io.ioexception; import java.io.inputstream; import java.io.printwriter; import java.text.simpledateformat; import java.util.arraylist; import java.util.collections; import java.util.comparator; import java.util.date; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import com.google.firebase.firebaseapp; import com.google.firebase.firebaseoptions; import com.google.firebase.auth.fir

c# - Connecting to Weight Scale through RS232 -

Image
i have been cracking head trying figure how read weight scale, i'm kind of new c# , have never dealt com ports before, put code examples found online , other articles have been researching. i'm kind of stock, appreciate if there give me light of why code not displaying anything. scale i'm using nv-1.5r cci companies. i'm connecting trough rs232 port using db9 female female null modem cable. code have far: using system; using system.io.ports; using system.collections.generic; namespace serialcombuffering { class program { serialport com = new serialport(serialport.getportnames()[0], 9600, parity.none, 8, stopbits.one); list<byte> bbuffer = new list<byte>(); string sbuffer = string.empty; static void main(string[] args) { new program(); } program() { com.datareceived += new serialdatareceivedeventhandler(com_datareceived); com.open(); console.writeline("waiting incoming data…&

matplotlib - ModuleNotFoundError: No module named 'PyQt4' while installing veusz -

when trying install veusz (under anaconda) using command line: pip install veusz==1.25.1 i getting error message. collecting veusz==1.25.1 downloading veusz-1.25.1.tar.gz (1.9mb) 100% |████████████████████████████████| 1.9mb 492kb/s complete output command python setup.py egg_info: traceback (most recent call last): file "", line 1, in file "/tmp/pip-build-no22q_2g/veusz/setup.py", line 59, in import pyqtdistutils file "/tmp/pip-build-no22q_2g/veusz/pyqtdistutils.py", line 17, in import pyqt4.qtcore modulenotfounderror: no module named 'pyqt4' command "python setup.py egg_info" failed error code 1 in /tmp/pip-build-no22q_2g/veusz/ i have tried change matplotlibrc config file (under anaconda) , change backend qt4agg instead of qt5agg didn't help. my other option install using conda as: conda install -c lidavidm veusz but has own caveat

Not able to POST Variable to Another Page (PHP, Javascript, AJAX) -

i have while loop (inside "searchvessel.php") display content of query , have button "upgrade" each record of query. `while($fetch = $read->fetch_array()) { ?> <tr> <td id="1" style="display:none;"><?php echo $fetch['vesselid']?></td> <td id="2"><?php echo $fetch['vesselname']?></td> <td><input type="submit" class="button" name=<?php echo $fetch['vesselid']; ?> value="upgrade"/></td> </tr>` this "upgrade" button when click call javascript code use value inside tag name pass page using ajax. <script type = "text/javascript"> $('.button').click(function(){ alert($(this).attr('name')); $.ajax({ type: "post", data: { name: $(this).attr('name')

ms access - MS ACESS Code convert to SQL -

hi ask "!" mean in msaccess code. given startdate = "8/18/2017" , [tbl_expectedpymts] <-- table startdate found code: right('00' + format([tbl_expectedpymts]![startdate],"dd"),2) question. "!" mean in code above? thank you

python - In-app circle-clip image glyphs in bokeh -

how add circle-clipped image glyphs chart, without processing , uploading images manually beforehand? i'm open using other modules. i want end result chart (from nytimes). http://imgur.com/a/nv6ta my current understanding can load images directly urls, not desired outcome. http://bokeh.pydata.org/en/latest/docs/reference/models/glyphs/image_url.html my current understanding can load images directly urls this not correct, there imagergba allows sending images raw rgba data, directly embedded in bokeh document. see, e.g., gallery example: http://bokeh.pydata.org/en/latest/docs/gallery/image_rgba.html so assuming images python list of 2d numpy arrays of rgba data (pre-cropped) images want display, bokeh show them with: p.image_rgba(image=images, x=....) of course, have convert images rgba arrays yourself, , crop them, things may easier or more ready made use-case tool.

arrays - C pointer dereference error -

suppose have following code (example): #include <stdio.h> #include <stdlib.h> #include <stdbool.h> void ex(void *ret, int ret_len, int choice){ if(choice==1){ int *ret = ret; for(int i=0; i<ret_len; i++){ *(ret+i) = i; } } else { int **ret = ret; for(int i=0; i<ret_len; i++){ for(int j=0; j<ret_len; j++){ *(*(ret+i)+j) = i*j; } } } } int main() { int m[10]; ex(m,10,1); printf("%i",m[3]); return 0; } the goal of function take pointer preallocated memory of 1 or 2 dimensional array. when compiled , executed code works when choice==1 , otherwise, if run #include <stdio.h> #include <stdlib.h> #include <stdbool.h> void ex(void *ret, int ret_len, int choice){ if(choice==1){ int *ret = ret; for(int i=0; i<ret_len; i++){ *

mysql - Retrieving data from my sql and sending it to a web service using python -

i trying retrieve data mysql in raspberry pi 2 , posting data web service using python . able retrieve data mysql within raspberry pi using python script. however, having trouble posting data web service using separate python script when try try pass data values it. tell me doing wrong? or there way can this? python code retrieve data mysql in raspberry pi(fetchdata.py): import mysqldb import sys import subprocess db = mysqldb.connect("localhost", "root", "1234", "tempdata") cursor = db.cursor() sql = "select * webdata" cursor.execute(sql) results = cursor.fetchall() row in results: id = row[0] channelid = row[1] timestamp = row[2] rmsvoltage = row[3] print "id=%s, channelid=%s, timestamp=%s, rmsvoltage=%s" % (id, channelid, timestamp, rmsvoltage) db.close() the output following: id=4, channelid=43, timestamp=56, rmsvoltage=78 here python code posting web service(sendjson.py): import sys

c - Debugging memory issues ARM7 -

i having issues trying debug appear strange behaviors. example, have: static const char* log_format = "0x%02x,%.5f,"; and pointer changes no obvious reason. garbage, other constant strings (or part of) defined elsewhere in code. see code jump different section should not running (state variable appears change without being asked to). there 2 or 3 common failure modes, , appear happen @ random. relatively large code base , adding or removing sections changes failure behavior (or removes completely) though sections never referenced. the best theory @ moment is memory related issue have been on of recent changes fine tooth comb, , simple act of inserting sections of code move things around appears change or remove behavior. what best ways debugging issue or similar issues? have found debugger useful @ times, , not @ others (but user error). further notes. arm7, using keil µvision 4 , armcc v4.1 compiler. this means have pointer bugs/memory corruption somew

html - Have child item fill parent using flexbox -

i have navigation have child elements (in case: tags) fill height of flex parent (ul). possible not use padding , solely rely on flexbox here? appreciated here. can see in codepen, black tags not fill area. eventual plan add border @ top when tag hovered. why need fill area. want use flexbox instead of padding if possible. this have far: <div class="nav"> <ul> <li><a href="#">link</a></li> <li><a href="#">link</a></li> <li><a href="#">link</a></li> <li><a href="#">link</a></li> <li><a href="#">link</a></li> </ul> body, html { background:skyblue; padding:0; margin:0; } .nav { background-color:salmon; height:40px; ul { display:flex; align-items:center; height:100%; } ul > li { list-style:none; background:black; flex:1; } ul &g

Javascript: ios 8 show json content to DOM instead of run callback on ajax request -

have ajax request, runs on android , ios 10, on ios 8/9, puts json string data dom , nothing else. there json string showed, no dom head or other contents. don't know why strange error happens. ajax request: var xmlhttp = new xmlhttprequest(); xmlhttp.onreadystatechange = function () { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { var data = json.parse(xmlhttp.responsetext.trim()); if (data.status == 1) { console.log("ok"); location.href = data.ref; } else { app.emptymessages(); (var = 0; < data.messages.length; i++) { app.putmessages(data.status, data.messages[i]); } } } }; xmlhttp.open("post", "/users/register"); xmlhttp.setrequestheader("content-type", "application/x-www-form-urlencoded"); xmlhttp.send(app.urlencodeparams(form));

c# - Sorting some records in the .txt file without disturbing other records and overwriting in the same file -

i trying read text file line line , trying sort "puma" named shoes in ascending manner according price , save changes in same file without disturbing order of "nike" , "adidas" shoes. great if can me in this. in advance. here code below tried public class program { static string content; static string outputfile = @"c:\users\desktop\shoerack.txt"; public static void main(string[]args) { sorting(); } public static void sorting() { try { string[] scores =system.io.file.readalllines(@"c:\users\desktop\shoerack.txt"); var numbers = scores.orderby(x=>(x.split(',')[2])); foreach(var dat in numbers) { content = dat.tostring(); writetofile(outputfile,content); } } catch(exception e) { console.writeline(e); console.readline(); }

dns - Old parking page info is mixed in with search results for a newly crawled site -

i had domain set parking page registrar. nameservers have been changed (i'm using azure dns), i've updated robots.txt , submitted sitemap. i've requested google crawl site, , we're showing in google's search results. the problem every title link shows in search results, info parking page tacked on end. so result link might about | example company - example.com - nameofregistrar . about | example company correct, - example.com - nameofregistrar seems old info parking page. the urls , text descriptions fine, it's title links messed because add url of site again , name of registrar. think info in title on parking page. how rid of old (presumably cached) info? need contact google? registrar? shall ask crawl? why happening? so result link might "about | example company - example.com - nameofregistrar". "about | example company" correct, "- example.com - nameofregistrar" seems old info parking page. urls ,

php - Session Doesnt work first time (want explanation ) -

hello seen lot of question session doesn't working first time. couldn't see explanation on question , why doesn't working first time happening during sessioning. mine others first time doesn't working after works fine. this php sessioning. session_start(); $personname=$_get['personname']; $surname=$_get['surname']; $testxml=$_get['testxml']; $testdate=$_get['testdate']; $testpkid='0000000000000000000000000000'; include('dbconnect.php'); $proc = "{call p_set_test(?,?,?,?,?,?,?,?,?)}"; $params = array(array($testdate,sqlsrv_param_in), array(0,sqlsrv_param_in), array($personname,sqlsrv_param_in), array($surname,sqlsrv_param_in), array($testxml,sqlsrv_param_in), array('',sqlsrv_param_in), array(101,sqlsrv_param_in), array(10,sqlsrv_param_in),

javascript - How to release browser memory on infinite scrolling load more data? -

as infinite scrolling provides best user experience have implemented it. problem have found freezing browser on load more . firstly, have implemented lazy loading , masonry grid making view pintrest.com issue when user clicks on load more button load more contents browser freezing , unable scroll smoothly. have set cache: false in load more ajax call. is there method can release memory of browser on load more button click? angular js please provide best solution.

How to fetch hindi string from php file and set into android textview properly -

Image
i have php file contains hindi string want fetch exact string in android, send encoded value abc.php: <?php echo "शुभ प्रभात"; ?> in android: @override protected void onpostexecute(string s) { toast.maketext(getactivity(), "message :+s, toast.length_long).show(); } output got: i tried urldecoder.decode and try typeface typeface = typeface.createfromasset(context.getassets(), "hindi.ttf"); hometitle.settypeface(typeface); for set textview nothing works me. assets: you need declare character set php file like header('content-type: text/plain; charset=utf-8'); then after can try fetch json service give proper data. in case example <?php header('content-type: text/plain; charset=utf-8'); echo "शुभ प्रभात"; ?>

node.js - NodeJS deployment on Azure package problems -

when deploy nodejs application on azure, 1 node packages gets broken. error is: error: %1 not valid win32 application. \\?\d:\home\site\wwwroot\node_modules\bcrypt\lib\binding\bcrypt_lib.node @ error (native) @ object.module._extensions..node (module.js:597:18) @ module.load (module.js:487:32) @ trymoduleload (module.js:446:12) @ function.module._load (module.js:438:3) @ module.require (module.js:497:17) @ require (internal/module.js:20:19) @ object.<anonymous> (d:\home\site\wwwroot\node_modules\bcrypt\bcrypt.js:6:16) @ module._compile (module.js:570:32) @ object.module._extensions..js (module.js:579:10) @ module.load (module.js:487:32) @ trymoduleload (module.js:446:12) @ function.module._load (module.js:438:3) @ module.require (module.js:497:17) @ require (internal/module.js:20:19) @ object.<anonymous> (d:\home\site\wwwroot\models\user.model.js:3:14) when download deployed files back, doesn't wor

C++ unordered_map with custom hash issues -

i trying write custom hash function use in unordered_map. able insert items , iterate through them, cannot lookup items using at(), find() or operator[] functions. #include <cstddef> #include <iostream> #include <functional> #include <random> #include <unordered_map> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #define jhash_golden_ratio 0x9e3779b9 using namespace std; #define __jhash_mix(a, b, c) \ { \ -= b; -= c; ^= (c>>13); \ b -= c; b -= a; b ^= (a<<8); \ c -= a; c -= b; c ^= (b>>13); \ -= b; -= c; ^= (c>>12); \ b -= c; b -= a; b ^= (a<<16); \ c -= a; c -= b; c ^= (b>>5); \ -= b; -= c; ^= (c>>3); \ b -= c; b -= a; b ^= (a<<10); \ c -= a; c -= b; c ^= (b>>15); \ } uint32_t jhash_3words (uint32_t a, uint32_t b, uint32_t c, uint32_t initval) { += jhash_golden_ratio; b += jhash_golden_ratio; c += initval; __jhash_mix (a, b, c);

SQL Multiple Joins Query -

here have 2 tables committee_colleges , colleges. structure of tables this committee_colleges committeecollegeid collegeid committeememberid 1 2 1 2 2 2 3 3 2 i storing committeememberid committeemember table.and 1 college can have multiple committee members.how can wite query display colleges assigned specific committee member. example,if committeemember id=2 has logged in want display colleges id=2,3. in college table have this, collegeid typename 1 aicte 2 ncte 3 ntcs this committee member table committeememberid name 1 xyz 2 abc now writing this,but know wrong because dont know how take college table since displaying college details. select cc.committeecollegeid committeecollegeid, c.collegeid collegeid, cc.committeememberid committeememberid committee_college cc left oute

r - Append to list of lists in for loop -

i have 2 data frames: data<-structure(list(sample = structure(c(1l, 2l, 2l, 1l, 1l, 1l, 1l, 2l, 2l, 2l), .label = c("s1", "s2"), class = "factor"), chrom = structure(c(1l, 1l, 1l, 2l, 2l, 2l, 1l, 1l, 1l, 2l), .label = c("2l", "2r"), class = "factor"), pos = c(318351l, 605574l, 1014043l, 2031592l, 2886957l, 2910379l, 2218351l, 105574l, 1344043l, 216957l)), .names = c("sample", "chrom", "pos"), row.names = c(na, 10l), class = "data.frame") > arrange(data, chrom,sample) sample chrom pos 1 s1 2l 318351 2 s1 2l 2218351 3 s2 2l 605574 4 s

Unable to see installed Plugin in Runtime configuration in anypoint studio (Mule based eclipse Ide) -

i have installed plugin api gateway runtime 2.1.0 in anytime studio i'm unable see api gateway runtime plugin in runtime configuration dropdown while creating new mule project. i uninstalled anytime studio , install api gateway 2.1.0 plugin i'm able see api gateway runtime configuration.i hope there better way same

ios - How to make view always visible on screen within the app? -

i need make banner view @ bottom of screen. should on screen. need push/present other viewcontroller , view should visible. i made container view, when push/present other vcs - show above it. is there way make it? why not use uiwindow? can makekeyandvisible() make uiwindow visible on screen let view = uiwindow() view.center = cgpoint(x: 100, y: 100) // view @ view.makekeyandvisible() // make view bring front

Jquery Validation when all enabled fileds are not empty -

please me following using jquery. condition 1: how can check if fields(input, textarea, select) enabled not empty or has selected value. condition 2: fields disabled not included in validation on condition 1. ive tried lot of codes , code below seems do, captures fields including disabled. $('#btnsave').click(function (e) { $('input:enabled:not([readonly])').each(function () { if ($(this).val() == "") { alert("please fill out fields."); e.preventdefault(); return false; } else { addsomestuffs(); } }); }); can me on this. thanks in advance. use jquery form validation in achieving requirement https://jqueryvalidation.org/ hope helps

Python, geopy time limit raising -

i'm totally beginner @ python, need bit help. use geopy in long loop in python, service timed out error. code following: #!/usr/bin/python # -*- coding: utf-8 -*- import os, sys geopy.geocoders import nominatim geopy.exc import geocodertimedout geolocator = nominatim() fobj_out = open('out.txt', 'a') open('alagridsor.txt') fobj_in: koor in fobj_in: koor.rstrip() location = geolocator.reverse(koor, timeout=none) cim = location.raw['address']['country'] print(cim) fobj_out.write(cim.encode('utf8')) fobj_out.write("\n") fobj_out.close() and read method function, maybe work, don't know how implement code. function is: def do_geocode(address): try: return geopy.geocode(address) except geocodertimedout: return do_geocode(address) can me in this?

angular - TypeError: Invalid Event Target - But just by using direct Route -

the application has following component implemented customer-overview.component.ts import { component, oninit, elementref, viewchild } '@angular/core' import { router } '@angular/router' import { datasource } '@angular/cdk' import { behaviorsubject } 'rxjs/behaviorsubject'; import { observable } 'rxjs/observable'; import 'rxjs/add/operator/startwith'; import 'rxjs/add/observable/merge'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/debouncetime'; import 'rxjs/add/operator/distinctuntilchanged'; import 'rxjs/add/observable/fromevent'; import { customeroverviewservice, customeroverviewdatasource } './../../services/customer-overview.service' @component({ selector: 'customer-overview-component', templateurl: 'customer-overview.component.html', styleurls: ['./customer-overview.component.css'], providers: [customeroverviewservice] })

Order List of Objects by List inside object c# -

i have list of objects ( obj1 ) , inside each object have list of objects shown below: list <obj1> obj1 obj1 string name list <obj2> obj2 obj2 string name int id i want order list of obj1 order marked list of obj2 id s. first element in list of obj2 defines order of obj1 list, if same second 1 defines order, , on until end of list of obj2 . example data: "test" : {("a", 2), ("b", 3)} "test2" : {(("c", 1), ("d", 2)} "test3" : {(("a", 2), ("b", 2), ("c", 3)} result data: "test2" : {(("c", 1), ("d", 2)} "test3" : {(("a", 2), ("b", 2), ("c",3)} "test" : {("a", 2), ("b", 3)} the following solution implement icomparable interface int compareto(object obj) method obj2 , obj1 . obj2 has compared it's id , obj1 compared lis

android studio - Global object declaration in kotlin -

how declare objects globally in kotlin in java textview tv; . or method call same variable in different methods/functions. override fun oncreate(savedinstancestate: bundle?) { super.oncreate(savedinstancestate) setcontentview(r.layout.activity_main) val textview: textview = findviewbyid(r.id.texfirst) textview textview.setonclicklistener { toast.maketext(applicationcontext,"welcome kotlin ! $abc "+textview.text, toast.length_long).show() } myfunction(textview) } fun myfunction(mtextv : textview) { toast.maketext(applicationcontext,"this new $abc "+mtextv.text, toast.length_long).show() } see above code i've separate function parameter of textview . want textview object @ second function. question is: possible call function without parameter , able textview object @ myfunction() . learning kotlin in android studio. hope question clear . the 1 mentioning class property . for case, need declare t

Autolisp user function overloading -

Image
you can read on autocad knowledge website: "note: can define multiple user functions same name, have each definition accept different number or type of arguments." has using feature? tried not work @ all. can call latest defined function.if call (file::appendfile arg1) autocad said give less argument i'm not @ computer autocad installed, can't check if autolisp works way documentation says should, know i've seen workaround pass variable number of arguments function. the trick pass arguments single list, , process list in body of function. example: (defun myfunction (argslist / path header) (setq path (car argslist)) (setq header (cadr argslist)) (somefunction path "a" header) ) ... , you'd call function (myfunction '(arg1)) or (myfunction '(arg1 arg2)) . note in examples above i'm using list constructor literal, pass in actual strings "arg1" , "arg2". if want pass in contents of variabl

ruby - rubyXL iterate through specific column from xslx -

i new ruby , rubyxl , have (maybe) simple question. have excel file parse rubyxl. then want save values column b array. , don't know how done. maybe can me? @workbook = rubyxl::parser.parse(path) . . . @excelcolumnb = array.new #only iterate column b (1) @workbook.worksheets[0].each[1] { |column| column.cells.each { |cell| val = cell && cell.value excelcolumnb.push(val) puts val } } return excelcolumnb i know example wrong. tried many things. the each[1] main problem. can't index iterator way, it's syntactically incorrect. block variable contains row, not column. try this: @workbook.worksheets[0].each { |row| val = row[1].value @excelcolumnb << val puts val } but recommend more succinct way create array: @col_b = workbook.worksheets[0].collect {|row| row[1].value}

Can Salesforce Commerce Cloud be used as CMS? -

salesforce acquired demandware , re-branded salesforce commerce cloud e-commerce solution, comes einstein has inbuilt ai, machine learning, deep learning give seamless digital cutomer journey experience. can use salesforce commerce cloud cms , leverage advantages of einstein? don't have requirement of e-commerce.

qt4 - Copy files and folders from directory in QT pro file -

i want copy files , directory source folder other directory the code tried below mentioned binary_path = $$pwd/../bin/ resource_path = $$pwd/../resources/ qt += core qt -= gui config += c++11 target = untitled config += console config -= app_bundle template = app sources += main.cpp win32 { qmake_post_link +=$$quote(cmd /c xcopy /s /q /y /i $${resource_path} $${binary_path}$$escape_expand(\n\t)) } resource_path contain 2 files , 1 folder the above code not copying files or filders source directory. trying on windows 7

javascript - Jquery validation does not submit form in once click when ajax call is async -

this question has answer here: how return response asynchronous call? 21 answers jquery validator , custom rule uses ajax 3 answers i using jquery validation customized function check duplicate values in database ajax call , ajax call async. issue when fills value , click on submit button directly "without focus out field" form not getting submit though validation function returning true. need click on submit again submit form. below code using: add customized rule: jquery.validator.addclassrules("checkduplicate", {checkduplicate: true}); the function "checkduplicate" : $.validator.addmethod("checkduplicate", function (value, element) { var returnvalue = false; $.ajax({ type: "post", async: false,

insert into - I can't add database in inbound data from salt method in php -

i have problem mentioned title. want add named tbl_users in database. tables column user_name, password ans salt. have hash class. class hash { public static function create($string, $salt = '') { return hash('haval256,4',$string.$salt); } public static function salt($length = 32) { if(function_exists('random_bytes')) return random_bytes($length); else return mcrypt_create_iv($length); } public static function unique() { return self::create(uniqid()); } } i creating $salt variable salt column hash::salt. but, when added $salt variable value in salt column, can't add value. $salt = hash::salt(); $pass = hash::create('123456',$salt); $query = connection::getinstance()->getconnection("insert tbl_user set user_name='blablabla' password='$pass', salt='$salt'"); but, can add random values ('2345234',fgsdffs' that)

Cant add additional Python Interpreter (Python3.5) in Eclipse (currently Python2.7) -

i using python2.7 , needed import pyqt5.qtcore wanted install pip install pyqt5. recognized possible higher version. installed python3.5 , installed package. far good. now wanted change python interpreter window -> preferences -> pydev -> interpreter - python -> new.. -> browse -> c:\users\user\appdata\local\programs\python\python35-32 -> python.exe a prompt with: python doesnt work anymore opened. problemdetails showed: problemsignatur: problemereignisname: appcrash anwendungsname: python.exe anwendungsversion: 3.5.150.1013 anwendungszeitstempel: 55f4dcca fehlermodulname: ucrtbase.dll fehlermodulversion: 10.0.10586.788 fehlermodulzeitstempel: 5879aa7b ausnahmecode: 40000015 ausnahmeoffset: 0008469a betriebsystemversion: 6.1.7601.2.1.0.256.48 gebietsschema-id: 1031 zusatzinformation 1: 8bb9 zusatzinformation 2: 8bb9472aa5ef366a719aa187ee7b3438 zusatzinformation 3: 315a zusatzinformation 4: 315a6e0e