Posts

Showing posts from June, 2012

mysql - Need some assistance in writing this insert into query, what's an effective way to do it? -

i putting recipe app time instead of mean stack using postgresql database. goes until time me write insert , downhill there, have written code several different ways , these errors have received: server stareted on port 3000 events.js:141 throw er; // unhandled 'error' event ^ error: null value in column "id" violates not-null constraint tried else , got: server stareted on port 3000 events.js:141 throw er; // unhandled 'error' event ^ error: syntax error @ or near "where" the above when thought woud work adding id = server stareted on port 3000 error running query { [error: there no parameter $1] name: 'error', length: 87, severity: 'error', code: '42p02', detail: undefined, hint: undefined, position: '59', internalposition: undefined, internalquery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, datatype: undefin...

javascript - React redux logic done in parent reducer vs. child reducer -

in react redux doc todo example, dan passes action type toggle_todo todos passes on each individual todo. notice logic checking todo.id in todo reducer. couldn't logic have been done in todos well? me, seem better take care of logic @ higher level iterating through each todo rather passing work every todo , having them figure out if need toggle or now. there reason why dan did way? const todo = (state = {}, action) => { switch (action.type) { case 'add_todo': return { id: action.id, text: action.text, completed: false } case 'toggle_todo': if (state.id !== action.id) { return state } return object.assign({}, state, { completed: !state.completed }) default: return state } } const todos = (state = [], action) => { switch (action.type) { case 'add_todo': return [ ...state, todo(undefined, action) ] case ...

javascript - Anonymous function as callback -

this question has answer here: javascript closure inside loops – simple practical example 32 answers i seeking understanding why way using anonymous functions erroring in circumstances. in snippet below popuplate 2 arrays functions invoked @ later stage. var arr1 = []; var arr2 = []; // callback function var func = function(i){ return function(){$("body").append(i);} }; var = 1; while(i <= 5) { arr1.push(function(){$("body").append(i);}); arr2.push(func(i)); i++; } // invoke functions $("body").append("output arr1 == "); for(var c = 0; c < arr1.length; c++){ arr1[c](); } $("body").append("<br> output arr2 == "); for(var c = 0; c < arr1.length; c++){ arr2[c](); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js...

c++ - Need to know why the code behaves in this way - explanation code in C -

#include <stdio.h> int main() { int c; c = f(3, 5); printf("c = %d\n", c); c = f(4, 2); printf("c = %d\n", c); c = f(2, 4); printf("c = %d\n", c); c = f(3, 3); printf("c = %d\n", c); } int f(int d, int e) { if (e > 0) return f(d, e - 1) + f(d, e - 1); else return d; } i know code gives me product between d (the first number in f ) , 2 elevated second number in f(function) the problem don't understand why gives me such output, don't see operators within code (something equation d*2^e). deep explanation appreciated, feel free recommend material can helpful in learning c. this simple recursive function, can write in such way: | f(d, e-1) + f(d, e-1) if e > 0 f(d,e) = | | d otherwise but can add 2 equal terms f(d,e-1) , , becomes: | 2* f(d, e-1) if e > 0 f(d,e) = | ...

php - Call to undefined method on calling DB Class -

i've been struggling little while code should take care of (is not mine 1 of biggest issues). original programmer unresponsive , unwilling help; improve situation further. the code page content shown, e-catalog. flow of items @ bottom consists of 10 items, fatal error on calling php database information: fatal error: call undefined method db::connection() in c:\xampp\htdocs\menonitapp2\api\modelos\productos.php on line 128 the error occurs here: require_once "db.php"; //the db info file. require_once "producto.php"; require_once "subasta.php"; class productos { private function __construct() { //actually empty constructor. } //other functions public static function buscar_primeros($id, $bus, $counting){ $min = $counting; $max = 10; $statement = db::connection()->stmt_init(); //where error occurs //more stuff after } } and full db.php file access database: class db { private static $servername = "localhost...

swing - Java GUI support on Wayland -

i want include java gui support on system has wayland backend supported. tried include openjdk-7-jre package, seems have x11 dependency. compiled ‘openjre-8’ package , included in image. but, can run java applications without gui. when try run java swing api based gui program following error: exception in thread "main" java.awt.headlessexception @ java.awt.graphicsenvironment.checkheadless(unknown source) @ java.awt.window.<init>(unknown source) @ java.awt.frame.<init>(unknown source) @ java.awt.frame.<init>(unknown source) @ javax.swing.jframe.<init>(unknown source) @ guiapp1.<init>(guiapp1.java:25) @ guiapp1.main(guiapp1.java:20) is possible run java gui programs on wayland? how it? ...

json - Apache2 in Freebsd Concurrent request cause Connection reset -

