Posts

Showing posts from January, 2011

mysql - SQL select where column clause -

i have table follows date1 | date2 | datechoice 1-5-17 2-6-17 date2 datechoice can either date1 or date2. , want first @ datechoice column decide column use in statement. example pseudo code: case when datechoice ='date2' date2 >= 2-2-17 , date2 <= 2-9-17 else date1 >= 2-2-17 , date1 <= 2-9-17 how can this? where (datechoice ='date1' , date1 >= '2017-02-02' , date1 <= '2017-02-09') or (datechoice ='date2' , date2 >= '2017-02-02' , date2 <= '2017-02-09')

python - Are global variables thread safe in flask? -

in app state of common object changed making requests, , response depends on state. class someobj(): def __init__(self, param): self.param = param def query(self): self.param += 1 return self.param global_obj = someobj(0) @app.route('/') def home(): flash(global_obj.query()) render_template('index.html') if run on development server, expect 1, 2, 3 , on. if requests made 100 different clients simultaneously, can go wrong? expected result 100 different clients each see unique number 1 100. or happen: client 1 queries. self.param incremented 1. before return statement can executed, thread switches on client 2. self.param incremented again. the thread switches client 1, , client returned number 2, say. now thread moves client 2 , returns him/her number 3. since there 2 clients, expected results 1 , 2, not 2 , 3. number skipped. will happen scale application? alternatives global variable should at? yo

c# - EF Core Migrations with Multiple DB Schemas -

ef core 1.1 , sql server 2016 we running microservice application microservices having independent few tables. 1 of solutions have many tables individual microservice, give these services unique schema (e.g. not dbo) , put of them in 1 database (good cost + maintenance). that works fine in ef 6, however, looking @ generated dbo.__efmigrationshistory in core, looks core doesn't take schema account. i aware migration in ef core has changed in code rather db, problem version recorded in dbo.__efmigrationshistory table schema-agnostic. do know how can make ef core schema-aware when writes migration db? n.b. builder.hasdefaultschema(constants.schema); set in dbcontext. builder.hasdefaultschema() used set schema model. migrationhistory table configured bit differently. can read more here from link, the simplest scenario when want change table name or schema. can done using migrationshistorytable method in onconfiguring (or configureservices on asp.net cor

javascript - Cannot read property 'entries' of undefined in http://maps.googleapis.com/maps/api/ -

