Posts

Showing posts from February, 2011

memory - how to know process working set size in linux /proc -

process working set info in linux i finding working set size of process in proc folder link can find working set size in /proc don't know how know. knew rss working set size rss different working set size can know working set size using /proc/[pid]/statm ? i don't believe /proc/[pid]/statm gives wss, or /proc/[pid]/status matter. wss number of pages process needs in memory keep "working". rss number of pages of process reside in main memory. so rss >= wss. meaning rss may include pages process doesn't need right now. maybe used stale pages in past. from understanding of linux internals, kernel doesn't keep track of wss on per-process basis. wss involved track continuously , doesn't have exact formula. rss simpler calculate, kernel reports that. note if sum of wss of processes greater or equal main memory size (i.e. system thrashing or close thrashing) rss equals wss because pages absolutely needed process kept in main memory. g...

grails - Sorting on nullable fields in GORM -

i'm trying figure out how sort on multiple fields in grails 3, 1 of may or may not null. have book domain: class book { string title string sorttitle static constraints = { title blank: false sorttitle nullable: true } } books titles "the peripheral" have sorttitle of "peripheral, the", otherwise sorttitle null. want books sorted sorttitle if 1 exists, otherwise title . i found other similar questions, none nullable field. happen have pointers in right direction? you can use: coalesce(book.sorttitle, book.title) here have official hibernate documentation.

Convert "Day Date Of Month YYYY" To YYYY-MM-DD In Php -

how convert "friday 20th of march 2015" "2015-03-20" in php ? options tried (failed): $time = strtotime(stripslashes("friday 20th of march 2015")); echo date("y-m-d",$time); $time = strtotime("friday 20th of march 2015"); echo date("y-m-d",$time); option 2 (failed): $old_date = date('friday 20th of march 2015'); $old_date_timestamp = strtotime($old_date); $new_date = date('y-m-d', $old_date_timestamp); echo $new_date; option 3 (failed): $date = datetime::createfromformat('l d of f y', 'friday 20th of march 2015'); $new_date_format = $date->format('y-m-d'); echo $new_date_format; duplicate entries didn't work out: how convert "day, dd month yyyy" "yyyy-mm-dd" in php convert 1 date format in php this code works: $date = datetime::createfromformat('l ds \o\f f y', 'friday 20th of march 2015'); ...

c# - Delegate with generic list signature for passing data to another form -

i'm quite new in c#, i'm struggling more 2 days. hope 1 can me out one. below simplified code application. i want pass list form1 form2 using delegate , event. how can this? read tons of explanations events , delegates, still can't figure out, how works. form1: public delegate list<string> profileimporteventhandler(); public event profileimporteventhandler profileimported; private void btnimport_click(object sender, eventargs e) { // raise event onprofileimported(); } protected virtual void onprofileimported() { if (profileimported != null) // check if there subscribers { profileimported(); } } form2: public partial class form2 : form { form1 frm1; public form1() { // constructor logic frm1.profilechanged += new form1.profileimporteventhandler(form1_onprofileimported); } } list<string> form1_onprofileimported() { // } update none of solutions worked far. here have tried: form 2 ...

java - Swing JTextPane in javafx -

i'm looking rich textarea in javafx. have tried richtextfx component tomas mikula buggy needs. i thinking whether possible plug in swing jtextpane using swingnode class. so far works in, can see text in jtextpane , jscrollpane around works. mouselistener on jtextpane seems triggered correctly mouse events other that...nothing works. there no cursor indicating current position, no way "click" mouse change position, select text,... key events don't arrive (using keylistener) is possible use jtextpane in javafx , if so, missing? currently know workaround problem. node.setonmousereleased(event -> node.requestfocus()); (node swingnode). used mousereleased mimic same behavior standard fx nodes.

ms word - ActiveDocument.Tables.Count returns 0 but there are 4 tables -

Image
issue resolved: had 2 different sessions of word running. code in 1 tables in other. there 4 tables in document activedocument.tables.count isn't working. ideas? i had 2 different sessions of word running. code in 1 tables in other.

