Posts

Showing posts from April, 2013

java - Jar file can't write files to local machine -

i know java applets have bunch of restrictions can , cannot access, thought jars different. record, i'm new jar files , like. i have written gui data entry tool, , able write formatted data text file. works when program run eclipse. however, once packaged in jar file, can no longer write-to-file piece work. doesn't error out either. there's no single line of code share here, program allows user is: look @ data sheet transpose data text fields in gui click save , produce text file containing data in selected directory that last step runnable jar failing me. click save , dialog box shows , everything, when check output folder, no file produced. note: not have incorrect path--i've checked that. said above, works in eclipse. is there restriction i'm missing? ideally i'd able share executable file few others divvy data entry task. there format packaging program allow work? (i've spend long time on , make work in java) below actionlistener save...

android - Configuration change using Robolectric -

to retain asynctasks across configuration changes, use fragment-based solution setretaininstance(true), hosts each asynctask , calls listening activity, similar solution http://www.androiddesignpatterns.com/2013/04/retaining-objects-across-config-changes.html ultimately, purpose test asynctask's retention functionality throughout configuration changes using robolectric, need start setting actual configuration change correctly. however, seems can't mimic exact reference behavior occurs during configuration change. real app: when running real app, on configuration change, activity destroyed , recreated while fragment retained, seems working. can see checking references before , after configuration change (example references used below): real app, before: activity: abc fragment: xyz real app, after: activity: bca fragment: xyz (properly retained , reattached) case 1: when running recreate() on activity in robolectric test, however, activity doesn't se...

Batch File - Read from a text file with spaces -

i wrote batch file read text file located in specific path. loop reads text file located in folder. if same path had spaces loop can't read it. if wrap path in quotes still can't read it. path exist, checked multiple times, , confirmed loop works pathnames contain no spaces. is i'm doing wrong, or, limitation of batch loop? code: for /f "tokens=* delims=" %%x in (c:\users\someuser\virtualboxlog\log.txt) set read=%%x if path contained space example c:\users\someuser\virtualbox log\log.txt can't read text file, if wrap quotes , folder virtualbox log existed. the solution problem enclosing path in quotes: "c:\users\someuser\virtualbox log\log.txt" but problem rises: for interprets quotet string string, not filename. to work around this, use usebackq keyword: for /f "usebackq tokens=* delims=" %%x in ("c:\users\someuser\virtualbox log\log.txt") set read=%%x

How To Use android:largeHeap:true In API <= 10 in Android -

how use android:largeheap:true in androidmanifest.xml cin api level 10 , bellow ? defined in api 11 , above. that attribute did not exist prior api level 11, , there no documented , supported way of requesting large heap prior api level 11. also, note there no guarantee get large heap on api level 11+ devices.

largest palindrome product in java -

i have written code fourth question of euler project. the question is: palindromic number reads same both ways. largest palindrome made product of 2 2-digit numbers 9009 = 91 × 99. find largest palindrome made product of 2 3-digit numbers. here code: public class largestpalindromeproduct { private static int product;//integer palindrome number private static string palindrome;//string palindrome private static int largestpalindrome(){ for(int = 100; i<=999; i++){ for(int k = 100; k<=999; k++){ product = i*k; palindrome = integer.tostring(product); for(int j = 0; j<= palindrome.length()-1; j++){ if(palindrome.charat(j) == palindrome.length() - 1 - j){ return product; } } } } return product; } public static void main(string[] args) { int largestpalindrome = largestpalindrome(); system.out.println(largestpalindrome); } } this ...

python - Unzip my_file.zip pulled from s3 using boto -

i trying use boto open .zip file have in s3 . trying work data directly, want avoid creating temporary files. in [201]: import stringio in [202]: import boto in [203]: conn = boto.connect_s3() in [204]: my_bucket = conn.get_bucket('my_bucket') in [205]: my_list = [ele ele in my_bucket.list('my_file.zip')] in [206]: f = stringio.stringio() in [207]: my_list[0].get_file(f) in [208]: f.seek(0) if file not zipped use: my_content = my_list[0].get_contents_as_string() but since zipped, getting garbage. an answer question want (i borrowed bit of attempt it) using gzip , can't find using zip . tried using zipfilezipfile , read , extract , extractall methods don't seem want. you should python module gzip : https://docs.python.org/2/library/gzip.html you should able stringio gzip. . from boto.s3.connection import s3connection import gzip stringio import stringio s3conn = s3connection() # assuming .boto has been setup bucket = s3co...

How to put different color random dots in a rectangle separated by a diagonal (JAVA) -

my problem cant diagonal resize properly. if run code diagonal on wrong side , when expand vertically doesn't maintain perfect diagonal 1 corner another. below have code program , driver. import javax.swing.jframe; public class points { public static void main(string[] args) { jframe frame = new jframe("points"); frame.setdefaultcloseoperation(jframe.exit_on_close); pointspanel panel = new pointspanel(); frame.getcontentpane().add(panel); frame.pack(); frame.setvisible(true); } } here main program import javax.swing.jpanel; import java.awt.dimension; import java.awt.graphics; import java.util.random; import java.awt.color; import java.lang.math.*; public class pointspanel extends jpanel { private final int max_points = 20000; private final int length = 1; private int x,x1,y,y1; private random random; double slope,b,c,g; public pointspanel(){ random = new random(); setbackground(color.black); setpreferredsize(new dimension(...

templates - C++ same name for non-virtual function in derived class conflicts with `final` specifier -

this has feeling of complete newbie question, why following code not compile when final specifier used b::operator() ? struct { virtual void operator()() const = 0; }; // crtp-component not necessary here // possibly makes more sense in applied in reality // template<typename derived> struct b : { virtual void operator()() const override final { static_cast<derived const&>(*this).operator()(); } }; struct c : b<c> { void operator()() const { //do } }; int main() { c()(); } g++ prints following error message : main.cpp:17:14: error: virtual function 'virtual void c::operator()() const' void operator()() const ^ main.cpp:9:22: error: overriding final function 'void b<derived>::operator()() const [with derived = c]' virtual void operator()() const override final ^ i have thought works non-virtual c::operator() not override virtu...

javascript - Wow.js Working on Images But Not Other Elements -

from i've read, should possible place wow classes on elements divs , forms, far i've gotten work on img tags. the below code works: <img src='blah.jpg' class="wow fadeinup"> this code not work: <div class="wow fadeinup"> i have proper css file , js file loaded , have made sure add doctype html tag. is there i'm missing?

javascript - Radio button clicks change function -

we have 2 radio buttons when change button need call function. below code. <input id="ordertype" type="radio" align="top" name="ordertype" value="new order" checked=""> <input id="ordertype" type="radio" align="top" name="ordertype" value="additional order (add items previous order)"> jquery code jquery(document).ready(function(){ $('input:radio[name="ordertype"]').change(function(){ if($(this).val() === 'additional order (add items previous order)'){ var removepages = 'boothlightingdiv'; }else{ var removepages = 'furnishingsprovideddiv'; } }); }); call function togglediv('boothsizediv', removepages); based radio button need change togglediv function parameter.any help? i this: http://jsfiddle.net/bobrierton/5lc17p1t/1/ $(document)....

javascript - Pass err into express.js Router, Node.js -

can err passed express.js router? there no answer in express.js documentation related express middleware, routers, , error handling (i can't post links due lack of reputation). i thoroughly searched stackoverflow , couldn't find answer. i google searched pretty thoroughly, , couldn't find answer. example: app.js var express = require('express'); var myrouter = require('./myrouter.js'); var app = express(); app.use(function(req, res, next){ console.log('about call next("someerror")'; next('someerror'); }); app.use(myrouter); app.use(function (err, req, res, next){ console.log('handling error in main , err is:'); console.log(err); }); myrouter.js var express = require('express'); var myrtr = module.exports = express.router(); myrtr.use(function(err, req, res, next){ console.log('handling error in myrouter.js'); next('anothererror'); }); i did testing express version ...

batch file - Strange Behavior with Wildcards and DIR Command in Command Prompt -

i've noticed when using dir in windows command line 1 particular case wildcards don't function i'd expect. example: dir *.doc runs similar dir *.doc* i've noticed behavior when wildcard directory precedes period (which important , frequent case). whats stranger if run either: dir *.d dir *.do it execute expected. it's once hit 3 character extensions strange behavior starts. mentioned runs similar command above because if contents after *. not extension not return file. e.g.: dir *.tar will not return file.tar.gz will return file.targa why , how can avoided? the extension part after last dot. before last dot filename, including dots ordinary characters. also remember dir matches short , long names.

c - How to get the value of the base pointer, stack pointer and saved base pointer -

i know how use gdb , used info frame can't find value of base, stack , saved base pointer. how these? can find them in information info frame gives me or have else? info reg tell contents of registers, including stack pointer ( rsp on 64 bit x86) , base pointer ( rbp on 64 bit x86): (gdb) info reg rax 0x401340 4199232 rbx 0x0 0 rcx 0x0 0 rdx 0x7fffffffe608 140737488348680 rsi 0x7fffffffe5f8 140737488348664 rdi 0x0 0 rbp 0x0 0x0 rsp 0x7fffffffe508 0x7fffffffe508 r8 0x7ffff7dd4e80 140737351863936 r9 0x7ffff7dea560 140737351951712 r10 0x7fffffffe2d0 140737488347856 r11 0x7ffff7a50290 140737348174480 r12 0x4013e2 4199394 r13 0x7fffffffe5f0 140737488348656 r14 0x0 0 r15 0x0 0 rip 0x7ffff7a50290 0x7ffff7a50290 <__gi_exit> eflags 0x202 [ if ] cs...

How can I sort an array in javascript without modifying it? -

array.sort() in javascript modifies underlying array: > = [5,1,3] [ 5, 1, 3 ] > a.sort() [ 1, 3, 5 ] > [ 1, 3, 5 ] > is there anyway sort array not in place, sorted version returned copy. this? > = [5,1,3] [ 5, 1, 3 ] > b = a.some_function() [ 1, 3, 5 ] > [ 5, 1, 3 ] > b [ 1, 3, 5 ] not without writing own function it. can, of course, clone , then sort: var b = a.slice(0).sort(); example: var = [5,1,3]; var b = a.slice(0).sort(); snippet.log("a: " + json.stringify(a)); snippet.log("b: " + json.stringify(b)); <!-- script provides `snippet` object, see http://meta.stackexchange.com/a/242144/134069 --> <script src="http://tjcrowder.github.io/simple-snippets-console/snippet.js"></script>

c++ - Understand the following pointer code written in c -

i trying understand piece of code , not experienced programmer. can please me understand meant statement here? dimage *filterdimage; float *lp = filterdimage->pixels[0];//statement a, what's going on? here, dimage struct defined : typedef struct dimage{ int width; int height; float **pixels; } filterdimage->pixels accesses pixels member in filterdimage . filterdimage->pixels[0] accesses first element in array pixels points to. since pixels of type float** , elements of type float* . float *lp = filterdimage->pixels[0] assigns pointer lp .

java - Transliteration with Android -

i want transliterate (not translate!) text arbitrary (as far possible) languages english in android app. there built-in way? i've found https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/icu/transliterator.java doesn't seem available default (at least ide doesn't find it). need add code, suggested comment in where can jar import libcore.io? ? alternately, add icu4j dependencies , follow icu4j cyrillic latin . large dependency (though proguard should help). finally, add transliteration cyrillic myself , wait until/if needs other languages (with obvious drawbacks). under hood, android has of icu4j available under android.icu , subset exposed public api. if want use class isn't exposed, can write code uses class , should work fine. however, doing not technically supported, there version of android somewhere doesn't have class whatever reason , causes code break. (this unlikely happen in practice, possible noneth...

JavaScript - Gulp/Browserify: SyntaxError: Unexpected token -

for whatever reason, browserify , gulp stopped working. example, here's gulp js script bundle javascript. gulp.task('js', function() { gulp.src('src/js/*.js') .pipe(plumber()) .pipe(gulp.dest('js')); return browserify('./src/js/main', { debug: true }) .bundle() .pipe(source('bundle.js')) /* .pipe(streamify(uglify()))*/ .pipe(gulp.dest('.')) .pipe(notify({ message: 'javascript has been bundled browserify!'})); // .pipe(livereload()); }); and here main.js : var ajaxchng = require('./ajax-changelog'); ajaxchng(); and inside src/js/ajax-changelog.js this: module.exports = { console.log('hello world'); }; but when gulp js , get: λ gulp js [19:11:50] using gulpfile c:\wamp\www\osrsmap\gulpfile.js [19:11:50] starting 'js'... events.js:85 throw er; // unhandled 'error' event ^ syntaxerror: unexpected token ... ...

java - Parent notification within array of objects -

so, i'm working on java program utilizes created class (we'll call "hair"). however, inside class, can have array of objects objects of class "hair". so, basically, looks this: hair (level 0) hair (level 1) hair (level 2) hair (level 1) now, issue i'm having this: let's say, instance, change field in level 2. want level 1 notified, don't know how notify level 1. there way can have object talk object that's containing it? now, if using android, maybe use broadcast receiver, i'm not familiar in java or way directly talk "parent" hair level. suggestions? for object talk parent must know it's parent. example: class hair{ hair parent; public hair(hair _parent){ parent = _parent; } public void notify(string data){ ... need } public void changehair(...){ ... if(parent != null) { parent.notify(...); } } if need more let me know. edit: notify or down the objec...

c++ - Visual Studio, Defined Function Not Recognized? -

i using visual studio professional 2013. have attached header file function prototypes main file. compiler saying "'assignnum': identifier not found." have absolutely no clue what's wrong, figured else might. here's relevant code: main file #include "bullets.h" #include "stdafx.h" #include <ctime>`enter code here` #include <cstdlib> int main() { srand(time(null)); greetings(); assignnum(); return 0; } header file #include "stdafx.h" using namespace std; void greetings(); void assignnum(); if using precompiled header feature... #include "stdafx.h" must first line in cpp file. remove h file.

regex - sed: find and replace a string (with characters like $ and space) in a binary file -

i have file, there string tail +390 $0 > $outname . need find line , replace tail -n +390 $0 > $outname . trying sed -- sed -i -e 's/tail +390 \$0 > \$outname/tail -n +390 \$ > \$outname' file.bin ; and sed -i -e 's/tail\ +390\ \$0\ >\ \$outname/tail\ -n\ +390\ \$\ > \$outname' file.bin ; the file trying modify binary file. but can not work, hint appreciated. you need add / @ last because sed syntax incorrect. it's s/search/replace should s/search/replace/optional-modifiers . sed -i 's/tail +390 \$0 > \$outname/tail -n +390 \$0 > \$outname/' file example: $ echo 'tail +390 $0 > $outname' | sed 's/tail +390 \$0 > \$outname/tail -n +390 \$0 > \$outname/' tail -n +390 $0 > $outname

c# - When I use DataGridRow for Getting data from selected row content, Null data is returned always -

i use wpf metro datagrid. when use datagridrow getting data selected row content, null data returned @ var 'rowview'. problem? this code. private void datagrid_mousedoubleclick(object sender, mousebuttoneventargs e) { iinputelement element = e.mousedevice.directlyover; if (element != null && element frameworkelement) { if (((frameworkelement)element).parent datagridcell) { datagrid grid = sender datagrid; if (grid != null && grid.selecteditems != null && grid.selecteditems.count == 1) { datagridrow rowview = grid.selecteditem datagridrow; if (rowview != null) { projectinfo addjobwindow = new projectinfo(); addjobwindow.showdialog(); } } } } } <datagrid x:name="dgpro...

android - How to have decimal to int to decimal again? -

i developing app calculation. on tab have 3 edittexts. 1 edittext price input , 1 percentage of , last 1 result them both. got task make these edittexts shown currency(i using decimal format). able display result currency. price input need in decimal format, somehow code wont work(its bad,really bad implementation). idea make diplayed value decimal format meanwhile value being calculated , result displayed on edittext result box. further task make these 3 edittext auto generated user input value anywhere(could on price edittext , percentage or result , price edittext ) example: price edittext: 100000 percentage 30 result: 30000 (auto generate itself(means fill value)) or price edittext 100000 percentage: 30(auto generate itself(means fill value)) result 30000 i able first 1 using textwatcher, code: edittextforprice.addtextchangedlistener(new textwatcher() { @override public void ontextchanged(charsequence s, int start, int before, ...

javascript - bacon.js Bus.plug: Uncaught Error: not an Observable : [object Object] -

i trying baconjs's tutorial. https://baconjs.github.io/tutorials.html#content/tutorials/2_ajax but, got error @ "bus.plug" var cart = shoppingcaret([]) var cartview = shoppingcartview(cart.contentsproperty) var newitemview = newitemview() cart.addbus.plug(newitemview.newitemstream) error: uncaught error: not observable : [object object] shopbundle.js:145 assertobservable shopbundle.js:2650 bus.plug i use follows baconjs@0.7.53 jquery@2.1.3 bacon-jquery-bindings@0.2.8 webpack 1.7.3 what doing wrong? thanks. edit: 2015/3/25 cause newitemview.newitemstream not observable. ( newitemview.newitemstream instanceof bacon.observable returns false.) and newitemview.newitemstream eventstream eventstream {takeuntil: function, sampledby: function, combine: function, flatmaplatest: function, fold: function…} isn't eventstream observable? i have made newitemstream follows: var $button = $('#addbutton'); var $namefield = $('#namete...

cannot type into tinymce textarea when jquery-ui.min.js is included - MASTERPAGE RELATED -

Image
i checked many resources not find else having same issue. tinymce not clickable when include this: <script src="../scripts/jquery-ui.min.js"></script> if not have it, works perfect. if include it, cannot click inside textarea , type something. problem need include jquery-ui file. do have idea going on here? <link href="../content/bootstrap.min.css" rel="stylesheet" /> <link href="../content/jquery-ui.min.css" rel="stylesheet" /> <script src="../scripts/jquery-1.9.1.min.js"></script> <script src="../scripts/jquery-ui.min.js"></script> <script src="../scripts/bootstrap.min.js"></script> <script src="../scripts/tinymce/tinymce.min.js"></script> <script src="../scripts/tinymce/jquery.tinymce.min.js"></script> <script> tinymce.init({ selector: "textarea#txt_postcomment...

javascript - How to Hide/Show 'div' using jQuery? -

how can show text box depending on user's selection in dropdown box? <select name="sites" id="select5" required="yes"> <?php for($i=0;$i<=128;$i++){ echo "<option>".$i."</option>"; } ?> </select> <div id="yes"> other: <input class="input-text" type="text" name="name"/> </div> if user selects 1 - text box not show. if user selects more 2 -> <div id="yes"> show. here's jquery: <script type="text/javascript"> $(document).ready(function(){ $('#yes').hide(); $("#select5").change(function(){ $('#yes').hide('slow'); $("#" + this.value).show('slow'); }); }); </script> any suggestions? you can call hide/show based on value of select like $(...

Can we run android vm on google compute engine? -

i installed androidx86-4.4-rc2 in virtual box on macos yosemite system, , fowllow link upload image gce, when run command ~/google-cloud-sdk/bin/gcloud compute images create vbox-ubuntu --source-uri gs://bucket_name/vbox-image.tar.gz the gce tell me 'the tar archive not valid image'. so, can run android vm on google compute engine? ravello systems can run android vm on gce , how did it? thank you!

c# - How do i make XML from a List? -

this question has answer here: how create xml file list of objects 6 answers assume have class public class test1 { public int binid { get; set; } public int number1 { get; set; } public decimal holgraphic { get; set; } public test1(int id, int num, decimal hol) { binid = id; number1 = num; holgraphic = hol; } } assume have created list collection of test1 in class called test2 . in test2 class have created collection t of test1 . list<test1> t = new list<test1>(); assume list contains 2 test1 objects. how convert list xml have following schema? <t> <test1> <binid>23</binid> <number1>123</number1> <holographic>2345.12</holographic> </test1> <test1> <binid>3</binid> <number1>346233</number1> <holog...

ios - how to connect RSS feed with swift -

i want make application news. decided use rss feed somehow rss feed doesn't come up. here code how declare variable var parser = nsxmlparser() var feeds = nsmutablearray() var elements = nsmutabledictionary() var element = nsstring() var ftitle = nsmutablestring() var link = nsmutablestring() var fdescription = nsmutablestring() this in viewdidload function feeds = [] var url: nsurl = nsurl(string:"https://www.apple.com/main/rss/hotnews/hotnews.rss")! parser = nsxmlparser(contentsofurl: url)! parser.delegate = self parser.shouldprocessnamespaces = false parser.shouldreportnamespaceprefixes = false parser.shouldresolveexternalentities = false parser.parse() this didstartelement function. func parser(parser: nsxmlparser!, didstartelement elementname: string!, namespaceuri: string!, qualifiedname qname: string!, attributes attributedict: [nsobject : anyobject]!) { element = elementname // instantiate feed properties ...

routing - Polymer/web components <app-router> Cannot GET/<route> -

i'm using polymer app , using erik ringsmuth's app-router routing. code follows: in index.html: <app-router mode="pushstate"> <app-route path="/" import="/elements/login-page/login-page.html"></app-route> <app-route path="/dash" import="/elements/dash-page/dash-page.html"></app-route> <app-route path="/new" import="/elements/newapp-page/newapp-page.html"></app-route> <app-route path="*" import="/elements/dash-page/dash-page.html"></app-route> </app-router> in login-page.html: <link rel="import" href="../../../bower_components/polymer/polymer.html"> <polymer-element name="login-page" attributes=""> <template> <link rel="stylesheet" href="login-page.css"> <section vertical layout center-center> <h1>lo...

potion - Printing odd prime every 100K primes found -

i'm trying make program print every 100k-th odd prime number until 10m using potion , code: last = 3 res = (last) # create array loop: last += 2 prime = true len = res length -1 = 0 while(i<len): v = res at(i) if(v*v > last): break. if(last%v == 0): prime = false, break. += 1 . if(prime): res append(last) if(res size % 100000 == 0): last print. if(last>9999999): break. . . but gives segmentation fault (core dumped) , wonder what's wrong? for reference, working ruby version: res = [last=3] loop last += 2 prime = true res.each |v| break if v*v > last if last % v == 0 prime = false break end end if prime res << last puts last if res.length % 100000 == 0 break if last > 9999999 end end the output should be: 1299721 2750161 4256249 5800139 7368791 8960467 and no, not homework, out of c...

ios - How to add views in an existing view made in Interface Builder with Auto Layout? -

Image
i have created following auto layout in interface builder: as can see didn't give fix size buttons. add 2 button programmatically result: adding constraints programmatically know how that, @ least know syntax. my problem when create buttons? i create width constraint based on width of button 4. if in viewdidload (if i'm not wrong), auto layout hasn't been set yet width (and height) wrong. i thought in viewdidlayoutsubviews it's called multiple times when loading viewcontroller, multiple buttons stacked on each other , when go landscape more buttons added.. when should create button have right sizes? auto layout rules hold @ times, not (primarily) frame sizes @ 1 moment. you should not care getting frame of button 4 when set constraints buttons 5 , 6. constraint add buttons 5 , 6 should refer button 4's width attribute, not current width in points. is, create constraint this: nslayoutconstraint* constraint = [nslayoutconstraint constr...

html - Bootstrap Navheader Safari Weird Layout on First Load -

Image
i'm seeing odd layout in safari using bootstrap nav header. shows on first page load sometimes. refreshing page gives correct layout (opening fresh window , pasting in url triggers incorrect layout consistently.) here picture of current layout: and here's layout when reopen page sometimes: i want have links section on same line brand, positioned right. here's relevant html (i've tried cut down as possible): <header> <nav class="navbar navbar-default navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <button class="navbar-toggle" data-target= "#collapser" data-toggle="collapse" type="button"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class=...

amazon web services - Powershell: Extract IP from AWS Output -

i'm trying extract ip address output of aws cli command "describe-tags". i'm new powershell , have been struggling. output of aws command in both "text" , "json" formats. if can me extract ip address either of these formats, i'd appreciate it. i'm using "powershell 2" , convertfrom-json isn't available in version. let's assume can't upgrade powershell 3. text: tags nameserver i-xxxxxxxx instance 10.0.0.56 json: { "tags": [ { "resourcetype": "instance", "resourceid": "i-xxxxxxxx", "value": "10.0.0.56", "key": "nameserver" } ] } thanks lot! you use regex, example : [regex]::match($awsoutput,"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b").value

ms access - check box in datesheet view for multi-user mode -

my subform needs check box each record. user can check/uncheck each record next step. example, check sales order ship it. can use yes/no field implement it. but, works on single user mode only. how can have check box on each record unique each user? thank in advance. you can add 1 more table pk , checkbox , user fields. checkbox hold yes/no user = currentuser() record pk value.

Google Apps Script webapp server error -

i'm new google apps scripts trying make simplest script work. want deploy web app it's not tied google app. i've deployed web app here: https://script.google.com/macros/s/akfycbztajd08h_la_0dolv6kc0bq3ba_5hfbojtpq5i0gkuu03t6wbn/exec however, when go error: "we're sorry, server error occurred. please wait bit , try again." how can fix this? code or project missing something? seem short. project has following main.gs file: function doget() { return htmlservice.createhtmloutput('<b>hello, world!</b>'); } nothing shows in logs, , same error when click run or debug (with or without breakpoints). if attempt wrong approach, simplest script work? thanks. i created new apps script, added code, deployed it, , ran without errors. maybe delete file, , try again beginning. it's not code problem. when first learning new code, things happen time. not sure problem is. you'd need document every step took. ...

php - Deny direct access to success url in ecommerce website by typing it -

bottom line: how prevent direct access success page when transaction done (filename thankyou.php ) if he/she knows url . have integrated ccavenue payment gateway in application. full detail: have made ecommerce web application (still under construction). on checkout page, whenever user clicks proceed payment button, generating unique ordercode , saving in session , calling session value in success url page , inserting details in order table , if ordercode not set, heading user away //www.example.com/store/ now, suppose knows success url ( //www.example.com/store/thankyou.php ) ccavenue redirecting after successful payment of amount merchant, types url directly. want user should not directly access typing in url bar, when payment done, thankyou.php file has shown 2 minutes , not more that. , after 2 minutes, if tries access success url page again, should not see success page again. after bit of research, many of them have said use $_server['http_referer'] ...

c# - ajax combobox not working -

i trying use ajax combobox in asp.net web forms. i have added ajax toolkit , can use other controls popupcontrolextender etc. when use combobox gives error saying combobox not known element. i right-clicked on ajaxcontrol toolkit in toolbar--> choose items , verified combobox checked doesn't appear in toolbar does know issue may or has faced similar problem ? edit : code : <div> <asp:scriptmanager runat="server" id ="scriptmanager1" /> describe how spicy food: <br /> <cc1:combobox id="combobox1" runat="server"> <asp:listitem text="mild" value="0" /> <asp:listitem text="medium" value="1" /> <asp:listitem text="hot" value="2" /> </cc1:combobox> <%-- <asp:button ...

applying difference set operation in matlab? -

i have 23 sentences have extracted text file , 6 frequent words extracted same text file. have implemented logic shows word occured in sentence word occured other set of frequent words in sentences following code , out put illustrates logic: occurstogether = cell(length(out1)); ii=1:length(out1) jj=ii+1:length(out1) occurstogether{ii,jj} = intersect(out1{ii},out1{jj}); end end celldisp(occurstogether) out1 1d array shows words , in sentences occur number wise have applied setdiff inplace of intersect didn't result needed. sentences stored in sentence variable shown bellow: sentences = regexp(f,'\s.*?[\.\!\?]','match') char(sentences) following occurstogether shows me 1st word occurs self in sentence number 5, 1st word occurs 2nd word in sentence 5 , 6 , on..: occurstogether{1,1} = 5 occurstogether{1,2} = 5 6 occurstogether{1,3} = 6 9 20 , on.... what want find out these words don't occur follows: notogether{1,1} = 1 2 3 4 6 7,...23 notogether{1...

angularjs - How to use Angular UI-Grid with Server Side Paging -

i'm using angularjs ui-grid.info display dynamic data grids, love have hook database table 60,000 records using server-side filtering , paging , appears pagination options plugin client side paging. has been able working server side paging. have code example. view code <div class="gridcontainer"> <div id="grid1" ui-grid="gridoptions" class="grid" ui-grid-auto-resize ui-grid-pagination></div> </div> part of controller $scope.gridoptions = { enablefiltering: true, enablecolumnresize: true, paginationpagesizes: [25, 50, 75], paginationpagesize: 25, columndefs: [ { //field: 'id', width: 60, displayname: 'id', enablefiltering: false field: 'id', width: 60, displayname: 'id', enablefiltering: false }, { field: 'skill_count', }, { field: 'name' }...

itext pdf PageSize.LEGAL_LANDSCAPE.rotate() does not print -

i have created program write pdf having 2 page, first page portrait , second 1 landscape. creates pdf when print file not print second page i.e. landscape page. below code /******************/ import com.itextpdf.text.document; import com.itextpdf.text.documentexception; import com.itextpdf.text.element; import com.itextpdf.text.pagesize; import com.itextpdf.text.paragraph; import com.itextpdf.text.pdf.pdfwriter; import java.io.filenotfoundexception; import java.io.fileoutputstream; public class testpdf { public static void main(string args[]) throws documentexception, filenotfoundexception { document document = new document(); pdfwriter.getinstance(document, new fileoutputstream("/home/devang/test.pdf")); document.setmargins(10.0f, 10.0f, 20.0f, 2.0f); document.open(); //page1 addfirstpage(document); //page2 addsecondpage(document); document.close(); } public static document addfir...

javascript - ExtJS 5 grid with grouping feature: Selected row with box shadow -

Image
i'd add box shadow selected row in grid uses grouping feature. applied box shadow table element of selected row: .x-grid-item-selected { box-shadow: 0 0 6px 2px rgb(119, 119, 119) inset; } unfortunately, table element of first row in group contains group header gave me result when selected first row in group: also can't apply box shadow tr element of grid row ( .x-grid-item-selected .x-grid-row ) since chrome doesn't support box shadows on tr elements (at least not without setting display property block break layout completely). applying box shadow each cell ( .x-grid-item-selected .x-grid-cell ) doesn't give me desired neither: here's how i'd selected row (just sake of completeness): in extjs 4 able accomplish using rowwrap feature removed extjs 5. i'd appreciate if give me this! here's fiddle play around with: https://fiddle.sencha.com/#fiddle/jkv thanks & best regards ps.: i've asked question on sencha for...

r - HCS clustering throwing function ‘nodes’ for signature ‘"numeric"’ error -

#loading libraries library(graphclusteranalysis) library(igraph) library(rbgl) library(graph) library(snow) library(snowfall) library(parallel) reading input data data<-read.csv('/home/poorna/desktop/cluster/test',header=false,sep=",") g = graph.data.frame(data,directed=false) make cluster type cl <- makecluster( '172.1.30.240', type="sock" ) clusterexport(cl, c('data')) hcs cluster in parallel results <- parlapply( cl, g, function(g) { require(graphclusteranalysis) require(igraph) require(rbgl) hcsclustering(g,kappa=3) } ) i try execute above code in parallel throwing below error` error in checkforremoteerrors(val) : 1 node produced error: unable find inherited method function ‘nodes’ signature ‘"numeric"’` my input data in below format 2,5 159,5 2,100 2,858 3,100

linux - 'noarch binary' on ARM architecture with android -

this knowledge: there different architectures: x86,x64,arm, , on(you can find others on wikipedia) there different linux binaries each: x86 - i386,x64 - amd64, arm - armel,armhf). and there 'noarch' binaries. i need know if 'noarch' binary can run on arm platform. please correct me if wrong , please correct me, rather marking question off-topic. "noarch" binaries written in architecture-independent format. include not limited shell scripts, mono/.net executables, java classes , jars, , python scripts. long appropriate interpreter and/or vm available on architecture can run. note not guarantee platform they're being run on support apis required proper execution, if there run.

Repairing Visual Studio 2013 with Update 4 -

if repair of visual studio "add or remove programs", need re-run update 4 afterwards? you can add or remove programs, think more wise re-download installer , repair software. not necessary run update 4 afterwards.

javascript - Weird jquery error when checking for email data in textarea -

okay have working example jsfiddle cannot work. used code yesterday , doesnt work. the code should check duplicated emails , extract emails first textarea second. the link jsfiddle working sample: http://jsfiddle.net/49fkexu9/ i'm using exact same code on website, says theres no emails in text. can see error in code? my website it: http://truelads.com/email-extractor/ my html code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <textarea id="email-extractor" class="email-extractor-textarea"></textarea> <textarea id="email-extracted" class="email-extractor-textarea"></textarea> my jquery code: function extractemails(text) { return text.match(/([a-za-z0-9._-]+@[a-za-z0-9._-]+\.[a-za-z0-9._-]+)/gi); } function eliminateduplicates(arr) { var i; var len = arr.length; var out = []; var obj = {}; (i = 0; < l...

ios - How to show timezone abbreviation with the date -

i getting time in utc , want append timezone abbreviation it. have below code timezone abbreviation giving gmt +5.30. want ist. for america giving edt, need timezones give 3 letter abbreviation. is possible? please check below code: nsdateformatter* dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"yyyy-mm-dd't'hh:mm:ss.sssz"]; nsdate* sourcedate = [dateformatter datefromstring:@"2015-03-16t13:08:17.989z"]; nstimezone* destinationtimezone = [nstimezone defaulttimezone]; nsstring *str =[destinationtimezone abbreviation]; nsdateformatter* dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"mmmm dd yyyy, hh:mm "]; nsstring* localtime = [dateformat stringfromdate:sourcedate]; nsstring* str1 = [nsstring stringwithformat:@"%@, %@",localtime, str]; nslog(@"localtime:%@", str1); the output is: localtime:march 16 2015, 18:38 , gmt+5:30 i need localtime:march 16 2015,...

python - Save data in Models where field name comes from a variable -

i want save data in models fieldname stored in variable while storing giving error of invalid keyword argument my code : field = request.post['creationlanguage'] title = translation.objects.create(field = request.post['title']) here field stores field name model translation how store data dynamic field_name . use kwargs magic: field = request.post['creationlanguage'] value = request.post['title'] title = translation.objects.create(**{field: value})

How should "this can never happen" style of errors in C be handled? -

i'm developing large project in c other team members , have disagreement on how "this can never happen" style of errors should handled. mean error cases code can never reach, can modify code , after modification possible error case reached. for example, let's have function returns either 0 on success or -einval if it's given null argument. naturally is: int err; struct myctx ctx; err = callfunction(&ctx); if (err != 0) { abort(); } or even: int err; struct myctx ctx; err = callfunction(&ctx); if (err == -einval) { abort(); } else if (err != 0) { abort(); } ...to distinguish between 2 cases of -einval , unknown error code. the benefits of error handling approach simple program (few lines of code) , leaves behind core file can used debug situation. however, team members disagree error handling approach because i'm doing unclean exit , while code can never reach abort() line possible in future modifies code , reaches abort() line t...

postgresql - how to pass an image as paramenter to sql function -

i quality analysts , got task test database function n_execute() takes 3 parameters 1. image_name 2. image_data (byte array) blob type. 3. data_created problem test function want call function don't know how input iamge o second parameter of function. know can writing java code calls function wants execute through sql editor only. you haven't mentioned database platform working in sql server t/sql script image data binary constant . simple example 0x0102030405 represents 5 hex bytes; 01, 02, 03, 04 , 05. edit postgresql for postgresql take @ docs, binary data types . note; the bytea type supports 2 external formats input , output: postgresql's historical "escape" format, , "hex" format. the postgresql equivalent sql server example e'\\x0102030405' .

javascript - Why data.reponseText is empty -

why data.reponsetext in following code not contain while works in browser? <!doctype html> <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script type="text/javascript" src="jquery.xdomainajax.js"></script> <script type="text/javascript"> window.onload = function() { $.get('http://www.vtb24.ru/_layouts/vtb24.pages/currencyrateajax.aspx', function(data) { console.log(data.responsetext); }); }; </script> </head> <body> </body> </html> you can find "jquery.xdomainajax.js" here -- https://github.com/padolsey/jquery.fn/tree/master/cross-domain-ajax thanks in advance.

jquery data attribute as selector: how to get value from attribute inside onclick function? -

can best way value data attribute? $('[data-scrollto]').on('click', function(event) { $(document).scrollto('#'+#data?, {duration:'slow'}); return false; }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <a data-scrollto="#scrolltome" href="#">test</a> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <div id="scrolltome"></div> how can value (shortest way) ? use this , data() suggested. catch scrollto needs specified in lowercase letters. $(this).data('scrollto'); as snippet... scrollto() not part of jquery 1 of plugins. natively jquery only, use scrolltop() : $('[data-scrollt...