everything worked , there mistake cannot read property 'entries' of undefined ? (including googlemaps api) uncaught typeerror: cannot read property 'entries' of undefined @ js?key=<api_key>&callback=map.init:105 map.init map.init = function (id) { id = id || 'map'; map = new google.maps.map(document.getelementbyid(id), { center: {lat: 46.409998, lng: 30.710000}, scrollwheel: true, zoom: this.address ? 20 : 12 }); infowindow = new google.maps.infowindow(); map.addlistener('zoom_changed', function () { var zoom = map.getzoom(); if (zoom > zoomshowpoints && !pointsvisibility) { pointsvisibility = true; points.foreach(function (item) { item.setvisible(pointsvisibility); }); } else if (zoom <= zoomshowpoints && pointsvisibility) { pointsvisibility = false; points.fo

Here map api Android: MapRoute Out of memory error on zoomTo() -

i seem getting out of memory error on older devices when attempt add maproute object map. happens in routes outside of city size , long routes across us. have attempted on emulator device (nexus 4.4.4) , physical device (samsung galaxy prevail 4.4.4). here code calculating route: public void calculateroute(geocoordinate start, geocoordinate end, final routelistener listener) { routeplan routeplan = new routeplan(); routeoptions routeoptions = new routeoptions(); routeoptions.settransportmode(routeoptions.transportmode.car); routeoptions.setroutetype(routeoptions.type.shortest); routeoptions.setroutecount(1); routeplan.setrouteoptions(routeoptions); routemanager routemanager = new routemanager(); routeplan.addwaypoint(start); routeplan.addwaypoint(end); routemanager.calculateroute(routeplan, new routemanager.listener() { @override public void oncalculateroutefinished(routemana

java - Saving data persistently -

i have notes app whereby implemented 2 types of views: list , grid views. user can switch between listview , gridview depending on choice. issue have have been trying save state of view persistently such selected view opened @ start up. trying use sharedpreferences achieve this. doing getting wrong in code? private static final string key_name = "viewstate"; private listview mlistnotes; private gridview mgridnotes; sharedpreferences sharedpreferences; sharedpreferences.editor editor; private boolean mviewischanged = false; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // set layouts list/grid mlistnotes = (listview) findviewbyid(r.id.main_listview); mgridnotes = (gridview) findviewbyid(r.id.main_gridview); // retrieve value shared preferences. sharedpreferences = getpreferences(context.mode_private); mviewischanged = sharedpreferences.getboolean(key_name, fals

sqlite3 - SQLite VACUUM in DB opened from multiple processes -

i’ve 2 questions sqlite vacuum (and possibly wal): • if multiple processes have db open, sql statements in processes need finalized vacuum succeed? • why vacuum sometime not have effect (no space reclaimed) sqlite return sqlite3_ok? a bit more details problem: i’ve database in wal mode accessed 2 processes. @ point, user has choice of dropping data database. because database can opened multiple processes, delete records , run vacuum reclaim disk space (instead of closing connection , deleting file). the problem if 2 processes have db connection opened, vacuum 1 of processes returns ok, not reclaim space really. i think happens vacuum won’t succeed till there’s outstanding sql statement process. problem not want make 2 processes aware of each other. what considering doing vacuum both processes, whichever closes connection last (upon user request drop data), takes care of space reclamation. considering auto_vacuum (i aware of limitations, deletes not frequent

apache spark - How to apply windowing function in pyspark over grouped data which needs an aggregation within an aggregation? -

i have complicated winodwing operation need in pyspark. i have data grouped src , dest , , need following operations each group: - select rows amounts in socket2 do not appear in socket1 (for rows in group) - after applying filtering criteria, sum amounts in amounts field amounts src dest socket1 socket2 10 1 2 b 11 1 2 b c 12 1 2 c d 510 1 2 c d 550 1 2 b c 500 1 2 b 80 1 3 b and want aggregate in following way: 512+10 = 522, , 80 record src=1 , dest=3 amounts src dest 522 1 2 80 1 3 i borrowed sample data here: how write pyspark udaf on multiple columns? you can split dataframe 2 dataframes 1 socket1 , other 1 socket2 and use leftanti join instead of filtering (works

Neo4j data-model of documents, keywords, and word stems for searching -

Image
my goal 2 different kinds of searches documents using neo4j. i'll use recipes(documents) example. have list of ingredients(key-words) on-hand (milk, butter, flour, salt, sugar, eggs...) , have recipes in database ingredients attached each recipe. i'd input list , 2 different results. 1 recipes closely include ingredients entered. second combinations of recipes include of ingredients. given: milk, butter, flour, salt, sugar, eggs a search result first case might be: 1.)sugar cookies 2.)butter cookies a result second might be: 1.)flat bread , gogel-mogel i'm reading in recipes insert neo4j, , pulling out ingredients ingredients list @ top of each recipe, recipe instructions. want weigh these differently, maybe 60/40 in favor of ingredients list. i stem each ingredient in case people enter similar words. i'm struggling come data model in neo4j. plan user enter english ingredients, , stem them in background, , use searching on. my first thought was:

bash - How to schedule to run first Sunday of every month -

i using bash on redhat. need schedule cron job run @ at 9:00 on first sunday of every month. did little research , see there no short hand in cron this. do know of optimal way ? you can put in crontab file: 00 09 * * 7 [ $(date +\%d) -le 07 ] && /run/your/script the date +%d gives number of current day, , can check if day less or equal 7. if is, run command. if run script on sundays, should mean runs on first sunday of month. remember in crontab file, formatting options date command should escaped.

javascript - epochjs charts with python flask -

i have been fighting epochjs last few days , brain exhausted. want have real time line graph part of dashboard shows cpu usage. pulling cpu percentage using psutil , using ajax on front-end json object containing data graph. chart loads in div tag, initial time stamp no chart lines. have feeling json objects aren't correct, i've matched them examples on site epochjs . not sure if examples aren't correct of if it's issue code. appreciated! thanks! python (flask) from flask import flask, render_template, response import psutil import time import json app = flask(__name__) def get_timestamp(): return int(time.time()) @app.route('/', methods=['get']) def app_main(): return render_template('index.html') @app.route('/system/cpu/initial', methods=['get']) def cpu_init(): initial_stats = list() cpu_stats = psutil.cpu_percent(percpu=true) t = get_timestamp() in range(len(cpu_stats)): ini

Build c++ lib for windows 7 from windows 10 -

Image
which best way build c++ lib(static or dll, type) have included in application runing on windows 7. don't have windows 7 system windows 10 , 8. unless you're using components in library come windows sdk (and differ in structure or behavior between windows 7 , windows 10), there shouldn't significant difference between code created windows 10 , windows 7. heck, compiler targets windows 10 pretty every project make, , computer i'm testing on windows 7, , don't have problems running code. if do encounter situation absolutely need code strictly conformant windows 7, can achieve on msvc changing platform toolset: i don't know how make kind of change in gcc or clang, said: it's unnecessary in first place.

How to plot two curves with error bars using R ggplot2.qplot -

Image
how can put 2 graphs error bars on 1 graph using ggplot.qplot . i've made far plotting 1 graph error bars using this post: library(ggplot2) time_points = c(15, 30, 60, 90, 120, 150, 180) control_data = c(1,2,3,4,5,6,7) control_sd = c(0,1, 0.2, 0.3, 0.4, 0.5, 0.6) treated_data = c(9,8,7,6,5,4,3) treated_sd = c(0,1, 0.4, 0.6, 0.8, 0.8, 0.9, 1.5) qplot(time_points, control_data) + geom_errorbar(aes(x = time_points, ymin = control_data - control_sd, ymax = control_data + control_sd)) which produces: how can plot treated data on on same canvas? note tweaked given vectors create data frames. library(ggplot2) library(dplyr) library(tidyr) library(magrittr) time_points = c(15, 30, 60, 90, 120, 150, 180) control_data = c(1,2,3,4,5,6,7) control_sd = c(0, 1, 0.2, 0.3, 0.4, 0.5, 0.6) treated_data = c(9,8,7,6,5,4,3) treated_sd = c(0.1, 0.4, 0.6, 0.8, 0.8, 0.9, 1.

javascript - Combine multiple Canvas in a single html page -

i trying load 2 canvases on single html page (one load on desktop , 1 on mobile). believe i'm missing making each unique ids (or messed else). issue similar https://stackoverflow.com/questions/12475780/working-with-multiple-canvas-in-a-single-html-page <style> #canvas_desktop, #canvas_mobile { position:absolute; margin:auto; left:0;right:0; top:0;bottom:0; } </style> <script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script> <script src="desktopscript.js"></script> <script src="mobilescript.js"></script> <script> var canvas, stage, exportroot; function init_desktop() { canvas = document.getelementbyid("canvas_desktop"); images = images||{}; var loader = new createjs.loadqueue(false); loader.addeventlistener("fileload", handlefileload); loader.addeventlistener("complete", handlecomplete); loader.loadmanif

python - Debugging a Flask app under gunicorn with PyCharm -

i'd single-step through hello-world flask app running under gunicorn pycharm ce. the app usual 5-10 liner sitting in /tmp/hello-world/app , , venv in /tmp/env . my pycharm configuration looks this: script: /tmp/env/bin/gunicorn script parameters: /tmp/hello-world/app:app working directory: /tmp/hello-world the app runs fine command line in venv using gunicorn app:app , when launch server under pycharm ce, import internal gunicorn fails: traceback (most recent call last): file "/tmp/env/lib/python2.7/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker worker.init_process() file "/tmp/env/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process self.load_wsgi() file "/tmp/env/lib/python2.7/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi self.wsgi = self.app.wsgi() file "/tmp/env/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callabl

javascript - Node start script env not being set on Mac -

i have following seems work on windows (and linux far can tell): package.json: "scripts": { "test": "node_env=test || set \"node_env=test\"&& mocha **/*.test.js --reporter spec" } but doesn't work on osx reason, tried doing node_env=test doesn't work either, thoughts? you need add export before variable name, set in windows: "scripts": { "test": "export node_env=test || set \"node_env=test\" && mocha **/*.test.js --reporter spec" }

function - User defined match terms for sting distance calculation in R -

there many choices of string distance calculation methods in r in package {stringdist} ( https://cran.r-project.org/web/packages/stringdist/stringdist.pdf ), curious if possible include user defined match items using regex or other ways in jaro or jaro-winker distance calculations? if not, there other packages provide kind of function? for example: string "usa starwar corporation" (a) , "us starwar corporation" (b) , "united states starwar corporation" (c) jaro distances between ((a),(b)),((b),(c)),((a),(c)) respectively 0.01449275, 0.2020202, 0.216513 . there way define "usa" matches "us" matches "united states" in calculation , therefore distance 0,0,0 ? thanks!

c++ - Clear buffer independent of the operating system -

i'd know how can clear standard input buffer, regardless of operating system i'm using. know in windows can use fflush , linux fpurge , single solution works both (does not have function). depending on mean "clear standard input buffer", may do: int c; while ((c = getchar()) != eof && c != '\n') /* nothing */; this absorbs eof or newline, whichever comes first. the main situation wouldn't want if don't want maybe block until user presses enter. in case, you're sol; there no universal mechanism.

oracle - PL/SQL Get last line in file, avoid looping -

i have simple oracle database , logfile. each row in logfile unique. there lot of lines (~1 million). need use last line in file part of insert statement. getting file works fine: f1 := utl_file.fopen('user_dir','log.txt','r'); putting inside loop works each row in file unique know if have added line yet or not: loop begin utl_file.get_line(f1,vx); -- action exception when no_data_found exit; end end loop; but seems horribly inefficient going read every line in file though know care last line. something avoided loop , went: utl_file.get_last_line(f1,vx) -- action would great. i'm sure there construct or can't find it. it's oracle11g if matters. does article help? utl_file - random access of files the fgetattr procedure allows check file exists , return file length. read first line using get_line procedure normal. last line need skip end of file using fseek procedure , work backwards until hit line termin

Django-Rest-Framework - nested objects and serializers, how to? -

i'm using drf first time. i've been reading documentation pages no clue on how this. i have 2 models, adprice model make reference ad model. need list various prices ad. my question is: how can list of ads this? [ { "title": "some long title ad1", "name": "name ad1", "prices": { { "name": "price now", "price": 200 }, { "name": "price later", "price": 300 } } }, ] models.py class ad(models.model): title = models.charfield(max_length=250) name = models.charfield(max_length=100) def __str__(self): return self.name class adprice(models.model): ad = models.foreignkey(ad) name = models.charfield(max_length=50) price = models.decimalfield(max_digits=6, decimal_places=2) def __str__(self): return self.name serializers.py class adpriceserializer

mysql - How to retrieve the rows in a table that has a value that appears NOT the most times? -

i have 2 tables. a customers table , orders table. customers: orders: customer_id customer_name orders_id customer_id 1111 charles 1020 1111 2222 bertram 1021 1111 3333 barbare 1022 2222 1023 3333 i want output be: customer_name bertram barbara i want retrieve order bertram , barbara because have not placed order highest numbers of times. the problem here subquery. know how count numbers of times customer has placed order, having real difficulties selecting customer_id occurs fewest times. using mysql , apache based on sample data, may finding customers 1 order, may use following query select customer_name customer c join orders o on c.customer_id = o.customer_id group customer_name having count(orders_id) = 1 result customer_name bertram barbara

angular - Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) (" -

i learning angular scratch , new. please forgive me if question simple. have done research solutions did not work me. have app.component.html contains below code: <!--the content below placeholder , can replaced.--> import { formsmodule } '@angular/forms'; import { domsanitizer} '@angular/platform-browser' import { safehtml } '@angular/platform-browser' <input type="text" [(ngmodel)] = "name"> <p>{{ name }}</p> // have tried {{ '{' }} name {{'}'} suggested in other forums. then have app.component.ts file contains: import { component } '@angular/core'; @component({ selector: 'app-root', templateurl: './app.component.html', styleurls: ['./app.component.css'] }) export class appcomponent { name = '' ; } i using angular cli handle building code. not sure why below error. compiler.es5.js:1690 uncaught error: template parse errors: unexpected

PayPal: payments/order vs order api, what's the difference? -

what's difference between payments/order , order api? https://developer.paypal.com/docs/api/payments/#order . vs https://developer.paypal.com/docs/api/orders/

virtualenv - Installing python-setuptools 20.4 or greater on CENTOS 7 for CKAN server -

i trying install setuptools 20.4 or greater requirement ckan. have tried downloading rpm files , installing ckan not recognize python2 rpm. running virtualenv ckan server under use ckan bash shell. have advice on how install setuptools 20.4 or greater on centos? if not using pip upgrade setuptools, install/upgrade setuptools before create virtualenv. i believe rpm update system python's setuptools. when create virtualenv copies system setuptools virtualenv.

sql server - How to pass NULL Value to Stored Procedure Through C# -

i have multiple textboxes , want allow user leave empty instead of giving error sqlparametercollection accepts non-null sqlparameter type objects. what use inserting data in data_access_layer class public void executecommand(string data, sqlparameter[] param) { sqlcommand sqlcmd = new sqlcommand(); sqlcmd.commandtype = commandtype.storedprocedure; sqlcmd.commandtext = data; sqlcmd.connection = sqlconnection; if (param != null) { sqlcmd.parameters.addrange(param); } the main form code: namespace m_weight_system.presentation_layer { public partial class main : form { bussiness_layer.cls_data dta = new bussiness_layer.cls_data(); public main() { initializecomponent(); } private void bsave_click(object sender, eventargs e) { try { dta.add_data(tid.text, tnumber.text, tclient.text, tdriver.

matplotlib - 3D surface plot , " float() argument must be a string or a number " in python -

i'm trying plot surface plot following x, y , z axis: my x value, "excess_calc" : {'2012-04-03': array([ 74.918567 , 74.5223076 , 84.45777874)] '2012-04;04': array([78.03464433, 81.65472595, 85.00621476, 87.1444176]) ...} y value, "spread_calc" : {0: array([ 1.84499667, 1.87126911, 1.8720464 , 1.87548384)] 1: array([1.89338594, 1.88059231, 1.87021495, 1.872181080)] ... } and z value, "equi": [float(num) num, date in equi_locs] which list of numbers, [1, 2 , 3, 4 .. etc way 242) , 242 len of keys in both dicts above. when : mpl_toolkits.mplot3d import axes3d fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.plot_surface(spread_calc, [float(num) num, date in equi_locs], excess_calc) i keep getting error "typeerror: float() argument must string or number"

regex - r rename files in folder from xlsx to csv -

this question has answer here: dynamically converting list of excel files csv files in r 2 answers i searched , found stuff, still having issues. i have files in directory "result (1).xlsx" , "result (2).xlsx". want change them "new1.csv" , "new2.csv", etc. i'm using following , not working (the problem seems regex.. , ive flip flopped between using file.rename , sapply): folder = "r:\\files" files <- list.files(folder,pattern = "*.xlsx",full.names = t) sapply(files,fun=function(eachpath){ file.rename(from=eachpath,to= sub(pattern="result\\s(*).xlsx", paste0("new.csv"),eachpath)) }) thanks before answer question, i'd mention changing extension of file doesn't, in computer science, automatically change file formatting. in other words, changing .xlsx

swift - Update tableview instead of entire reload when navigating back to tableview View Controller -

i have home uiviewcontroller contains uitableview . on view controller display games current user reading data firebase in viewwillappear . view controller user can press button start new game , button takes them next view controller select settings, updates data in firebase , adds new child. once navigate home view controller there anyway update data new child added instead of loading games table view again doing? this current code: override func viewwillappear(_ animated: bool) { super.viewwillappear(animated) if let currentuserid = auth.auth().currentuser?.uid { let gamesref = database.database().reference().child("games").child(currentuserid) self.games = [] gamesref.observesingleevent(of: .value, with: { snapshot in child in snapshot.children { let game = child as! datasnapshot self.games.append(game) self.tableview.reloaddata() } }) } }

c - How much info does the -g GCC compile option provide? -

i need debug program. several reasons convenient else takes @ it. however, code sensitive , need limit amount of exposure give code person helping debugging. i considering compiling using -g option, person can use gdb. however, not familiar amount of information using -g option provide. want person helping me debug "your coffee gets stuck in line 573", don't want person able reverse engineer source code. what additional information included in binary file , accessible using gdb after compiling -g option?

how to show uploaded image to jsp page in spring mvc -

i writing program in spring mvc upload , show image. save project in "d:/skillup/spring/uploaddemo" location.but when upload image uploaded.i specify location upload image in "web-inf/image" folder in project path. code of specify path is- servletcontext context; context.getrealpath("/web-inf/image") + file.separator ; but save in location "d:\skillup\spring.metadata.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\uploaddemo\web-inf\image". now question how show image uploaded location.?

java - "VARIABLE NAME cannot be resolved to a variable" in nested loops -

our task create table listed powers of number inputted user maximum exponent inputted. requirement use of nested loops , that's problems arose. or ideas appreciated. `//method powers table public static void powers(){ system.out.print("enter base: "); int base = console.nextint(); system.out.print("enter maximum exponent: "); int exponent = console.nextint(); system.out.print("the base " + base); system.out.println(" , maximum exponent " + exponent); system.out.println(); system.out.println("powers of " + base); system.out.println(); system.out.print("x\t"); system.out.println(base + "^x"); for(int = 0;i <= exponent;i++){ for(int = (int)math.pow(base, i);a <= exponent;a++); system.out.print(i + "\t"); system.out.print(a); //error happens here variable "a" } system.out.println(); }`

node.js - Socket emit to room works for all sockets except the sender -

i'm creating voting feature using socket.io. sockets placed rooms channelid . whenever socket in room emits vote event, i'm trying emit current vote-list sockets in room. my problem if have sockets a, b, c in same room, votes socket visible b , c (that is, b , c's on.('vote') listeners called), not itself. what expect happen, if sockets a, b, c in same room, , emits vote , sockets a, b, c vote listeners called. client: these listeners defined within methods, i've singled them out clarity. variables defined. const socket = io('https://localhost:3001') socket.emit('join-channel',{ channelid: payload.channelid, senderid: socket.id }) socket.emit('vote',{ senderid: socket.id, channelid: state.channelid, vote: payload.vote, userid: state.userid }) socket.on(`vote`, function (data) { store.commit(mutations.set_votes, data) }); server module.exports = (app,server) => { var io = requi

JavaScript convert specified single objects into array -

i dealing json data retrieving database. if result contains single value, creates single object. if there multiple values, creates array of objects. my issue having try , handle becomes problem when dealing loops. example data: // single result db var obj = { "records": { "recordid": 1, "recordname": 'test' } } // multiple results db var obj = { "records": [{ "recordid": 1, "recordname": 'test' }, { "recordid": 2, "recordname": 'test again' }] } i have function loops on of records example , becomes problematic when have 1 result because no longer looping on array. due of objects being pretty large, trying come function can initialize object when database before handling it. this function loop through of keys , check see if key exists in array of "does need array?" flags. if finds match, check see if single object , if so

php - In Magento 1.9 How to display mini-cart in top menu? -

i new magento 1.9. have custom theme. need display functional mini-cart in top menu. right not sure how achieve this? i found step step guide problem. sharing link here future reference. http://dltr.org/blog/magento/118/magento-add-sidebar-mini-cart-on-the-header this header mini-cart depends on sidebar mini cart, make sure it's active at: magento admin / system / configuration / sales / checkout / shopping cart sidebar select "yes" display shopping cart sidebar. add below code inside on checkout.xml: path: app\design\frontend\your-package\your-template\layout\checkout.xml <reference name="header"> <block type="checkout/cart_sidebar" name="cart_cartheader" template="checkout/cart/cartheader.phtml" before="-"> <action method="additemrender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/carthea

android - Recyclerview inside ViewPager which is inside nested Scroll View -

Image
i have used following code inside coordinator layout , using custom collapsing toolbar design. <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:ignore="rtlhardcoded"> <android.support.design.widget.appbarlayout android:id="@+id/main.appbar" android:layout_width="match_parent" android:layout_height="250dp" android:background="@drawable/backg"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/main.collapsing" android:layout_width="match_parent

javascript - Decoding code text to ASCII failure -

my program codes normal text ascii. works well, except decoding doesn't work. wrong? also, don't want commas appear when coded text printed. oh, , want include caesar cipher too. function code() { var leer = document.getelementbyid('1').value, array = []; (var = 0; < leer.length; i++) { array[i] = leer[i].charcodeat(0); } document.getelementbyid('2').innerhtml = 'chale, chale ' + array; } function decode() { var leer = document.getelementbyid('1').value, array = []; (var = 0, char; char = leer[i]; i++) { array[i] = string.fromcharcode(leer[i].charcodeat(0)); } document.getelementbyid('2').innerhtml = 'chale, chale ' + array; } <form> escriba el mensaje:<br><br> <input type="text" id="1" name="mensaje" rows="10" cols="40"> <br><br> <br><br> elige una opci

Python multithreading and Global Interpreter Lock -

i came across gil present in python according single thread can execute @ time , multithreading can not utilize cores. now in 1 of projects, used multithreading , lots of locks , semaphores here question can achieve same thing if don't use locks , semaphores? i.e if remove concurrency logics project. edit: want know is, whether it's possible attain same functionality if remove concurrency logics, know gil , prevents threads use cores , 1 thread run @ time. the global interpreter lock ensures 1 thread executing byte code @ once. execution interrupted @ time. consider simple function might intended atomically store related values attributes on instance x def f(x, a, b): x.a, x.b = a, b here disassembly bytecode 0 load_fast 1 (a) 3 load_fast 2 (b) 6 rot_two 7 load_fast 0 (x) 10 store_attr 0 (a) 13 load_fast 0 (x)