Posts

Showing posts from April, 2011

Load Record by ID for View CakePHP 3 -

i have basic question. have column in computer record id of customer owns computer. trying show name in table next computers' , found temporary solution. using in view (which isn't proper mvc) , makes page take forever load (i showing 100 computers per page). <td> <?php foreach ($customers $customer): if ($computer->cust_id == $customer->id) { echo $this->html->link( $customer->first.' '.$customer->last, ['controller'=>'customers', 'action'=>'view', $customer->id] ); } endforeach; ?> </td> i tried $this->customers->get($computer->cust_id) after loading model in controller says need customer helper. cakephp method of taking care of issue? thanks!

algorithm - Is it possible to generate the wheel lazily? -

on the genuine sieve of erastosthenes paper, author uses wheel of finite size skip checking multiples of first n primes on sieve construction. example, in order avoid checking multiples of 2, 3 , can begin @ 5 , , alternately add 2 , 4. wheel 2 below: -- wheel 0 = ([2],[1]) -- wheel 1 = ([3,2],[2]) -- wheel 2 = ([5,3,2],[2,4]) -- "start @ 5, add 2, 4, 2, 4..." -- wheel 3 = ([7,5,3,2],[4,2,4,2,4,6,2,6]) her wheel generated on startup of sieving process. presents tradeoff, since larger wheels require more memory. find underlying mechanism behind wheel generation interesting itself, though. given repetitive nature, wonder if possible create "infinite wheel" which, sieve, presented stream? stream be, guess, limit of sequence of lists [1], [2], [2, 4], [4, 2, 4, 2, 4, 6, 2, 6]... - , work implementation of primes itself. as bakuriu says, wheel sequence has no limit. there no such thing "infinite wheel", i'll try demonstrate why. if kn

c# - Task.Yield(); SyncAction(); vs Task.Run(()=>SyncAction()); -

let's wanted make following method run asynchronously: resulttype synchronouscode(paramtype x) { return somelongrunningwebrequest(x); } what difference in how following 2 code samples executed/scheduled? async task<resulttype> asynchronouscode(paramtype x) { return await task.run(() => somelongrunningwebrequest(x)); } compared to: async task<resulttype> asynchronouscode(paramtype x) { await task.yield(); return somelongrunningwebrequest(x); } i understand task.yield() call ensure thread returns caller, , task.run() schedule code run somewhere on threadpool, both of these methods make method async? let's assume question on default synchronizationcontext. while both options bad, there difference (important in gui applications): after task.yield returns, rest of method dispatched original synchronizationcontext . if ran ui thread, long running operation executed on ui thread, freezing it. if intention avoid ui blocking - ta

Change Date Settings in Spotfire -

the default spotfire work week starts on sunday , ends on saturday. i adjust default value starts on monday , ends on sunday. adjust work week value , company's work week 1 less default spotfire value. so if i'm looking @ 2016, work week 1 starts monday january 4th , ends sunday january 10th. thanks!

android - How to cancel the repeated alarm and scheduled so that it fire up every after 5 sec? -

