Posts

Showing posts from January, 2011

angularjs - How to use materialize-cssc with ts in angular4 -

i'm new npm stuff, i'm working on angular project using typescript. question how use materialize-css package http://materializecss.com/ ? installed locally npm install materialize-css don't know how proceed. tried use simple <select> tag , initialized $('select').material_select() keep on getting error error ts2339: property 'material_select' not exist on type 'jquery' . installed jquery using npm. please help. regards. add materialize (js,css, jquery) in index.html file , in appcomponent file add this: declare let $ : any; @component({ //... }) export class appcomponent{ //... };

javascript - Is it possible to style jsTree checkboxes like input controls -

i have web application using standard checkboxes in various places <input type="checkbox"... recently have added jstree (v3.3.0) checkbox plug in. i've not come across jstree before. what style check-boxes same input control. i have seen various solutions along lines of altering images in png file (like these ) seems bit fiddly , worry after managing solution hack input controls rendered differently in different browsers. i'm not sure useful tbh include code... /** * prepare tree data */ $(document).ready(function() { $('#divid') .on( "changed.jstree", function(e, data) {}).jstree({ 'core' : { 'data' : $scope.treedata, "themes" : { "icons" : false, "responsive":true

javascript - couchdb lucene date sort order is not working as expected -

i have couch db documents have field of lastupdatedatetime lastupdatedatetime : "2016-11-02 17:36:55", lastupdatedatetime :"2016-07-02 17:36:55", lastupdatedatetime :"2017-01-02 17:36:55", i defined index following r.add(doc.lastupdatedatetime, { field: 'lastupdatedatetime', store: 'yes' }); } then call view ......q=stage:xxxx &sort=lastupdatedatetime now want date field sort order ascending or descending order, not work, not sure wrong? thanks { "rows": [ { "id": "xxxxxx", "fields": { "severity": "3", "lastupdatedatetime": "2017-01-02 17:36:55", }, "sort_order": [ "[35 35]" ] },

How can we use the dynamically upload images effectively and responsively in content management system like Drupal 7? -

need solution following: single image uploaded via cms used responsively without losing clarity...and bigger file size images being used in devices. methods can done improve faster loading of image files , overall site performance. have tried using picture module https://www.drupal.org/project/picture . need set using breakpoints should able take care of both of issues. picture module creates variation of image different breakpoints.

c# - Order of execution with multiple filters in web api -

i using latest web api . i annotate some controllers 3 different filter attributes. 1 [authorize] 2 [ressourceownerattribute derived authorizationfilterattribute] 3 [invalidmodelstateattribute derived actionfilterattribute] i can not sure filters run in order declared top down. how define order of execution in web api 2.1 ? https://aspnetwebstack.codeplex.com/workitem/1065# http://aspnet.uservoice.com/forums/147201-asp-net-web-api/suggestions/3346720-execution-order-of-mvc4-webapi-action-filters do still have fix myself ?? some things note here: filters executed in following order action: globally defined filters -> controller-specific filters -> action-specific filters. authorization filters -> action filters -> exception filters now problem seem mention related having multiple filters of same kind (ex: multiple actionfilterattribute decorated on controller or action. case not guarantee order based on reflection.). case, there way in

java - Extending OkHttp protocol selection -

i trying implement client http/2-based protocol using okhttp. protocol unencrypted http/2-prior-knowledge stream on custom tcp protocol (yes, know it's broken, no, can't change it). okhttp3 seems support http/2 prior knowledge when using tcp, built custom sslsocketfactory , sslsocket implement protocol. hacky works alright until prior knowledge requirement kicks in. remote not support http/1.1->http/2 upgrade, requires prior knowledge, okhttp seems support via tls extensions, protocol selection code is platform-dependent . is there way hook protocol selection logic not involve reimplementing half of okhttp or reflecting okhttp- or jdk-internal classes? maybe without fake-tls hack? replacing realconnection not feasible, since okhttp not provide sort of connectionfactory can implement. okhttp http/2 on https alpn. since you’re stuck own custom protocol, consider adding http/2 on https server sits in front of custom protocol. might able nginx?

amazon web services - AWS S3 copy to bucket from remote location -

there large dataset on public server (~0.5tb, multi-part here ), copy own s3 buckets. seems aws s3 cp local files or files based in s3 buckets? how can copy file (either single or multi-part) s3? can use aws cli or need else? there's no way upload directly s3 remote location. can stream contents of remote files machine , s3. means have downloaded entire 0.5tb of data, computer ever hold tiny fraction of data in memory @ time (it not persisted disc either). here simple implementation in javascript: const request = require('request') const async = require('async') const aws = require('aws-sdk') const s3 = new aws.s3() const bucket = 'nyu_depth_v2' const baseurl = 'http://horatio.cs.nyu.edu/mit/silberman/nyu_depth_v2/' const parallellimit = 5 const parts = [ 'basements.zip', 'bathrooms_part1.zip', 'bathrooms_part2.zip', 'bathrooms_part3.zip', 'bathrooms_part4.zip', 'bedro

angular2 services - Angular 2 project configuration for tomcat server -

i merged angular2 project(hello world) in existing maven project. while running project, can see "loading..." in 'index.html'. dynamic values not appending tag. i hope missing configuration tomcat server. because same sample project working in angular cli. what can add run sample tomcat server.

android - How to find the middle index of Horizontal Listview(Recycler View) -

Image
i have horizontal listview in want find every time middle index of screen can change size. want fisheye effect on middle index of listview every time while swiping , stopping. kindly give me suggestion. @override public void onbindviewholder(viewholder holder, final int position) { try { holder.image.setimagedrawable(cntx.getpackagemanager().getapplicationicon(apps.get(position).getappname())); log.e("tag", "position: "+position ); if(position%4==0) { holder.image.setminimumheight(250); holder.image.setminimumwidth(250); } holder.image.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { packagemanager pm = cntx.getpackagemanager(); intent launchintent = pm.getlaunchintentforpackage(apps.get(position).getappname()); cntx.startactivity(launchintent); }

bash - How do I correct this UNIX command for copying files into a directory? -

i have following command not work while read line; ls $line | head -10 | cp xargs dest_folder; done < my_file.txt the objective have file named my_file.txt contains name of folder on every line. want copy 10 files each of directories mentioned on every line of file dest_folder. how can correct above command? you cand achive following bash script: #!/bin/bash # first argument filename contains ton each line name of folder # teh second argument destination folder while ifs='' read -r line || [[ -n "$line" ]]; filestocopy=($(ls $line |head -n 10)) in "${filestocopy[@]}" : cp $line/$i $2 done done < "$1" usage: chmod +x your_bash_script ./your_bash_script my_file.txt dest_folder note: the folder names inside file should absolute paths.

javascript - How can remove place from OpenStreetMap? -

Image
how can remove place on openstreetmap ? in google map thing required , add line code style don't know how can on osm in above image, marked in blue line places must remove this single image (a raster tile ). can't influence pois shown unless switch vector tiles . alternatively choose different tile server or render own tiles own stylesheet . last approach requires amount of work flexible solution.

php - October CMS | display images on reordering lists -

Image
there way turn on reorder functionality on list controller , re-order list items name example... but there way display images instead of text on reorder list? what have now: config_reorder.yaml title: 'configurar ordem' azuref: ref azuimg: image modelclass: frama\azulejos\models\azulejo toolbar: buttons: reorder_toolbar reordercontroller.php ... public function __construct($controller) { ... $this->azuimg = $this->getconfig('azuimg', $this->azuimg); ... } ... and result of course text... , don't know that... need access path or (better) getthumb edit ok can path that, transforming sting: json_decode($this->reordergetrecordimg($record))->path but how make thumb work? solution well solution easy ***k :) modules/backend/behaviors/rendercontroller/partials/_records.htm <?php foreach ($records $record): ?> <!-- ... --> <img src="<?= $record->image->getthumb

sql server - SET DATEFIRST inside function -

i have database holds multiple modules. module i'm working on works different start date rest of modules. in module need, @ 1 point, calculations rely on first day of week inside function created calculations tried putting set datefirst which, found out, doesn't work. put out fire, i've put set datefirst outside of function call, i'm refactoring , better alternative. other discussions on topic either set outside function or change logic not depend on it. problem setting outside of function kind of defeats purpose of function , changing logic not simple whatever do, needs rely on specific day being first day of week (it's not 1 line needs rely on it). additionally, logic relatively complex (that's part of reason why it's function , not inline code in sp) rewriting in such way both error-prone , difficult read , change when needed i'm looking better alternative. so there better alternative having different datefirst in user-defined function than:

Applescript, placing an image in a table cell in InDesign CC 2017 -

i attempting create script automatically inputs tabled/tabular slug @ base of indesign page - quite common query on internet , far have done cobbling bits of relevant script... creates table, inputs variables, find page size etc etc... however, i'm stuck when comes inputting logo - want input company logo 1 of table cells. users' hd location. does have tips share on this? again, applescript indesign. the content of cell text. need create rectangle , insert image there: found on macscripter while ago - modify needs (especially image bounds - size/position) set placedimage (choose file) string tell application "indesign cc 2017" tell document 1 tell table 1 of story 1 tell cell 1 set newimage make new rectangle @ insertion point 1 properties {label:"photo 1"} set imagebounds geometric bounds of newimage set geometric bounds of newimage {item 1 of imagebounds, item 2 of image

antlr - How do I make sure that Antlr4 gets credit for my new language -

i developed new language using antlr4 libraries. reading license , noticed if develop product using antlr, need give credit antlr contributors (particularly terrance parr). want make sure correctly , on , up, i'm not sure put credit, in product. can me? typcially mention 3rd party libraries in readme file or contributors file. used "about" information applications have. yet possibility documentation, must accessible in public. don't need add note everywhere, 1 place enough.

ruby on rails - Create an offline version of web application -

question : start write application can work without internet connection? this explanation : have web application deployed. since internet not great in india, create offline version of same web application users/people can access without internet well. want them experience similar stuff of web interface without of changes. one idea came mind create tar ball of contents of application , ship people/users. users have use tar ball install/configure on machine can use it. contents of tar ball debatable should enclose in tar ball. apache, technology stack etc etc. i happy write more in case have not written precisely. question not related technology stack might of interest everyone. since not sure right tag append here, can stackoverflow team tag right tag. :) my application in ror. so, tagging ruby on rails community. may can here? as long web application contains flat files (html, css, js, text data, etc.) , not depend on components need installed, can distribute files

python - Retrieve name of column from its Index in Pandas -

i have pandas dataframe , numpy array of values of dataframe. after work on numpy array, index of column , have row index of important value. need column name of particular value dataframe. after searching through documentations, found out can opposite not want. can any1 suggest way so. i think need index columns names position (python counts 0 , fourth column need 3 ): colname = df.columns[pos] sample: df = pd.dataframe({'a':[1,2,3], 'b':[4,5,6], 'c':[7,8,9], 'd':[1,3,5], 'e':[5,3,6], 'f':[7,4,3]}) print (df) b c d e f 0 1 4 7 1 5 7 1 2 5 8 3 3 4 2 3 6 9 5 6 3 pos = 3 colname = df.columns[pos] print (colname) d pos = [3,5] colname = df.columns[pos] print (colname) index(['d', 'f'], dtype='object')

c++ - UTF8 data to std::string or std::wstring -

i receive body bytes http server response , dont know how convert them utf8 string work them. i have idea not sure wheter works. need bytes of response , search on them , modify them, need transform std::vector<byte> std::wstring or std::string . the bytes encoding in utf8 of response in std::vector<byte> , how can transform them std::string ? shall transform them std::wstring ?. i found code: std::string encoding::stringtoutf8(const std::string& str) { int size = multibytetowidechar(cp_acp, mb_composite, str.c_str(), str.length(), null, 0); std::wstring utf16_str(size, '\0'); multibytetowidechar(cp_acp, mb_composite, str.c_str(), str.length(), &utf16_str[0], size); int utf8_size = widechartomultibyte(cp_utf8, 0, utf16_str.c_str(), utf16_str.length(), null, 0, null, null); std::string utf8_str(utf8_size, '\0'); widechartomultibyte(cp_utf8, 0, utf16_str.c_str(), utf16_str.length(), &utf8_str[0], utf8_size, null, null); return u

material design - Applying gradient on an android button with ripple -

to apply gradient on button create gradient.xml this <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:angle="270" android:endcolor="#fff" android:startcolor="#f00" /> when set button background material effects of button gone. i heard can use backgroundtint property of button cannot equate drawable , color resource allowed. how can apply gradient background on button while keeping material , feel?

sql - ORACLE NOT NULL IN WHERE CLAUSE WITH NVL OPERATION -

i want know query faster. ex:1 select comm emp comm not null; ex:2 select comm emp nvl(comm,'0') not null; please consider emp table contains hundreds of thousands of records. instead of asking hypothetical question should run benchmarks on actual data. here observations: your queries different things. first query selects records comm not null. second query selects records. in both cases 2 full table scans: " lakhs of records." makes no difference. however, given have same projection , no sort clause execution time same. except: the time render output different, because second result set may larger first. if there index on emp(comm) first result use full fast index scan, because you're selecting comm there's no need touch table. index read faster because normal oracle indexes don't index nulls. even if there's function-based index on emp(nvl(comm)) second query still execute full table scan, because select comm

c# - How can I resolve this issue `" UserControl". The path is not of a legal form` -

i deleted form usercontrol since couldn't find way fix project, project cannot rebuild anymore, each time try rebuild shows error below in visual studio 2013. tried copy project system problem still persists. how can rid of error? files has invalid value "public partial class info : usercontrol". path not of legal form. this warning too.. warning 1 not determine dependencies of com reference "crqueryengine". error loading type library/dll. (exception hresult: 0x80029c4a (type_e_cantloadlibrary)) headsup

node.js - Font generation with webfont: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory -

i run my script use webfont on directory 41214 svg files , got following error function buildfont(config) { return webfont({ files: config.inputfiles, fontname: config.fontname }) .then(content => content) .catch(err => { console.log(err); }); } ``` error node --require babel-core/register ./index.js exists <--- last few gcs ---> 232006 ms: mark-sweep 1350.0 (1406.9) -> 1349.8 (1406.9) mb, 574.3 / 0.0 ms [allocation failure] [gc in old space requested]. 232583 ms: mark-sweep 1349.8 (1406.9) -> 1349.8 (1406.9) mb, 576.6 / 0.0 ms [allocation failure] [gc in old space requested]. 233164 ms: mark-sweep 1349.8 (1406.9) -> 1349.8 (1403.9) mb, 580.3 / 0.0 ms [last resort gc]. 233745 ms: mark-sweep 1349.8 (1403.9) -> 1349.7 (1403.9) mb, 580.3 / 0.0 ms [last resort gc]. <--- js stacktrace ---> ==== js stack trace ================

ios - Thread 1 exc_bad_access Error -

i developing ios app , working google maps. drawing lines on map, add coordinates in mutablearray, save coordinate in nsuserdefault works perfectly. when getting data nsuserdefault , showing coordinates on google maps not work. in gmsmutablepath, app crashes following error message : exec_bad_access (code=1,address=0*4) . any idea why? here related code: getting data nsuserdefaults *defaults=[nsuserdefaults standarduserdefaults]; nsarray *coordinatearray = [defaults objectforkey:@"numberarray"]; nslog(@"%@",coordinatearray (int = 0; < [coordinatearray count]; i++) { nsdictionary *dic = [coordinatearray objectatindex:i]; nsstring *lat = [dic valueforkey:@"lat"]; nsstring *longitude = [dic valueforkey:@"long"]; _valuepoints.latitude = [lat doublevalue]; _valuepoints.longitude = [longitude doublevalue]; gmsmutablepath *path = [[gmsmutablepath alloc] initwithpath:self.polyline.path]; [path addcoordinate:_va

schemacrawler not returning all Oracle tables - what permissions are required? -

using schemacrawler , trying connect oracle database. resulting json file including 10 tables, expecting larger number of tables in database. this must restricted permissions of user being used access oracle database, permissions required user schemacrawler able "see" table/columns? presumably schemacrawler uses data dictionary. user restricted tables , columns visible in all_tab_cols view i.e. tables have @ least select privilege on. otherwise user needs select on dba_tab_cols, shows tables in schemas. requires dba access grant.

python - Merge multiple rows in Pandas -

i have dataset 5 rows wish merge 1 can use them unique column identifiers. example name unique no. summary nominal voltage nominal voltage upstream upstream nan nan class upstream downstream constraint oppurtunity (non unique) nan nan nan nan physical nan i columns named name (non unique) unique no. summary class nominal voltage upstream nominal voltage downstream upstream constraint phsyical upstream oppurtunity so rows (there 5) merged (while ignoring nans) use unique column names. thanks in advance. as far can understand, groupby requires common between things being grouped, can't used here? whole database of string type because thought make easier join them, couldn't figure out way. i think need apply dropna : df.columns = df.apply(lambda x: ' '.join([x.name] + x.dropna().tolist())) print (df.columns.tolist()) ['name (non unique)&#

hadoop - Generating star schema in hive -

Image
i sql datawarehouse world flat feed generate dimension , fact tables. in general data warehouse projects divide feed fact , dimension. ex: i new hadoop , came know can build data warehouse in hive. now, familiar using guid think applicable primary key in hive. so, below strategy right way load fact , dimension in hive? load source data hive table; let sales_data_warehouse generate dimension sales_data_warehouse; ex: select new_guid(), customer_name, customer_address sales_data_warehouse when dimensions done load fact table like select new_guid() 'fact_key', customer.customer_key, store.store_key... sales_data_warehouse 'source' join customer_dimension customer on source.customer_name = customer.customer_name , source.customer_address = customer.customer_address join store_dimension 'store' on store.store_name = source.store_name join product_dimension 'product' on ..... is way should load fact , dimension table in h

java - Line argument must contain a key and a value. Only one string token was found. shiro.ini -

this error: error statuslogger no log4j2 configuration file found. using default configuration: logging errors console. exception in thread "main" java.lang.illegalargumentexception: line argument must contain key , value. 1 string token found. @ org.apache.shiro.config.ini$section.splitkeyvalue(ini.java:542) @ org.apache.shiro.config.ini$section.tomapprops(ini.java:567) @ org.apache.shiro.config.ini$section.(ini.java:464) @ org.apache.shiro.config.ini$section.(ini.java:445) @ org.apache.shiro.config.ini.addsection(ini.java:302) @ org.apache.shiro.config.ini.load(ini.java:351) @ org.apache.shiro.config.ini.load(ini.java:287) @ org.apache.shiro.config.ini.load(ini.java:275) @ org.apache.shiro.config.ini.loadfrompath(ini.java:244) @ org.apache.shiro.config.ini.fromresourcepath(ini.java:225) @ org.apache.shiro.config.inisecuritymanagerfactory.(inisecuritymanagerfactory.java:69) @ com.ldapconsole.consoleldaplogin.s

asp.net - VB.net Webform Gridview with checkbox DataControlRowType -

vb.net webform pulling data sql database gridview. i have 2 bit columns rush , normal - in code behind if rush checked row cells turn red , normal turns blue. the problem have bit true or false not having luck converting them integer or int32. here code working with, code turn rows blue , if cell 7 not equal 1. if go rush cell(10) error input string not in correct format. question how convert bit true/false 1/0 or correct format. protected sub onrowdatabound(sender object, e gridviewroweventargs) if e.row.rowtype = datacontrolrowtype.datarow dim sh string = convert.toint32(e.row.cells(7).text) each cell tablecell in e.row.cells if sh = 1 cell.backcolor = drawing.color.red else cell.backcolor = drawing.color.blue end if next end if end sub why converting integer, when having bit column, try below code. protected sub onrowdatabound(sender object, e grid

amazon web services - Why is my CFN IAM role failing with "Missing required field Action"? -

my code has action. assume formatting error. know it's silly thing cant figure out. resources: lambdaexecrole: type: aws::iam::role properties: path: "/" assumerolepolicydocument: version: "2012-10-17" statement: - effect: allow principal: action: - "sts:assumerole" service: - "lambda.amazonaws.com" action needed @ same level principal.

html - Semantic UI : how to place an button at the bottom of a column? -

this simple question, after research, can't find way properly: have grid 3 columns in semantic ui , content of each column has specific height. try add button @ bottom of each column, "bottom aligned" doesn't work. has clue ? here example: <div class="ui basic segment"> <div class="ui divided grid container"> <div class="three column row"> <div class="column"> hello <br> fdsfsd <br> fsfsd <br> fdsfsd <br> fsfsd <br> fsfsd <br> fdsfsd <br> fsfsd <br> fs </div> <div class="column"> <div class="segments"> <div class="ui segment">hello</div> <div class="ui bottom aligned segment"> fdsfsdf </div> </div> </div&

Adding months to a date in access based on a number in another field -

i have database of documents "last reviewed" date field, field has number states how many months until document expires (6, 12, 18, 24) display document expire each month based on review dates x months till expire. for example if 3 documents have date of 28/03/2017 , 6 month review box on menu states 3 documents need reviewed in september. any great, in advance first find future month check, calculate expire date documents, , compare these. then can use dcount in expression textbox counting documents: =dcount("*","yourtable","datediff('m',dateadd('m'," & [yourmonthsforwardtextbox] & ", date()),dateadd('m',[expires],[last reviewed]))=0")

php - How to delete a picture after i searched it in database? -

as administrator want delete pictures website after have searched picture. doesn't delete file ($target). <nav> <a href="../home/frontend.php"><img class="icon" src="../logo/home.png" /></a> <a href="../search/search.php"><img class="icon" src="../logo/search.png" /></a> <a href="../upload/upload.php"><img class="icon" src="../logo/camera.png" /></a> <a href="../super/supervisor.php"><img class="icon" src="../logo/supervisor.png" /></a> <a href="../profile/profile.php"><img class="icon" src="../logo/profile.png" /></a> </nav> <div class="searchdiv"> <form action="supervisor.php" method="post"> <input type="text" class="search" name=

hadoop - delete hive partitioned external table but retain partitions -

when using external hive tables, there way can delete data within directory retain partitions via query. please note dont want drop table , recreate it. want empty underlying folder , start process on again. tables large, partitions year, month, date , hour , takes lot of time recreate partitions manually. thanks truncate table ... delete data. truncate table partition (...) delete specific partitions' data. the directories structure kept. external table should first converted manged, .e.g alter table t set tblproperties('external'='false'); when done, can convert back alter table t set tblproperties('external'='true'); demo create table t (i int) partitioned (x char(1)); set hive.exec.dynamic.partition.mode=nonstrict; insert t partition (x) values (1,'a'),(2,'b'),(3,'c'); alter table t set tblproperties('external'='true'); select * t; +-----+-----+ | t.i | t.x | +-

php parsing Json to variable -

this question has answer here: how extract data json php? 2 answers i need assistance parsing json variables using php. googled , check through lots of howtos without success. think problem format json in. here json: {"type":"success","response":{"data":[{"id":5,"username":"account2","hostname":"testapp.net","port":8080,"status":"enabled","email":"john@yourmomma.com","servertype":"icecast","hostref":"0.0.0.0"},{"id":4,"username":"account1","hostname":"testapp2.net","port":8082,"status":"disabled","email":"john@yourmomma.com","servertype":"shoutcast2","hostref"

ruby - Sinatra app cannot find ActiveRecord tables -

i'm writing ruby app using rack, sinatra, active record, , sqlite3 (in-memory). setup in-memory db follows: class mydatabase def self.init activerecord::base::establish_connection( :adapter => 'sqlite3', :database => ':memory:' ) activerecord::schema::define unless activerecord::base::connection.data_sources.include? 'my_table' create_table :my_table |table| table.column :age, :integer table.column :name, :string end end end end end then in rack config file call: mydatabase::init() run rack::urlmap.new( '/api/v1/some_route' => mycontroller.new ) however, if create connection database inside controller class , list of tables, it's empty. how can make application/sinatra controllers use tables create in mydatabase class? the controllers declared as mycontroller

sql - Losing rows on Google BigQuery after doing a WHERE / through unnesting/flattening -

i got daily tables google analytics website. in table 167.286 rows. main target create new table (csv) needed columns , rows. using legacy sql have query: select concat(cast(visitid string), cast(fullvisitorid string), cast(visitnumber string), cast(hits.hitnumber string)) identifier, hits.hitnumber hitnumber, hits.page.pagepath pagepath, hits.page.pagepathlevel1 pagepathlevel1, hits.page.pagepathlevel2 pagepathlevel2, hits.appinfo.exitscreenname exitscreenname, hits.eventinfo.eventcategory eventcategory, hits.eventinfo.eventaction eventaction, hits.eventinfo.eventlabel eventlabel, hits.customdimensions.value value, hits.customdimensions.index index, visitid, fullvisitorid, date, visitnumber, totals.hits hits, totals.pageviews pageviews, device.devicecategory devicecategory, geonetwork.city, channelgrouping, trafficsource.campaign campaign, trafficsource.source source, trafficsource.medium medium [project:dataset.table] not hits.cus

dependency injection - Choosing lifetime for stateless services -

some service types have pretty clear lifetime requirements. example, if 1 using entityframework in asp.net app, clear dbcontext lifetime should tied request. however, there services "stateless": not store state, , instead forward instructions dependencies. simple case query object: public class myquery : iquery<somequery, someresponse> { private readonly irepository<mytable> repository; // injected via constructor public someresponse query(somequery query) { return repository.all().where(r => r.field == query.field) .select(r => new someresponse { field = r.field }).single(); } } this particular class has no requirements itself, other imposed dependencies. guidelines should used determine lifetime choose type of object? should 1 use transient lifetime whenever possible? or should 1 have longest lifetime possible? , why?

javascript - AJAX post not sending value from form data -

i have weird situation, have created ajax post static value , it's work fine. tried ajax post dynamic value html input doesn't work. if tried insert value="1" post 1 php. can take code ? <script> $(document).ready(function () { $('#unggah<?php echo $mhs?>').submit(function (event) { var formdata = { 'jmlmhs': $('input[name=jmlmhs]').val(), 'mulaikul': $('input[name=mulaikul]').val(), 'akhirkul': $('input[name=akhirkul]').val() }; $.ajax({ type: 'post', url: '<?=base_url()?>operator_pt/unggah/<?php echo $proses.'_'.$cl?>', data: formdata, datatype: 'json', encode: true }) event.preventdefault(); }); }); </script> html <form action="<?=base_url()?>operator_pt/unggah/<?php echo $proses.'

Read stream of json log objects using c# -

i'm using modsecurity , audit log logs stream of json objects ones below: {"transaction":{"time":"28/mar/2017:15:39:04 +0200","transaction_id":"18158513699705323558","remote_address":"","remote_port":80,"local_address":"127.0.0.1","local_port":80},"request":{"request_line":"get /iisstart.htm http/1.1","headers":{"connection":"keep-alive","content-length":"0","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8","accept-encoding":"gzip, deflate, sdch, br","accept-language":"sv-se,sv;q=0.8,en-us;q=0.6,en;q=0.4","cookie":"__requestverificationtoken_l1ryawdnzxjmaxnoq2hly2tlcg2=5nsh5scvpvljkp2yty6wfyqzakvxa29eunbnnic_c_mvrn2mcbmzidocq08zivizusi66el47gprmhugsxqp80iesdfwrqbs9shlf8fjia01; .a

How can i Get foreign key's value instead of id , in django rest framework -

sorry bad english hope u can understand mean. out put im getting now: [ { "maincatname": 1, "name": "harry potter", "image": "/media/101029496--sites-default-files-images-101029496-3176173-1748009911-hp.jp-1_moxqrlp.jpg" }, { "maincatname": 2, "name": "princes girl", "image": "/media/character_princess_rapunzel_8320d57a.jpeg" }, { "maincatname": 3, "name": "sex in city", "image": "/media/250px-satc_title.jpg" }, { "maincatname": 4, "name": "who dragon", "image": "/media/reggio_calabria_museo_nazionale_mosaico_da_kaulon.jpg" }, { "maincatname": 2, "name": "drama queen", "image": "/medi

android - How to show the toolbar layout only when a song is played (ListView item is clicked) -

activity_main2.xml i want show toolbar in following code when listview item clicked. otherwise, remain hidden. if use (view.invisible) in java code layout disappears, yet white space remains in area. want listview occupy area. <?xml version="1.0" encoding="utf-8" ?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.ashutosh.music_player.main2activity"> <imageview android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/catv" /> <listview android:id="@+id/track_list_view" andr

Anonymous javascript polling function does not trigger setTimeout ajax call immediately -

this question has answer here: javascript ajax setinterval delay 3 answers i have anonymous polling function has settimeout kick off ajax call every 30 seconds. however, anonymous function kick off reason ajax call not kick off immediately, starts after 30 seconds. missing calling trigger right away? (function poll() { console.log('polling called'); settimeout(function () { $.ajax({ url: "/server/call", type: 'get', datatype: "json", timeout: 30000, success: function (data) { var currentdate = new date(); var datetime = "last sync: " + currentdate.getdate() + "/" + (currentdate.getmonth() + 1) + "/" + currentdate.g

php - Having some trouble with synchronizing prints between jquery and javascript -

i have 2 forms, 1 login form , 1 register form. have added jquery creating error message displays every input not filled, can't manage php create error message saying "invalid info" when fields filled info wrong. have tried ajax, can't work @ all. my php code: require 'dbconnect.php'; if(isset($_post['login-btn'])){ $email = strip_tags($_post['email']); $password = strip_tags($_post['password']); $email = $dbcon->real_escape_string($email); $password = $dbcon->real_escape_string($password); $query = "select email, password members email='$email'"; $result = $dbcon->query($query); $row = $result->fetch_array(); $count = $result->num_rows; if(password_verify($password, $row['password']) && $count==1) { header("location: home.php"); die(); } else{ echo "invalid email or password!"; }

forms - Secure route in HTTPS Laravel -

in view page have route: <form action="{{ route('unisharp.lfm.upload') }}" role='form' id='uploadform' name='uploadform' method='post' enctype='multipart/form-data'> with https 'mixed-content error'. how can secure route? use secure_url() instead of route(), replace action url secure one. helper function - secure_url()

database - Syntax error on IF EXISTS -

Image
im having trouble in drop user if exists statement in mysql workbench. error is syntax error : unexpected if. the if exists syntax drop user new feature in mysql 5.7. not implemented in mysql 5.6. https://dev.mysql.com/doc/refman/5.7/en/drop-user.html says: as of mysql 5.7.8, if exists clause can used, causes statement produce warning each named account not exist, rather error. it's possible mysql workbench has not caught syntax. can try upgrade latest version of mysql workbench, , hope have updated it. or can try putting new clause version-specific comment: drop user /*!50708 if exists */ ... this comment syntax mysql uses protect syntax isn't supported earlier versions. see https://dev.mysql.com/doc/refman/5.7/en/comments.html explanation.

java - How to add filter / AOP method that cannot be removed without recompile? -

my question be: how add servlet filter, or spring aop method (or third solution - name it) cannot removed web application without recompiling? i'd solve license handling way, if modifies web.xml or spring config, protection gone. licence handling cross-cutting concern (and imo should) modelled means of aop. i cannot servlet filters, being unexperienced in regard, i know spring aop proxy-based, i.e. not modify source code directly, not want. aspectj, on other hand, when used @ compile-time (not via load-time weaving usual approach in spring), compile aspect code right core class files, "baking" them byte code. want. not cannot reverse-engineered - there option - code not run without aspectj runtime on classpath , not remove licencing aspects without recompilation. option recomment purpose. interesting question, way.