Posts

Showing posts from February, 2011

internet explorer - javascript findIndex issue with IE -

i've completed small form , found out how i'm using findindex doesn't work ie. here example of issue. var people = [ {name:"mike", age:"25"}, {name:"bill", age:"35"}, {name:"terry", age:"44"} ]; console.log(people.findindex(x => x.name=="bill" )); what fastest way fix issue ie? find index support browsers chrome 45.0 , above: supports firefox 25.0 , above: supports internet explorer: no support microsoft edge: supports opera: supports safari 7.1 , above: supports so need modify code similar below work in browsers. var index; for(var i=0;i<people.length;i++){ if(people[i].name == 'billi'){ index = } } more info

c# - Populating an inventory UI with JSON, what's wrong with my code? -

i'm using json , litjson in unity 5 populate inventory ui game. problem is, code not returning except information item @ id:0. @ point have 2 items in json. code in unity recognize there items @ id:0 , id:1, because if put else in there, error outside of argument, it's still printing information console id:0. here json: [ { "id": 0, "title": "stun gun", "value": 6, "stats": { "power": 100, "defense": 4, "vitality": 2 }, "description": "testing stun gun.", "stackable": false, "rarity": 2, "slug": "stun_gun" }, { "id": 1, "title": "the great gun", "value": 500, "stats": { "power": 700, "defense&qu

javascript - jQuery Image Crossfade not working -

hello wrong our jquery image crossfade set-up!? http://tips.techmatemn.com/ html <div class="hero-cycler"> <img class="active" alt="tips qualified client 1" src="<?php bloginfo('stylesheet_directory'); ?>/assets/img/hero-bk-1.jpg"> <img alt="tips qualified client 2" src="<?php bloginfo('stylesheet_directory'); ?>/assets/img/hero-bk-2.jpg"> </div> css .hero-cycler{position:relative;} .hero-cycler img{position:absolute;z-index:1} .hero-cycler img.active{z-index:3} script <script> // homepage client images function cycleimages(){ var $active = $('.hero-cycler .active'); var $next = ($active.next().length > 0) ? $active.next() : $('.hero-cycler img:first'); $next.css('z-index',2);//move next image pile $active.fadeout(1500,function(){//fade out top image $active.css('z-index',1).show().

javascript - Mobile Safari doesn't trigger "orientationchange"—how to debug? -

i have website ( http://7db.9ed.myftpupload.com/ ) display content tailored orientation. when in landscape mode, should display wide slideshow, when in portrait should switch thin slideshow. i'm attempting use "orientationchange" event apple specifies in safari web content guide. jquery( document ).ready( function() { window.addeventlistener("orientationchange", function() { console.log("the orientation of device " + screen.orientation.angle); placeslideshow(); }, false); }); this works without hitch in chrome's ios simulator. but, in both osx hardware simulator , on live ios device, nothing happens on orientation change. it's not placeslideshow function—safari isn't triggering orientation change @ all. at loss troubleshoot this—where start? it turns out issue console.log call had added in. safari not recognize property screen.orientation.angle, , reason unknown me, call managed

sass - Unable to find source files -

i've started working on existing website @ work uses sass , auto-prefixer grunt. i'm not 100% familiar files yet, don't want change structure avoid breaking anything. problem i'm having no matter .scss files edit, doesn't affect required .css file. developers built site aren't here anymore. the changes make either affect file.css or file2.css, , need reach file.expanded.css, there's no mention of file in gruntfile, either removed, or it's being compiled in way. obviously, i'm avoiding editing directly. i'm unsure if have enough figure out. in case helps, here's gruntfile: module.exports = function(grunt){ require("matchdep").filterdev("grunt-*").foreach(grunt.loadnpmtasks); grunt.initconfig({ pkg: grunt.file.readjson('package.json'), sass: { build: { files: { 'assets/css/file2.css': 'assets/sass/folder/file2.sass' } } }, autopre

VBA: Unexpected Behaviour of Variant Data Type -

as per msdn , variant data types: “numeric data can integer or real number value ranging -1.797693134862315e308 -4.94066e-324 negative values , 4.94066e-324 1.797693134862315e308 positive values.” however, following code gives error though final values after computation fall within acceptable range: sub test() dim v1, v2, v3, v4 v1 = 569847501 + 54678 ' okay v2 = 7784687414# + 98565821345# ' okay v3 = 7784687414# + 1132747441 ' okay v4 = 1132747441 + 1788441323 ' fails end sub msdn points out: ” however, if arithmetic operation performed on variant containing byte, integer, long, or single, , result exceeds normal range original data type, result promoted within variant next larger data type. byte promoted integer, integer promoted long, , long , single promoted double.” the documentation states type should promoted when arithmetic operation exceeds normal range original data type. why isn’t v4

c - Visual Studio is it possible to break when a type is first used? -

i've been handed gigantic code base, written in c, need step through , find feature can reverse engineer , modify it. since code hundreds of thousands of lines long, can imagine process quite slow. have idea how speed along, don't know if possible. have resembles this: struct a{ /* data */ }; struct b{ a* a; /* data */ }; /* note , b defined in different files */ i want visual studio break when b->a first assigned/modified on arbitrary instance of b. possible in visual studio professional 2012? you can set breakpoint on constructor type b (or equivalent of constructor in c code). when triggers, can set memory breakpoint on b->a , wait 1 trigger.

python - How would I use a while loop so that if they enter a number it would ask them the again? -

fn = input("hello, first name?") firstname = (fn[0].upper()) ln = input("hello, last name?") lastname = (ln.lower()) i want fn on loop if enter number instead of letters, repeat question i guess need this final_fn = "" while true: fn = input("hello, first name?") if valid(fn): final_fn = fn break define validation method before it. example joran mentioned def valid(fn): return fn.isalpha()

c# - nesting three if statements -

i check if condition "_email" met first time , pass result next if statement check , again after that. if _email null, want empty string last check. here code private string _email; public string email { { if (string.isnullorempty(_email)) { _email = getemailaddress(); } else if (_email.isemptyornull()) { _email = user.current.preference("email"); } else if (_email.isemptyornull()) { _email = ""; } return _email; } } i not sure doing wrong. please let me know if need more info. you need remove else in code because first if clause condition met executed and isnullorempty static method on string class. use string.isnullorempty instead of _email.isnullorempty . (i compiler error when try _email.isnullorempty ) private string _e

c# 4.0 - Generic list and static main -

using system; using system.collections.generic; namespace consoleapplication74 { class program<t> { public void add(t x) { console.writeline("{0}", x); } static void main(string[] args) { program<string> mygeneric = new program<string>(); mygeneric.add("abc"); console.read(); } } i have erroe program not contain static 'main' method suitable entry point . program.cs properties has build action compile. have no idea wrong. the main method, or entry point in program, cannot in class has generic arguments. program class has t type argument. c# specification calls out in section 3.1 under application startup: the application entry point method may not in generic class declaration. you should make new class instead of trying use program : class program { static void main(string[] args) { myclass<string> mygeneric = ne

Ember.js: How to access a model's attributes inside Javascript code -

in ember.js while using ember-data , can access model's attributes when in .hbs template: {{#each model |person|}} welcome, {{person.firstname}} {{person.lastname}}! {{/each}} i tried accessing these values in javascript code (be inside controller or component) using following methods: // method 1 if (person.firstname === 'jack') { // when first name jack } // method 2 if (person.get('firstname') === 'jack') { // when first name jack } but none of these work attributes of current model. value can way id of current model instance. i have looked far , wide solution problem , found nothing, ask question: is possible access attributes of model instance inside javascript code while using ember.js , ember-data? if so, how can done? if not, why can't that? for reference, here current ember.js setup: debug: ember : 2.5.1 debug: ember data : 2.5.3 debug: jquery : 2.2.4 debug: ember simple auth : 1.1

r - connecion with statconnDCOM connector -

i try create connection between r , other software using r connector: statconndcom dosen't work. under r 3.1.0 called following packages: library(rdcomclient) library(rscproxy) then tested connection statconndcom , got following error: loading 32 bit statconnector server... done initializing r...function call failed code: -2147221485 text: installation problem: unable load connector releasing statconnector server...done

python - Returning the words after the first hypen is found -

suppose have list of items - ['test_item_a-engine-blade', 'test_item_a-engine-part-initial', 'test_prop_prep-default-set'] and trying grab words after first hypen found such result should follows: test_item_a-engine-blade => engine_blade test_item_a-engine-part-initial => engine_part_initial test_prop_prep-default-set => default_set i tried re.sub("[^a-z\d]", "", <my string>.split('-', 1)) seems presents me words before string... you can use split maximum number of one. something.split('-', maxsplit=1)

ruby - How to alter the default value of a column in a Sequel migration? -

i have user table. i'm trying change default integer value of column 0 1. so far, method can come dropping , adding column updated default in separate migration. don't want have this, because lose data in pre-existing tables. haven't been able find answer online. is there sequel way this? how set_column_default ? alter_table :foo set_column_default :bar, 1 end

ruby - Hashes and different syntax: getting nils as return values when trying to access key-values -

beginner programmer here who's been in couple of months. assuming have block of code data structure: users = { admin: "secret", admin2: "secret2", admin3: "secret3" } when try access value specific key so: users[:admin] , return value of nil , if use syntax: users['admin'] , return value of "secret" . why happen? aren't these 2 syntaxes supposed equivalent according documentation. side question: when create .yml file data structure, , try set this: { "admin" => "secret", "admin2" => "secret2", "admin3" => "secret3" } i not able load ("parse") file , error: did not find expected ',' or '}' while parsing flow mapping @ line 1 column 1 but block of code in beginning fine. again, thought syntax supposed equivalent or perform same function. why happen? think weakest point in coding @ point hashes because confuses me m

Call a function after login fails or success laravel 5.3 -

i want call custom function when user success in login , when fails can't find solution, use laravel 5.3 , make:auth method. i have logincontroller emtpy. the route login post: route::post('login', ['as' => 'login.post', 'uses' => 'auth\logincontroller@login']); i have helper function called flash('the messaje') sends jquery alert on view, use in controllers , works fine, don't know put code show alert if auth login fails , success. thanks! as default logincontroller uses authenticatesusers trait, need write custom methods sendloginresponse , sendfailedloginresponse . can of reuse trait methods , add custom mode want execute.

python - How to allow a tkinter window to be opened multiple times -

i making makeshift sign in system python. if enter correct password brings new admin window. if enter wrong 1 brings new window says wrong password. if exit out of 1 of windows , try enter password again breaks. tkinter.tclerror: can't invoke "wm" command: application has been destroyed there way prevent if enters wrong password don't need restart app? import tkinter tkinter import * #define root window root = tkinter.tk() root.minsize(width=800, height = 600) root.maxsize(width=800, height = 600) #define admin window admin = tkinter.tk() admin.minsize(width=800, height = 600) admin.maxsize(width=800, height = 600) admin.withdraw() #define wrong window wrong = tkinter.tk() wrong.minsize(width=200, height = 100) wrong.maxsize(width=200, height = 100) wrong.withdraw() label(wrong, text="sorry password incorrect!", font=("arial", 24), anchor=w, wraplength=180, fg="red").pack() #admin sign in label areadmin = label(root, text=&q

oracle - How to configure MyBatis mapper for cursor as an output parameter? -

oracle stored procedure: create or replace procedure "tgt_mpd_planogram_sel_sp" ( pog_num_in in varchar2, plan_data_sel_cur out sys_refcursor, sql_code_out out number, sql_err_msg_out out varchar2) ... mapper.xml <select id="getplanograms" statementtype="callable" parametertype="com.tgt.snp.pog.vo.planogramsearchvo" resultmap="mapresultplanogram"> { call tgt_mpd_planogram_sel_sp( #{pog_num_in,javatype=string,jdbctype=varchar,jdbctypename=varchar2,mode=in}, #{plan_data_sel_cur,jdbctype=cursor,resultmap=mapresultplanogram,mode=out}, #{sql_code_out,javatype=integer,jdbctype=integer,jdbctypename=integer,mode=out}, #{sql_err_msg_out,javatype=string,jdbctype=varchar,jdbctypename=varchar2,mode=out} ) } </select> vo object public class planogramsearchvo { public planogramsearchvo(){} public string getpog_num_in(

why is this code giving me a ran out of memory error code on racket? -

Image
i need create defintion outputs picture of traffic light depending on string either green yellow or red , whatever string determines bulb solid (define green-light (overlay (above (circle 15 "solid" "green") (circle 15 "outline" "yellow") (circle 15 "outline" "red")) (rectangle 50 100 "outline" "black"))) (define yellow-light (overlay (above (circle 15 "outline" "green") (circle 15 "solid" "yellow") (circle 15 "outline" "red")) (rectangle 50 100 "outline" "black"))) (define red-light (overlay (above (circle 15 "outline" "green") (circle 15 "outline" "yellow") (circle 15 "solid" "red")) ( rectangle 50 100 "outline

amazon web services - Microsoft Redis Session State Provider on AWS issue -

i'm building web farm environment ecommerce package. package runs on .net + aws. the package gives ability store session state in redis cache. problem when use amazon redis (v 2.82 think) connectivity exceptions when trying use cache. no such issues on azure. difference see between configs azure requires password whereas aws not. system.nullreferenceexception: object reference not set instance of object. @ stackexchange.redis.serverendpoint.get_lastexception() @ stackexchange.redis.exceptionfactory.getserversnapshotinnerexceptions(serverendpoint[] serversnapshot) @ stackexchange.redis.exceptionfactory.noconnectionavailable(boolean includedetail, rediscommand command, message message, serverendpoint server, serverendpoint[] serversnapshot) @ stackexchange.redis.connectionmultiplexer.executesyncimpl[t](message message, resultprocessor`1 processor, serverendpoint server) @ stackexchange.redis.redisbase.executesync[t](message message, resultprocessor`1 processor, serverendpoin

entity framework - How to update a field using its own value with only one query? -

considering folling query: update t1 set p1 = p1 + 10 id = @id how can achieve same behaviour in entityframework 1 query? currently, doing this: var obj = bd.objs.single<objclass>(x=> x.id == id); obj.p1 = obj.p1 + 10; bd.savechanges(); but wastes db access querying object well, there way it, need use 3rd party library ( entity framework extended library ) context.objs .where(t => t.id== id) .update(t => new obj{ p1= t.p1+10 }); this nuget package need install. library eliminates need retrieve , load entity before modifying it. can use delete or update entities.

html - CSS vertical alignment table method has no effect -

i need vertically align box css without using display: inline-block . don't know height of elements used way here described (css table method). <div style="background-color: black"> <div style="background-color: aqua; display: table; margin: auto;"> <div style="background-color: aliceblue; width: 200px; float: left; display: table-cell; vertical-align: middle;"> <p>a</p> <p>a</p> <p>a</p> </div> <div style="background-color: green; height: 20px; width: 100px; float: left; display: table-cell; vertical-align: middle;"></div> <div style="background-color: aliceblue; width: 250px; float: left; display: table-cell; vertical-align: middle;"> <p>b</p> <p>b</p> <p>b</p> <p>b</p> <

ssl - Can't access HTTPS but can access HTTP for our website on server. -

we can't access https:// version of our company website. (http:// accessible). we have looked @ certification, valid , working correctly. have looked bindings, looks good. on ie error is: "this page can’t displayed" on chrome error is: "this site can’t reached" server details: windows 2008 r2 sever. iis - hosted website we suspect tls disabled on server might cause problem. (what think?) what missing here? thank you.

ibm bpm - Using bindings with BrazosUI buttons -

i'm used using boolean bindings ibm buttons track if button clicked. button in brazos ui can bound variable type doesn't make automatic updates booleans. how use bindings brazos ui buttons track last-clicked? the binding of button useful in tables. acceptance of variable type binding of button stems use of determining index of selected row or obtaining entire row object: if bind , integer button in table, binding update index of row when button clicked. if bind variable of same (singular) type table's binding, clicking button update binding row's data. both of handy interactions table control don't work tracking button clicked when used elsewhere on coach. that, want utilize 'button control id' configuration option. direct method bind same string variable of buttons need track. when clicked, button update shared variable match own control id. can use unique id in various scripting checks take button-specific actions. see bp3 center article gre

python - file is uploaded in jupyter notebook but not accessible -

i not sure why can see first 5 lines in uploaded file in jupyter notebook though file uploads: import io ipython.display import display import fileupload def _upload(): _upload_widget = fileupload.fileuploadwidget() def _cb(change): decoded = io.stringio(change['owner'].data.decode('utf-8')) filename = change['owner'].filename print('uploaded `{}` ({:.2f} kb)'.format( filename, len(decoded.read()) / 2 **10)) _upload_widget.observe(_cb, names='data') display(_upload_widget) uploaded_file = _upload() uploaded `plot.r` (3.00 kb) %%bash pwd head -5 uploaded_file head -5 "/home/jalal/plot.r" head -5 plot.r %%bash pwd head -5 uploaded_file head -5 "/home/jalal/plot.r" head -5 plot.r /home/jalal head: cannot open ‘uploaded_file’ reading: no such file or directory head: cannot open ‘/home/jalal/plot.r’ reading: no such file or directory head: cannot open ‘plot.r’ rea

Reorder coordinates based on distance from each other in R -

Image
i have x & y coordinates (black points) make irregular rectangle. order these coordinates each point connects nearest neighbor in order. if add lines, points across each other connect. data plot(xy) lines(xy,col="red") this seems bit of rube goldberg contraption , i'm not sure how robust is, but... the basic idea separate points "upper" group , "lower" group finding line goes between (xmin, y(xmin)) , (xmax, y(xmax)). work if none of y values fall on "wrong" side of line. is, if points don't have big departure convexity. once have upper , lower points, sort each group x separately, reverse order of upper group after plot lower group, next line connect highest x-value of upper group (rather lowest x-value of upper group). load("xy.rdata") # convert matrix data frame xy = as.data.frame(xy) names(xy) = c("x","y") # range of xy$x; xy$y values @ min , max xy$x values x.rng = c(min(xy$x

is there a difference between public key and ephemeral public key in Android Pay? -

i going through google android pay page: https://developers.google.com/android-pay/integration/payment-token-cryptography . have question: is there difference between public key generated (e.g. openssl) , submitted google in maskedwalletrequest , so-called "ephemeral public key" in payment method token response? are same base64 string? if not, difference? thanks! the public key app provides android pay api public key you've generated, , passing android pay api encrypt payment credential bundle. https://developers.google.com/android-pay/integration/payment-token-cryptography#setting-a-public-key the ephemeral public key returned android pay api along encrypted message, , generated part of encryption process. use ephemeral public key decrypt encrypted message. more information on eliptic curve, please see https://en.wikipedia.org/wiki/elliptic_curve_diffie%e2%80%93hellman

algorithm - Determine the Big O Notation: -

5n^5/2 + n^2/5 i tried eliminating lower order terms , coefficients, not producing correct answer. not sure if should use logs? let f(n) = (5n^5)/2 + (n^2)/5 = (5/2)*n^5 + (1/5)*n^2 the big o notation f(n) can derived following simplification rules: if f(n) sum of several terms, keep 1 largest growth rate. if f(n) product of several factors, constant omitted. from rule 1, f(n) sum of 2 terms, 1 largest growth rate 1 largest exponent function of n , is: (5/2)*n^5 from rule 2, (5/2) constant in (5/2)*n^5 because not depend on n , omitted. then: f(n) o(n^5) hope helps. check introduction algorithms

parsing - How can I parse homogeneous lists in FParsec? -

i'm having issue trying parse homogeneous json-like array in fparsec. i've decomposed problem short example reproduces it. #r @"..\packages\fparsec.1.0.2\lib\net40-client\fparseccs.dll" #r @"..\packages\fparsec.1.0.2\lib\net40-client\fparsec.dll" open system open fparsec let test p str = match run p str | success(result, _, _) -> printfn "success: %a" result | failure(errormsg, _, _) -> printfn "failure: %s" errormsg type cvalue = cint of int64 | cbool of bool | clist of cvalue list let p_whitespace = spaces let p_comma = pstring "," let p_l_sbrace = pstring "[" .>> p_whitespace let p_r_sbrace = p_whitespace >>. pstring "]" let p_int_value = pint64 |>> cint let p_true = stringreturn "true" (cbool true) let p_false = stringreturn "false" (cbool false) let p_bool_value = p_true <|> p_false let p_li

javascript - Click on icon to display overlay -

i have yellow fa-icon in center. screens sizes smaller 767px. above overlay shows upon hover-over. <767px display, hover-over effect on fa-icon. not work (probably because of .overlay on top of it) = problem 1. also, try when clicking fa-icon overlay shows. not working @ (= problem 2). how solve these? //$("#read-more").click(function() { // $(".overlay").show(); //}); .product-detailsmas .overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; border-radius: 0; background: #f7f7f7; color: blue; text-align: center; border-top: 1px solid #a10000; /* vertical-align: middle; */ -webkit-transition: opacity 500ms; -moz-transition: opacity 500ms; -o-transition: opacity 500ms; transition: opacity 500ms; } .product-detailsmas { background-color: #e6e6e6; text-align: center; position: relative; } @media screen , (min-width: 768

c# - Generic Repository with UnitOfWork with IoC Custom Methods -

i have generic repository pattern unitofwork , using ioc. other base methods used repository, have custom methods. instead of implementing whole irepository methods again, have inherited genericrepository class. here unitofwork implementation: public interface iunitofwork<t> : idisposable t : dbcontext { int save(); t context { get; } } public class unitofwork<t> : iunitofwork<t> t : mycontext, new() { private readonly t _context; public unitofwork() { _context = new t(); } public unitofwork(t context) { _context = context; } public int save() { return _context.savechanges(); } public t context { { return _context; } } public void dispose() { _context.dispose(); } } this repository implementation: public interface igenericrepository { iqueryable<t> all<t>() t : class; void remove<t>

html - jquery toggle one div with same class when div is not in the same code block -

i have simple problem cannot find solution this. have found many references using .parent(), .next(), .find() none of them doing expect. ether divs same class name expanding , collapsing @ same time or not work @ all. so looking here have same class names , expand , collapse 1 click. have this: html: <table> <tr> <td><div class="expand">more details</div></td> <tr/> <tr> <td> <div class="extras" style="display:none;"> <table> <tr><td>some data</td></tr> </table> </div> </td> </tr> <tr> <td><div class="expand">more details</div></td> <tr/> <tr> <td> <div class="extras" style="display:none;"> <table> <tr><td>some data</td></tr>

android - Seven inch tablet layout issue -

i developing app multiple screen support. used layout-sw720dp folder 10 inch tablets , layout folder smartphones , 7 inch tablets. tested app in lanix ilium pad t7 http://phoneradar.com/gadgets/phones/lanix/ilium-pad-t7/ , didn't take layouts layout folder. tried adding layout-sw600dp , layout-sw600dp-hdpi folders device still taking layouts layout-sw720dp. what have take layouts folder different layout-sw720dp? resources should this. if not working you, try test on other device.you can use usefull tool this (genymotion) non commercial use best,in opinion. res/layout/main_activity.xml # phones res/layout-sw600dp/main_activity.xml # 7” tablets res/layout-sw720dp/main_activity.xml # 10” tablets also can select resource use in code public class myactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(); configuration config = getresources().getconfiguration();

laravel - Periodic spikes in CPU usage, possibly queue related? -

i added beanstalk queue application (running through supervisor ). i noticed cpu usage periodically spiking: http://i.imgur.com/0fg1fql.png as far know, there's nothing in queue. i've restarted beanstalkd multiple times. noticed when stop supervisor processes, cpu usage goes zero. is normal behavior queues though there's nothing in queue? there way make spikes less severe? and if helps, here's supervisor worker configuration: [program:laravel-worker] process_name=%(program_name)s_%(process_num)02d command=php /var/www/laravel/artisan queue:work beanstalkd --sleep=3 --tries=3 --daemon autostart=true autorestart=true numprocs=8 redirect_stderr=true thanks. the short answer takes effort load relevant php files, , check queue new items, regardless of work in queue, done. enabling opcache used command-line scripts, faster versions of php, v7, help, longer sleeps between runs pause if there no jobs in queue.

javascript - What does JSX stand for? -

what jsx stand for? i referring jsx defined xml-like syntax extension ecmascript, has become quite popular increasing popularity of reactjs. jsx stands j ava s cript x ml . react, it's extension xml-like code elements , components. per react docs , mentioned: jsx xml-like syntax extension ecmascript without defined semantics from quote above, can see jsx doesn't have defined semantics, it's extension javascript allows write xml-like code simplicity , elegance, , transpile jsx pure javascript function calls react.createelement . per react tutorial: jsx preprocessor step adds xml syntax javascript. can use react without jsx jsx makes react lot more elegant. just xml, jsx tags have tag name, attributes, , children. if attribute value enclosed in quotes, value string. otherwise, wrap value in braces , value enclosed javascript expression. any code in jsx transformed plain javascript/ecmascript. consider component called login . render jsx:

python - NLTK sentiment vader: polarity_scores(text) not working -

i trying use polarity_scores() vader sentiment analysis in nltk, gives me error: polarity_scores() missing 1 required positional argument: 'text' i totally beginner in python. appreciate help! from nltk.sentiment.vader import sentimentintensityanalyzer sid sentences=["hello","why not working?!"] sentence in sentences: ss = sid.polarity_scores(sentence) sentimentintensityanalyzer class. need initialize object of sentimentintensityanalyzer , call polarity_scores() method on that. from nltk.sentiment.vader import sentimentintensityanalyzer sia sentences=["hello","why not working?!"] sid = sia() sentence in sentences: ss = sid.polarity_scores(sentence) you may have download lexicon file if haven't already >>> import nltk >>> nltk.download() --------------------------------------------------------------------------- d) download l) list u) update c) config h) q) quit --

javascript - Submenu refuses to open on click -

i'm trying make left side navigation bar by-default categories listed , while clicking on category, subcategories shown under (in sort expanding sub-menu). i'm working in django , relevant portions of code below. when include js code, none of links on page work , when exclude it, subcategories categories shown by-default. need categories shown default , while clicking on any, respective subcategories shown. i'm missing here? js code: @ bottom of page, loaded after footer: {% block theme_script %} <script src="{% static " pinax/js/theme.js " %}"></script> <script> $(function() { $(".nav-collapse88").hide(); $(".nav-collapse89 a").click(function(e) { e.preventdefault(); $(".nav-collapse88", $(this).parent()).slidetoggle(); }); }) </script> {% endblock %} my html: categoryindex.html template: {% load staticfiles %} {% load i18n pybb_tags forumindexlistbycat %} {

php - What is the solution of request entity too large -

i want add files more 1mb through tnymice editor. if files size less 1mb code work if size exceed 1mb request entity large error occurred. please tell solution of error. don't have knowledge error. here php_ini file code. please me. memory_limit = 20000m; max_execution_time = 10000; upload_max_filesize = 20000m; max_allowed_packet = 500m; post_max_size = 100m; request entity large the requested resource /phpcode_class.php not allow request data requests, or amount of data provided in request exceeds capacity limit. additionally, 413 request entity large error encountered while trying use errordocument handle request. you may need change upload.maxsize in config ( http://archive.tinymce.com/wiki.php/mcimagemanager:upload.maxsize ). if use plugin file uploads, should read configuration.

multithreading - How to multi-thread function calls on read-only data without cloning it? -

this question has answer here: lifetime of variables passed new thread 1 answer take simple example we're using immutable list of vectors calculate new values. given working, single threaded example: use std::collections::linkedlist; fn calculate_vec(v: &vec<i32>) -> i32 { let mut result: i32 = 0; in v { result += *i; } return result; } fn calculate_from_list(list: &linkedlist<vec<i32>>) -> linkedlist<i32> { let mut result: linkedlist<i32> = linkedlist::new(); v in list { result.push_back(calculate_vec(v)); } return result; } fn main() { let mut list: linkedlist<vec<i32>> = linkedlist::new(); // arbitrary values list.push_back(vec![0, -2, 3]); list.push_back(vec![3, -4, 3]); list.push_back(vec![7, -10, 6]); let result = calculate

linux - Running C code on android using termux or gnuroot? -

Image
i'm trying run c code on android device using various terminal emulator apps. have tried 3 far , of them giving me errors. first 1 tried popular: terminal ide. ever since later versions of android have been released app not compile c code due position independent executable (pie) error. next promising app called termux. this app allows me compile c code gcc gives me "permission denied" errors whenever try run simplest of codes. have examined , researched error thoroughly. have tried using chmod in various different ways checking permissions using ls -l , have tried compiling , running in both external sd card on internal device storage. understand sd card doesn't have exec permission still won't work in device's internal memory. have asked termux creator no avail. no matter cannot seem these codes run on android device. not rooted , don't plan root time soon. of these apps claim should work without rooting device. tried running c code in app (my last

symfony - Some property object are null -

i have problem , of course dont understand :) (and of course im french :) on table "evenement" have user linked. , when : $repository = $this->getdoctrine()->getmanager()->getrepository('appbundle:evenement'); $evt = $repository->findonebyid($evt); dump($evt) all ok, can read evt, when in profiler click on child object "user", property null (except id, usermail, mail, password) and same thing when : dump($evt->getuser()); why property not filled ? thank , sorry english. it's lazy loading . properties not beeing read db unless need them. try following: $repository = $this->getdoctrine()->getmanager()->getrepository('appbundle:evenement'); $evt = $repository->findonebyid($evt); $evt->getuser()->getroles(); // ot whatever properties user has. dump($evt) in case, dump show property populated.

c# - Handling Windows Popup like Save As, Choose File, Direct UI HWND InternetExplorer Download Strip....When System is Locked -

to handle windows popup i'd followed 3 different ways none of them works when system locked, kindly me this with of uiautomationclient.dll,uiautomationclientsideproviders.dll,uiautomationprovider.dll,uiautomationtypes.dll using system.windows.automation; automationelement ieelement = automationelement.fromhandle((intptr)ieobj.hwnd);//save popup handle popups automationelement saveelement = returnrequiredelement(ieelement, "save", "name"); if (saveelement.current.name.equals("save")) { var invokepattern = saveelement.getcurrentpattern(invokepattern.pattern) invokepattern; invokepattern.invoke(); } with of inputsimulator using windowsinput; inputsimulator.simulatemodifiedkeystroke(virtualkeycode.menu, virtualkeycode.vk_s); with sendkeys sendkeys.sendwait("^+{s}"); you know while running scheduler or batch process automation in system can't e

android - How to disable back button behavior? -

i need create pin entry. want numeric keypad visible always. problem is, cannot override hardware button behavior dismisses keyboard. onbackbuttonpressed isn't entered when button pressed dismissing keyboard. can do? () i think best option use specific keyboard. maybe can use xamarin component https://components.xamarin.com/view/testcomponent

mysql - Recombine link between element -

i have simple thing do, recombine 2 elements in table names, based on link. create table element ( id int(11) not null auto_increment, text varchar(100) not null ); create table link ( elem_1_id int(11) not null, elem_2_id int(11) not null ); i want have text of both elements in link : after : insert element (text) values ('door'); insert element (text) values ('key'); door = id 1, key = id 2 and insert link (elem_1_id,elem_2_id) values (1,2); how can use select have : | door | key | able : select e1.text, e2.text link, element e1 inner join element e2 link.elem_1_id=e1.id , link.elem_2_id=e2.id;

Yii2 Mongodb Migration -

in yii2 project have mongodb collections , migrations. want have sample code create multiple index on collection , want know there approach define columns data type in mongo @ all? mongodb nosql, every document can structured differently. without knowing documents structure, it's impossible create sample code. index creation simple , there no real limit how many indexes collection can have. every document don't need have indexed key - value pairs. at mongodb there no fixed type key (column). can insert: x:1 x:longint(1) x:"1" , have 3 documents, witch every 1 have different type of key x. to answer second question... /** * builds , executes sql statement creating new index. * @param string $name name of index. name quoted method. * @param string $table table new index created for. table name quoted method. * @param string $column column(s) should included in index. if there multiple columns, please separate them * commas. co

Android: while i select an item from navigation drawer, it is not moving to the new screen -

when set size of viewerpage want output image i set tabs in home footer menu. code follow: home.java package com.example.sachin.omcommunication; import android.app.fragmentmanager; import android.content.intent; import android.os.bundle; import android.support.design.widget.navigationview; import android.support.design.widget.tablayout; import android.support.v4.app.fragment; import android.support.v4.app.fragmentpageradapter; import android.support.v4.app.fragmenttransaction; import android.support.v4.view.gravitycompat; import android.support.v4.view.viewpager; import android.support.v4.widget.drawerlayout; import android.support.v7.app.actionbardrawertoggle; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.menu; import android.view.menuitem; import java.util.arraylist; import java.util.list; public class home extends appcompatactivity implements navigationview.onnavigationitemselectedlistener {