i trying move web server (php zendframework based) ubuntu freebsd. both servers having same hardware configuration. after migration, did jmeter test (http request (json), concurrent = 200) of server, "throughput" in freebsd server double of ubuntu server amazing. however, when increase concurrent 500, see 50% request failure due " java.net.socketexception: connection reset ". works normal in ubuntu server. after many times testing, found ubuntu can handle 1500 concurrent httprequest without error, freebsd server can handle 200 concurrent request double speed without error, cannot handle more. in order verify result, tried ab command. **ab -c 200 -n 5000 127.0.0.1/responsecontroller . fails , terminate if ¬ -c parameter on 200, works fine in ubuntu. for debugging did following: 1. adjust httpd.conf, /boot/loader.conf, /etc/sysctl.conf somehow, looks nothing changed. 2. try switch mpn_worker_module in apache configuration , relevant configuration in php....

How can I interface a C++ class to Java? -

i'm working on integrating c++ code dll dependencies java through jni. need retain object instance of c++ subsequent call through java. could me understand how pass class instance java. appreciate here. #include <windows.h> #include <iostream> #include <stdlib.h> #include <uil.hpp> #include <deviceinfo.hpp> typedef hinstance libraryhandle; // pre-define uil library entry points typedef uil* create_uil(const char*, bool, int, const char**); typedef void delete_uil(uil*); const char* uildriver; bool uilabsolute; int uilparmcount; static libraryhandle uilhandle; int _tmain(int argc, _tchar* argv[]) { uilhandle = loadlibrary(text("uil.dll")); if (uilhandle != null) { create_uil* createuil = (create_uil*)getprocaddress(uilhandle, "createuil"); uil = createuil(uildriver, uilabsolute, uilparmcount, uilparms); **//i need return instance uil java** } } uil.hpp class uil { public: //! cons...

latex - Trying to split an equation, but it will not compile -