i use broadcast receiver repeated notification notify user every after 5 sec when receiver cut call or come in idle state. ** mainactivity.java protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); btn1 = (button) findviewbyid(r.id.callbutton); phonecalllistener phonelistener = new phonecalllistener(); telephonymanager telephonymanager = (telephonymanager) .getsystemservice(context.telephony_service); telephonymanager.listen(phonelistener, phonestatelistener.listen_call_state); btn1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent callintent = new intent(intent.action_call); callintent.setdata(uri.parse("tel:0000000000")); startactivity(callintent); } }); } private class phonecalllistener extends phonestatelistener { strin

html - CSS outline property appearing as two separate line in firefox -

Image
i using css outline property create dashed line. while line renders correctly in chrome , safari, in firefox appears 2 separate lines. if adjust size of window can these 2 line perfect alignment appear single line, should not have this. chrome css outline property: css .dash-border{ outline-style: dashed; outline-color: #fff; width: 100%; position:absolute; bottom: 80px; } html <div class="dash-border"></div> try use -moz , example: .dash-border { outline-style: dashed; outline-color: #fff; -moz-outline-style:dashed; -moz-outline-color: #fff; width: 100%; position:absolute; bottom: 80px; }

youtube api - How to solve android.view.InflateException with class <unknown>? -

i using youtubebaseactivity recyclerview adapder.: android.view.inflateexception: binary xml file line #19: binary xml file line #19: error inflating class <unknown> @ android.view.layoutinflater.inflate(layoutinflater.java:539) @ android.view.layoutinflater.inflate(layoutinflater.java:423) code public class youtubevideoplayeractivity extends youtubebaseactivity implements youtubeplayer.oninitializedlistener { private static final int recovery_request = 1; private youtubeplayerview youtubeview; string uri; string title; textview videotitle; recyclerview recyclerview; requestqueue requestqueue; youtubevideoplayersreenadapter adapder; list<videothumblinedata> videothumblinedatas = new arraylist<videothumblinedata>(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activ

Can I open / stream a remote file (PDF) in JavaScript and push it to another server? -

i'm building out internal tools staff streamline processes. 1 particular task gets tedious needing download pdf file 1 website, , upload same file website use send faxes (hellofax). hellofax support email -> fax, i'd build bookmarklet / browser extension grab pdf file instead of forcing browser download it, , send on basic web service email file attachment. possible?

protocols - Transmitting odd number of bits serially -

i'm implementing lin protocol on linux sbc transmits on uart. don't have time develop complete lin stack, i'm implementing frame structure messages defined protocol. problem protocol requires "break" field makes slave devices on bus listen. field consists of zeros 13 bit-times. ideas how send zeros 13 bit-times on uart, when serial data transmission requires complete bytes? per wiki : lin (local interconnect network) serial network protocol used communication between components in vehicles. need cheap serial network arose technologies , facilities implemented in car grew, while can bus expensive implement every component in car. european car manufacturers started using different serial communication topologies, led compatibility problems. if have paid attention @ class have known that: data transferred across bus in fixed form messages of selectable lengths. the master task transmits header consists of break signal fol

java - Q: javafx fxml jdbc getting database data to ListView -

i'm making program using scene builder create ui, got problem how load database listview @ beginning of program, have no clue how it. created method in controller class, can run button or this. program looks like: http://pastebin.com/y9vcavwf i appreciate help in controller create method called initlialize, method called after controller created , fxml fields assigned. put loadevents(); inside it. @fxml public void initialize() { loadevents(); }

TYPO3 / Formhandler / Make formhandler records editable? -

is possible make formhandler records editable , show , sort - lets - name , lastname in typo3 be? thanks in advance. i lately made dummy extbase extension customer. formhandler stores data in these tables. accessible usual in backend. sortable , editable , like.

angular - Angular2 - How do I delay initial load until service completes? -

i have angular2 rc6 application , need defer loading pages until after functionality executed. i have service determines uri webapi. need application wait until url determined before tries load data. if hide main application in app.component, *ngif, routing errors because router outlet not exists. before rc5/6 manually bootstrapped application after service get's uri. if use router can use canactivate , canactivatechild . see https://angular.io/docs/ts/latest/guide/router.html#!#guards resolve value *before* activating route in angular 2 angular2 canactivate() calling async function for loading once before app initialization can use app_initializer explained in how pass parameters rendered backend angular2 bootstrap method

php - Parse error: syntax error, unexpected in Redux framework wordpress -

this question has answer here: php parse/syntax errors; , how solve them? 12 answers i used redux framework theme according tutorial of redux in link gives error error : parse error: syntax error, unexpected ''placeholder'' (t_constant_encapsed_string), expecting ')' in c:\xampp\htdocs\wp\wp-content\themes\theme\options\config.php on line 273 and config file : redux::setsection( $opt_name, array( 'title' => __( 'صفحه ی اصلی', 'dima_theme' ), 'id' => 'dima-index', 'desc' => __( 'تنظیمات صفحه ی اصلی', 'dima_theme' ), 'icon' => 'el el-instagram', 'fields' => array( array( 'id' => 'opt-slides',

cordova - Phonegap android allow specified domains not restrict other -

so problem phonegap android allow specified domains not restrict other i set config.xml <plugin name="cordova-plugin-whitelist" spec="https://github.com/apache/cordova-plugin-whitelist.git" /> <allow-navigation href="http://domain.net/*" /> <access origin="http://domain.net" browseronly="true" /> but webview still can open other domains. it works on ios not on android.

regex - how to configure htaccess file if main controller resides in public folder -

i saw near identical question mine, accepted answer doesn't work reason. my problem cannot access index.php sits inside public folder. have tried innumerable combinations , believe it's in correct folder -- public folder. the answer didn't work make rewritebase %{document_root}/public. did index of. @ least public folder not visible, however, feels i'm getting close. any appreciated. ps. can see application on local machine rewritebase /projectname/public url must include public or index of page. want rid of public portion , work off root (domain name). here .htaccess file: options -multiviews rewriteengine on rewritebase %{document_root}/public rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.+)$ index.php?url=$1 [qsa,l] updated htaccess file: options +followsymlinks -multiviews rewriteengine on rewritebase /public/ rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.+)$ index

php - I have two identical .htaccess. How do I create one in root folder? -

here .htaccess in root. same 1 in folder /enter rewriteengine on rewritecond %{script_filename} !-d rewritecond %{script_filename} !-f rewriterule ^([a-za-z0-9_-]+)$ index.php?content=$1 rewriterule ^([a-za-z0-9_-]+)/([a-za-z0-9_-]+)$ index.php?lang=$1&content=$2 how turn on folder "enter" in root .htaccess , remove duplicate htaccess ? i think you're looking this: rewriteengine on rewritecond %{script_filename} !-d rewritecond %{script_filename} !-f ## enter rewriterule ^([a-za-z0-9_-]+)/enter$ enter/index.php?lang=$1&content=$2 [l] rewriterule ^([a-za-z0-9_-]+)/enter/([a-za-z0-9_-]+)$ enter/index.php?lang=$1&content=$2 [l] ## root rewriterule ^([a-za-z0-9_-]+)$ index.php?content=$1 rewriterule ^([a-za-z0-9_-]+)/([a-za-z0-9_-]+)$ index.php?lang=$1&content=$2 by way: [l] means "last": http://httpd.apache.org/docs/2.4/rewrite/flags.html

javascript - For ThreeJS, 'm looking for a Helper class or utility that works like AxisHelper -

Image
in working three.js , i’ve run across several useful helper classes make displaying , or modifying scene easier. there 1 tool out there can’t seem find again. kind of axishelper has plane between axis when mouse on area allowing user move object along xy, xz, or yz plane depending on pick. i’ve drawn example of adds object in order user move object along plane. if knows of tool or maybe example of uses utility this, great if point out me. thanks. i expect looking transformcontrols . there three.js example of use here . transformcontrols not part of library -- part of examples. must include explicitly in project. three.js r.80

c# - How to get Lumenworks CsvReader to correctly parse data with unescaped double quotes and commas from a CSV file -

i trying parse csv file using lumenworks csvreader. each data point wrapped in double quotes, however, values contain unescaped double quotes within data, , other values contain commas within data. the issue facing when parse csvreader, columns ending in file due lumenworks seeing these characters delimiters. as read below, i've handled issue unescaped double quotes using known solution, results in issue of columns being generated data commas inside. example: 2 columns (each wrapped in quotes), unescaped double quotes in 1 of data points "name","description" "bob","i "cool" guy" when attempting perform csvreader.readnextrecord(), instead of splitting 2 columns, splits 4 columns: bob i a cool guy i've used solution provided in reading csv having double quotes lumenwork csv reader , works quite well! this how i've implemented it: char quotingcharacter = '\0' ; char escapecharacter = quot

c - Error during string read/write -

this question has answer here: implicit declaration of 'gets' 2 answers the following program used write string file when compile using gcc shows errors #include<stdio.h> #include<string.h> #include <stdlib.h> int main() { file *fp; char s[80]; fp = fopen("poem.txt", "w"); if(fp == null) { puts("cannaot open file"); exit(1); } printf("\n enter"); while(strlen(gets(s)) > 0) { fputs(s, fp); fputs("\n", fp); } fclose(fp); return 0; } the error when compiling gcc expi.c expi.c: in function ‘main’: expi.c:18:14: warning: implicit declaration of function ‘gets’ [-wimplicit-function-declaration] while(strlen(gets(s))>0) ^ expi.c:18:14: warning: passing argument 1 of ‘strlen’ makes pointer integer with

continuous integration - Travis-ci decryption of encrypted files -

i encrypted .env file, , have .env.enc file. how team decrypt this? got response when encrypted file, , stored in .travis.yml file openssl aes-256-cbc -k $encrypted_cf94abc85bdc_key -iv $encrypted_cf94abc85bdc_iv -in .env.enc -out .env -d i tried on terminal , get: iv undefined i tried decrypting travis-cli: travis encrypt-file .env.enc .env -d i this: key must 64 characters long , valid hex number i tried key , iv travis encrypt-file .env.enc .env -d -k $encrypted_cf94abc85bdc_key -iv $encrypted_cf94abc85bdc_iv i checked if travis env variables exist, , do: encrypted_cf94abc85bdc_key=[secure] encrypted_cf94abc85bdc_iv=[secure]

How to open a Visual Studio Code Folder (Project) in Visual Studio IDE -

how open visual studio code folder in visual studio 2015? if open "web site", tries treat node_modules directory part of project's normal javascript files , hits error when path exceed maximum path length. but can't open other project type unless first create project of type , move vs code files folder. should trying open web site? or should create new project , copy files + folders it? is there advantage having project? if create project, makes difficult work using vs code? and if use project, project type should select? currently there no way open folder directly visual studio. why? because visual studio , visual studio code shared name, not the idea behind it. extend jenny o'reilly answer: visual studio code folder oriented editor this means vsc has same point-of-view project file explorer. visual studio (not code) solution oriented integrated development environment (short ide) instead every project in visual studio need

c# - SQL Server gives "duplicate key" error for a non-key property? -

Image
i have db table products 5 columns. id primary key. in sql server management studio, can see here: i have product id = 69 , name = "lawn darts" . trying insert new product id = 420 , name = "lawn darts". trying use identity insert can specify id products inserted. names same id different. should no problem, right? i using linq --> sql insert in c# console app. when try insert same name different id , following error message: cannot insert duplicate key row in object 'dbo.products' unique index 'ix_name'. duplicate key value (lawn darts). why, if non-key? well, simpler making it. @rook pointers. even though name column not primary key, specified "unique index". looking in wrong settings in sql server management studio, missed it. looking in "properties". needed right-click on "name" column , select "indexes/keys..." option. brings window can turn attribute is unique &

jquery - How to fix the header to top After Scrolling -

Image
logo: my header has logo. how fix @ top after scrolling? here code please help!! stucked it nice if see code, have feeling duplicate anyways. try here: how can stick div after scrolling down little or try here: make nav bar stick top when scrolling css also, https://css-tricks.com/ out this.

java - Is there a way to check if a ComboBox has any items in JavaFX? -

is there way check if combobox has items in or whether empty? have array of combobox es , need go through each of them, if there no items in combobox , must hide it. following code doesn't seem work: for (combobox cmb : comboboxes) { if (cmb.getitems().isempty()) { cmb.hide(); } } the .getitems() method returns observablelist<t> can check .size() . tell if it's empty. for (combobox cmb : comboboxes) { if (cmb.getitems().size() <= 0) { // or cmb.getitems().isempty() cmb.setvisible(false); } } if combobox populated list of own, check if list empty same .size() call.

perl - How to access other controllers in your application? -

i have application several controllers dedicated each own part, say, "news", "articles" , "shop". not connected each other, should be, need insert data them, news related current shop category. have not found clean way access controllers other current 1 handling request. the structure of modules is: site.pm main project file. articles.pm handles articles. news.pm handles news. shop.pm handles shop. site.pm loads each of above dynamically array of module names , calls register function set routes , other things @ startup. articles, news, etc take content database, , rendered inline template, thus, can't take related news , slam them stash, not entries in shop might need information. this theoretical answer without code. you have database stuff decoupled actual controllers models. that's good. so let's assume we're in shop , want show news related current product. there @ least 2 ways that. you call models

javascript - <Selenium WebDriver JS> Can't find element & implicit wait problems -

i've been trying write selenium script in javascript fill out 'email' field on site, keeps telling me "element not found"... i'm trying find element: <input type="email" placeholder="email" name="email" class="form-control sweep" data-radium="true" data-reactid=".btcvpfkiyo.0.$/=10=22.0.0.$=12.0.0.0.$=10.$=11.0.$/=10.$=10.0" disabled=""> first go page, wait few seconds before try find element: driver.get('www.mysite.com').then(function() { driver.manage().timeouts().implicitlywait(10000); driver.findelement({name:'email'}) .then(function(present) { if (present) { console.log("found"); } }); }); i've tried access element in many ways... here's i've tried: driver.findelement(by.xpath("//input[@name='email']")) driver.findelement(by.css("input[type='email']")) driv

Change background color in Yii2 gridview cell depend on its value -

i trying make background color depending on value calculation number in 1 cell. code: [ 'attribute' => 'coeftk', 'label' => '<abbr title="koefisien jumlah tenaga kerja">tk</abbr>', 'encodelabel' => false, 'headeroptions' => ['style'=>'text-align:center'], 'options' => [ 'style' => $dataprovider['coeftk']/$dataprovider['coeftk_se']<2 ? 'background-color:red':'background-color:blue'], ], but got error, "cannot use object of type yii\data\activedataprovider array" so, how can change background gridview cell have value calculation ? use contentoptions : [ 'attribute' => 'coeftk', 'label' => '<abbr title="koefisien jumlah tenaga kerja">tk</abbr>', 'encodelabel' => false, 'headeroptions' => ['style

javascript - Angularjs Remove Objects With Empty Fields -

if have within scope variable so: $scope.mylistold = [ { title: "first title", content: "first content" }, { title: "second title", content: "" }, { title: "third title", content: "" }, { title: "fourth title", content: "fourth content" } ]; how create new scope variable removed empty values on specific field? (in case content). $scope.mylistnew = [ { title: "first title", content: "first content" }, { title: "fourth title", content: "fourth content" } ]; use array.prototype.filter function removeifstringpropertyempty(arr, field) { return arr.filter(function(item) { return typeof item[field] === 'string' && item[field].length > 0; }); } var $scope = {"mylistold":[{"title":"first title","

sql - how can get count of rows in hibernate when hql have group by? -

i have hql query have group .in pagination result want count of result show in pagination . in query donot have group .i write utility create count of query hql query select u personel u u.lastname='azizkhani' i find main "from" keyword , substring hql , add count(*) , make query select count(*) personel u u.lastname='azizkhani' when have query contain group can not select u.lastname,count(*) personel u group u.lastname; count of query in sql select count(*) ( select u.lastname,count(*) tbl_personel u group u.lastname ) how can generate group query hql ?? i have genericrepository have method public <u> pagingresult<u> getallgrid(string hql,map<string, object> params,pagingrequest searchoption); and developer call this string hqlquery = " select e personel e 1<>2 , e.lastname=:lastname"; hashmap<string, object> params = new hashmap<string

javascript - Edit image on browse -

i have code when click on edit icon adds new image below existing image. want new image replace existing image. i know have use index attribute in div, need in doing so. adding code here: addimage = function(event){ var parent = event.currenttarget.parentnode.parentnode.parentnode, index = parseint(parent.getattribute('index')), script, clone = imageview.clonenode(true), files = event.target.files; (var = 0, f; f = files[i]; i++) { // process image files. if (!f.type.match('image.*')) { continue; } var reader = new filereader(); // closure capture file information. var imagebot = clone.queryselector('[name=imagebot]'); if (imagebot) imagebot.innerhtml = '<svg style="position:absolute; top:45%;left:50%" class="spinner" width="25px"

javascript - Saving data into Objects for Json Retrieval -

i working on saving data onto objects generated json input , later retrieved via load method . while saving data, due loop occurs in-between, breaking .push , re-pushing elements within loop shown below. but, while retrieving json output generated method, i'm unable access data pushed within loop , object value out of first push method. i know if there way can perform of needed, within single .push itself. if not, suggestions in regard appreciated. code in context //first push node.push({ id:idofel, class:dropelem, position: { top: position.top, left: position.left, bottom: position.bottom, right: position.right }, name:createdsimplequeryarray[elid][1], fromstream: { index:createdsimplequeryarray[elid][2][0], name:createdsimplequeryarray[elid][2][1] }, filter:createdsimplequeryarray[elid][3], intostream: { index:createdsimplequeryarray[elid][5][0], name:create

java - Elasticsearch 2.x sometimes throws NoNodeAvailableException -

i have same problem , doesn't happen, lets say: try connection. fail try connection. fail try connection. works... sometime i'm lucky , works couple of weeks i don't use spring-boot, jars , server same es-version (2.1.1. tried 2.4.0 too, , older es-version not solution). cluster name , port well. curl commands , sense working too my elasticsearch.yml: cluster.name sugar network.host: [my_host, _local_] my java connection code: settings settings = settings.settingsbuilder() .put("cluster.name", "sugar") .build(); inetaddress hostaddress = inetaddress.getbyname("my_host"); client client = transportclient.builder() .settings(settings) .build() .addtransportaddress(new inetsockettransportaddress(hostaddress, 9300)); // testing connection purpose client.admin() .cluster() .preparehealth() .execute(); .actionget(); we have docker-container qa, , works always!, our customers using windows,

java - Maven "Update Project" operation in Eclipse results in PMD "unable to find referenced rule" error -

i have maven project imported eclipse via m2e. project includes spring , other dependencies, reason not being recognized eclipse @ all. when attempt use "update project..." (right click => maven => update project) rectify issue, following error: an internal error occurred during: "updating maven project". unable find referenced rule emptyifstmt; perhaps rule name misspelled? pmd , checkstyle not enabled project. ideas why might getting error and/or how address it? the project builds fine via "mvn clean install," assume issue eclipse-specific. i've tried disabling , re-enabling maven nature of project no avail. end getting same error upon converting project maven one. go project folder , run mvn eclipse:eclipse before running update project . hope resolve issue.

pointers - How to check if two variables point to the same object in memory? -

for example: struct foo<'a> { bar: &'a str } fn main() { let foo_instance = foo { bar: "bar" }; let some_vector: vec<&foo> = vec![&foo_instance]; assert!(*some_vector[0] == foo_instance); } i want check if foo_instance references same instance *some_vector[0] , can't ... i don't want know if 2 instances equal; want check if variables point same instance in memory is possible that? i did digging on rust's github , found out there used function in std , it's not there anymore. there open rfc have back. for can perform cast *const t : assert!(some_vector[0] *const foo == &foo_instance *const foo); it should check if references point same place in memory.

caching - Umbraco 7.2.0 - grid.editors.config.js is cached and will not update -

i have created new grid editor, , have deployed production server. when on development machine, change grid.editors.config.js reflected immediately. however, on production server, change grid.editors.config.js has no effect. after research, have found issue client dependency cache. have tried following: removing files app_data/temp/clientdependency incrementing version number in config/clientdependency.config recycling application pool clearing browser cache restarting server what missing? when add query string, ie. https://mywebsite/config/grid.editors.config.js?v=1 changes shown, means file has updated on server. what need update file? are using expiration headers caching js on website? you try delete following files: app_data/temp/distcache app_data/temp/plugincache

WSO2 CEP - Single Event Table for Multiple Execution PLans -

i have been exploring wso2 cep last couple of days. i considering scenario single lookup table used in multiple execution plans. far know, way store data data event table. my questions are: can load event table once(may 1 execution plan) , share table other execution plans? if answer of q1 no, multiple copies of same data storing in different execution plans, right ? there way reduce space utilization ? if event table not correct solution other options ? thanks in advance, -obaid event tables work in scenario. however, might need use rdbms eventtable or hazelcast eventtable instead of in-memory event tables. them, can share single table data multiple execution plans. if want data preserved after server shutdown, should use rdbms eventtables (with can access table data using respective db browsers, i.e., h2 browser, mysql workbench, etc...). if want share single event table multiple execution plans @ runtime, can go ahead hazelcast eventtable.

java - How to get the scrollbars to work in a ScrolledComposite when using GridLayout? -

Image
i trying have scrolled composite fixed size content , label below scrolled composite display status information of scrollable content. want controls resize parent, have used gridlayout on parent. facing issue scroll bars of scrolled composite , positioning of label control. i.e, scrolling doesn't work unless set scrolledcomposite's grid data attribute as grabexcessverticalspace = true if allow scrolledcomposite grab excess vertical space, label not appear below scrolledcomposite due space between them. public class snippet5 { public static void main(string[] args) { display display = new display(); shell shell = new shell(display); shell.setlayout(new gridlayout(1, true)); // button 400 x 400. scrollbars appear if window // resized small show part of button scrolledcomposite c1 = new scrolledcomposite(shell, swt.border | swt.h_scroll | swt.v_scroll); button b1 = new button(c1, swt.push); b1.settext("fixed size button");

swift - How to insert a symbol at previous index for CorePlot real-time plotting? -

Image
as title, want insert symbol @ previous index real-time plotting image below. i have computation in order location of peak value symbol index(e.g. index = 1) , real-time scatter index (e.g. idx = 5) not same. how add symbol in previous index? please me, thanks!! use plot's -insertdataatindex:numberofrecords: method add data. starting index can between 0 (to add data before of existing data) , number of existing data points (to add data @ end). if add new points before existing ones, existing ones shifted on make room. keep in mind if reload plot data after inserting new points—the indices of old points change.

Wordpress htaccess in custom PHP -

i creating new website uses custom php code, retrieving wordpress posts remote wordpress. in root folder (as wordpress does), have default wordpress .htaccess file: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress i have index.php file gives me posts wp: <?php // include wp-load'er include('wp/wp-load.php'); // last 10 posts $recent_posts = wp_get_recent_posts(array( 'numberposts' => 10, 'post_status' => 'publish' )); ... ?> in project have other custom php files search.php , detail.php etc. all wordpress posts links formatted using slugs like: www.mywebsite.com/my-post/ the question is, how can change .htaccess file in order pass index.php slug parameter when url not .php file?. (like index.php?slug=my-post) th

java - BufferedReader with FileReader use alot of RAM -

i use bufferedreader , filereader on big files (~100g) bufferedreader reader = new bufferedreader(new filereader("file path")); bufferedwriter writer = new bufferedwriter(new filewriter("output file")); string line; while ((line = reader.readline()) != null) { // check if need line, , if need it, print writer.write(line); writer.newline(); } writer.close(); reader.close(); when run source on files, in beginning use low memory, used memory grows(can use on 50g of ram). why it's that? , can fix it? i see when run java program on linux command line -xmx parameter, reason make java program need alot of ram. from when remove -xmx parameter, java program use low memory. this old command: java -xmx350g -jar myjar.jar this new command: java -jar myjar.jar

javascript - Make field not required based to dropdown list selection MVC 5 -

in mvc 5 app, have form dropdown , fields required. need change attribute of fields when dropdown selection change. i have enum public enum orderkind { market, research, } from fill dropdown list. have use javascript show or hide fields work. something as $(function () { $('#orderkind').change(function () { var value = $(this).val(); if (value == "market") { $(datefrom).hide(); $(datefrom).hide(); $("#fromdate").attr("required", false); $("#todate").attr("required", false); else if (value == "research") { $(datefrom).show(); $(datefrom).show(); $("#fromdate").attr("required", true); $("#todate").attr("required", true); fromdate.setcustomvalidity('please fill date field');

amazon web services - Disk Space and Cluster in redshift -

is there option specify disk space , cluster usage each user while creating user in redshift ? disk space there no capability in amazon redshift limit users specific amounts of disk storage. redshift uses postgresql-like commands grant/revoke permissions database users. while tables associated owner , not possible limit amount of disk storage used tables associated user. in fact, not possible restrict storage space parameter cluster usage there 2 levels of control: redshift api calls launch , terminate clusters (plus other associated commands) database-level commands control whether users can create tables, query data, access views, etc these controls limit whether user permitted perform particular operation, not limit 'amount' of usage (eg disk space, concurrent queries). see: redshift security documentation

wordpress - Leverage browser caching not working - Htaccess & mod_expires Active -

i´ve been trying leverage browser cache quite while , have no idea problem. tried several methods activate it, nothing works... the site running on namecheap hosting. contacted support , asked if mod_expires module active , according customer support is... this code i´ve been using: # start --- browser cache control # turn on expires , set default 0 expiresactive on expiresdefault a0 # set caching on media files 1 year (forever?) <filesmatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> expiresdefault a29030400 header append cache-control "public" </filesmatch> # set caching on media files 1 week <filesmatch "\.(gif|jpg|jpeg|png|swf)$"> expiresdefault a604800 header append cache-control "public" </filesmatch> # set 2 hour caching on commonly updated files <filesmatch "\.(xml|txt|html|js|css)$"> expiresdefault a7200 header append cache-control "proxy-revalidate&

java - Data is not being inserted in MySQL database -

i have been trying develop webpage using java. this index.html : <!doctype html> <html > <head> <meta charset="utf-8"> <title>simple dark form</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <form action="../patientregistrationservlet" method="post"> <link href='http://fonts.googleapis.com/css?family=open+sans:400,300,700' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=sofia' rel='stylesheet' type='text/css'> <div class='login'> <h2>register</h2> <input name='first name' placeholder='first name' type='text'> <input name='last name' placeholder='last name' type='text'> <input name='ad1' placeholder=

entity framework - EF code first telling me to do the migration for db object which is already is in db -

i working ef code first. have no tables in database. wrote class , when query class saw ef code first create tables in db when create sql server view in db , later map view code in c# & ef project , when try query view getting error message follows. additional information: model backing 'testdbcontext' context has changed since database created. consider using code first migrations update database i understand ef telling me migration if migrate ef create view in db again when view in db exist. so tell me how inform ef view in db migration not required. please guide me. thanks edit 1 first time database has no table. wrote classes below one. public class customerbase { public int customerid { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string address1 { get; set; } public string address2 { get; set; } public string phone { get; set; } public string

excel - Trouble with Vlookup on power queries? -

Image
so it's simple function, =vlookup(a23,sheet3!a:e,5,0) i have 2 vlookup both returning power query, 1 works , other doesn't both formatted in same way , both query's similar (no obvious differences) as can see vlookup returns values sheet3 not sheet2 though there differences. have re-written many times , changed 0 - false in formula no changes. unfortunately, screenshot shows formulas, not error messages. errors important when troubleshooting. check data types. looks if data in column in second screenshot numeric, whereas column in first screenshot contains text, can seen trailing / signs in cells. ensure lookup value , first column of lookup table same data type. numbers may numbers, stored text. non-matching data types cause #n/a error.

google maps - iOS GoogleMaps area accuracy and Polygon drawing -

i trying mark location points while walking around small area house. how accurate draw perimeter i.e. polygon. how accurate distance be. thirdly can draw curved path suggestion experience highly appreciated. thank you i can't comment on accuracy of polygon area, there's lot of questions when searched (eg. this stackoverflow question . for drawing curved path, can use gmspolyline geodesic option set yes . when yes, render polyline edge geodesic. geodesic segments follow shortest path along earth's surface , may appear curved lines on map mercator projection. non-geodesic segments drawn straight lines on map. defaults no.

WPF - C# - Print a XAML Datagrid - multiplie Pages -

xaml - code: <grid name="label"> <grid.rowdefinitions> <rowdefinition height="60"/> <rowdefinition height="*"/> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="75" /> <columndefinition width="*" /> </grid.columndefinitions> <label content="text" grid.row="0" grid.column="0" /> <label content="text" grid.row="1" grid.column="0" /> <label content="text" grid.row="0" grid.column="1" /> <label content="text" grid.row="1" grid.column="1" /> </grid> now want print label. when use function "

java - how to determine whether last call was outgoing or incoming in android -

i using android call logs in app , determine whether last call incoming or out going call. have tried far int type gives me error android.database.cursorindexoutofboundsexception: index -1 requested, size of 284 cursor managedcursor = context.getcontentresolver().query( calllog.calls.content_uri,null, null,null, android.provider.calllog.calls.date + " desc"); int number = managedcursor.getcolumnindex( calllog.calls.number ); int duration1 = managedcursor.getcolumnindex( calllog.calls.duration); int type = integer.parseint(managedcursor.getstring(managedcursor.getcolumnindex(calllog.calls.type))); log.v("dialbroadcast receiver", "number is: " + type); if( managedcursor.movetofirst() == true ) { string phnumber = managedcursor.getstring( number ); callduration = managedcursor.getstring( duration1 ); string dir = null; sb.append(