Posts

Showing posts from January, 2011

activerecord - Using method in a where clause Rails Ruby Active Record -

i wondering if posible use model instance method clause query. mean. have model school method defined class school < activerecord::base def my_method users.where(blablabla).present? end end is posible like: school.all.where(my_method: true) i know can like: school.all.map{|x| x if x.my_method} but way has huge penalization in performance compared query. furthermore, return of i'm searching activerecord relation , map returns array. update: also there way like: school.all.joins(:users).where("users.attribute = something") but not fit want several reasons. thanks in advance i don't know relations between models. but clause gets hash of key - value. can example return id's of users in kind of hash , use it. def my_method {user_id: users.where(blablabla).ids} end and use it: school.all.where(my_method)

mysql - SQL Join Between Two Tables -

below 2 tables structure, mysql> desc catalog_product_entity; +------------------+----------------------+------+-----+---------------------+----------------+ | field | type | null | key | default | | +------------------+----------------------+------+-----+---------------------+----------------+ | entity_id | int(10) unsigned | no | pri | null | auto_increment | | entity_type_id | smallint(8) unsigned | no | mul | 0 | | | attribute_set_id | smallint(5) unsigned | no | mul | 0 | | | type_id | varchar(32) | no | | simple | | | sku | varchar(64) | yes | mul | null | | | created_at | datetime | no | | 0000-00-00 00:00:00 | | | updated_at | datetime | no | | 0000-00-00 00:

java - Join different tables determined by a control filed -

there 3 tables , b1 , b2: a(id, b_id, control) b1(id, other) b2(id, other) if control = 1, b_id in mapping table b1; if control = 2, b_id in mapping table b2. these 3 classes like: @entity @table(name = "a") public class { @id @column(name = "id") private integer id; private b b; @column(name = "control") private integer control; } @entity @table(name = "b1") public class b1 { @id @column(name = "id") private integer id; @column(name = "other") private integer other; } class b2 same b1. i need different object b table b1 or b2 determined field control in class a. possible make hibernate annotation? appreciated advice. i think missing out way 1 table refers in sql. mean way have defined tables there no foreign keys , no referential integrity secured. recommend reconsidering implementation , add respective foreign keys in table. anyway, if want contin

sql server - SQL - parametrized procedure with multiple parameters as array -

i have simple procedure: create procedure [report] @statusvalue varchar(200) = '%' begin select * sometable upper(@statusvalue) end i'd provide user set multiple statusvalue. because there 6 levels of statusvalue in table, i'd provide user define required statusvalue procedure parameters - array. i don't know, how works - i'm new in area - i'm supposing have procedure one: exec report @statusvalue = 'statusvalue1|statusvalue2|statusvalue3' do happen know, how can adjust procedure have required output. many in advance. use following user defined function return values delimited string (say pipe): create function [dbo].[stringlist_to_table] (@list varchar(8000), @delimiter nchar(1) = n',') returns @tbl table (value varchar(8000)) begin declare @pos int, @tmpstr varchar(8000), @tmpval varchar(8000); set @tmpstr = @list; set @pos = charindex(@delimiter , @tmpstr); w

Neo4j - Filter nodes by relationship attribute lists -

Image
lets have collections ( collection ) have things ( thing ) attached them. these collections can have sub collections contain subset of parent collection. there [:filters] relationship between parent , sub collection contain attribute lists thing s should filtered. attributes key same key on thing , , values key on relationship values accepted on thing . if relationship not have attributes, thing s should "shared" between collections. the problem i'm having hard time solving how filter things attributes on relationship. here graph like: graph view and here cypher code creating said graph: // collections create (c1:collection {name: 'c1'})-[:filters {type: ['image']}]->(c1_img:collection {name:'c1_img'}), (c1_img)-[:filters {user: ['john']}]->(c1_user_img:collection {name:'c1_user_img'}), (c2:collection {name: 'c2'})-[:filters {type: ['image']}]->(c2_img:collection {name:'c2_img'}), (c2_

php - How to call API from frontend/backend application in Yii? -

so yii structure this. api |modules |v2 |actions common frontend backend we can call common in backend , frontend. able call backend modules in frontend module. is possible call api i.e v2 action frontend module in yii? this required done api module there. , avoiding backend logic need call api. you can use soa(service oriented architecture) in yii, have create services folder in service write logics can used backend , api's both frontend api based , backend service based. below api     |modules         |v2              |actions common frontend backend services

asp.net mvc - asp-validation-summary shows custom but not model errors -

