Posts

Showing posts from May, 2014

jquery - ASP.NET MVC RadioButtonFor Not Selected On Load -

there many other questions here on stack overflow , elsewhere, have spent far time sifting through them answers not ask 1 myself. have tried many of solutions found here , none of them work. my problem stated in title; radio buttons not being set on page load , can't figure out why. in code below model has boolean value cansubmit, cansubmityes , cansubmitno id's generated id's using viewcontext.viewdata.templateinfo.getfullhtmlfieldid("cansubmityes") and viewcontext.viewdata.templateinfo.getfullhtmlfieldid("cansubmitno") my radio buttons , corresponding labels set following: @html.labelfor(function(m) m.cansubmit, "yes", new {.for = cansubmityes}) @html.radiobuttonfor(function(m) m.cansubmit, true, new {.id = cansubmityes, .class = "submit-toggle-yes"}) @html.labelfor(function(m) m.cansubmit, "no", new {.for = cansubmitno}) @html.radiobuttonfor(function(m) m.cansubmit, false, new {.id = cansubmitno, .class

railstutorial.org - Advanced Testing Setup - Ruby on Rails Tutorial -

Image
i'm working through ruby on rails tutorial , test worked fine until installed advanced testing setup @ end on chapter 3. never got expected result now when run test receive message result when run rake db:migrate here's copy of controller it's warning of duplicate title in staticpagescontrollertest . last test looking contact page, change it's title 'should contact'. then try re-running rake rake db:migrate

algorithm - Permutations and indexes, python -

i create list of permutations of lets 0,1,2 perm = list(itertools.permutations([0,1,2])) this used accessing indexes in list in specific order. every time index accessed popped. when element popped, elements indexes higher popped elements index shift 1 position down. means if want pop list indexes [0,1,2] result in index error, since index 2 not exist when reach it. [0,1,2] should therefor popped in order [0,0,0]. more examples [0,2,1] = [0,1,0] [2,0,1] = [2,0,0] [1,2,0] = [1,1,0] right being handled through series of checks, question if knows smart way turn list of lists generated itertools desired list: [(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)] [(0, 0, 0), (0, 1, 0), (1, 0, 0), (1, 1, 0), (2, 0, 0), (2, 1, 0)] simply iterate through each tuple, , decrement indexes of each subsequent index greater element: l=[(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)] def lower_idxs(lst): new_row = list(lst) i, val in e

c# - Filter on Group By dataGrid -