php - Manually Logout from previous browser session if user login in any new browser in Cakephp 3 -

i working on cakephp 3. i need user login once @ time. i using cakephp auth component login app. worked database session , cake session . but when try delete session manually database or delete session file form app/tmp/session , session re-create again. i don't want disallow second login of user, want destroy previous session. how can achieve single session of user in cakephp 3. you can store current session id of user in users table: before login, check if current session id present in users table user. if session id present, destroy old session deleting sessions table. after login, store generated session id.

java - OpenCSV not escaping the quotes(") -

i have csv file have delimiter or unclosed quotes inside quotes, how make csvreader ignore quotes , delimiters inside quotes. example: 123|bhajji|maga|39|"i said hey|" "5|'10."|"i "you"|get that" this content of file. the below program read csv file. @test public void readfromcsv() throws ioexception { fileinputstream fis = new fileinputstream( "/home/netspurt/awesomefile.csv"); inputstreamreader isr = new inputstreamreader(fis, "utf-8"); csvreader reader = new csvreader(isr, '|', '\"'); (string[] row; (row = reader.readnext()) != null;) { system.out.println(arrays.tostring(row)); } reader.close(); isr.close(); fis.close(); } i o/p this. [123, bhajji, maga, 39, said hey| "5|'10., idiot "you|get that] what happened quote after you edit: opencsv dependency com.opencsv opencsv 3.4 ...

ios - how to set image on default back button of navigation bar -

Image
i setting button image on navigation bar view controllers using following code in appdelegate: [[uibarbuttonitem appearance] setbackbuttonbackgroundimage:image forstate:uicontrolstatenormal barmetrics:uibarmetricsdefault]; now in 1 of view controllers pick newimage gallery , save it. want save newimage, 'image' of button gets replaced 'newimage'. i tried following code in viewwillappear of each , every view controller [self.navigationitem.backbarbuttonitem setbackbuttonbackgroundimage:newimage forstate:uicontrolstatenormal barmetrics:uibarmetricsdefault]; and tried [self.navigationitem.backbarbuttonitem setimage:new]; this too. in vain. image gets changed when run app again , when code in appdelegate gets called. plz help! for set own image button need set custom appearance . , call in appdelegate.h file. note: need set once in appdelegate.h , apply in whole project. don't need declare in each , every controller. please ch...

ios - How to make a local notification alert with sound -

i want set sound in local notification when app in foregroundmode. m try lot of thing . please me. uint32 flag = 0; systemsoundid soundid; int err = audioservicessetproperty(kaudioservicespropertyisuisound, sizeof(uint32), &uilocalnotificationdefaultsoundname, sizeof(uint32), &flag); nslog(@"%d",(unsigned int)err); audioservicesplaysystemsound(soundid); if trying launch local notification sound can use soundname property: uilocalnotification *localnotif = [[uilocalnotification alloc] init]; localnotif.firedate = [nsdate datewithtimeintervalsincenow:30]; localnotif.alertbody = @"hey!"; localnotif.alerttitle = @"notification!"; localnotif.soundname = uilocalnotificationdefaultsoundname; [[uiapplication sharedapplication] schedulelocalnotificat...

javascript - SVG Group Animation - SVG Image Slider -

i'm creating masked vertical image slider using svg , ran bit of snafu. i'm wrapping 3 images in group so: <g> <image></image> <image></image> <image></image> </g> and need animate them @ same time. can't animate y of group. is there way combine 3 images 1 element , animate element up/down? i've included snap.svg , using other animations on site.

javascript - AJAX/PHP login - error messages not working -

i have login system user can enter in credentials , redirect them either "client" view or "admin" view of website. working properly. my issues when user types in incorrect credential information error messages being displayed, i.e. invalid username , password. here login form: <form name="ajaxform" id="ajaxform" action="auth/ajax-auth.php" method="post" > <h4>client login</h4> <div id="error"></div> <label for="username" class="col-sm-2 control-label">username</label> <input id="username" class="form-control" name='username' placeholder="username"> <label for="password" class="col-sm-2 control-label">password</label> <input type="password" class="form-control" id="password" name=...

mysql - Rails controller action hanging -

i newbie in ruby/rails , have been breaking head problem past 2 days , hoping in forum can me out it. i working on rails 4 , running application in production using passenger + nginx mysql database (mysql2 adapter). have following code in productscontroller.rb (log_info custom logging wrapper calls rails logger): def index log_info("productscontroller", "getting products...") @products = product.get_products(params[:offset]) log_info("productscontroller", "got products...") # populate access_url before sending data through update_products_with_access_url(@products) end here definition of get_products function inside product model: def self.get_products(products_offset) products_offset ||= 0 product.includes(:categories, :suppliers). where(active: true).order(updated_at: :desc). limit(20). offset(products_offset * 20) end the problem application hangs in production (wo...

Rails 4: Can I update enums using a button? -

i looking @ updating database. since have rails 4 found use enums. if items statuses set 0 defualt, able add button change status 1 once clicked. how do that? there example demonstrates because i'm looking have default status can changed in view button. is possibility , how go it? state machine gem better type of issue? you can update enums other attribute: use update action. to send new attribute value use hidden form or attach "form" data link or button. this how can link/button: link_to 'update enum', item_path(@item), data: { method: :patch, params: { item: { status: 1 } } } you have adapt path , names in data-params hash names using. depening on use case might want include remote: true send ajax request.

c++ - How to convert a 3D vector to a cv::Mat -

i trying fill opencv mat (float) 3d vector of floats (vgraph1). however, resulting opencv mat (test) not correctly filled, i.e. first column filled correct values while rest junk values (-4.32e+08). confirmed error writting mat text file. doing wrong? kindly advice. thanks. int nstates = 9; const int rows = 10; const int cols = 10; vector < vector < vector<float> > > vgraph1; for(int iii = 0; iii < rows; iii++){ vgraph1.push_back(vector<vector<float> >()); for(int jjj = 0; jjj < cols; jjj++){ vgraph1[iii].push_back(vector<float>()); for(int kkk = 0; kkk < nstates; kkk++){ vgraph1[iii][jjj].push_back(rand()); cout << vgraph1[iii][jjj][kkk] << " "; } cout << endl; } } cout << "opencv mat \n" << endl; mat test(rows, cols, cv_make_type(cv_32f, nstates)); for(int iii = 0; iii < rows; iii++){ float *...

ios - How to detect with CoreBluetooth when a peripheral disappears? -

i have list of ble devices ios can connect, refreshes when ble devices appear , disappear. in order that, created nsmutabledictionnary* peripheralsavailable , , everytime - (void)centralmanager:(cbcentralmanager *)central diddiscoverperipheral:(cbperipheral *)peripheral advertisementdata:(nsdictionary *)advertisementdata rssi:(nsnumber *)rssi; called cbcentralmanager, add peripheral peripheralsavailable dictionnary (and update uitableview). ok here. however can't find how can update dictionnary if peripheral "disappear". seems can add peripherals in dictionnary when detected, can't remove 1 when shut down example. could tell me if i'm missing something? the os cache discovery of devices. i.e. 1 "discovery" event per device. to continuously discovery events while peripheral advertising, must use following option: cbcentralmanagerscanoptionallowduplicateskey a boolean value specifies whether scan should run without duplic...

ios - Add a text field to UIAlertViewController in swift -

i'm new swift , have uialertviewcontroller , want add text field , data that. example text inside text field. add text field alert controller: alertcontroller.addtextfieldwithconfigurationhandler { (textfield) -> void in textfield.placeholder = "some placeholder text" // configure text field here } get text text field when user presses button: let okaction = uialertaction(title: "ok", style: .cancel) { (action) -> void in let textfield = alertcontroller.textfields![0] as! uitextfield } alertcontroller.addaction(okaction)

python - Import variable initialization -

i wonder why import variable in python (python 3.4) has different result importing module , referencing, more on why deep copy made - , there way bypass copy (and not defining function returns it)? a.py v = 1 def set(): global v v = 3 main.py import import b a.set() b.foo() b.py from import v def foo(): print(v) print(a.v) print(id(v)) print(id(a.v)) output 1 3 1585041872 1585041904 the problem you're modifying scalar value. not problem specific modules, work same when passing variable function , modifying there. the value 1 imported a , period. whatever in a afterwards not modify value, because it's simple immutable scalar value. if a.v object, changes object propagate variable holding reference it.

c++11 - Constant container (map) - eliminate heap allocation -

if create static const std::map, allocate memory on heap. following code throws bad_alloc: #include <iostream> #include <map> class { public: static const std::map<int, int> a; }; const std::map<int, int> a::a = { { 1, 3} , { 2, 5} }; void* operator new ( std::size_t count ) { throw std::bad_alloc(); } int main (void) { for(auto &ai: a::a) { std::cout << ai.first << " " << ai.second << "\n"; } return 0; } is possible create constant map somehow without having memory allocation? as igor tandetnik suggested, custom allocator trick. following quick'n'dirty example of simple linear allocator, returns memory slots static buffer: #include <iostream> #include <map> #include <cassert> template <typename t> class linearallocator { static constexpr size_t _maxalloc = 1<<20; using buffer = std::array<t, _maxalloc>; us...

php - MySQL (mysqldump) to SQLite on Android - is there a Windows shell / command line script? -

so, question entirely in title: i'm running android virtual machine on windows machine , i'm trying transfer mysql database xampp-phpmyadmin server via php script , mysqldump create new sqlite database on android machine. when run script, $config = parse_ini_file('config.ini'); $dump = shell_exec('mysqldump --user=' . $config['username'] . ' --password=' . $config['password'] . ' --opt users'); i sql dump, echo , receive string in android (i write file). sweats when think extracting sql syntax output. so, isn't there nice little command line script me, or other more convenient way? edit: clarification: script should able extract sql syntax mysqldump output (there's lot of non-sql output in there) can use string execsql in android. wondering: must have been done before, don't want start primordial ooze here. edit 2: stackoverflow question convert mysql sqlite links this page containing mysql2sqlite, us...

objective c - Why NSNumber truncate double value? -

it's function talked - (void)getaddressfromlatlon:(double)pdbllatitude withlongitude: (double)pdbllongitude { nsdictionary *adresswithltln = @{ @"latitude":[nsnumber numberwithdouble:pdbllatitude], @"longtitude":[nsnumber numberwithdouble:pdbllongtitude]}; [[nsnotificationcenter defaultcenter]postnotificationname:@"useraddress" object:adresswithltln]; } listener: - (void)didgetaddressnotification:(nsnotification*)notification { if ([notification object]!=nil){ nsdictionary *nott = [notification object]; if( nott!=null ){ currentaddress=nott; } }} button action - (ibaction)pressbuttonorder:(id)sender { if ([currentaddress count]>0){ order *order = [[order alloc]init]; [order sendorder:[currentaddress objectforkey:@"latitude"] source_lng:[currentaddress objec...

c++ - Error when overwriting value in unsigned char array -

why error message error: invalid conversion ‘const char*’ ‘unsigned char’ [-fpermissive] if try overwrite value in array of data type unsigned char ? the data type want overwrite value unsigend char . don't use your_array[index] = "c"; instead of your_array[index] = 'c'; ? anyway should put code on post show error.

php - Non-anonymous sessions must use encryption -

i trying connect ftp using php commands. when try login below error warning: ftp_login(): non-anonymous sessions must use encryption code have tried: ftp_connect($ftp_server) ftp_get($ftp_conn, $local_file, $server_file, ftp_ascii) though getting connected through filezilla . not sure error means. thanks probably should use ftps instead of ftp, excerpt link: in order maintain compatibility existing non-tls/ssl-aware ftp clients, implicit ftps expected listen on iana known port 990/tcp ftps control channel, , 989/tcp ftps data channel. allowed administrators retain legacy-compatible services on original 21/tcp ftp control channel. the ftp server may sit on port connect to, tell you need connect port via ftp on ssl. in php use ftp on ssl .

json - How to use google Places API to find an existing list of places -

i have list of malls latitude/longitude from. can them 1 @ time using function. https://maps.googleapis.com/maps/api/place/textsearch/json?query=cherry+hill+mall&key=my_api_key is there anyway automate can find 78 locations @ once?

scala - Difference between Traits? -

is there difference between these 2 trait 's? scala> trait bar[a <: foo] { | def bippy(x: a): | } defined trait bar and scala> trait bartwo { | type <: foo | | def bippy(x: a): | } defined trait bartwo edit : the difference in names not meaningful difference per question. i'm looking difference between these 2 trait constructs. in practical cases, there no difference, , @akoskrivachy commented, scheduled made equivalent. nevertheless, while the official documentation states it possible turn abstract type members type parameters of classes , vice versa. it states @ end that furthermore, there cases not possible replace abstract types type parameters. sadly, not find description of cases :-( i'm posting answer in case given better answer might not forthcoming , might want close this, let's hope.

ember.js - Ember JS: render same view twice ( with data from one controller ) -

i have ember js drag & drop view used connect items bigger piece. construct grows overlaps viewport vertically. what want have small preview-view of d&d view. i want controller data first (big, vertically overlapping ) view interact with, appear in second view (preview, small, not vertically overlapping ). any idea's how render view twice data 1 view, or connect view view's controller? thanks in advance! first of all, should not using views anymore. use components. then, move logic , state model. have model represents drag-n-drop gizmo, , feed 2 components: 1 component preview interface, other 1 full interface.

r - Events in last 21 days for every row by Name -

this dataframe looks like. 2 rightmost columns desired columns.these 2 columns check condition whether in last 21 days there "email" activitytype , whether in last 21 days there "webinar" activitytype. name activitytype activitydate email(last21days) webinar(last21day)** john email 1/1/2014 true na john webinar 1/5/2014 true true john sale 1/20/2014 true true john webinar 3/25/2014 na true john sale 4/1/2014 na true john sale 7/1/2014 na na tom email 1/1/2015 true na tom webinar 1/5/2015 true true tom sale 1/20/2015 true true tom webinar 3/25/2015 na...

java - RxJava- performing a peek() or void operation within an Observable chain? -

java 8 lambda streams have peek() operator allows execute void operation on each item. typically used debugging, nice way cheat , kick off void operation without mapping something. is there equivalent in rxjava? maybe i'm not following practice or thinking reactively enough... handy create status labels before , after operation? if peek() not supported, there better pattern follow? observable<item> item= ...; label statuslabel = new label(); label resultlabel = new label(); observable<calculateditem> calculateditem = calculated.subscribeon(schedulers.computation()) .peek(c -> statuslabel.settext("working..")) .map(c -> performexpensivecalculation(c)) .peek(r -> statuslabel.settext("")); calculateditem.subscribe(c -> resultlabel.settext(c)); there method doonnext(action1<item> action) called each item in stream. documentation

java - How to use some of ListView method in RecyclerView? -

i'm used recyclerview show , sort levels. because listview has speed did not use listview , use recyclerview. therefore, need of listview methods, methods has setscrollposition , setonitemselect . my recyclerview adapter codes : public class levels_card_adapter extends recyclerview.adapter<levels_card_adapter.viewholder> { private static string[] adapter_levels_number; public levels_card_adapter(string[] adapter_levels_num_data) { adapter_levels_number = adapter_levels_num_data; } @override public levels_card_adapter.viewholder oncreateviewholder(viewgroup parent, int viewtype) { view itemlayoutview = layoutinflater.from(parent.getcontext()).inflate( r.layout.levels_recycler_layout, null); viewholder viewholder = new viewholder(itemlayoutview); return viewholder; } @override public void onbindviewholder(viewholder viewholder, int position) { viewholder.adapter_...

aif - AX 2012 R3 CU8: System.ServiceModel.FaultException: An error occurred -

Image
i'm trying update existing sales order using aif services. when invoke service operation, following error message: system.servicemodel.faultexception: error occurred. server stack trace: @ system.servicemodel.channels.servicechannel.handlereply(proxyoperationruntime operation, proxyrpc& rpc) @ system.servicemodel.channels.servicechannel.call(string action, boolean oneway, proxyoperationruntime operation, object[] ins, object[] outs, timespan timeout) @ system.servicemodel.channels.servicechannelproxy.invokeservice(imethodcallmessage methodcall, proxyoperationruntime operation) @ system.servicemodel.channels.servicechannelproxy.invoke(imessage message) exception rethrown @ [0]: the client visualstudio .net c# console project. call wrapped in try/catch block. try { console.writeline("making call update sales order..."); proxy.update(callcontext, entitykeys, newsalesorderdoc); console.writelin...

android - MPAndroidChart - Round edged bar chart -

Image
i trying create chart below, android application using mpandroidchart. unable figure out, how make bar chart's edges round edged. comes square edge. so can please suggest me should do? in advance help. i've implemented solution achieve straight on library itself. firstly create attrs.xml adding new attribute use on chart view. this: <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="barchart"> <attr name="radius" format="integer" /> </declare-styleable> </resources> then edit method called drawdataset on barchartrenderer: protected void drawdataset(canvas c, bardataset dataset, int index) { transformer trans = mchart.gettransformer(dataset.getaxisdependency()); mshadowpaint.setcolor(dataset.getbarshadowcolor()); float phasex = manimator.getphasex(); float phasey = manimator.getphasey(); list<barentry...

android - java.net.MalformedURLException: Protocol not found: null -

this mainactivity.java /** asynctask parse json data , load listview */ private class listviewloadertask extends asynctask<string, void, simpleadapter>{ jsonobject jobject; // doing parsing of xml data in non-ui thread @override protected simpleadapter doinbackground(string... strjson) { try{ jobject = new jsonobject(strjson[0]); storejsonparser countryjsonparser = new storejsonparser(); countryjsonparser.parse(jobject); }catch(exception e){ log.d("json exception1",e.tostring()); } // instantiating json parser class storejsonparser countryjsonparser = new storejsonparser(); // list object store parsed countries list list<hashmap<string, object>> countries = null; try{ // getting parsed data list construct countries = country...

excel - Interesting Way to Format an Error, but recode for it at the same time -

i have function says lookup value, x, , return value, y, linked value x. however not time comes up. gets recoded n/a . used iferror function says if there error, recode 0 . is there way in can color cell , color. looked conditional formatting , seemed values or text, cell wont text after if function executes. to set things clearer, i've arranged set of example: this master table a1:a4 named num_l , then, b1:b4 named say_l b 1 number say_it 2 1 1 3 2 2 4 3 3 and transaction table g h 1 sample say_it 2 2 2 3 0 nope 4 2 2 5 6 nope 6 3 3 this formula h1 cell: =if(iserror(index(say_l; match(g2; num_l; 0))); "nope"; index(say_l; match(g2; num_l; 0))) so, number not in 1 or 2 or 3 written "nope" at conditional formatting cell h1 i can put this: =iserror(index(say_l; match(g2; num_l; 0))) and color yellow background cell, when conditi...

jquery - Flask URL routing : url_for only passes first argument -

i have jquery tabbed panel loads pages within tab on click. works fine. want pass additional arguments url such title of tab being clicked. script load following: $(document).ready(function(){ $( "#content" ).load( "{{url_for(xyz, query=query)}}" ); var tabs = $('.tabs > li'); tabs.on("click", function(){ tabs.removeclass('active'); $(this).addclass('active'); $( "#content" ).load( "{{url_for(xyz, query=query)}}" ); }) }); the html following: <ul class="tabs clearfix" > <li> <a href=# >all</a> </li> <li class=active > <a href=# >you</a> </li> <li> <a href=# >me</a> </li> i pass tab title parameter flask url_for. also, best way inspect properties of objects. mean, in python can use dir(object) list object. there simple way of showing attributes of clicked tab object somewhere in browser. thanks...

c# - Remove close button in an Extended WPF Toolkit style -

i using extended wpf toolkit message box here: http://wpftoolkit.codeplex.com/wikipage?title=messagebox&referringtitle=home i'm not sure how remove close button messagebox type - don't want user close messagebox @ all. thanks help! edit: if create style setter in code this: system.windows.style style = new style(); style.setters.add(new setter(xceed.wpf.toolkit.messagebox.closebuttonvisibilityproperty, visibility.hidden)); messagebox.style = style; i exception: an exception of type 'system.invalidoperationexception' occurred in xceed.wpf.toolkit.dll not handled in user code additional information: close button on messagebox visible. according link there closebuttonvisibility property can or set visibility of close button, try setting 'false'

parse.com - What does includeKey do ? -

i'm confused pfquery's includekey: method. have instance of class foo containing string property name 'state' , pointer class instance (say bar instance) 'bar'. when query instances of foo want info on bar instance related too: let query = pfquery("foo") .wherekey("state", equalto: "active") .includekey("bar") does fetch bar instance properties ? such can do: let foo = query.getfirstobject() as! foo // access bar property foo.bar.baz = "yep" what if foo bar property not pointer object ? thanks b. yes, "includekey" include 'bar' pfobject in query results. in swift should cast "bar" pfobject in order access properties. if let bar = foo["bar"] as? pfobject { println(bar["baz"]) }

Laravel 5.0.33 Illuminate\Database\Eloquent\Model not found in line 5 -

here file email.php in app, simple doesn't work: <?php namespace app; use illuminate\database\eloquent\model; class email extends model { protected $table = 'emails'; public $timestamps = false; } ?> laravel 5.0.33 illuminate\database\eloquent\model not found in line 5 yes got vendors , composer install doesn't solve anything.i need help. passed journey can't doing , searching internet without find that

sbt - Docker: getcwd: cannot access parent directories -

i have java app, packaged docker container via sbt-native-packager. when testing on local machine or other server, container starts fine. , on 1 of coreos machines on azure, i'm getting: shell-init: error retrieving current directory: getcwd: cannot access parent directories: success chdir: error retrieving current directory: getcwd: cannot access parent directories: no child processes pwd: error retrieving current directory: getcwd: cannot access parent directories: no such file or directory chdir: error retrieving current directory: getcwd: cannot access parent directories: no child processes chdir: error retrieving current directory: getcwd: cannot access parent directories: no child processes chdir: error retrieving current directory: getcwd: cannot access parent directories: success pwd: error retrieving current directory: getcwd: cannot access parent directories: no child processes chdir: error retrieving current directory: getcwd: cannot access parent directories: no c...

excel - Pass date input string to cell range -

i trying pass date entered in input box through range of cells in specific column. range isn't specific must fill cells contain data in column. 'date input box sub dateinput() dim datestring string, thedate date datestring = application.inputbox("enter certificate date") if isdate(datestring) thedate = datevalue(datestring) else msgbox "that's not good!" end if end sub this far i've gotten, can't seem feed entered date range of cells. you can use following sample replace non empty cells in range date: sub dateinput() dim datestring string, thedate date dim rng range dim lastrow long dim lastcol long dim ws worksheet dim wb workbook set wb = activeworkbook '<-- workbook working in set ws = wb.activesheet '<-- worksheet working in ws if application.worksheetfunction.counta(.cells) <> 0 '...

php - Which is the best in performance having 1 to many relationships on tables -

i have table company in saving company information , want save n number of company locations particular company (country_id, city_id). 1 company has multiple locations. have save country , city in database in such way if user wants view company filter country or filter city , search fast ( indexing applied ). which option give me better performance in terms of fast search, normalization? option 1: should maintain country id , city id in json , save in company table? no need of new table. every time add or update json based on users selections. for e.g. [{"country1" : {city1, city2, city3}}, {"country3" : {city5, city1, city3}}] then can (like) query on field -> decode json -> return result option 2: should create new table , save country's , city's pk along company_id fk. company_id (fk) | country id | city id 1 | 25 | 12 1 | 25 | 16 1 | 25 | 19 1 | 30 | 1 1 | 30 | 69 1 | 30 | 14 then query , return result normal...

python - Template variable replacements only. Is text/Template a good fit? -

i'm looking efficient way replace bunch of placeholders/tokens in user supplied text file, corresponding values stored in simple map or environment vars. thing template file supplied end user, i'm looking "safe" way variable replacements, without risk of code execution, etc. go's standard "text/template" work replacement imposes specific formatting requirements (e.g. dot "." before key) , opens other possibilities function invocations, pipelines, etc. so i'm looking for, ideally, function can parse text file configurable delimiters ("{{}}" or "${}" or "$##$") , replace detected tokens lookups supplied map or env var values. similar python's string.template ( https://docs.python.org/2.6/library/string.html?highlight=string.template#string.template ) does. is there easy way configure or reuse text/template library this? there other approaches fit use case better? i've looked non-golang options ...

sql server - (Un)pivoting tables on SQL -

i'm trying create matrix historical data parameters have in table. matter is, when try pivot it, won't work. using following code select concept, [1] '1993', <...>, [23] '2015' (select concept, year(begin_date) year, value params p with(nolock)) st pivot ( sum(value) year in ([1], <...>, [23]) ) pt will return nothing matrix full of null values. on other hand, i've got correct values using other query select pt.year 'year', [1], <...>, [38] (select concept, year(begin_date) year, value parameters p with(nolock)) st pivot ( sum(value) concept in ([1], <...>, [38]) ) pt but columns , rows supposed other way around. cause of situation? how solved? in advance you have: year in ([1], <...>, [23]) this supposed be year in ([1993], <...>, [2...

google maps - How to embed a kml or kmz file in my webpage -

i need embed kml google earth map in webpage. followed this instructions, link code embed doesn't seem activated here . i tryed followning code, shows simple map without informatons in kml file <head> <title></title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #google-map { height: 100% } </style> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=my-key&sensor=false"> </script> <script> function initialize() { var mapoptions = { center: new google.maps.latlng(42.753633, 13.952404), zoom: 10, maptypeid: google.maps.maptypeid.satellite, scrollwheel: false } var map = new google.maps.map(document.getelementbyid('google-map...

php - codeigniter- insert data into db not working -

when click on submit button keep getting message "your menu not added, please try again" while code working before after committing on svn not working , data being inserted db controller: public function addmenu() { $this->load->model('organizer_model'); $data = array( $data['email']=$this>session>userdata('email'); 'menu_name' => $posted_data['menu name'], 'price' => $posted_data['price'] ); if($this->organizer_model->insertmenu($data)) { $this->session->set_flashdata('message', 'your menu has been added'); redirect('/menu/index', 'refresh'); } else { $this->session->set_flashdata('message', 'your menu not added, please try again'); redirect('/menu/index', 'refresh'); } } model: public function in...

I keep getting the error message 'TypeError: 'int' object is not subscriptable' in python -

i have tested code several times , keep getting same error message. typeerror: 'int' object not subscriptable here code has problem: guess = int(guess) number = int(number) if guess[0] == number[0]: ## other (correct)code goes here int base type- not list or array, cannot int[0] string work, hard figure out if thats want based on tiny snippet guess = str(guess) number = str(number) if guess[0] == number[0]:

ruby on rails - What is causing NoMethodError in my CRUD? -

i student working on first project on own. user supposed able create to-do list. have form partial displayed , trying render list items through partial. after altering routes.rb , items_controller.rb still receive nomethoderror. here stack trace. completed 500 internal server error in 23ms (activerecord: 0.2ms) actionview::template::error (undefined local variable or method `items' #<#<class:0x007fa1c3b4e238>:0x007fa1bd6f2258>): 1: <% items.each |i| %> 2: <%= i.name %> 3: <% end %> app/views/items/_item.html.erb:1:in `_app_views_items__item_html_erb___4201771908086516106_70166314068980' app/views/users/show.html.erb:5:in `_app_views_users_show_html_erb__1693372631105662933_70166313045680' items_controller.rb class itemscontroller < applicationcontroller def index @items = item.all end def show @item = item.find(params[:id]) end def new @item = item.new end def edit @item = item....