asp-validation-summary in view shows errors added via modelstate.addmodelerror, don't show model validation errors ("the user field required."). i'm using microsoft.aspnetcore.mvc 1.0.0-rc2-final. btw: user field not displayed via view correctly identified ef model level error before add. //<div asp-validation-summary="modelonly" class="text-danger"></div> in view modelstate.addmodelerror(string.empty, "this error shows in validation-summary"); viewbag.headermessage = "error: " + string.join(" - ", modelstate.values.selectmany(x => x.errors).select(x => x.errormessage)); errors show in field filled via viewbag not in validation-summary change html: <div asp-validation-summary="modelonly" class="text-danger"></div> to <div asp-validation-summary="all" class="text-danger"></div>

Gererating Hibernate Entiry classes from data source in Intellij Ultmate edition -

i'm following steps in below link generate hibernate entity classes. i'm suck step 1. not able find persistence tool window. in view > tool windows > persistence. using intellij ultimate edition - 2016.1.3 missing? intellij idea 10 generate entity (pojo) db model i've found issue. hibernate plugin not enabled. file -> settings -> plugins -> search "hibernate support" , select same. save , exit , follow steps in other window. works!!

Running macros in a macro in excel -

i'm trying write macro runs 2 other macros. however, second macro requires select location of file data is. there way of running second macro 10 times 10 different file locations. in summary, have 10 loops both macros. some along lines of following sudo code: file_loc = ('c:/users/desktop/....sim1.csv','c:/users/desktop/....sim2.csv'..'sim3'...sim10') in range (10): run macro1 wait calculation run macro2 file = file_loc(i) wait calculation copy cell a10 (result) az(i) next is possibility in vba? assuming macros this: private sub macro1() ' prompt location ' stuff end sub you refactor to: private sub macro1(optional location string = "") ' test whether location specified, , prompt if not ' stuff end sub that way, can loop through list of locations , pass each 1 parameter, while still leaving macro usable without information.

javascript - Navigation SlideMenu with even onChildClick ExpanListview hitch -