i'm working on wpf - mvvm application. i have datagrid populated invoices filtered textbox works fine. now, grouped invoices invoice number (suppinvnumber), , filter doesn't work anymore. how can make work? viewmodel public class consultinvoiceviewmodel:viewmodelbase { public context ctx = new context(); private icollectionview _datagridcollection; private string _filterstring; private observablecollection<invoice> invoicecollection; public consultinvoiceviewmodel() { datagridcollection = collectionviewsource.getdefaultview(get()); datagridcollection.filter = new predicate<object>(filter); } public icollectionview datagridcollection { { return _datagridcollection; } set { _datagridcollection = value; onpropertychanged("datagridcollect

spring - Bad deserialize with jackson -

i try call url accept list. data sent {"contactavailableidlist":["1"],"contactidlist":["2","3"]} method on server @requestmapping(value = "/lodgers/{lodgerid}/associate/dissociate/contact", method = requestmethod.put) public void associatelodgerandcontact(@pathvariable("lodgerid") long lodgerid, @requestbody @valid final list<long> contactidlist, @requestbody @valid final list<long> contactavailableidlist) { lodgerservice.associatedissociatelodgerandcontact(lodgerid, contactidlist, contactavailableidlist); } "{"timestamp":1445958336633,"status":400,"error":"bad request","exception":"org.springframework.http.converter.httpmessagenotreadableexception","message":"could not read document: can not deserialize instance of java.util.arraylist out of start_object token\n @ [source: java.io.pushbackinputstrea

c# - How to stop thread if another thread has acquired lock on critical section? -

i have created scheduler executes piece of program in x minutes time interval. if program execution takes more time, next job should not wait current job completed. using system.timers.timer . _scheduler = new system.timers.timer(someminutes); _scheduler.elapsed += new elapsedeventhandler(ontimedevent); _scheduler.enabled = true; _scheduler.autoreset = true; private void ontimedevent(object source, elapsedeventargs e) { lock(obj) { //critical section } } if use lock, next thread waits current thread release lock. don't want behavior. if thread acquired lock object on critical section thread should exit without executing critical section you can use monitor . msdn: the monitor class controls access objects granting lock object single thread. object locks provide ability restrict access block of code, commonly called critical section. while thread owns lock object, no other thread can acquire lock. can use monitor class ensure no other thread al

amazon iam - Does amzon congnito support for authenticating for IAM user -

there basic inquiry, suppose mobile game vendors, , have game player(users). want confirm whether game player iam user ? if so, how authenticate iam user using amazon congnito ? document not mention .. there no api login/authenticate (verify passwords) aws iam users. amazon cognito allows authenticate players/users when login facebook, twitter, digits, amazon, google or openid connect compatible provider (see external identity providers in documentation). alternatively, if store users , credentials in own backend database, can use cognito's developer authenticated identities feature authenticate players ( docs , sample ). whether using external provider or developer authenticated identities, cognito enables provide users aws credentials can directly access resources in aws (e.g. such s3 or dynamodb).

Magento Add Instructions to Purchase Order Method on Onepage Checkout -

Image
magento 1.9.1 allows payment instructions bank transfer , cash on delivery, however, there isn't instructions option purchase order. i'd have same box type below purchase order number field when user selects purchase order on checkout. how can add instructions in following places: admin configuration (purchase order) one page checkout payment type: purchase order order review - payment method receipt / invoice page purchase order (no instructions) bank transfer (instructions) bank transfer (payment method instructions) admin configuration i solved going app/design/frontend/base/default/template/payment/form/purchaseorder.phtml , edidted source code here. from this: <ul class="form-list" id="payment_form_<?php echo $this->getmethodcode() ?>" style="display:none;"> <li> <label for="po_number" class="required"><em>*</em><?php echo $this->

assembly - Load byte offset confusion -

when code runs, 4 stored in $t2 . in thinking, though, in order load last byte, offset need 11, 0x04 12th byte after item . not understanding here? lbu $t2, 8($t0) .data item: .word 0x11111111 .word 0xabcd0123 .word 0x01020304 i suspect number being stored in 'little endian' format, integer 0x01020304 represented in memory bytes 04,03,02,01 (in order). 0x04 thought last byte in word (offset 11), first byte (offset 8).

python - How to plot result of np.histogram with matplotlib analog to plt.hist -

Image
this question has answer here: histogram matplotlib 6 answers i plot histograms this: data = [-0.5, 0.5, 0.5, 0.5, 1.5, 2.1, 2.2, 2.3, 2.4, 2.5, 3.1, 3.2] plt.hist(data, bins=5, range=[-1, 4], histtype='step') now, when have somehow large input data (larger memory), need fill histogram chunk chunk. e.g. this: h, bins = np.histogram([], bins=5, range=[-1, 4]) data in a_lot_of_input_files: h += np.histogram(data, bins=5, range=[-1, 4])[0] but question always, "how plot h again, looks previous matplotlib version. the solution came with, looks this: plt.plot(bins, np.insert(h, 0, h[0]), '-', drawstyle='steps') however, neither looks result identical, nor feel nice create copy of h plotting it. is there elegant solution missing? (i did not yet try use plt.bar , because bar-graphs don't work nicely, when 1 want

java - Selenide ElementsCollection throwing StaleElementException -

i've started using selenide recently, , i'm loving fluent code allows. have strange issue elementscollection, however. $$("some ref").filterby(not(attribute("an-attr-that-should-not-be"))).gettexts() this query intermittently returns stringified staleelementreferenceexceptions , , can't understand why. if run query in debugger, returns valid values, while during normal runtime (single thread application), get. the target element gwt combo box results list. could please point me in right direction? update: if it's relevant, i'm using internetexplorerdriver. chrome , chromedriver fire off staleelementreferenceexception point of test - time element no longer visible webelement reference have becomes invalid , must again. if combo showing/hiding or changing cause (need more details on combo , seems cause more specific) - try looking element when expect use instead of reusing reference again , again.

node.js - failing to install mongoose npm -

i installing mongoose npm. getting bunch of errors. did npm install of npm install -g node-gyp post read similar problem. however, problem did not seem go away. not able problem solve warning on one. insight hugely appreciated. ../lib/kerberosgss.c:509:13: warning: implicit declaration of function 'gss_acquire_cred_impersonate_name' invalid in c99 [-wimplicit-function-declaration] maj_stat = gss_acquire_cred_impersonate_name(&min_stat, ^ 1 warning generated. cc(target) release/obj.target/kerberos/lib/base64.o cxx(target) release/obj.target/kerberos/lib/kerberos_context.o solink_module(target) release/kerberos.node ld: library not found -lgcc_s.10.5 clang: error: linker command failed exit code 1 (use -v see invocation) make: *** [release/kerberos.node] error 1 gyp err! build error gyp err! stack error: `make` failed exit code: 2 gyp err! stack @ childprocess.onexit (/users/stevenkauyedauty/.npm-packages/lib/node_mo

javascript - How to minification of group of string data in angularjs? -

this code, tried following code not working var uglifyjs = require("uglify-js"); var result = uglifyjs.minify("hello world @123;", { fromstring: true }); console.log(result.code); in above code using uglifyjs. got error require undefined . want minimize above string using angularjs. var uglifyjs = require("uglify-js"); this code uglify-js , assign variable. the error require undefined possible because of not inserting requirejs in project. install requirejs using npm in project directory $ npm install --save bower-requirejs check more details on : https://github.com/yeoman/bower-requirejs notes : uglifyjs javascript parser, minifier, compressor or beautifier toolkit. not used minifying string. below basic example has javascript code not string . var result = uglifyjs.minify("var b = function () {};", {fromstring: true});

c# - "Cannot resolve symbol 'system'" and other namespaces when using ASP.NET 5 in VS2015 Community -

in vs2015 community, when create asp.net 5 project, many errors namespaces , i'm not sure why is. i have downloaded vs2015 community , have downloaded microsoft asp.net , web tools 2015 (beta8) , followed install instructions on web tools beta8 page , installed .net version manager (beta8) prior web tools. in vs2015, click on new project, go web within visual c# section , select "asp.net web application". select "web application" template within asp.net 5 preview templates. creates project. can start debugging click on green play button "iis express" text , page loads in web browser should. however, of namespaces flagged '"cannot resolve symbol". have tried uninstalling , reinstalling , has not worked. in solution explorer, have 2 references, dnx 4.5.1 , dnx core 5.0 , these have fair number of references within those. noticed dnx 4.5.1 has "framework assemblies" containing microsoft.csharp, mscorlib, system , system.core.

c++ - gcc dynamic linking dependency missing library? -

main.cc #include <stdio.h> #include <thread> int output() { printf("thread\n"); } int keke(); int main() { //keke(); std::thread th(output); th.join(); return 0; } keke.cc #include <unistd.h> #include <pthread.h> int keke() { pthread_attr_t attr; return pthread_attr_init(&attr); } makefile haha: libkeke.so g++ -std=c++11 -o haha main.cc -l. -lkeke -pthread libkeke.so: keke.cc g++ -o libkeke.so -fpic -shared keke.cc -pthread clean: rm libkeke.so haha make , result haha not load pthread.so, (link)$ ldd haha linux-vdso.so.1 => (0x00007fff65972000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9dee04a000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9dede34000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9deda6f000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9ded769000) /lib64/ld-linux-x86-64.so

javascript - Efficiency of VBOs vs BufferGeometry -

i curious kind of performance improvement should expect using vbo's in three.js. under impression recent geometry rewrite threejs did handled already, wrong. i'm trying wrap head around vbo's , trying gauge expect. working voxels, hesitant use voxel.js since seems dead , have odd use case not think supported under it. overall trying deepen understanding of working gpu , on performance improvements should expect fantastic.

objective c - Warning - whose view is not in the window hierarchy in IOS 9 -

i created 2 view controllers, viewcontrollerone , detailviewcontroller . , gave action uibutton , when button pressed go second view controller, - (ibaction)loginbuttonpressed:(uibutton *)sender { self.loginbutton.hidden= yes; self.aview.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"authentication.png"]]; lacontext* context = [[lacontext alloc]init]; nserror* error = nil; if ([context canevaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics error:&error]) { [context evaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics localizedreason:@"authenticate touch id" reply:^(bool success, nserror*error){ if (success) { dispatch_async(dispatch_get_main_queue(), ^{ self.loginbutton.hidden= no; self.aview.backgroundcolor = [uicolor clearcolor]; detailviewcontroller* detailviewcontroller = [[detailviewcontroller alloc]init]; [self pres

mysql - SQL still got duplicate rows after add DISTINCT -

here sql include 3 tables, trans , sys_org , sys_pay .select through mid (but not unique) i tried select distinct trans.mid,trans.a,sys_org.b,sys_org.c,sys_pay.d sys_org left join trans on sys_org.mid = trans.mid left join sys_pay on sys_org.mid = sys_pay.mid and returns duplicate rows,how fix it? return this: trans.mid trans.a sys_org.b sys_org.c sys_pay.d 1111 aaa bbb ccc ddd 1111 aaa bbb ccc ddd i sure rows distinct here distinct means whole row not specific column. if not create sqlfiddle can check it. further if want fetch unique value based on specific field should use group by.

javascript - Random Keyframe Positions Every Iteration to Create Falling "Matrix Code" -

i'm attempting make html web page animated css classes on many independent divs moving own randomly generated positions. have 20 elements randomly generated characters falling top of page , dissipating move along y-axis (like matrix code). edit: jsfiddle demo remember range wide, group of characters generate far off right (outside small viewing window) generating random char in top javascript <script type="text/javascript"> $(document).ready(function() { }); function generatechar() { var text = ""; var possible = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789«‘¥~‹÷´`≠¡Ë†()][¶#@…•–!£$%&/?^*駰ç_:è+òàù,.-"; text = possible.charat(math.floor(math.random() * possible.length)); return text; } </script> html of 20 divs <div id="m1 " class="timespan movement"></div> ... <div id="m20" class="timespan movement

oracle - Get current cell value in DBGrid -

in delphi application, use lookup fields, in unusual way. actually, wanna update field in underlying data set, if in same table. existing guides tell there no problem, join table , voila... envy if succeeded task such simple solution. not. btw think i'm getting close reach goal. have 1 question left: how hell can value just entered dbgrid cell? i tried dbgrid[fieldname].editvalue , .displaytext , show same value field.value , doesn't change after exiting column, because lookup field. sender.newvalue null. i'm using function update lookup table: procedure tkdgridform.lookupfieldchange(sender: tfield); begin if not assigned(sender) exit; sender.onchange := nil; if not assigned(sender.lookupdataset) exit; if sender.lookupdataset.locate(sender.lookupkeyfields, sender.dataset[sender.keyfields], []) sender.lookupdataset.edit else sender.lookupdataset.append; // how value entered? sender.value := kdgrid3[sender.fieldname].displaytext; s

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

Image
i try , create radar chart using chart.js has various colours each scaleline, or coloured between scalelines. wondering if possible? from: to: i have working graph, though there doesn't seem method change individual scale lines. kind regards leigh you can extend radar chart type this, so chart.types.radar.extend({ name: "radaralt", initialize: function (data) { chart.types.radar.prototype.initialize.apply(this, arguments); var originalscaledraw = this.scale.draw; var ctx = this.chart.ctx; this.scale.draw = function () { var linewidth = this.linewidth; // bypasses line drawing in originalscaledraw this.linewidth = linewidth; originalscaledraw.apply(this, arguments); ctx.linewidth = this.linewidth; var scale = this; // draw chart.helpers.each(scale.ylabels, function (label, index) { // color of

groovy - Throw IOException in multiple return results with Spock -

i'm testing error handling. want first call mockedobject.foo() throw new ioexception, , second return bar. tried following code, mockedobject.foo() >>> [{throw new ioexception()}, bar] but, when run test, error stating closure cannot cast bar, foospec$_$spock_feature_0_1_closure2 cannot cast bar how can mock behavior spock? edit: after seeing documentation referenced tim_yates, changed test to, mockedobject.foo() >>> firstbar >> {throw new ioexception()} >> secondbar this comes close enough testing needed test. following code threw same exception, i'm guessing spock setting return type of mocked method based on first object return. mockedobject.foo() >>> {throw new ioexception()} >> secondbar here, complete working example: @grab('org.spockframework:spock-core:0.7-groovy-2.0') @grab('cglib:cglib:3.1') @grab('org.ow2.asm:asm-all:5.0.3') import spock.lang.* class mytestspe

html - how can I give different css for safari browser -

i wanna give different css safari. because code works perfect in chrome , firefox. destroy structure in safari. so, want give different stylesheet safari. tried, button{ margin: 0px 10px 0px 0px /* safari */; margin: 0px 10px 0px 20px /* chrome */; } this 1 example, there many things, break in safari. you can use jquery target safari specifically, , load alternate css or entirely different stylesheet if wish: if (navigator.useragent.indexof('safari') != -1 && navigator.useragent.indexof('chrome') == -1){ // safari } else { // else in other browsers } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

xcode - How to add a background image -

Image
i have image view on storyboard, , when trying use background. no matter do, stays on top. how change background image, don't care weather programmatically through swift or through way. by moving of item up/down can set layer state. first 1 on second appear on first 1 then.... last 1 appear on top most. i hope you.

c# - searching video from Youtube channel which are uploaded only in that channel depending on the video Name -

i trying search video present in channel based upon video name of particular video. when tried following code, seeing videos present in youtube related search keyword. want fetch videos present in channel. using required latest library code here private async task run() { var youtubeservice = new youtubeservice(new baseclientservice.initializer() { apikey = "my api key ",//"replace_me", applicationname = this.gettype().tostring() }); var searchlistrequest = youtubeservice.search.list("snippet"); searchlistrequest.q = "myvid"; // replace search term. searchlistrequest.maxresults = 50; // call search.list method retrieve results matching specified query term. var searchlistresponse = await searchlistrequest.executeasync(); list<string> videos = new list<string>(); list<string> channels = new list<string>(); list<string>

flink: Flink Shell throws NullPointerException -

i using flink interactive shell execute wordcount. works file size of 10mb. 100mb file shell throws nullpointerexception: : java.lang.nullpointerexception @ org.apache.flink.api.common.accumulators.serializedlistaccumulator.deserializelist(serializedlistaccumulator.java:93) @ org.apache.flink.api.scala.dataset.collect(dataset.scala:549) @ .<init>(<console>:22) @ .<clinit>(<console>) @ .<init>(<console>:7) @ .<clinit>(<console>) @ $print(<console>) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ scala.tools.nsc.interpreter.imain$readevalprint.call(imain.scala:734) @ scala.tools.nsc.interpreter.imain$request.loadandrun(imain.scala:983) @ scala.tools.nsc.interpreter.imain.loadandrun

c# - How to export draft and deleted emails to email account of Exchange? -

can suggest me link or way synchronize(export) local emails of database exchange mail account? using ews download(import) emails of exchange mail account. if you're exporting mailbox, suggest new-mailboxexportrequest command via powershell. way can script run on schedule or run @ drop of hat. per: new-mailboxexportrequest new-mailboxexportrequest -mailbox samaccountname -filepath "\\server\share\mbxnameorwhatever.pst" the caveat "exchange trusted subsystem" acct in ad needs read/write access share you're using , acct that's running command needs "mailbox import export" role or have available in role group. if read through new-mailboxexportrequest examples, you'll see can add pretty neat features, , default include mailbox dumpster (really deleted items). hope helps, if not, lemme know. -chase

How to read a specific key-value pair from Lua-returned table in C++ -

i writing lua script return table this: return_table = { "service"="ish" "worker"="tim" "place"="seattle" "abbrevation"="its"} after returning table, have c++ code needs elements returned lua. problem that, want c++ code read specific key-value pair table, means want realized in c++: city = return_table["place"] would possible? know in c++ lua api, once "return" called, lua script stop, cannot multiple return lua c++ wherever need returned value. can return table full of elements need, reading them in c++ of random order.....

How to create current date folder from ffmpeg command -

i writing code ffmpeg command .but want value stored in current date folder . there way create current date folder in ffmpeg command . not in batch files . try this #!/bin/bash now=$(date +"%m_%d_%y") outdir=/pathtodirectory/$now if [[ ! -d "$outdir" ]]; mkdir -p "$outdir" fi ffmpeg -i input "$outdir"/output

java - Procrun with org.apache.commons.daemon.Daemon -

i wrote daemon using apache commons sample code: public class lockdaemon implements daemon { @override public void init(daemoncontext context) throws daemoninitexception, exception { logmanager.getlogger().info("initialized arguments {}", context.getarguments()); } @override public void start() throws exception { logmanager.getlogger().info("start called"); } @override public void stop() throws exception { logmanager.getlogger().info("stop called"); } @override public void destroy() { } } unfortunately example not mention how install class procrun. procrun needs static "start method", not have when using code above. so start (and stop) method needs set procrun make code above work? this question further discussed in thread: howto setup daemon implementation windows service

powershell - How to log an eventlog only when the script gives a red error? -

what want - log event in eventlog - application, when scheduled script gives red error in session... i know how log write-eventlog, cant limit when gives red error saying maybe wrong. your response appreciated! one way clear $error before statemtent, check if error occurred: $error.clear() invoke-something if ($error.count -gt 0) { write-eventlog ... } or turn errors terminating errors , use try..catch statement: $eap = $erroractionpreference $erroractionpreference = 'stop' try { invoke-something } catch { write-eventlog ... } $erroractionpreference = $eap

amazon web services - AWS RDS painfully slow when connecting from local machine -

i have aws rds instance , running. when db queried website (also on aws, same region) runs beautifully. but, if try connect database local developments machine takes ages query execute. know why? have opened security group allow connections (while try connect local machine).

deployment - Dokku zero downtime deploy CHECKS fails -

started work 0 downtime deploy in dokku , fails check checks file. checks file content, /home/dokku/oktob/checks wait=30 # wait 1/2 minute timeout=60 # timeout after minute attempts=10 # attempt checks 10 times /pages/about info@oktob.io /assets/twitter-f5f5e668ebe5e0324b1cc9f568d47e2d.jpg the app running @ 178.62.102.155 , first path about page , second image this deployment failure message -----> discovering process types procfile declares types -> web -----> releasing oktob... -----> deploying oktob... -----> checking status of postgresql found image postgresql/oktob database checking status... ok. -----> running pre-flight checks waiting 5 seconds ... checking with: curl -q --compressed --fail --location --max-time 30 http://172.17.1.167:5000wait=30 remote: % total % received % xferd average speed time time time current remote: dload upload total spent left speed r

sugarcrm - How to solve undefined labels in suiteCRM -

i getting error in suitecrm : "networkerror: 404 not found - /cache/jslanguage/home/en_us.js?v=9w_drn8pphmvoasvu564ua" please me how can solve it? go admin > repair , "quick repair & rebuild". execute changes shown @ bottom of page. if doesn't work, go admin > repair , "rebuild .htaccess file" , afterwards, admin > repair , "quick repair & rebuild" again.

ajax - Javascript uploading duplicates -

i have bit of html area user can drag , drop files upload. nested within, "browse files" button clicks() hidden file input should choose traditional upload method. works far exception if user drags , drops multiple files (more one), uploads each of them twice (3 dropped files uploads 6 files). not if user uploads via browse files button, i've narrowed down on ondrop function , included below. can post additional code if problem isn't in code block. update: logged variable droppedfile console once before for loop , once after , noticed when logged after loop , 2 files dropped, variable contained 2 filelists , each list contained both of files (making 4 uploads). how for loop altering variable?? dropzone.ondrop = function(e){ e.preventdefault(); this.classname = 'dropzone'; var droppedfile = e.target.files || e.datatransfer.files; (i=0; < droppedfile.length; i++) { if(droppedfile[i].type != "text/plain" &&

C Reading numbers from file and placing them in range bins and printing to file -

i'm having issue program. what i'm trying read lines file input.txt, first line number of integers in file. input.txt formatted 5 //num of ints 2 40 49 90 70 then, want print file output.txt output.txt basically. range 0-9 1 range 10-19 0 range 20-29 0 range 30-39 0 range 40-49 2 range 50-59 0 range 60-69 0 range 70-79 1 range 80-89 0 range 90-99 1 the ranges go 99. there 10 ranges. there never number on 99 after initial line in input.txt. the issue i'm having program works fine long number of guesses 10. know has how set range numbers increase, since it's tied loop. i'm lost on how properly. any advice? thanks, in advance! what i've got far: /* print numbers in range file output.txt list of numbers in file input.txt */ #include <stdio.h> int main(void) { file *input; file *output; int num_guesses, nums, bin_count=0, guesses_in_bin; int i, j, k, firstline; int bin_start = 0; int bin[10]; input= fopen("i

javascript - How to show/hide fields on modal in Ruby on Rails? -

i writing application using rails 4.1 , ruby 2.1.2. has following show.html.erb view assignment model: <h1><%= "#{'source url'}"%> <div class="source-url"><%= @assignment.source.url %></div></h1> <%= link_to new_assignment_contact_path(@assignment), id: 'display_modal', class: "add-btn btn-big" %> <i class="i15"></i> add contact <% end %> <br /> <br /> <table> <thead> <tr> <th>contact email address</th> <th>contact name</th> <th>title</th> <th>phone</th> <th>notes</th> </tr> </thead> <tbody> <% @contacts.each |contact| %> <tr> <td><%= contact.contact_email %></td> <td><%= contact.contact_name %></td> <td><%=

javascript - Open and Close a Simple Popup Window in Chrome Extension -

i have chrome extension should allow users log in google via popup because won't display in iframe. doing window.open() worked fine except not close pop-up after user logged in. i have been trying no success use chrome.windows.create instead of window.open in hopes able close popup once detect via url have logged in. in popup_google.js have simple function: function login(login_url) { // var win = window.open(login_url, "windowname1", 'width=800, height=600'); chrome.windows.create({'url': 'http://stackoverflow.com/', 'type': 'popup'}, function(window) { }); } the login function called via "onclick" this: <a href='#' onclick='login("https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http%3a%2f%2fdev.sbceoportal.org%2fcastest%2fwp-login.php&client_id=191567976061-9uksb59gedrtlsmoeo1fouov94370j96.apps.googleusercontent.com&scope=openid+email+ht

Smarty / PHP does not show error why it's not rendering anymore -

this little bit hard explain feel free ask further details. scenario: built website using smarty template engine. alle texts use located in lang.php file. wanted to same before (in first step), reading "language array" databse. but call textreading function smarty not render anymore, though not override existing texts. looks this: $content = new content("en"); $result = $content->gettexts(); // calling, not changing // var_dump($result) ==> working! $lang_en = array ( ... ); $lang_de = array ( ... ); the function gettexts working perfectly. can dump results, or can leave table empty - nothing changes, code stops working suddenly. actual language variables ($lang_en, $lang_de) or not yet affected call. i tried activate log: error_reporting(e_all); ini_set("display_errors", 1); nothing seems help. any ideas? update: problem calling datbase. if not call - working (for example returning "test" before actual call). proble

openedge - How to check the availablility of a Progress database record with the values stored in a .csv file as input? -

i uploading csv file of records check if these records available in specific progress database table. how proceed? assuming lot of things here since you're not specifying much. assuming have file containing animal id's, 1 per row: file.csv ========= 1 2 3 assuming have database table called animals fields id , animalname can (a naive approach - assuming input data formatted, no error checking etc): /* define temp-table store file data in*/ define temp-table ttanimal no-undo field id integer. /* input files */ input value("c:\temp\file.csv"). repeat: /* assumption: data clean , formatted! */ create ttanimal. import ttanimal. end. input close. /* each animal id read file. locate database record , display name */ each ttanimal: find first animal no-lock animal.id = ttanimal.id no-error. if available animal do: disp animal.animalname. end. end.

javascript - Ignore directive on page load -

i have setup below directive give focus 'newest' input field added page. works other 1 problem. on page load last input on page selected. want directive ignored on page load can instead set focus on button #new-query id. there anyway tell directive begin watching scope after user interacts page? 'use strict'; angular.module('app') .directive('setfocus', setfocus); function setfocus($timeout, $parse) { return { link: function(scope, element, attrs) { var model = $parse(attrs.setfocus); scope.$watch(model, function(value) { if (value) { $timeout(function() { element[0].focus(); }); } }); } }; } an example of how use directive: <div ng-show="parameter.repeatable" ng-repeat="index in parameter.values track $index"> <input name="parameter" type="text" ng-model="parameter.values[$index]" set-f

oracle - SQL - find rows that have the same set of values in a column -

i have table , want select rows have same set of values appear in column , return them pair of column. for example, let's have table named table: c1 c2 1 1 1 2 1 3 2 1 3 1 3 2 3 3 4 1 4 2 when run query, should return row: 1 3 because these 2 values in c1 have same set of values in column c2 (1,2,3). i have incorrect query below returns rows have @ least 1 matching value in c2 , can't figure out how correct it. select distinct t1.c1, t2.c1 table t1, table t2 t1.c1 != t2.c1 , t1.c2 = t2.c2 , t1.c1 < t2.c1 group s1.suppid, s2.suppid; any appreciated, thanks. as not specify, 1 handle case of 2 sets of matching c2 values, outputting 2 rows - 1 each matched set. with thetable ( select 1 c1, 1 c2 dual union select 1 c1, 2 c2 dual union select 1 c1, 3 c2 dual union select 2 c1, 1 c2 dual union select 3 c1, 1 c2 dual union select 3 c1, 2 c2 dual union select 3 c1, 3

java - Do we really need ServiceFacade Design Pattern while consuming a web-service? -

i wanted know if servicefacade design pattern required while consuming web-service. http://soapatterns.org/design_patterns/service_facade any insight , code snippet helpful. thanks in advance !! the aim of facade provide forward (or client) facing endpoint, in turn provides needed communication , hide behind outside world. having facade allow abstract behaviour without exposing it. allow make changes without potentially affecting endpoint itself. depends on type of changes obviously, if have requirements require change in logic might possible actual input , output of service remain untouched. if away service facade, changes code might require clients update code end, , who, reason not update might end broken system or else have cater multiple versions.

curl - Login using php -

i have tried following code login authentication not working. <?php define('url', 'https://xxxxxxxxxxxx.com'); function authenticate($uname, $pass) { $url = url . 'issue/bug-5555'; $curl = curl_init(); curl_setopt($curl, curlopt_userpwd, "$uname:$pass"); curl_setopt($curl, curlopt_url, $url); curl_setopt($curl, curlopt_returntransfer, 1); curl_setopt($curl, curlopt_followlocation, 1); curl_setopt($curl, curlopt_ssl_verifypeer, 0); // ssl ensure cert curl_setopt($curl, curlopt_ssl_verifyhost, 1); /// ssl ensure cert $issue_list = (curl_exec($curl)); echo $issue_list; return $issue_list; } ?> you didn't mention trying achieve code. trying ticket info, post issue? using api... well here's script works jira api. <?php $username = 'test'; $password = 'test'; $url = "https://xxxxx.xxxxxxx.net/rest/api/2/project"; $ch = curl_init(); $headers = arr

java - Create Dervice Instance by passing base instance -

hi basic level question. need know best way handle this. parent class. public class parent { private string familyname; public parent() { } public parent(string familyname) { this.familyname = familyname; } public string getfamilyname() { return familyname; } public void setfamilyname(string familyname) { this.familyname = familyname; } child class. public class child extends parent { string name; public child(parent parent) { super(parent.getfamilyname()); } public string getname() { return name; } public void setname(string name) { this.name = name; } @override public string tostring() { return "child{" + "name='" + name + '\'' + "familyname='" + getfamilyname() + '\'' + '}'; } } or there support library create c