i trying split equation because long line. here equation: \begin{equation} \label{eq:eq37} \begin{split} y(x) = p \left[ \sum_{n=0}^{\infty} \frac{\left(i \omega b \left( x_c - x \right) \right)^{n}}{n!(n+b-1)!}+h(0.5-\textup{re}(b) ) \frac{\sin{\theta_e}}{\sin{\left( \theta_e - \pi b \right)}} \\ \times \frac{b(-b)!}{(b+1)!} \omega^{2} e^{1+b} \left(x_c - x \right)^{1-b} \sum_{n=0}^{\infty} \frac{\left( \omega b \left(x_c - x \right) \right)^{n}}{n!(n+1-b)!} \right], \end{split} \end{equation} the message when compiling is: ! }, or forgotten \right. <template> } $\endtemplate l.579 \end{split} \left , \right should on same line: \begin{equation} \begin{split} \left( blah blah \right. \\ \left. blah blah \right) \end{split} \end{equation} for equation, try this: \begin{equation} \label{eq:eq37} \begin{split} y(x) = p \left[ \sum_{n=0}^{\infty} \frac{\left(i \omega b \left( x_c - x \right) \right)^{n}}{n!(n+b-1)!}+h(0.5-\te...

node.js - npm request module doesn't follow 301 redirects correctly -

i have 2 urls: http://tbphoto3.bababian.com/upload7/fuguirenshen/201606/001169212894_m.jpg 301 redirected , http://t.shuaishou.com/get/168062675 302 redirected. but when request 2 js request.defaults({ proxy: 'my-proxy-address' }) 302 redirect returned final content. 301 redirect url returns body lenth=0. if remove proxy option, both urls followed , retrieved correctly. could me fix please?

string and int concatenation in C++ -

this question has answer here: how concatenate std::string , int? 26 answers string words[5]; (int = 0; < 5; ++i) { words[i] = "word" + i; } (int = 0; < 5; ++i) { cout<<words[i]<<endl; } i expected result : word1 . . word5 bu printed in console: word ord rd d can tell me reason this. sure in java print expected. c++ not java. in c++, "word" + i pointer arithmetic, it's not string concatenation. note type of string literal "word" const char[5] (including null character '\0' ), decay const char* here. "word" + 0 you'll pointer of type const char* pointing 1st char (i.e. w ), "word" + 1 you'll pointer pointing 2nd char (i.e. o ), , on. you use operator+ std::string , , std::to_string (since c++11) here. words[i] = "word" + std::to...

elixir - Record real IP address on using phoenix in the nginx upstream -

i have upstreaming phoenix app, that: upstream my_app { server localhost:3001; } server { root /var/www/my_app/priv/static; listen 80; location / { proxy_pass http://my_app; } } i want track real ip address, don't know how via standard phoenix conn.remote_ip because return 127.0.0.1 (because nginx proxies query phoenix). how can fetch real ip address? there x-forwarded-for header designed that! # nginx proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; # phoenix conn.get_req_header(conn, "x-forwarded-for")

python - Color-coded syntax in terminal -

Image
currently, terminal i'm using write python code monochrome gray on black, this , this example show can have color coded syntax well. can't identify in default settings indicates ability use color coded syntax in terminal. i'd use terminal window python interactive shell, color coded text must. how do so? visual studio 2015 easier in regard, suppose because vscode isn't ide. having interactive shell work test new script. the default console repl not have syntax highlighting. idle ide ships cpython has syntax-highlighting repl (interactive shell). ipython 5 has syntax highlighting in repl :

c# - Retryable SQLBulkCopy for SQL Server 2008 R2 -

i database background , new .net stuff. please bear me if question sounds silly. i using sqlbulkcopy in code transfer data 1 sql server other. failing due network issues. avoid planning 2 things decrease batch size (from 5000 1000) , increase timeout (from 3min. 1min) implement retry logic my question what best way implement retry, i.e., @ table level or @ batch level (if @ possible)? i found frame work resiliency sql azure here: https://msdn.microsoft.com/en-us/library/hh680934(v=pandp.50).aspx have thing similar sql server 2008 r2? sample code using: private void bulkcopytable(string schemaname, string tablename) {using (var reader = srcconnection.executereader($"select * [{sourcedbname}].[{schemaname}].[{tablename}]")) { const sqlbulkcopyoptions bulkcopyoptions = sqlbulkcopyoptions.tablelock | sqlbulkcopyoptions.firetriggers | sqlbulkcopyoptions.keepnulls | ...

Can we change the constructor behavior using typescript class decorators? I mean to change number of parameters in constructor -

typescript code @logclass // decorator class person { public name: string; public surname: string; constructor(name : string, surname : string) { this.name = name; this.surname = surname; } } function logclass(target: any) { // save reference original constructor var original = target; // utility function generate instances of class function construct(constructor, args) { var c : = function () { return constructor.apply(this, args); } c.prototype = constructor.prototype; return new c(); } // new constructor behaviour var f : = function (...args) { console.log("new: " + original.name); return construct(original, args); } // copy prototype intanceof operator still works f.prototype = original.prototype; // return new constructor (will override original) return f; } in above code new constructor adds console.log(); . want change number of parameters passed constructor. possible? or can add ot...

Android Studio - Layout Theme Selection -- Where is this data stored? -

Image
i quite familiar android layouts , fact can declare app wide theme in manifest or indirectly via styles resource such "halo" , or "material" , etc... . i know style can done on per layout basis. android studio "layout editor" allows select theme layout. question: where selected theme stored when applied per layout? the android documentation seems suggest in manifest activities declared. example: <activity android:name=".mainmenu" `android:theme="@android:style/theme.holo.noactionbar"/>` however, when select different theme, after compile , run application see no changes in manifest, or respective layout, or activity sub class. so association between layout , chosen theme being stored? tl;dr androidmanifest.xml references styles.xml in turns references colors.xml . layout editor modifies styles.xml , you're not seeing results because of possible overrides in styles.xml . -- modify parent s...

php - Laravel tinker in multi-tenant environment -

i developing multi-tenant application using laravel-5.2 each tenant have separate database. each tenant has separate subdomain. detect tenants using subdomains. i have setup models tenant , databaseconnection tenant hasone databaseconnection , databaseconnection belongsto tenant . db connections tenants set dynamically beforemiddleware . these work well. now want use artisan tinker tenants. if run php artisan tinker connects tenant db credentials present in .env file. so trying make console command same. here's have achieved far. class clienttinker extends command { protected $name = 'cdb:tinker'; public function fire() { // subdomain $subdomain = $this->argument('subdomain'); // client $client = tenant::wheresubdomain($subdomain)->first(); $connection = $client->databaseconnection(); // $connection contains database server, database name, user name, , password. // d...

java - EST time conversion with daylight saving time -

est time conversion daylight saving time coming wrongly private void timeconversion() { string s = "2016-08-29 1:40:00 am"; dateformat df = new simpledateformat("yyyy-mm-dd hh:mm:ss a", locale.english); df.settimezone(timezone.gettimezone("est")); date timestamp = null; try { timestamp = df.parse(s); df.settimezone(timezone.getdefault()); system.out.println(df.format(timestamp)); } catch (parseexception e) { e.printstacktrace(); } } the time zone est not respect daylight saving time offsets: timezone esttz = timezone.gettimezone("est"); system.out.println(esttz.usedaylighttime()); // prints 'false' that time zone est have -5:00 hour offset utc. this due locations in canada, mexiko , central america (panama) not using dst using est year. if want time zone dst offset, should use us/eastern or america/new_york, etc: timezone useasterntz = timezone.gettimez...

excel vba - Selecting Which Cells Can Be Active Cells -

i have created simple code place active cell address cell. `sheets("esm").range("k16").value = activecell.address` i limit cells work code (e.g n5:ar7) can't quite work out. assume need somehow define range using "dim myrange" or similar. would mind assisting? just wrap code condition: if not intersect(activecell, range("n5:ar7")) nothing sheets("esm").range("k16").value = activecell.address end if

r - Shiny submitButton not updating my result -

i using shiny make rcode interactive. @ first run, got initial result my initial shiny output . problem have submitbutton should update result after changing input not working. have searched stackoverflow , not find solution. glad if can help. my ui.r code is: library(shiny) source("travelcbr1.r") shinyui(fluidpage( # application title. titlepanel("travel recommendation"), sidebarlayout( sidebarpanel( selectinput("holidaytype", "choose holiday type:", choices = c("bathing", "active", "education", "recreation", "wandering", "language", "skiing", "city")), selectinput("transportation", "choose means of transportation:", choices = c("plane", "train", "coach", "car")), ...

Android Video and voice call (WebRTC) -

i want develop android application on webrtc allows video , voice call. did research on , come know can implement using jingle library there no proper documentation , no example on how implement. want use open source library. please suggest documentations , examples. bad news! there aren't documentation yet. good news! come gamble. best starter template android webrtc find far pristine.io mirror of official android apprtc demo. if wanna compile webrtc library , build android project scratch add latest build hosted pristine.io , can directly compile in gradle file. current version using io.pristine:libjingle:9456@aar i found tutorial 'appear in' extremely helpful familiar android webrtc development steps.

c# - How to encrypt file name on upload and decrypt on download? -

made asp.net web application receives file using file upload control , encrypts file name on upload. but when redirect user file_address (so user can download file) don't know how can decrypt file name now? because file (for example .docx file) doesn't have code behind. so when user downloads file he/she receives file encrypted name! all files in server have encrypted name , not original name , want know how give files original name when users download files you can't give user direct link file - rather page first decrypts file, writes appropriate response headers , sends decrypted file response. like getfile.aspx?encryptedfilename=abcxyz . in init , getfile.aspx loads encrypted file, decrypts it, writes appropriate response headers file, changing mime type whatever file requires, , sending decrypted file instead of web page. here's example of how zip file. if need more after looking @ this, let me know. how generate , send .zip file user in c# ...

html - Bootstrap modal takes space even when closed or if changed all link colors change -

if use code this, links on shop have blue color. right links black , want them stay this. if delete header code, links black again, modal takes space on page (makes huge blank white space) if open , page goes @ bottom of "open modal" close, takes space. i pretty new coding, appreciate help. thank you <head> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css"> </head> <body> <!-- button trigger modal --> <a data-toggle="modal" href="#mymodal" class="btn btn-primary btn-lg">launch demo modal</a> <!-- modal --> <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div cla...

javascript - How to check if variables are true with in a multi-dimensional array? -

i trying call these arrays , check if whole array true (like ["cell1", "cell2", "cell3"]). have html , js below. this pretty easy fix, struggling find stuff , how fix it. <tr> <td id="cell1" onclick="tic(this)"></td> <td id="cell2" onclick="tic(this)"></td> <td id="cell3" onclick="tic(this)"></td> </tr> <tr> <td id="cell4" onclick="tic(this)"></td> <td id="cell5" onclick="tic(this)"></td> <td id="cell6" onclick="tic(this)"></td> </tr> <tr> <td id="cell7" onclick="tic(this)"></td> <td id="cell8" onclick="tic(this)"></td> <td i...

python - Seaborn: Overlaying a box plot or mean with error bars on a histogram -

Image
i creating histogram in seaborn of data in pretty standard way, ie: rc = {'font.size': 32, 'axes.labelsize': 28.5, 'legend.fontsize': 32.0, 'axes.titlesize': 32, 'xtick.labelsize': 31, 'ytick.labelsize': 12} sns.set(style="ticks", color_codes=true, rc = rc) plt.figure(figsize=(25,20),dpi=300) ax = sns.distplot(syndata['synergy_score']) print (np.mean(syndata['synergy_score']), np.std(syndata['synergy_score'])) # ax = sns.boxplot(syndata['synergy_score'], orient = 'h') ax.set(xlabel = 'synergy score', ylabel = 'frequency', title = 'aggregate synergy score distribution') this produces following output: i want visualize mean + standard deviation of dataset on same plot, ideally having point mean on x-axis (or right above x-axis) , notched error bars showing standard deviation. option boxplot hugging x-axis. tried adding line commented out (sns.boxplot...

php - Importing multiple files into MySQL table -

this question has answer here: php: importing multiple csv files mysql table 2 answers i trying import bunch of text files(3098) mysql table. there no problem importing single file load data local infie . files in 1 folder. reckon need use foreach not sure how it.is possible without php. helpful. run following shell script for f in /path/to/files/folder/*.txt mysql -e "load data infile '"$f"' table [tablename] fields terminated ',' lines terminated '\n' ignore 1 lines" -u [username] --password= [password] [databasename] echo "done: '"$f"' @ $(date)" done

Combine DataPicker and TimePicker on a Button Flyout in Windows 10 XAML C# -

Image
i'm making uwp app (windows 10). want combine datepicker , timepicker in button flyout. that, wrote following code. <button height="30" width="30" horizontalalignment="stretch" verticalalignment="stretch" borderthickness="0" x:name="buttonsetalarmtime"> <button.flyout> <flyout> <grid height="100"> <grid.rowdefinitions> <rowdefinition height="*"/> <rowdefinition height="*"/> </grid.rowdefinitions> <calendardatepicker x:name="calendardatepickeralarmdate" /> <timepicker x:name="timepickeralarmtime" grid.row="1"/> </grid> </flyout> </button.flyout> <button.background> <imagebrush imagesource="assets/alarm-icon...

winapi - How to copy a picture from disk into the clipboard with win32? -

it's easy copy text clipboard win32 api, want copy picture disk (for example, d:\1.jpg) clipborad. i search many webpages , can't find useful. please teach me how it. and no mfc. you can use gdi+ load image, hbitmap , , set clipboard data. gdi+ unicode only, if using old ansi functions have convert filename wide char. example in c++: bool copyimage(const wchar_t* filename) { bool result = false; gdiplus::bitmap *gdibmp = gdiplus::bitmap::fromfile(filename); if (gdibmp) { hbitmap hbitmap; gdibmp->gethbitmap(0, &hbitmap); if (openclipboard(null)) { emptyclipboard(); dibsection ds; if (getobject(hbitmap, sizeof(dibsection), &ds)) { hdc hdc = getdc(hwnd_desktop); //create compatible bitmap (get ddb dib) hbitmap hbitmap_ddb = createdibitmap(hdc, &ds.dsbmih, cbm_init, ds.dsbm.bmbits, (bit...

javascript - Changes in ng-style have no effect to CSS-Style -

i have material design grid list either 1 or 2 columns dependend of screen size. if there 1 column (xs-screens) want give every second tile background-color. in 2 column layout colored tiles should diagonal, means every first , fourth tile (in block of four). in hmtl calling function within ng-style attribute of md-grid-tile: ng-style="{{getbackgroundcolor($index)}}" and in javascript function is: $scope.getbackgroundcolor = function(index){ if($mdmedia("xs")){ //screen size extra-small if(index % 2 === 0){ return "{'background-color':'lightgray'}"; } } else { if(index % 4 === 0 || index % 4 === 3){ return "{'background-color':'lightgray'}"; } } return "{'background-color':'white'}"; } this code working. if change screen size function gets called , ng-style attribute looks expected. style attribute doesn't cange anymore. means background-...

android - How to optimize this references statements findViewById() -

i have activity 80 imageview, have add references in java file & doing this. there way simplyfy code. please me. iv[0]=(imageview)findviewbyid(r.id.iv0); iv[1]=(imageview)findviewbyid(r.id.iv1); iv[2]=(imageview)findviewbyid(r.id.iv2); iv[3]=(imageview)findviewbyid(r.id.iv3); iv[4]=(imageview)findviewbyid(r.id.iv4); iv[5]=(imageview)findviewbyid(r.id.iv5); ....... iv[79]=(imageview)findviewbyid(r.id.iv79); a simple for loop appropriate in case: for (int = 0 ; < iv.length ; ++i) { int resourceid = this.getresources().getidentifier("iv" + i, "id", this.getpackagename()); iv[i] = (imageview) findviewbyid(resourceid); } but optimise code. use recyclerview , show images in adapter. way surely outofmemoryerror 's.

java - launch and submit job spark -

i try "run" spark jobs width java application, searching, found following 2 methods: clientsarguments , sparklauncher . could explain me difference between two? difference between launch , submit job/application spark? thank you. sparklauncher wrapper library spark-submit , coverts sparklauncher code spark-submit script , trigger jobs. the mechanism same spark-submit script, if @ source code of sparklauncher, uses processbuilder construct shell. if want use sparklauncher , need specify $java_home , $sprak_home , other essential parameters. there limitation sparklauncher , machine sparklauncher runs must have $java_home , $spark_home (spark library) used sparklauncher locating script , related dependencies. soft of impossible cloud environment cloudfoundry etc. you assume sparklauncher equals spark-submit script, choose client or master, local or yarn mode. clientsarguments class yarn script, works yarn-mode.

How can selenium run in IE do not show the browser windows? -

the operating system windows10, programming language java ,the browser ie11. how can selenium running without browser windows? you can use phantonjs, htmlunitdriver or headless chrome for htmlunitdriver webdriver driver=new htmlunitdriver(); driver.get("http://google.com"); for phantomjs first download ghostdriver , use system.setproperty("phantomjs.binary.path", "e:\\phantomjs-2.1.1-windows\\phantomjs.exe"); webdriver driver = new phantomjsdriver(); driver.get("http://google.com"); for chrome download chromedriver , use system.setproperty("webdriver.chrome.driver","e:/software , tools/chromedriver_win32/chromedriver.exe"); chromeoptions chromeoptions = new chromeoptions(); chromeoptions.addarguments("headless"); driver.get("http://google.com");

dojo - Return more rows from FTSearch results using valuepicker in Extlib -

Image
i using valuepicker dojotype: "extlib.dijit.pickerlistsearch" extlib in application. dialog works fine , can search values. problem search return 30 rows. need extend return more. there dojo setting can use or other way return more rows? <xe:formrow id="formrow5" label="artikelnummer"> <xe:djextlisttextbox id="djextlisttextbox5" displaylabel="true"> <xp:eventhandler event="onblur" submit="true" refreshmode="complete" disablevalidators="true"></xp:eventhandler></xe:djextlisttextbox> <xe:valuepicker id="valuepicker9" for="djextlisttextbox5" dojotype="extlib.dijit.pickerlistsearch" pickertext="välj artikel"> <xe:this.dataprovider> ...

bash - what does -s option mean in GNU sed? -

i have read sed manual -s option. there says: -s --separate default, sed consider files specified on command line single continuous long stream. gnu sed extension allows user consider them separate files: range addresses (such ‘/abc/,/def/’) not allowed span several files, line numbers relative start of each file, $ refers last line of each file, , files invoked r commands rewound @ start of each file. add -s , no -s in same [root@kvm ~]# cat 1 |sed -s -n '/1/p' 12345a6789a99999a 12345a6789a99999b [root@kvm ~]# cat 1 |sed -n '/1/p' 12345a6789a99999a 12345a6789a99999b 1 file cat 1 12345a6789a99999a 12345a6789a99999b how use -s ? it matters if give sed multiple files. if don't specify -s flag, sed act if files contents had been concatenated in single stream : echo "123 456 789" > file1 echo "abc def ghi" > file2 # input files considered single stream of 6 lines, second fourth printed sed...

python - Speed up multilple matrix products with numpy -

in python have 2 3 dimensional arrays: t size (n,n,n) u size (k,n,n) t , u can seen many 2-d arrays 1 next other. need multiply matrices, ie have perform following operation: for in range(n): h[:,:,i] = u[:,:,i].dot(t[:,:,i]).dot(u[:,:,i].t) as n might big wondering if operation in way speed numpy. carefully looking iterators , how involved in dot product reductions, translate of 1 np.einsum implementation - h = np.einsum('ijk,jlk,mlk->imk',u,t,u)

jsf 2 - Primefaces facet header button -

i have datatable in primefaces: <p:datatable var="feedback" value="#{actiondetailsview.action.feedback}"> <f:facet name="header"> feedback </f:facet> <p:column headertext="date"> ... </p:column> now want have button (add feedback) inside header on right hand side. somehow possible? yes, is. may define button child of f:facet tag. <p:datatable> <f:facet name="header"> <p:commandbutton /> <!-- either here --> </f:facet> <p:column> <f:facet name="header"> <p:commandbutton /> <!-- or here --> </f:facet> </p:column> </p:datatable>

c# - Session state - strange behaviour when injecting with Autofac -

consider have autofac configured in mvc app this: builder.registermodule(new autofacwebtypesmodule()); it needed inject session state: internal class defaultsessionaccess : isessionaccess { private readonly httpsessionstatebase session; public defaultsessionaccess(httpsessionstatebase session) { this.session = session; } public void put(string key, object @object) { this.session.add(key, @object); } } the problem following code put in controller: public class somecontroller : controller { private isessionaccess session; public somecontroller(isessionaccess session) { this.session = session; } public actionresult someaction() { this.session.put("key", "value"); var isnull = this.httpcontext.session["key"] == null; } } the problem on local machine (iis) isnull false - object saved in session. when deploy azure, isnull is... true ! somehow ob...

javascript open page in new tab and new links on that same tab -

basically have table if user clicks on id opens link on new tab. if user clicks on id should open on earlier tab , not make new tab $scope.navigationurl = function (event,item) { if (event.ctrlkey) { window.open('link' + item,"_blank"); // in new tab } else { $location.path('link' + item); // in same tab , yeah, wrong } ; <tbody> <tr ng-repeat="case in lastbuild"> <td colspan="1" ng-click="navigationurl($event,case.id)">{{case.id}}</td> <td colspan="1">{{case.timetaken}}</td> </tr> </tbody> the ctrl+click works opens link on new tab everytime. how can keep same tab click ? the window.open method has parameters: window.open(url,name,specs,replace) if define name window, , use on javascript code, named window replaced content. reference here .

python - how to auto check check box by entering value in other field? -

i have made module hotel room management , want check room availability in python. have taken on checkbox named available = fields.boolean() . now, want automatically checked when enter check_in_time. so, how can this? have taken check_in_time=fields. datetime() . have tried this... class hotel_management(models.model): check_in_time = fields. datetime() available = fields.boolean() @api.onchange('check_in_time') def auto_check(self): in self: if a.check_in_time: a.available=true print a.available else: print a.available but changes value of checkbox in terminal....not in database....it takes "false" value default every time. so, tell me how change value of checkbox in database? your code right. value saved upon "save" action in client. onchange save value virtually @ clientside. depends instead write directly database. onchange should enoug...

delphi - How to make a proper alternate row color on a filtered TVirtualStringTree -

Image
previously used virtualstringtree showing of nodes, , used node.index check odd , rows inside onbeforecellpaint event. but when filtered nodes, realized node.index irrelevant used alternate rows shown in screenshot below: any idea/solution solve this?

php - Is there any restriction to transfer btc to another account? -

i have account in mkraken.com balance around ฿0.05012, when try sent ฿0.00157 other address using below code: code : $res = $kraken->queryprivate('withdraw', array( 'asset' => 'xxbt', 'key' => 'mykey', 'amount'=> '0.00157' ) ); transaction show in different state/status initiated->onhold->cancelled. i have check in panel said minimum transaction limit 0.00100 , 0.00050 fee transaction. per code have transfer more still it'll give me transaction cancelled. any 1 having idea why transaction failed...? yes got solution, problem not in code need confirm transaction received mail. when sent request withdraw mkraken team sent email confirmation link r u sure want processed transaction one's confirm , it'll processed transaction on hold status sending status , complete transaction.

html - Disable a:focus and a:active color? -

i have base css defines this: a:hover, a:focus { color: black; } i want have specific link overrides , not trigger focus, still triggers hover. how can override color setting? a:focus{ color: none; } i've tried color:transparent no avail, focus still triggers. try a:hover{ color:green; } .class:hover, .class:focus { color: red; } <a href="#" class="class">dsadsfdsfsd</a> <a href="#">dsadsfdsfsd</a>

wpf - How to customize the visible area of the scroll viewer's content -

Image
the scrollviewer 's default behavior is, content stops on bottom of scrollviewer 's view port: i change behavior, content can scrolled top of scroll scrollviewer 's view port: a) possible configure existing scroll viewer way? b) if not, best way achieve behavior? embed scrollable content in grid 3 rows. scrollable content occupies second row. other 2 have same height of scrollviewer : <scrollviewer height="50"> <grid> <grid.rowdefinitions> <rowdefinition height="50"/> <rowdefinition height="auto"/> <rowdefinition height="50"/> </grid.rowdefinitions> <yourscrollablecontent grid.row="1"/> </grid> </scrollviewer> i've no way test in order see if code perfect , i'm sure can way :) maybe can bind height of 2 rows height of scrollviewer : <rowdefinition height="{binding path=height, ...

intellij idea - Use IntelijJ as default diff/merge tool in Eclipse -

Image
has maybe used intelij default merge/diff tool in eclipse? i don't know parameters should used in highlighted fields below. edit: see https://www.jetbrains.com/help/idea/2016.2/running-intellij-idea-as-a-diff-or-merge-command-line-tool.html kind of command-line parameters intellij expects diff/merge: seems have add diff argument first , use ${file1path} , other placeholders separated spaces, without using comma nor and .

javascript - Writiing to a SERVER file using JS -

tried solutions.. none of them seem work me. basically, have website uploaded on server has button when clicked simple task of loading file server, displaying , adding +1 , saving back. the main question arises, tried ways find on net save file doesn't seem work me. specific advice on how can fix issue using js? update - 1 way using - (doesn't work tho) fso = new activexobject("scripting.filesystemobject"); var s = fso.createtextfile("total.txt", true); var text = test1; s.writeline(text); s.close(); where test1 name of variable trying write. assuming have php on server try js var data = new formdata(); data.append("data" , 1); var xhr = (window.xmlhttprequest) ? new xmlhttprequest() : new activexobject("microsoft.xmlhttp"); xhr.open( 'post', '/path/to/php', true ); xhr.send(data); php script <?php if(!empty($_post['data'])){ $data =...

machine learning - rare error when running my function in R -

i have 2 function. 1 train classifier , 1 predict test data. if run predict function step step works fine, if call predict function error. can't know happening due code of function has no errors compiled manually. i've upload 2 functions , data on github. you can access here modelfit=mdp(class = dades[,1],data=dades[,-1],lambda = 1,info.pred = t) predict.mdp(modelfit, dades[1:5,-1]) error in d[row, i] : subscript out of bounds thank can help the reason see in d[row, i] , variable row overshooting number of rows in d. row derived vec.new : for(row in vec.new) this piece culprit : start=dim(d)[1] vec.new=(start+1):(start+dim(newdata)[1]) vec.new starts nrow(d)+1 , first element beyond size of d . you can insert cat(row) in code , see. i guess have think start should be.

python - Convert a list of dictionaries into a set of dictionaries -

how can make set of dictionaries 1 list of dictionaries? example: import copy v1 = {'k01': 'v01', 'k02': {'k03': 'v03', 'k04': {'k05': 'v05'}}} v2 = {'k11': 'v11', 'k12': {'k13': 'v13', 'k14': {'k15': 'v15'}}} data = [] n = 5 in range(n): data.append(copy.deepcopy(v1)) data.append(copy.deepcopy(v2)) print data how create set of dictionaries list data ? ns: 1 dictionary equal when structurally same. means, got exactly same keys , same values (recursively) a cheap workaround serialize dicts, example: import json dset = set() d1 = {'a':1, 'b':{'c':2}} d2 = {'b':{'c':2}, 'a':1} # same according definition d3 = {'x': 42} dset.add(json.dumps(d1, sort_keys=true)) dset.add(json.dumps(d2, sort_keys=true)) dset.add(json.dumps(d3, sort_keys=true)) p in dset: print json.load...

ios - Dictionary returns consecutive/shuffled values when iterating in swift -

this question has answer here: ordered dictionary in swift 7 answers swift - stored values order changed in dictionary 5 answers i have following dictionary var data : [string: string] = ["dev" : "dev", "qua" : "qua" , "sit" : "sit", "uat" : "uat", "prod" : "prod"] i iterate using loop , following values sit prod dev uat qua ie consecutive values i have following code iterate for (key, value ) in data.enumerate() { print(value) } i want these values in same format of declaration. swift dictionary type unordered type. on every for in loop can receive different ordered result (in theory). should choose other data structure if wish keep order, array<(...

Spring amqp: detect shutdown and reconnect to another queue -

we have setup call webservice create queue, , receive queue name response. then set simplemessagelistenercontainer , set queue name there, , start it. however, time time, queue deleted - resulting in " 404 not declare queue xxxxxxxxx " error. in these cases, need call webservice again , add new queuename simplemessagelistenercontainer , removing old one. the way figured out trigger code handle create custom cachedconnectionfactory , overriding shutdowncompleted method. however, shutdowncompleted seems trigger when simplemessagelistenercontainer switches on well, sticks in loop. shutdownsignalexception sent shutdowncompleted not seem different if trigger external server or client handling new queue, can't figure out how skip handling on "second" go. so usual way detect , run custom handling when server kills queue? the container publishes listenercontainerconsumerfailedevent when listener fails. add applicationlistener<listenercontain...

jquery - How to implement date range selection or muti date selection feature in single kendo calendar? -

is possible have date range selection , multi date selection feature using single kendo calendar instance? by default kendo dont have feature. can vote here: http://kendoui-feedback.telerik.com/forums/127393-telerik-kendo-ui-feedback/suggestions/4122749-add-range-select-to-datepicker also here can find couple custom solutions: kendo ui calendar multiselection

jquery - DataTables Bootstrap pagination not rendering -

Image
i have sample datatable working on test server. however, reason bootstrap pagination not rendering properly. this not bootstrap styling. here code: <!doctype html> <html> <head> <script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js'></script> <script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js'></script> <link href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' rel='stylesheet'> <link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/datatables.bootstrap.min.css"> <script src="https://cdn.datatables.net/1.10.12/js/datatables.bootstrap.min.js" charset="utf-8"></script> <script src="https://cdn.datatables.net/1.10.12/js/jquery.datatables.min.js" charset="utf-8"></script> </head> <body>...