Posts

Showing posts from May, 2011

php - how can i use relationship in laravel? -

my schema follows: channel table: id int unsigned primary key auto increment, name varchar(30) not null, ... category table: id int unsigned primary key auto increment, channel_id int unsigned index, name varchar(30) not null, ... article table: id int unsigned primary key auto increment, category_id int unsigned index, title varchar(90) not null, content text not null, ... so, every article belong specific category , category belongs specific channel. my question is: how can search articles category name , channel name (the relationship ready in code)? i have tried $articles = app\article::latest()->with('category')->with('channel')->get(); but not work, can me? thank time. if want search through related tables should use joins this: $articles = app\article::latest() ->select('article.*') ->join('category', 'category.id', '=', 'category_id') ->join('channel', ...

html - Table alignment with div -

i trying construct html table 6 rows. first row has 1 line of text heading. second row has 3 columns (set 3 td elements). third row has 3 values in 3 columns (set 3 td elements). 4th row has 3 images in 3 columns (again set 3 td elements). works correctly far. want add fifth row line of text spans entire div , has dotted underline. when add element draws the dotted border 1/3rd of div only. if set width 100%, elements above dragged right of screen. doing wrong? here complete html snippet: <div id="toysummary" style="border:solid; border-width:4px; border-color:gray; padding:4px; margin:10px"> <span style="font-family:calibri; font-size:large; color:midnightblue; text-align:right"><b>final results summary</b></span> <table style="width:100%"> <tr> <td style="width:33%; font-size:large"><i>result</i></td> <td style="width:33%; ...

numpy - Order of repetition per row and column in Python -

i have been trying figure order of repetition per-row , couldn't it. ok. lets consider ndarray of size (2, 11, 10) a = np.array([ [ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 1, 1, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0, 0, 1, 0], [1, 1, 0, 0, 1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 0, 0, 1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 1, 0, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0, 1, 1, 0, 1], [1, 1, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 1, 0, 0, 1, 1], [0, 1, 1, 1, 0, 0, 1, 1, 0, 1] ], [ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0, 0, 1, 1], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0], [1, 1, 0, 1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 1, 1, 0, 0], [1, 0, 0, 0, 1, 1, 0, 0, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1, 0, 1], [1, 0, 0, 1, 1, 0, 1, 0, 1, 0], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0], ...

ios - How to optimize CPU and RAM usage on a UIView which uses `drawInRect:blendMode:`? -

i'm developing drawing app lets user draw 1 uibezierpath once on image has been drawn in uiview drawinrect:blendmode in drawrect method , it's uses on 80% of cpu , 55mb of ram , when traced down in time profiler, drawinrect:blendmode method causing of cpu usage. have done few optimizations further optimizations can both drawing uiimage being drawn using [image drawinrect:rect]; , uibezierpath user draws on top of it? in advance. @interface insideview(){ cgrect imagerect; cgrect targetbounds; } @property (strong, nonatomic) nsmutablearray *strokes; @property (nonatomic, strong) uiimage * img; @property (nonatomic, strong) uibezierpath *drawingpath; @end @implementation insideview -(void)drawrect:(cgrect)rect{ targetbounds = self.layer.bounds; imagerect = avmakerectwithaspectratioinsiderect(self.img.size,targetbounds); [self.img drawinrect:imagerect]; (int i=0; < [self.strokes count]; i++) { uibezierpath* tmp = (uibezierpath*)[self...

scipy - Calling MKL from Python : DSTEVR -

dstevr computes eigensolutions of triangular symmetric matrix. cool. except not 1 of routines ported wrapper scipy. i've followed instructions on how call mkl directly python , attached seems give correct answer. gosh.... there someway clean up?! import numpy np scipy import linalg ctypes import * c_double_p = pointer(c_double) c_int_p = pointer(c_int) c_char_p = pointer(c_char) mkl = cdll('mkl_rt.dll') dstevr = mkl.dstevr #subroutine dstevr( jobz, range, n, d, e, vl, vu, il, iu, abstol, m, # * w, z, ldz, isuppz, work, lwork, iwork, liwork, info) # character * 1 jobz, range # integer n, il, iu, m, ldz, lwork, liwork, info # integer isuppz(*), iwork(*) # double precision vl, vu, abstol # double precision d(*), e(*), w(*), z(ldz,*), work(*) dstevr.argtypes = [ c_char_p, c_char_p, c_int_p, c_double_p, c_double_p, c_double_p, c_double_p, c_int_p, c_int_p, c_double_p, \ c_int_p, c_double_p, c_double_p, c_int_p, c_int_p, ...

amazon web services - How do I log event and context information automatically on AWS Lambda function failures? -

i trying log lambda function failures in such way event , context information saved event information can, if deemed necessary, later manually republished function's trigger. not want handle logic in functions themselves. what i've tried far: cloudwatch alarms on error metric. tell me function has failed. looking in cloudwatch logs. see coded failure messages emitted each function. there no such setting, if that's you're looking for. if you'd these properties logged, have print them - way visible in cloudwatch , whatever service logs piped (logs can piped elasticsearch example, cloudwatch ). however, can done adding these 2 lines of code: exports.handler = (event, context, callback) => { console.log(json.stringify(event)); console.log(json.stringify(context)); // code }; as rule of thumb, logs way describing lambda went through @ each invocation.

algorithm - Reversing Alternate Levels of a perfect binary tree -

the problem statement is: given perfect binary tree, reverse alternate level nodes of binary tree. given tree: / \ b c / \ / \ d e f g / \ / \ / \ / \ h j k l m n o modified tree: / \ c b / \ / \ d e f g / \ / \ / \ / \ o n m l k j h solution 3 this site provides particularly elegant solution in uses swap method on nodes of numbered levels of tree:void preorder(struct node *root1, struct node* root2, int lvl) { // base cases if (root1 == null || root2==null) return; // swap subtrees if level if (lvl%2 == 0) swap(root1->key, root2->key); // recur left , right subtrees (note : left of root1 // passed , right of root2 in first call , opposite // in second call. preorder(root1->left, root2->right, lvl+1); ...

python - Make the background of 'Text' widget in tkinter transparent -

i'm looking add image in background of text widget in tkinter, far i'm concerned, not possible. so, work around this, i'm wondering if possible make background of text widget transparent. thanks in advance. no, not possible make background of text widget transparent.

How to set the proper connection parameters to connect a SQL Server database in Atom Editor using Data-Atom package? -

i'm trying use data-atom package in atom editor connect sql server 2012 database. can connect database sql server managment studio using windows authentication or sql server authentication . how data-atom-connections.cson file should using these 2 authentication methods? my data-atom-connections.cson file looks this: [ { name: "windowsauthentication" protocol: "sqlserver" user: "username" password: "password" server: "apphost/username" database: "master" options: "" } { name: "sqlserverauthentication" protocol: "sqlserver" user: "userlogin" password: "password" server: "apphost/sqlexpress" database: "master" options: "" } ] but error: error(esocket) - failed connect apphost:1433 - connect econnrefused 192.168.56.1:1433 note : specifying server name saw post loggin...

canvas - Redux - How to access a non-serializable object which is derived asynchronously? -

my user supplies url, , want use url background <canvas> element in react+redux app.this means render() method of react component needs access <img> dom node containing user’s image. unfortunately setting src attribute of image tag asynchronous, since requested image not populate in dom until data has been fetched server. normally asynchronous task, api call example, 1 store result of asynchronous task directly redux store, reading redux docs , appears storing non-serializable objects (like dom node) in store not advised. is there other reasonable way solve problem? abusing react component's life-cycle methods watch url prop change, , setting <img> dom node component's state asynchronously, feels awkward. why don't store image url in store/state , pass image constructor ? assuming have url in state : render() { var bg = new image() bg.src = this.state.url // here use bg <img> element } this way don't set callba...

php - What does double colon in laravel means -

example : auth::guard($guard)->guest() i dont double colon (::) notation means in laravel framework. http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php learn stand scope resolution operator access static, constant , overridden properties or methods of class. laravel learn auth means alias class facade need explanation of example above guard(parameter)->guest() means. i'm still new php , learning laravel framework back-end. :: scope resolution operator this called scope resolution operator? operator used refer scope of block or program context classes, objects, namespace , etc. reference identifier used operator access or reproduce code inside scope. reference auth::guard($guard)->guest() : in line using guard() method of static class auth. use function of static class use :: scope resolution operator.

php script to read and save web page contents not working on some sites -

i have simple script works on sites not main site want work - code below accesses sample site perfectly. when use on site want access http://www.livescore.com error this works. <?php $url = "http://www.cambodia.me.uk"; $page = file_get_contents($url); $outfile = "contents.html"; file_put_contents($outfile, $page); ?> this not work..... <?php $url = "http://www.livescore.com"; $page = file_get_contents($url); $outfile = "contents.html"; file_put_contents($outfile, $page); ?> and gives following error warning: file_get_contents( http://www.livescore.com ) [function.file-get-contents]: failed open stream: http request failed! http/1.0 404 not found in c:\program files (x86)\easyphp-5.3.8.1\www\livescore\attempt-1-read-page.php on line 3 thanks assistance in common case can file_get_contents follow redirects: $context = stream_context_create( array( 'http' => array( ...

java - Tab's full tile is not displaying in Tablayout in android -

public class customersameday extends appcompatactivity { private static final string position = "position"; private sectionspageradapter msectionspageradapter; /** * {@link android.support.v4.view.pageradapter} provide * fragments each of sections. use * {@link fragmentpageradapter} derivative, keep every * loaded fragment in memory. if becomes memory intensive, * may best switch * {@link android.support.v4.app.fragmentstatepageradapter}. */ /** * {@link viewpager} host section contents. */ private viewpager mviewpager; private tablayout mtablayout; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_customer_sameday); getsupportactionbar().setdisplayhomeasupenabled(true); getsupportactionbar().settitle("sameday"); // create adapter re...

javascript - Get all elements inside iframe tag -

this part of code i'm using iframe tag , loaded epub on iframe tag don't know how elements inside iframe tag. jquery(document).ready(function($) { var tmp = $('#epub_loader iframe').contents().find('body').html(); alert(tmp); }); <iframe id="epub_loader" href="test.epub" ></iframe> ` assuming both frames on same domain , there no restriction same domain policy , can use following code "parent" frame element in "child" iframe (in case body tag). pseudo code, need point iframe dom id: var html = document.getelementbyid('iframe').contentdocument.body.innerhtml; notes: in case iframe on different domain, have limited access browser security reasons.

python - Plot a Data Set According to Counts of Categories of a Variable -

Image
i have dataset has 14 columns (i had use 4 columns: travelling class, gender, age, , fare price) have split train , test data sets. need create vertical bar chart train data set distribution of passengers travelling class (1, 2, , 3 classes). not allowed use numpy, pandas, scipy, , scikit-learn. i new python, , know how plot simple graphs, when comes more complicated graphs, bit lost. this code (i know there lot wrong): travelling_class = defaultdict(list) row in data: travelling_class[row[0]] travelling_class = {key: len(val) key, val in travelling_class.items()} keys = travelling_class() vals = [travelling_class[key] key in keys] ind = range(min(travelling_class.keys()), max(travelling_class.keys()) + 1) width = 0.6 plt.xticks([i + width/2 in ind], ind, ha='center') plt.xlabel('tracelling class') plt.ylabel('counts of passengers') plt.title('number of passengers per travelling class') plt.ylim(0, 1000) plt.bar(keys, vals, width) plt....

How to replace tokens on email campain using REST API in PHP ? -

i have email campaign on marketo send emails using php. on email template have token like, {{my.emailbody:default=body}} replace the token custom email content php code, this code, $sample = new sendsampleemail(); $sample->id = 11111; $sample->emailaddress = "myemail@example.com"; print_r($sample->postdata()); class sendsampleemail{ private $host = "https://aaa-aaa-121.mktorest.com"; private $clientid = "dxxxxxxxxxxxxxxxxxxxxx1"; private $clientsecret = "sxxxxxxxxxxxxxxxxxxxxxxxxxxxxe"; public $id; //id of delete public $emailaddress;//email address send public $textonly;//boolean option send text version public $leadid;// id of lead impersonate public function postdata(){ $url = $this->host . "/rest/asset/v1/email/" . $this->id . "/sendsample.json?access_token=" . $this->gettoken(); $requestbody = "&emailaddress=" . $this->emailaddress; if (isset($thi...

Why can't I initialize and declare pointer to pointer to NULL in C? -

i wrote c program. part of code inside function looks this: struct node* functionname(struct node *currentfirstpointer){ struct node **head = null; *head = currentfirstpointer; return *head; } here node structure. line gives me segmentation fault when run program. if declare , initialize pointer pointer in separate statements inside same function below works fine. struct node* functionname(struct node *currentfirstpointer){ struct node **head; *head = null; *head = currentfirstpointer; return *head; } what reason 1st block doesn't work , 2nd block works fine? you have 2 examples of dereferencing pointer. struct node **head = null; *head = currentfirstpointer; and struct node **head; *head = null; *head = currentfirstpointer; both cause undefined behavior. in first, dereferencing null pointer. in second, dereferencing uninitialized pointer. the second block may appear work that's problem undefined behavior. you need...

jquery to run clone function with multiple selectors -

$(document).ready(function() { $(".add_file_group, .clone_email2, .clone_email").click(function() { $("#clone_file_group").clone().insertafter("div#clone_file_group:last"); console.log(this); }); }); using function different selectors in 1 section, 1 selector working as class name clone_email2, .clone_email suggest these generated dynamically. need use delegate event handler try this $(document).on('click', '.add_file_group, .clone_email2, .clone_email', function () { $("#clone_file_group").clone().insertafter("div#clone_file_group:last"); }); description: attach handler 1 or more events elements match selector, or in future, based on specific set of root elements.

php - I am working for a project and I have to get data from a WSDL -

i confused on , appreciate if helps me.i working project , have data wsdl.this webservice url . url. http://203.109.97.241/axis/services/searchhoteldetails?wsdl first in xml integration.so dont know how data fronm url.i try country name way. <?php $client = new soapclient("http://203.109.97.241/axis/services/searchhoteldetails?wsdl", array('soap_version' => soap_1_2)); $something = $client->gethoteldetailsxmlresponse(array("country"=>"india")); echo "<pre>"; print_r($something); die(); ?> but cant result..any 1 pls me. your using wrong method name. actual method name gethoteldetailsxml request call should : $something = $client->gethoteldetailsxml($xml_request); $xml_request request xml. (please xml document , assign variable.). modified code: <?php $xml_request = "<hotelsearchrequest> <clientinfo> <companycode>companycode</companycode> <usern...

html - Array index doesn't go out of bound in Javascript -

Image
i creating javascript application want generate arrayindexoutofbound exception. have created array of size 5 , trying insert elements fibonacci series it. ideally, should throw exception after inserting 6th element, not throwing exception. please check code , let me know views. attached code , screenshots of output. <!doctype html> <html> <head> <title>error handling demo</title> <script type="text/javascript"> var = 1; var fibona = []; fibona.length=5; function generatenext() { if(i>1) { number1.value = number2.value; number2.value = number3.value; } number3.value = parseint(number1.value) + parseint(number2.value); i++; fibona.push({'num1':number1.value, 'num2':number2.value, 'num3':number3.value}); } </script> </head>...

Extracting value(s) from json array with php -

this question has answer here: sum values of multidimensional array key without loop 4 answers my cart store orders in json_encode array database. possible extract total price array.. if there 4 products want extract sum of 5 prices? here example of array {"73":{ "title":"test", "description":"", "quantity":1, "image":"", "price":90}, "66":{ "title":"title", "description":"", "quantity":1, "image":"", "price":80}, "shipping":{" quantity":1, "image":"", "description":"", "title":"free delivery", "price...

android - Showing ProgressBar on parsing and downloading json result -

in app hitting service can have no result n number of results(basically barcodes). of using default circular progressbar when json parsed , result being saved in local db(using sqlite). if json has large number of data takes 30-45 min parse , simultaneously saving data in db, makes interface unresponsive period of time , makes user think app has broken/hanged. problem want show progressbar percentage stating how data parsed , saved user know app still working , not dead. took link couldn't find how achieve. here's asynctask, class backgroundtasks extends asynctask<string, string, void> { private string operation, itemref; private arraylist<model_barcodedetail> changedbarcodelist, barcodelist; private arraylist<string> changereflist; string page; public backgroundtasks(string operation, string itemref, string page) { this.operation = operation; this.itemref = itemref; this.page = page; } @override ...

php - PDO - Does PDO prepare query cache now? -

i read lots of articles, can't find clear answer question. most articles not seem recent ones, want check again. does mysql query cache affect pdo prepared queries now? if send prepare twice $mysql->prepare("select * `table` `id` = ?"); the second select reflect result cache? if yes, , if there different page send same prepare query, cache work fine? i read mysql documentation , know query cache support native sql query: mysql_stmt_prepare() , mysql_stmt_execute(). but didn't know how pdo prepare queries working.

dotnetnuke - How to set Module 'In Use' in DNN Installation.? -

Image
i have installed packages of flex event, learning dnn. don't know how use , further process. as module dropped on page in site system automatically flag "in use." that column designed users understand modules might used, versus, modules installed no longer or not yet implemented.

android - the first fragment in tabbed activity is always blank -

i'm using tabbed activity show 3 tabs problem is, first tab blank, while second , third works. , if click third 1 , after click on first one, first loads data public class main2activity extends appcompatactivity { /** * {@link android.support.v4.view.pageradapter} provide * fragments each of sections. use * {@link fragmentpageradapter} derivative, keep every * loaded fragment in memory. if becomes memory intensive, * may best switch * {@link android.support.v4.app.fragmentstatepageradapter}. */ private sectionspageradapter msectionspageradapter; /** * {@link viewpager} host section contents. */ private viewpager mviewpager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main2); //toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); //setsupportactionbar(toolbar); // create adapter return fragment each of 3 // primary sections of activity. msectionsp...

delphi - Writing a generic TList of records -

i trying write generic tlist contains records of specific type. starting david's answer on question , have written class: type tmerecordlist<t> = class(tlist<t>) public type p = ^t; private function getitem(index: integer): p; public procedure assign(source: tmerecordlist<t>); virtual; function first: p; inline; function last: p; inline; property items[index: integer]: p read getitem; end; procedure tmerecordlist<t>.assign(source: tmerecordlist<t>); var srcitem: t; begin clear; srcitem in source add(srcitem); end; function tmerecordlist<t>.first: p; begin result := items[0]; end; function tmerecordlist<t>.getitem(index: integer): p; begin if (index < 0) or (index >= count) raise eargumentoutofrangeexception.createres(@sargumentoutofrange); result := @list[index]; end; function tmerecordlist<t>.last: p; begin result := items[count - 1]; end; having methods return...

javascript - Execute all ajax request if browser closed -

i have report in codeigniter project complex report having more 100 pages. for using ajax retrieve data. there more 60+ ajax requests using set time out run each request. reports took 8 minutes complete. that's why want run crone, when added crone not running ajax code via linux, is there way run whole process back-end (no use of browser) or linux? if looking non-browser option there no need ajax. can same action pure php scripts. convert 60+ ajax request different functions , call function after time interval.

git - Gitkraken disable auto file renaming -

i noticed, gitkraken renames automatically files, filenames contains special character. äpfel.js becomes ?pfel.js or else. the problem is, these files provided else, filenames should stay same. so there chance change behavior? sourcetree example not alter filenames. gitkraken new code , still actively being developed. let them know problem, may not respond individually issue keep eye on release notes see when fixed.

powershell - Passing arguments to job initialization script -

i have multiple jobs , every job want have same initialization script sets things up. i'd pass arguments initialization script, unfortunately arguments passed using -argumentlist seem accessible in actual job script. here's example demonstrates argument being accessible in actual script: function startjob([scriptblock] $script, [string] $name, [scriptblock] $initialization_script = $null, $argument = $null) { start-job -scriptblock $script -name $name -initializationscript $initialization_script -argumentlist $argument | out-null } [scriptblock] $initialization_script = { # argument given startjob should accessible here param($test) echo "test: $test" } [scriptblock] $actual_script = { param($test) echo "test: $test" } startjob $actual_script "test job" $initialization_script "have string in `$initialization_script" @(get-job).foreach({ # wait job finish, remove , output results write-host ...

Error integration SonarQube Msbuild runner with TeamCity -

Image
i have teamcity build, i've added build start , end actions sonarqube analysis, , between 2 task there build msbuild. when sonarqube plugin executes end phase fails error. [10:16:52][step 5/9] starting: c:\sonarqube\runner\msbuild.sonarqube.runner.exe end [10:16:52][step 5/9] in directory: c:\agents\build2\work\a6252c8eea7552b3\src [10:16:52][step 5/9] sonarqube scanner msbuild 2.0 [10:16:52][step 5/9] default properties file found @ c:\sonarqube\runner\sonarqube.analysis.xml [10:16:52][step 5/9] loading analysis properties c:\sonarqube\runner\sonarqube.analysis.xml [10:16:53][step 5/9] post-processing started. [10:16:53][step 5/9] sonarqube scanner msbuild end step 2.1 [10:16:53][step 5/9] sonarqube msbuild integration failed: sonarqube unable collect required information projects. [10:16:53][step 5/9] possible causes: [10:16:53][step 5/9] 1. project has not been built - project must built in between begin , end steps [10:16:53][step 5/9] 2. unsupported version of msbuil...

cordova - Video Orientation On CordovaCapture -

i using cordova-plugin-media-capture plugin record videos. captures fine when recorded in landscape orientation on portrait mode, video shown upside down. following sample code var options = { limit: 1}; $cordovacapture.capturevideo(options).then(function(videodata) { addvideotolocalstorage(videodata, slotnumber); }, function(err) { $scope.localstoragevideos = 'err: <br />'+ json.stringify(videodata) }); you can lock orientation application using config.xml value: <preference name="orientation" value="portrait"/> while works well, wanted videos in landscape mode instead. had working fine in ios nothing tried work android. began looking plugin allow me switch orientation dynamically. one, screen orientation worked great. so @ point - found code in application fired off video go full screen mode, , added 2 simple lines of code set orientation landscape. video.addeventlistener('playing'...

multipartentity - How to print the sending data of multipart entity in android -

i have uploading multiple image , string data php server.i want print data want i'm sending sever.i have tried this class imageuploadtask extends asynctask { string sresponse = null; @override protected void onpreexecute() { // todo auto-generated method stub super.onpreexecute(); dialog = progressdialog.show(room_addroom1.this, "uploading", "please wait...", true); dialog.show(); } @override protected string doinbackground(string... params) { try { string url ="http://airbnb.abservetech.com/demo/public/mobile/hotel/roomsadd"; int = integer.parseint(params[0]); system.out.println("i---"+i); sharedpreferences prefs = getsharedpreferences(mypreferences, mode_private); string userid = prefs.getstring("userid", null); bitmap bitmap = decodefile(map.get(i)); httpclient httpclient = new defaulthttpclient(); httpcontext localcon...

rsyslog to send data to the same server showing error on modules -

my app producing logs under /var/log/myapp/app.log i need send logs under app.log syslog file /var/log/syslog. i created file following content /etc/rsyslog.d $workdirectory /var/spool/rsyslog $template rfc3164fmt,"<%pri%>%timestamp% %hostname% %syslogtag%%msg%" # log shipment rsyslog target servers $actionqueuefilename appfile $actionqueuesaveonshutdown on $actionqueuetype linkedlist $actionresumeretrycount 250 *.* @10.x.x.1;rfc3164fmt # log files $inputfilename /var/log/myapp/app.log $inputfiletag app: $inputfilestatefile state-app $inputfilefacility local7 $inputfilepollinterval 1 $inputfilepersiststateinterval 1 $inputrunfilemonitor 10.x.x.1 same node rsyslog installed , app running. once restart rsyslog getting following error in syslog file invalid or yet-unknown config file command 'inputfilename' - have forgotten load module? [try http://www.rsyslog.com/e/3003 ] invalid or yet-unknown config file command 'inputfiletag' - hav...

css - Reduce space between icon and text in Polymer's paper-icon-item -

Image
i want reduce space between icon , text in paper-icon-item . how do that? i tried paper-icon-item { --paper-item-icon: { padding-right: 0; } but not making difference. you need reduce icon area's width, default 56px. example: paper-icon-item { --paper-item-icon-width: 40px; }

javascript - jquery.mask - allow users to enter separators ("." and ",") -

i'm using jquery.mask percentage , price amounts; i'm trying find way allow users input own "," , "." separators: $(document).ready(function(){ $('.price').mask('###.###.###,##', { reverse: true }); $('.percent').mask('##.###,##', { reverse: false }); }); here's jsfiddle.net/muooymjd/2/ right now, everything's automatic; entering amount of 1000000, changes value 100.000,00 real-time , can't use "," or "." inside of input; however, intention allow user input data first (allowing him enter 10,00, 100.00,34, 1000 or whatever needs); and then, if decimals wrong, input when off-focus puts "," , "." in correct places. is feasible?

Calling unmanaged Code from C# -

with inspiration openhardwaremonitor project have made myself nice gadget monitor cpu , gpu metrics temperature, load, etc. it works fine running in pinvokestackimbalance warning when calling nvidia driver methods , don't think wise ignore them. however after weeks of experimentation (with nvidia documentaion in hand) still can't figure out how define , use drivers structs , methods in such way vs 2015 happy - strange because there no warnings in openhardwaremonitor project despite using exact same code. hopefully here can point me in right direction. [dllimport("nvapi.dll", callingconvention = callingconvention.cdecl, preservesig = true)] private static extern intptr nvapi_queryinterface(uint id); private delegate nvstatus nvapi_enumphysicalgpusdelegate([out] nvphysicalgpuhandle[] gpuhandles, out int gpucount); private static readonly nvapi_enumphysicalgpusdelegate nvapi_enumphysicalgpus; nvapi_enumphysicalgpus = marshal.getdelegateforfunctionpointer(n...

java - Android - storing two arrays in a single RecyclerView -

Image
i have 2 arrays : private void initdata(){ list = new arraylist<string>(); list.add("element 1"); list.add("element 2"); list.add("element 3"); list.add("element 4"); list.add("element 5"); } private void initdata2(){ list2 = new arraylist<string>(); list.add("item 1"); list.add("item 2"); list.add("item 3"); list.add("item 4"); list.add("item 5"); } what want achieve storing both lists in singler recyclerview in way list elements shown on left side of screen , items list shown in right side (like shown in picture below) using 2 listviews , willing convert single recyclerview ps. preferably maintain structure of arrays edit / tutorial going use recyclerview tut...

Increasing the maximum throughput of tcp/ip connections in linux -

i'm testing nodejs app serves media files stored in memory. media files approximately 2mb-5mb each in size. i'm trying figure out what's best way max out available ethernet channel (1 gbps or 10 gbps). i'm testing in vm (virtualbox) ubuntu 16.04.1 lts. testing i'm using own nodejs script makes multiple outgoing requests server , logs console average bitrate. test nodejs script runs 1 minute , there configurable parameter n indicates how many simultaneous downloads can have @ once. what noticed if increase number of simultaneous downloads average throughput goes down considerably. example: if tun test n = 30 (30 simultaneous downloads) 125 mb/s overall, in case each of these requests served @ 3-5 mb/s now, if run n = 300 overall bitrate of 90 mb/s or 30% lower if run n = 600 overall bitrate of 80 mb/s. any idea why doesn't seem scale higher number of simultaneous downloads? higher number of simultaneous connections doesn't have cpu impact, i...

generics - Java Wildcard cast to subtype -

this question has answer here: is list<dog> subclass of list<animal>? why aren't java's generics implicitly polymorphic? 12 answers for historical reasons must use abstract class 2 wildcard parameters: abstractcolumn<m, i> and have implementation(idatasource interface): simplecolumn<i> extends abstractcolumn<idatasource<i>, i> the problem starts when should cast idatasource<i> parameter it's implementation, e.g. genericdatasource<i> : simplecolumn<i> column; abstractcolumn<genericdatasource<i>, <i>> newcolumn = (abstractcolumn<genericdatasource<i>, <i>>)column; i'm getting error: type mismatch: cannot convert abstractcolumn<genericdatasource<i>,i> abstractcolumn<idatasource<i>,i> and if i'm trying convert ida...