i have import sliding menu lib on android expand listview if onchildclick on expandlistview hitch.however not crash user feel uncomfortable. please can me sorry, because english not enough well. this code of me: * [> expanlistview.setonchildclicklistener(new expandablelistview.onchildclicklistener() { @override public boolean onchildclick(expandablelistview parent, view v, int groupposition, int childposition, long id)] 1 { switch (groupposition) { case 0: break; case 1: break; case 2: break; case 3: if(childposition==1) { motolistfragment fragment1 = new motolistfragment(); getactivity().getsupportfragmentmanager().begintransaction() .replace(r.id.item_detail_container, fragment1).addtobackstack(null)

vaadin7 - Responsiveness of Vaadin FormLayout -

i starting make vaadin web app responsive. reading vaadin docs , managed make csslayout flexible such image shown either left of text section or in separate row depending on available width. now want make login form flexible. default, captions moved left of fields. how can achieve captions moved top of fields when width reached? possible formlayout ? can't imagine possible css because formlayout rendered html table. if so, simple alternative? that not possible formlayout. structure of formlayout not flexible. there not simple alternative that. can use csslayout or create own component container. starting point can extending abstractcomponentcontainer described in creating simple component container

Pushwoosh iOS SDK, disable alert generated by pushwoosh in Background mode -

i want disable alert generated pushwoosh manager when received notification when app in background mode. have tried both pushwoosh_show_alert , pushwoosh_alert_type, works fine in foreground mode. want show custom message user when received notifications. when app in background alert generated ios default. you might want deliver notification silently , present notification yourself. see article on how achieve that: http://docs.pushwoosh.com/docs/deletable-ios-push

excel - Copying rows from one sheet to another -

the following script seems should work, i'm getting "object defined" error on lines marked below. can't find what's causing @ all... sub mailmerge() sheets.add.name = "mailmerge" dim mailmerge worksheet set mailmerge = sheets("mailmerge") dim rng range dim i, index, lastrow long dim abstracts worksheet set abstracts = sheets("abstracts") lastrow = abstracts.cells(rows.count, 1).end(xlup).row = 1 lastrow set rng = abstracts.range("o" & i) if worksheetfunction.counta(rng) >= 1 abstracts.range("a" & i).resize(0, 14).copy _ destination:=mailmerge.range("a" & i).resize(0, 14) 'this error occuring end if next end sub any suggestions? resize not offset. set size of range size dictated. setting range size 0 rows. should 1: sub mailmerge() sheets.add.name = "mailmerge" dim mailmerge worksheet set mailmer

javascript - ChartJS Line Charts - remove color underneath lines -

Image
okay, have chartjs line chart working populates directly data coming db. need rid of color underneath each of lines. [as seen in screenshot below]. here's html: <div ng-if="hasdata"> <canvas id="line" class="chart chart-line" data="data" labels="labels" legend="true" series="series" options="options" click="onclick"></canvas> <div> here's js: scope.labels = ['02:00','04:00','06:00', '08:00', '10:00', '12:00','14:00', '16:00', '18:00', '20:00', '22:00']; scope.series = series; scope.data = [volumesselecteddate, volumespeakdate, volumesmodelcapacity]; scope.options = { scaleoverride: true, scalestartvalue: 0, scalesteps: 11, scalestepwidth: 6910,

visual studio 2015 - VS2015 crashes on start up in windows10 -

Image
recently installed vs2015 in windows10. visual studio crashed , closed every time when opening it. i error details eventviewer. if faced issue, please me. > > application: devenv.exe framework version: v4.0.30319 description: process terminated due unhandled exception. exception > info: system.nullreferenceexception stack: @ > system.windows.controls.primitives.toolbarpanel.measuregenerateditems(boolean, > system.windows.size, boolean, double, system.windows.size byref, > double byref) @ > system.windows.controls.primitives.toolbarpanel.measureoverride(system.windows.size) > @ > microsoft.visualstudio.platformui.vstoolbarpanel.measurewithcollapseprevention(system.windows.size) > @ > microsoft.visualstudio.platformui.vstoolbarpanel.measureoverride(system.windows.size) > @ system.windows.frameworkelement.measurecore(system.windows.size) > @ system.windows.uielement.measure(system.windows.size) @ > system.windows.controls.doc

sharepoint - Why am I receiving a "type could not be found or is not registered as safe" error for my iframe web part? -

i working on farm solution in sharepoint 2013. want open page in iframe has been passed url src. so made visual webpart .ascx file looks this: <asp:htmliframe id="frm2" runat="server" src="" height="600px" width="900"></asp:htmliframe> and in server side code (ascx.cs) set src property this: frm2.src = "http://wwww.google.com"; however, web part generates following error: web part error: web part or web form control on page cannot displayed or imported. type sharepointproject2.employee.employee, sharepointproject2, version=1.0.0.0, culture=neutral, publickeytoken=b6ac6e2971e56b29 not found or not registered safe. correlation id: c41f8d9d-2f85-509f-fa04-e1d0062edc96. on going through problem found various solutions add web.config file. <assembly location="myassembly.dll" deploymenttarget="globalassemblycache"> <safecontrols> <safecontrol ass

php - Getting error in add Bundle in Vendor Folder in Symfony2 -

bundle name : open tok ( downloaded github ) i put folder in vendor folder of symfony( project name\vendor\opentok\opentok\and files , folders here ) in appkernel.php <?php use symfony\component\httpkernel\kernel; use symfony\component\config\loader\loaderinterface; class appkernel extends kernel { public function registerbundles() { $bundles = array( new symfony\bundle\frameworkbundle\frameworkbundle(), new symfony\bundle\securitybundle\securitybundle(), new symfony\bundle\twigbundle\twigbundle(), new symfony\bundle\monologbundle\monologbundle(), new symfony\bundle\swiftmailerbundle\swiftmailerbundle(), new opentokbundle\opentokbundle(), new doctrine\bundle\doctrinebundle\doctrinebundle(), new sensio\bundle\frameworkextrabundle\sensioframeworkextrabundle(), new adminbundle\adminbundle(), new sitebundle\sitebundle(), new wsbundle\wsbundle(), ); if (in_a

android mediaplayer - How to stop music when user exits the app -

i reading many tips , answers similar questions can't done piece of code. isse music played in background when exit app. can me fix this? have button clicked starts music , clicked second time pause it. works want achieve stop music play, when user exits app eather clicking home or button. imagebutton playmusic; playmusic = (imagebutton)this.findviewbyid(r.id.listen_button); final mediaplayer mp = mediaplayer.create(this, r.raw.music); playmusic.setonclicklistener(new onclicklistener(){ public void onclick(view v) { if(mp.isplaying() == true) mp.pause(); else mp.start(); } }); } try overriding onpause method @override public void onpause() { super.onpause(); //pause player mp.pause(); //do more stuff } when opening again if want start playing again override onresume : @override public void onresume() { super.onresume(); //pla

python - Running Half life codes for a mean reverting series -

i trying compute half life results multiple columns of data. have tried incorporate codes got 'pythonforfinance.com' link . however, seem have missed few edits resulting in errors being thrown. this how df looks like: link and code running: import pandas pd import numpy np import statsmodels.api sm df1=pd.read_excel('c:\\users\sai\desktop\test\spreads.xlsx') halflife_results={} col in df1.columns.values: spread_lag = df1.shift(periods=1, axis=1) spread_lag.ix([0]) = spread_lag.ix([1]) spread_ret = df1.columns - spread_lag spread_ret.ix([0]) = spread_ret.ix([1]) spread_lag2 = sm.add_constant(spread_lag) md = sm.ols(spread_ret,spread_lag2) mdf = md.fit() half_life = round(-np.log(2) / mdf.params[1],0) print('half life:', half_life) the error being thrown is: file "c:/users/sai/desktop/test/half life test 2.py", line 12 spread_lag.ix([0]) = spread_lag.ix([1]) ^ syntaxerror: can't

ubuntu - Executors lost when starting pyspark in YARN client mode -

i able run pyspark in yarn client mode in laptop , trying setup in laptop. however, time can't running. when try start pyspark in yarn client mode, gives me following error. using dynamic resource allocation, have set spark_executor_memory less yarn container memory. using hadoop 2.6.4, spark 1.6.1, ubuntu 15.10 is possible error due network issues? 16/06/12 01:49:34 info scheduler.dagscheduler: executor lost: 1 (epoch 0) in [1]: 16/06/12 01:49:34 info cluster.yarnclientschedulerbackend: disabling executor 1. 16/06/12 01:49:34 info storage.blockmanagermasterendpoint: trying remove executor 1 blockmanagermaster. 16/06/12 01:49:34 info storage.blockmanagermasterendpoint: removing block manager blockmanagerid(1, 192.168.2.16, 37900) 16/06/12 01:49:34 error client.transportclient: failed send rpc 9123554941984942265 192.168.2.16/192.168.2.16:47630: java.nio.channels.closedchannelexception java.nio.channels.closedchannelexception 16/06/12 01:49:34 info storage.blockmanagermast

android - OnErrorNotImplementedException Caused by: rx.exceptions.MissingBackpressureException -

i have error when call syncusers() method. rx.exceptions.onerrornotimplementedexception @ rx.observable$27.onerror(observable.java:8139) @ rx.observers.safesubscriber._onerror(safesubscriber.java:157) @ rx.observers.safesubscriber.onerror(safesubscriber.java:120) @ rx.internal.operators.operatorzip$zip$innersubscriber.onerror(operatorzip.java:325) @ rx.internal.operators.operatorzip$zip$innersubscriber.onnext(operatorzip.java:333) @ io.realm.rx.realmobservablefactory$5$1.onchange(realmobservablefactory.java:143) @ io.realm.rx.realmobservablefactory$5$1.onchange(realmobservablefactory.java:139) @ io.realm.realmresults.notifychangelisteners(realmresults.java:1010) @ io.realm.realmresults.notifychangelisteners(realmresults.java:996) @ io.realm.handlercontroller.notifyrealmresultscallbacks(handlercontroller.java:303) @ io.realm.handlercontroller.notifysyncrealmresultscallbacks(handlercontroller.java:284) @ io.realm.handlercontroller.notifyt

html - How can I hide a link's origin from the linked-to site's analytics? -

i've been googling while now, wasn't able find answer this. what want accomplish following: let's have website hide search engines etc. , pretty accessible through direct url. want people whom send link see site. on site talk favourite pizza , link joe's pizza store . when 1 of visitor clicks link, joe's pizza store see url referrer in analytics. is there can link tags (or otherwise) obscure origin? use rel="noreferrer" something this: <a href="signin.php" rel="noreferrer">sign in</a> the noreferrer keyword may used , area elements. keyword not create hyperlink, annotates other hyperlinks created element (the implied hyperlink, if no other keywords create one). it indicates no referrer information leaked when following link. if user agent follows link defined or area element has noreferrer keyword, user agent must not include referer (sic) http header (or equivalent ot

linux - Remove lines with japanese characters from a file -

first question on here- i've searched around put answer have come empty far. i have multi-line text file cleaning up. part of remove lines include japanese characters. have been using sed other operations not working in instance. i under impression using -r switch , \p{han} regular expression work (from looking @ other questions of kind), not working in case. here test string - running returns full string, , not filter out jp characters expecting. echo 80岁返老还童的处女: 第3话 | sed -r "s/\\p\{han\}//g" am missing something? there command should using instead? i think might work you: echo "80岁返老还童的处女: 第3话" | tr -cd '[:print:]\n' sed doesn't support unicode classes afaik, , nor support multibyte ranges. -d deletes characters in set1, , -c reverses it. [:print:] matches printable characters including space. \n newline the above not remove japanese characters multibyte characters, including control characters. perl can u

How to pass global user defined structures to each callbacks libwebsockets C -

im not sure if related lws can't find way pass global structure holds values between callbacks . simple story have simple hashtable in c https://github.com/cgjones/android-system-core/blob/master/libcutils/hashmap.c i try explain in example : have main : //here define global hashmap *users_map; static struct lws_protocols protocols[] = { { "wsapi", callback_wsapi, sizeof(struct per_session_data__apigataway), 128, } , { null, null, 0, 0 } /* terminator */ }; int main(int argc, char **argv) { struct lws_context_creation_info info; //here init hash map users_map = hashmapcreate(10, str_hash_fn, str_eq); memset(&info, 0, sizeof info); info.port = server_port; info.protocols = protocols; ... info.options = opts | lws_server_option_libuv; context = lws_create_context(&info); if (lws_uv_initloop(context, null, 0)) { lwsl_err("lws_uv_initloop failed\n");

php - declared variable += and a new variable not containing last data of the previous variable -

example : $variable = somecode; $variable .= somemorecode; $variable .= somemoremorecode; i want make $variable2 containing somemoremorecode; notes: 1) whitout rewritting somemoremorecode; part. 2) variables in function, can't declare $variable2 on code part interests me. q: how can achieve ? $variable2=somemoremorecode; return $variable2; //because it's in function. if have interpreted question, answer. if not, please try make example , share code.

c# - How to use Latin Extended Char in Regex -

i have list of character contains both normal special character latin extended character. want use special character regex. list of spcl char: var listadvspclchar = file.readlines(_spclcharfilepath, encoding.default); stringbuilder sb = new stringbuilder(); foreach (string s in listadvspclchar) { sb.append(s); } sb.tostring(); output : ,.()-"*/#ÃŽ‚¦:'‚°?_+~& ¢¬³¹¼;\=%Æ’º¯…™£$‹“]¾Â`^¡Âµ[ž±<}¨!>¸¥Âœ²©·Â«®Ë„§¤¿Â­¶´†»{| i want use above spcl char below regex.ismatch(textstring, @"[^" + sb + "]"; i getting error parsing "[,.()-"*/#ÃŽ‚¦:'‚°?_+~& ¢¬³¹¼ ;\=%Æ’º¯…™£$‹“]¾ `^¡ µ[ž±<}¨!>¸¥ œ²©· «®Ë„§¤¿ ­¶´†»{|]" - [x-y] range in reverse order. and if adding \ each char getting error parsing "[,\.\(\)\-\"\*\/\#\Ã\Æ’\Ã…\½\‚\Â\¦\:\'\â\€\Å¡\°\?\_\+\~\

angularjs - NodeJs middleware set header -

i add add refresh token header in middleware seen in first answer of question: implementing refresh-tokens angular , express-jwt backend - middleware: jwt.verify(token, config.secret, function(err, decoded) { if (err) { res.status(401); return res.json({ success: false, message: 'authentication failed' }); } else { var token_exp = new date(decoded.exp * 1000); var date = new date(); var difference = (token_exp.gettime() - date.gettime()) / 60000; if(difference < (config.expiretimetoken / 2 )){ var expires = config.expiretimetoken + 'm'; var token = jwt.refreshtoken(decoded); res.setheader('authorization', 'bearer ' + token); next(); }else{ req.decoded = decoded; next(); } } }); front-end interceptor: module.exports = func

mysql - PHP insert data in database -

i've save function in php $post = $this->request->post('event'); $events = orm::factory('tasks_manage')->values(); try { $return = array(); foreach ($events $event) { $title = $event['name']['taskname']; $time = $event['time']; $return[] = $event; $event->save(); } return array( 'return' => $return; data, existing in headers array in response empty. please help $conn->insert('user', array('username' => 'jwage')); // insert user (username) values (?) (jwage)

php - Files changes not reflected in Docker image after rebuild -

i'm trying set 2 docker images php web application (php-fcm) reversed proxied nginx. ideally files of web application copied php-fcm based image , exposed volume. way both containers (web , app) can access files nginx serving static files , php-fcm interpreting php files. docker-compose.yml version: '2' services: web: image: nginx:latest depends_on: - app volumes: - ./site.conf:/etc/nginx/conf.d/default.conf volumes_from: - app links: - app app: build: . volumes: - /app dockerfile: from php:fpm copy . /app workdir /app the above setup works expected. however, when make change files , do compose --build the new files not picked in resulting images. despite following message indicating image indeed being rebuilt: building app step 1 : php:fpm ---> cb4faea80358 step 2 : copy . /app ---> using cache ---> 660ab4731bec step 3 : workdir /app ---> using cache ---> d5b2e4fa97f2 buil

mysql galera and jpa -

i whould implement scenario using jee/ejb/jpa mysql galera. has tried similar? i have 2 master mysql nodes communicate each other galera. i have same application running on 2 wildfly application servers(cluster 2 nodes) communicating each instance of galera cluster. use jpa. i have 2 instances of mysql , wildfly in different geographic locations. ping takes 250 ms betweeb locations. i'm looking mechanism prevent data inconsistency. typical prolematic scenario following: the first wilfly node writes first mysql insatnce data , galera replicates second mysql instance , jpa doesn't know it.

javascript - WordPress 4.5.3 - Uncaught ReferenceError: jQuery is not defined -

i got error in google console on website (index):878 uncaught referenceerror: jquery not defined(anonymous function) @ (index):878 jquery-migrate.min.js:2 jqmigrate: migrate installed, version 1.4.1 when click on error, got : jquery(window).ready(function($) { i identify wp_customize_support_script function in theme.php don't know how can fix it. do have idea problem ? thank you i think errors related '$' rohit416 referred to. looks these embedded in theme may want update theme if isn't on latest version. it looks site using premium theme called flavio. if purchased themeforest can use following plugin make update: https://github.com/envato/wp-envato-market

javascript - How to open browser wondow and pass HTML content? -

Image
by click on button "push" need open new window , pass html content display it. here view display html: here controller defenition: var test = angular.module('test', []); test.controller('testcontroller', ['$compile', '$scope','$window', function($compile, $scope, $window) { $scope.openwindow = function() { $window.open('to-print', 'width=500,height=400'); };}]); here html content: <div ng-app="test" id = "content" ng-controller="testcontroller"> <label>entar name:</label> <label>michael</label> <br/> <br/> <label>entar age:</label> <label>25</label> <hr/> <button ng-click="openwindow()">push!</button> </div> and html want display inside opened window is: <label>entar name:</label> <label>michael</label> <br/> <br/> &l

php - Hidden input isn't hidden in Laravel blade template -

i'm trying make hidden input , set value in blade template isn't hidden , visible on page. field {{ form::hidden('price', '<?php echo $item['price'] * $item['quantity'];?>') }} i have tried without <?php ?> tags because read in {{ }} in blade templates read php.. {{ form::hidden('price', '$item['price'] * $item['quantity']') }} throw error 'syntax error, unexpected 'price' (t_string)' your issue '$item['price'] * $item['quantity']' . you have single quotes within single quotes without them being escaped result in error php evaluate string instead of expression want. there no need wrap expression in quotes. so in blade 4, want: {{ form::hidden('price', $item['price'] * $item['quantity']) }} blade version 5 only in blade 5, {!! !!} should used html code. {!! form::hidden('price', $item[&#

node.js - Initilize method in node module -

in understanding node modules initialized when required first time. make initialization code optional. this: mymodule.js: module.exports.init=function(){ this.foo = 'initialized'; }; to achieve this: var mymodule = require('./mymodule'); mymodule.foo === undefined; //true mymodule.init(); mymodule.foo === 'initialized'; // true or there possibility of modules getting reloaded (and thus, in case, uninitialized)? thanks answers! m clarification: not want reload module. want module remain uninitialized until part of application explicitly. question is, node ever reload cached modules that, in example above, foo undefined though init has been called somewhere?

fixed length Alphanumeric generation in Informatica -

how generate fixed length alpha-numeric strings in informatica? output should like: str001 str002 str003 str004 . . . use sequence generator generate numbers. in expression transformation add desired prefix. use lpad or rpad function fill value characters of choice lenght need.

javascript - What is the meaning of == $0 that is shown in inspect element of google chrome for the selected element -

Image
this question has answer here: what ==$0 (double equals dollar zero) mean in chrome developer tools? 4 answers when used inspect elements in google chrome there == $0 @ end of selected element. new , hadn't see in older versions of google chrome: dev tools remembers last 5 dom elements (or javascript heap objects) you've selected in tab (or profiles panel). makes objects available $0 , $1 , $2 , $3 , , $4 . $0 returns selected element or javascript object, $1 returns second selected one, , on. see this more information.

embedded - FatsFs, eeprom energy consumption -

i working on ti mcu(cc1310), want save data in internal flash, have few questions using flash directory, or external eeprom. using flash can causes greater power consumption using external eeprom memory? using fatfs cause more power consumption compared writing directly flash?

PowerShell - Backslash at end when using variables -

Image
i´ve small problem didnt understand... want fire-up robocopy source/target information variable. $source = $tdu2backup_path+$dir_array[$i]+$file_array[$i] $target = $tdu2unpacked_path+$dir_array[$i]+$file_array[$i] when print var. content write-host fine, that: d:\spiele\tdu2community\euro\bnk\islands\ibiza\level\area-1\area-1-3\sector-1-3-4-2.bnk d:\spiele\tdu2community\backup\gas-station-xandernl\euro\bnk\islands\ibiza\level\area-1\area-1-3\sector-1-3-4-2.bnk but, if use var. robocopy (or xcopy or that), have backslash @ end --------------------------------------------------------------------------- quelle : d:\spiele\tdu2community\euro\bnk\islands\ibiza\level\area-1\area-1-3\sector-1-3-4-2.bnk\ ziel : d:\spiele\tdu2community\backup\gas-station-by-xandernl\euro\bnk\islands\ibiza\level\area-1\area-1-3\sector-1-3-4-2.bnk\ dateien : * . * optionen: * . * /dcopy:da /copy:dat /r:1000000 /w:30 here screenshot:

Bokeh: how to select individual plot objects and link to different urls -

hi i'm plotting bokeh rect tool plot list of rectangles: p.rect(xs, ys, widths, heights, fill_color="#f2583e", line_color="black",tags=rect_tags) i want have following function: different rectangles above, each link different url. try following function: url = "http://www.colors.commutercreative.com/@color/" taptool = p.select(type=taptool) taptool.callback = openurl(url=url) but links rectangles , cannot specify individual ones. if change to taptool = p.select(type=taptool, tags="sometag") to specify specific tags, link not work. could me how achieve function?thanks!

ruby on rails - ActiveRecord::NoDatabaseError: local user with ID does not exist -

developing api-only rails app consume data api, filter out number of fields, , broadcast fields want public. my app returning data normally, realized on source api level, changed data type 1 of fields of data we're exposing. accommodate, committed work, checked out new branch, ran migrations change data field's data type, decided wasn't happy how worked, rolled migration, committed, , checkout out master branch. app returning data normal. however, when test model's records in rails console using finder methods .first , .last , etc., error below. working fine before. i've looked around , haven't seen threads on particular error (they seem deal finding individual records show page) - although this , , this thread (by extension) seem closest. , checking users on db i'm using shows user id ("501") in error not present. what did , need can call finder methods again? need create user referenced in error in db? (and why not default us

javascript - How do I customize variables to prevent overwriting styles? -

i've been investigating alternative ways include bootstrap project , i'm not pleased solution. options: 1. react-bootstrap just use components imported in jsx >> override styles of (yuck!) 2. bootstrap-loader ( https://github.com/shakacode/bootstrap-loader ) parameterize styles write components in html (yuck!) 3. can have both? how write bootstrap components in jsx basic bootstrap variables customized can avoid things such overwriting styles in basic bootstrap navbar? react bootstrap not ship styles . have insert own styles. react bootstrap not dependent on jquery. because react-bootstrap doesn't depend on precise version of bootstrap, don't ship included css. however, stylesheet required use these components. how , bootstrap styles include you, simplest way include latest styles cdn. but don't have use prebuild version of styles (like download or cdn). can use customizer website or compile files less or sass. before compil

ios - Framework7 modal-overlay tap on iPad calls preventScrolling instead of handleClick -

i using framework7 inside of react our view layer. can popover open , close fine when viewing app in chrome. however, on ipad cannot seem close modal popover tapping on mask. after debugging, appears line of code within chrome handleclicks ends getting called close modal should. chromemasktap however, same exact line of code when debugging on ipad shows preventscrolling listener instead of handleclicks. ideas on why occuring or might missing? it turns out issue on end. using framework7 custom build process , not including fast-clicks module. once added custom build process fixed issue. sorry waste everyone's time!

shell - Window does not close when Python script on Windows is finished, until launched program exits -

the follwing python script works fine, exept shell window remains open. file = open("c:\\documents , settings\\user1\\desktop\\bpanel\badepanel\\steelusage.bsu", "a+") input = raw_input("please enter project name:") input = input.upper () line in file.readlines(): if input in line: print "project name exists, executing badepanel" import time time.sleep(4) import subprocess subprocess.call(['c:\\documents , settings\\user1\\desktop\\bpanel\badepanel\\badepanel.exe']) exit(subprocess) file.write (input+"\n") print "project name written file, executing badepanel" import time time.sleep(4) import subprocess subprocess.call(['c:\\documents , settings\\user1\\desktop\\bpanel\badepanel\\badepanel.exe']) exit(subprocess) file.close() the shell window terminates ony after close exeuted progrm (badepanel.exe) script display printed

c - How does dynamic linker changes text segment of process? -

if understand correctly when user tries execute dynamically linked executable (with execve("foo", "", "") ) instead of loading text segment of "foo" dynamic linker loaded (ld-linux.so.2) , executed. have load libraries required program ("foo") run , change addresses in "foo" , pass control foo, how acomplished? how (what system call uses) , dynamic loader load libraries , "foo"s code , data in memory (i guessing can't use malloc or mmap , jump code since should impossible, right? seems unlikely creates temp file whith complete executable (like staticlly linked one) , calls exceve again.). the actual implementation quite complex builds on top of elf, quite complex tries accommodate many scenarios, conceptually it's quite simple. basically (after library dependencies located , open ed) it's couple of mmap s, mprotect s, modifications implement linking binding symbols (can deferred),

c++ - Comparing 8 - bit Unsigned Integer to HEX Failing -

i have c++ vector full of uint8_t values tcp data segment. looking 1 of 2 values should @ first index of vector. i have following if statement express logic. if ( ui8bufferin.at(0) != 0xe4 || ui8bufferin.at(0) != 0xe2){ printf("\nwe have problem, no parsing done, package type = %u\n", ui8bufferin.at(0)); proceed = false; } the above if statement executing when shouldn't. following printout: we have problem, no parsing done, package type = 226 so don't have math, 226 integer 0xe2 in hex. i've been @ while, may simple, great! i think might want logic be: if ( ui8bufferin.at(0) != 0xe4 && ui8bufferin.at(0) != 0xe2){ as right you're saying "if either case of: (it's not 0xe4 ) or case of: (it's not 0xe2 ), have problem" - which, if understand correctly, not want say. statement, getting 0xe2 , because you're not getting 0xe4 ( ui8bufferin.at(0) != 0xe4 ), statement executes.

python - CompileError: Unconsumed column names -

i have conditional takes care of updating or deleting model based on changes on model , operation. if change.operation == 'update': db.query(model).filter_by(id=change.old_record_id).update(change.new) elif change.operation == 'delete': db.query(model).filter_by(id=change.old_record_id).delete() db.commit() when code reaches point gives: sqlalchemy.exc:compileerror: unconsumed column names: subscribers i declaring engine in function: def make_session(connection_string): engine = create_engine(connection_string, echo=false, convert_unicode=true, pool_size=20, max_overflow=20) session = scoped_session(sessionmaker(bind=engine)) return session, engine full traceback the error points line 2 of example, update happens file ".../site-packages/sqlalchemy/orm/query.py", line 2851, in update file ".../site-packages/sqlalchemy/orm/persistence.py", line 897, in exec_ file ".../site-packages/

php - Symfony2: Unique constraint for a string property is not working for values set in prePersist() method in a subscriber class -

i have form user enters phone number. common problem phone number can written in many different ways: "+49 711 xxxxxx", "0049 (0)711 xxxxxx" or "+49 711 - xxxxxx" presentations of same phone number. in order detect duplicates use "phone-number-bundle" ( https://github.com/misd-service-development/phone-number-bundle ) "normalized" e.164 representation of phone number can used comparison. if duplicate detected, entered number must not stored , notice has shown user. if entered phone number valid phone number, want check if e.164-formatted value of phone number stored in database table. this mysql table phone numbers: -+----+---------------------+----------------+ | id | original | phonenumber | -+----+---------------------+----------------+ | 1 | 0711-xxxxxxx | +49711xxxxxxx | -+----+---------------------+----------------+ | 2 | +49 7034 / xxxxx-xx | +497034xxxxxxx | -+----+---------------------+-----