Posts

Showing posts from September, 2011

How can I set the value for request.authenticated_userid in pyramid framework of python -

i getting error when try set attribute authenticated_userid request parameter. nosetest using mock request , see response. traceback (most recent call last): file "/web/core/pulse/wapi/tests/testwapiutilities_integration.py", line 652, in setup setattr(self.request, 'authenticated_userid', self.data['user'].id) attributeerror: can't set attribute code below @attr(can_split=false) class logsuspiciousrequestandraisehttperror(integrationtestcase): def setup(self): super(logsuspiciousrequestandraisehttperror, self).setup() pyramid.request import request pyramid.threadlocal import get_current_registry request = request({ 'server_protocol': 'testprotocol', 'server_name': 'test server name', 'server_port': '80', }) request.context = testcontext() request.root = request.context request.subpath = [...

javascript - Saving the clicked element and accessing it from another object -

what set click event on particular set of dom elements. i remember element has been clicked may need retrieve information later. i able access js object if possible. below have far... <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ul> <button> have clicked on? </button> <script> var listitem = { elementhandle: $('li'), instanceclicked: '', bindeventhandlers: function(){ $(this.elementhandle).click(this.alertthecontent); }, alertthecontent: function(){ this.instanceclicked = $(this); alert(this.instanceclicked.html()); } } var button = { elementhandle: $('button'), bindeventhandlers: function(){ $(this.elementhandle).click(this.showlistitemclicked); }, showlistitemclicked: function(){ console.log(listitem.instanceclicked); } } listitem.bindeventhandlers(); button.bindeventha...

android - Show in activity message from BroadcastReceiver when change connectivity -

i have broadcastreceiver control connectivity. would, when lost connection, show message, not generic toast, "layout" designed. broadcast generic broadcast connection: public class connectivitychangereceiver extends broadcastreceiver { @override public void onreceive(final context context, final intent intent) { connectivitymanager cm =(connectivitymanager) context.getsystemservice(context.connectivity_service); if (cm.getactivenetworkinfo()!=null){ toast.maketext(context, "connected internet", toast.length_long).show(); } else{ /** here instead of toast, iwould display message on activity **/ toast.maketext(context, "not connection", toast.length_long).show(); log.i("internet", "---------------------> internet disconnected. "); } } } and "no_connection_layout" <?xml version="1.0" encoding="utf...

c++ - Simple constexpr LookUpTable in C++14 -

i trying make simple lookuptable based on array of integers, idea have calculated @ compile time . trying make possible use other future tables of various integer types might have, need template . so have lookuptable.h #ifndef lookuptable_h #define lookuptable_h #include <stdexcept> // out_of_range template <typename t, std::size_t number_of_elements> class lookuptableindexed { private: //constexpr static std::size_t number_of_elements = n; // lookuptable t m_lut[ number_of_elements ] {}; // essential t default constructor compile-time interpreter! public: // construct , populate lookuptable such that; // indices of values mapped data values stored constexpr lookuptableindexed() : m_lut {} { //ctor } // returns number of values stored constexpr std::size_t size() const {return number_of_elements;} // returns data value @ given index constex...

haskell - What is complexity of Control.Monad.Writer for w ~ [a]? -

assuming tell = flip mappend should quadratic, make writer instance pretty useless. if it's so, can done improve performance? i'm thinking of trick used in control.monad.free.church control.monad.codensity : should possible reassociate mappend calls, codensity reassociates >>= , haven't figured how exactly. to sum up: yes, tell ing [a] has quadratic complexity in writer . can avoided using dlist (which uses codensity -like trick talking about) or datatype mappend isn't o(n^2) . on top of that, writer generates thunks each >>= used build computation. problem because unlike first case can't worked around. solution use state monad instead.

xml - How to add a field to sale order lines? -

i add "ship" field sale order lines drop down list (many2one field). my xml file ship_view.xml : <record model="ir.ui.view" id="ship_orderline"> <field name="model">sale.order.line</field> <field name="name">sale.form</field> <field name="inherit_id" ref="sale.view_order_form"/> <field name="arch" type="xml"> <xpath expr="//field[@name='order_line']/tree/field[@name='product_uom_qty']" position="before"> <field name="ship"/> </xpath> </field> </record> try belowing code. check out model should sale.order in view: python code from openerp import models, fields class customsaleorderline(models.model): _inherit = 'sale.order.line' ship = fields.char( string='ship', ) xml ...

java - Transitive dependencies coming from provided scope dependency -

i have added vaadin-client-compiler dependency provided scope dependency in vaadin application pom. as have read, provided dependency not transitive, dependencies of vaadin-client-compiler should become dependencies of webapp. but, found dependencies of vaadin-client-compiler (commons-lang3-3.1.jar) inside web-inf/lib directory. also, these dependencies shown in mvn dependency:tree output well. [info] | +- javax.validation:validation-api:jar:1.0.0.ga:compile [info] | \- javax.validation:validation-api:jar:sources:1.0.0.ga:compile [info] +- com.vaadin:vaadin-client-compiler:jar:7.6.4:provided [info] | +- com.vaadin:vaadin-sass-compiler:jar:0.9.13:compile [info] | | \- com.yahoo.platform.yui:yuicompressor:jar:2.4.8:compile [info] | | \- rhino:js:jar:1.7r2:compile [info] | +- commons-collections:commons-collections:jar:3.2.2:compile ................................................ ................................................. [info] | +- commons-codec:co...

Javascript / jQuery - Price calculation -

Image
i'm building events app using ruby on rails. @ moment user wishes book onto event can book , pay 1 space @ time. need offer facility them book multiple spaces , pay appropriate price - 5 spaces £10 each = £50 pay etc. i've looked appropriate solutions in ror sort i'm hitting brick wall. however, believe i've perhaps approached wrong way , solution using javascript or jquery best way forward. i'm novice @ both , need assistance in achieving objective. here's payment/booking page - i want user able place number of spaces in first text area , price (total amount) change accordingly. here's other relevant code - booking.rb - class booking < activerecord::base belongs_to :event belongs_to :user def total_amount #quantity.to_i * @price_currency.to_money quantity.to_i * strip_currency(event.price) end private def strip_currency(amount = '') amount.to_s.gsub(/[^\d\.]/, '...

vue.js - Vue js sync parent and child data with Vue-Router -

in vuejs application using vue-router routing. working fine except one. in parent have list view having link below on left side . <div class="col-md-5"> <ul> .... <a v-link="{ name: 'task-detail', params: { taskid: task.id }}">{{ task.title }}</a> </ul> </div> <div class="col-md-7"> <router-view></router-view> </div> when click it, nested route gets activated , display detail view on right side. now problem in parent view can toggle if task completed or not. i have label showing if task completed or not in child view. <label class="label label-success pull-right" v-show="task.is_completed">completed</label> how reflect status change on child view when in parent view. need refresh page ? or there simpler solution. in simpler terms when toggle completion status on parent view label should change on child view. so vue wan...

machine learning - Prediction with LightSide does not work -

i working machine learning workbench lightside ma-thesis. have trained models, use trained model predict new data. however, when try so, system stops after few seconds, pop-up message "prediction been stopped" , no hint on why. happens different data sets, algorithms used training... has encountered same problem , found solution it? thank :) edit: tried export feature table weka , train models there, weka gets lost in endless training loop, assume has built-in feature unigram use form lightside. still not closer predicting on new data... edit ii: lightside throws error saying 1 feature not part of model, when in fact is

java - Bean Lifecycle Management Spring Boot -

i trying deploy spring boot application external tomcat instance, , running questions regarding how best manage instantiation of things. as presently structured have along lines of public class myclass extends springbootservletinitializer{ @bean public threadpool pool(){ return new threadpool(); } @bean public backgroundthread setupinbox() { backgroundthread inbox = new backgroundthread(pool()); inbox.start(); return inbox; } @override protected springapplicationbuilder configure(springapplicationbuilder application) { return application.sources(myclass.class); } public static void main(string[] args) throws exception { springapplication.run(myclass.class, args); } } where backgroundthread thread listening amqp type messaging queue new jobs. know spring offers rabbitmq ways this, not using rabbit doesn't help. the entire purpose of *.war file being deployed expose functionality wire via messaging, question best way instantiate, start , des...

c# - How can i put this custom Linq query to view? -

i'm kind of newbie on linq , use help. i'm trying set custom linq query mvc view can't figure out how to? here code actionresult from st in db.stats orderby st.id descending select new { st.id, st.date, st.created, st.accepted, st.ended, totaltime = (sqlfunctions.stringconvert((double) sqlfunctions.datediff("ss", st.created, st.ended)/60) + ":" + ("0" + sqlfunctions.stringconvert((double) sqlfunctions.datediff("ss", st.created, st.ended)%60)) .substring( ("0" + sqlfunctions.stringconvert((double) sqlfunctions.datediff("ss", st.created, st.ended)%60)) .length - 2, 2)), ordertime = (sqlfunctions.stringconvert((double) sqlfunctions.datediff(...

ruby on rails - How to pass arguments in I18n.translate -

i18n.translate can translate error.messages this: i18n.translate('error.messages.taken') -> has been taken but there error messages contains arguments like: i18n.translate('error.messages.greater_than_or_equal_to') -> must greater or equal %{count}" is possible pass argument ‘count’ in i18n.translate? you can pass params after key i18n.translate('error.messages.greater_than_or_equal_to', count: 2)

android - How to catch soft keyboard "ENTER" -

i'm developing chat app, , looking way catch enter pressed on soft keyboard during message editing (in edittext). aim send text directly. have implemented "send" button. two attempts: using edittext.addtextchangedlistener(new textwatcher().. result: "\n" character either in ontextchanged , aftertextchanged callbacks. "remove" character , send chat, don't like way. using edittext.setoneditoractionlistener(new textview.oneditoractionlistener().. result: doesn't work. any better solution? try this; edittext.setonkeylistener(new onkeylistener() { public boolean onkey(view v, int keycode, keyevent event) { if (event.getaction() == keyevent.action_down) { switch (keycode) { case keyevent.keycode_dpad_center: case keyevent.keycode_enter: //perform action return true; default: ...

What is replacement of EventTimeSourceFunction (Flink 0.10.x) in Flink 1.x? -

i trying migrate slidingarrivalcount.scala example based on flink 0.10.1 flink 1.1.1. the taxiridesource data stream source used in example implements org.apache.flink.streaming.api.functions.source.eventtimesourcefunction interface, no longer provided flink 1.x. how can port taxiridesource flink 1.x? since flink 1.0.0, sourcefunction can operate in event time mode, i.e., have interfaces in place so. source functions implement eventtimesourcefunction can upgraded flink 1.x, replacing eventtimesourcefunction sourcefunction .

ios - Typhoon auto-inject assembly by protocol -

i'm having problem correctly acquiring assembly auto-injection macros. example: @protocol iformatterprovider <nsobject> - (id)statustextformatter; @end @interface myassembly : typhoonassembly <iformatterprovider> @end @implementation myassembly - (id <iformatterprovider>)formatterprovider { return [typhoondefinition with:self]; // first guess } - (id)statustextformatter { // impl } @end then trying use in business logic file: @interface mystuff () @property (nonatomic, strong) injectedprotocol(iformatterprovider)formatterprovider; @end but getting "no components defined satisify type" error (btw there typo), because assembly got registered typhooninjectiondefinition class nsobject is possible i'm doing? you can inject assembly itself, act factory or provider, using this approach . explicit wiring. i don't believe auto-wiring works assembly protocols, may raise feature request if of interest.

twitter bootstrap - Rails: Choosing an object on button click and showing info on modal -

i have long list of cats in database cat(id: integer, name: string, gender: integer, home: boolean, created_at: datetime, updated_at: datetime) and on web page wish open bootstrap modal information of 1 cat in it. id of cat determined on button click. in catscontroller have defined def index @cats = cat.all end and path /cats/ shows <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#mymodal"> open modal </button> <div class="modal fade" id="mymodal" role="dialog"> <div class="modal-dialog"> <!-- modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">modal header</h4> ...

python - How do you add an overall title to a figure with subplots in matplotlib? -

Image
this question has answer here: how set single, main title above subplots pyplot? 3 answers i can see can add title each subplot, discussed here: how add title subplots in matplotlib? is there way add overall title in addition subplot titles? using fig = plt.figure() fig.suptitle('this figure title')

javascript - looking for a better regex solution -

this question has answer here: using regular expressions parse html: why not? 18 answers my input is: <span question_number="18"> blah blah blah 1</span><span question_number="19"> blah blah blah 2</span> and want regex match <span question_number="somenumber">xxxx</span> pattern , desired output 1.somenumber 2.xxxx i wrote naive solution cover <span question_number="18"> blah blah blah 1</span> <span question_number="19"> blah blah blah 2</span> notice: on different lines output : 18 , blah blah blah 1 , 19 , blah blah blah 2 but when input <span question_number="18"> blah blah blah 1</span><span question_number="19"> blah blah blah 2</span> on same line my output 18 , blah blah blah 1</spa...

perl - Transliterate Characters in Hex in Bash -

i have set of hexadecimals d transliterate set of hexadecimals, in example : x00 -> x20 xb0 -> x20 x21 -> x40 x80-xff -> x20 x22 -> x43 i know can chain sed statements : sed -i.bak $'s/[\x80-\xff]/\x20/g' or : sed -e 's/\x00/\x20/g;s/\xb0/\x20/g' but there way "break" separate changes line more readable? : sed -e ' s/\x00/\x20/g; s/\xb0/\x20/g; . . . ' file_in > file_out if not possible, done perl? thank you. you can pass multiple expressions ( -e ) sed : sed \ -e 's/\x00/\x20/g' \ -e 's/\xb0/\x20/g' \ -e 's/\x21/\x40/g' \ -e 's/[\x80-\xff]/\x20/g' \ -e 's/\x22/\x43/g' file_in > file_out

php - Laravel 5.2 route with optional parameters not working -

i can't seem find problem, hope can me. im trying reach controller, , use parameter, alwasy says missing parameter. route file: route::get('admin/site-settings/global-data/{part?}/', ['as' => 'admin/global-data-edit', 'uses' => 'admin\globaldatascontroller@getglobaldata']); function: public function getglobaldata(request $request, $part){ $globaldata = globaldata::find(1); switch ($part){ case "content": if($request->ajax()){ return view('admin.site-settings.global-data._ajax_load_content', compact('globaldata')); } return view('admin.site-settings.global-data.edit')->with('globaldata', $globaldata); break; case "logo": if($request->ajax()){ return view('admin.site-settings.global-data._ajax_load_logo', compact('globaldata...

Java and MySql set unicode characters for this class -

i trying input unicode characters (greek) database. read in order have set unicode characters active. how can set character set unicode specific class? public class database { public static database busdatabase = null; protected string connection_url = ""; protected string driver_name = ""; protected string name = ""; protected string user = ""; protected string password = ""; protected class driver_class = null; protected static connection connection = null; protected resultset results = null; protected string current_table = ""; protected boolean error = false; public database(string name, string user, string password) { this(name, user, password, "jdbc:mysql://localhost:3306", "com.mysql.jdbc.driver"); } //public void run() { // con = (connection)drivermanager.getconnection(connection_url, user, password); //} public s...

java - Dependencies does not inject during weblogic deployment -

i want deploy project on weblogic when deploy war, spring applicationcontext gets loaded , when starts hydrating caches crashes giving me null pointer exception. when debugged saw persistence entity class, used during method, instantiated out dependencies meaning did not injected. my entity class marked @configurable , getter , setter methods dependencies marked @transient. also, when run tests inject dependencies in entity class , seems not inject when trying deploy weblogic. have no idea start looking problem have no idea code should supply with. any tips on should google or appreciated. if want have @ code ask , add it. thank , apologize lack of code have no idea bit , code useless. edit: adding code entity class @configurable @javax.persistence.entity @table(name = "some_table") public class interactionimpl implements interaction, serializable { private long interactionid; private long initiatorentitynr; private long agententitynr; transi...

delphi - I am trying to create a simple chat program by writing to a shared file on my network -

i trying use timer check the timestamp of file check if has been modified, if true must add line text file richedit. problem continually adds line richedit every 1/4 second (timer interval). have tried different methods can't right. procedure tform1.timer1timer(sender: tobject); var filet : textfile; filename, readtxt : string; filedate1, filedate2 : integer; begin assignfile(filet, 's:\share.talk'); filename := 's:\share.talk'; filedate1 := fileage(filename); if filedate1 <> filedate2 begin reset(filet); readln(filet, readtxt); richedit1.lines.add(readtxt); closefile(filet); filedate2 := filedate1; end;//if end; thanks help. in code if filedate1 <> filedate2 begin reset(filet); readln(filet, readtxt); richedit1.lines.add(readtxt); closefile(filet); filedate2 := filedate1; end; the comparison between filedate , filedate2 assumes these retain values between calls timer1timer . not , because declared local timer1timer , therefor...

c# - Roslyn - Use VisualStudioWorkspace in Visual Studio 2010 -

is possible somehow use visualstudioworkspace service, in vsextension targets visual studio version 2010?( http://source.roslyn.codeplex.com/#microsoft.visualstudio.languageservices/implementation/projectsystem/visualstudioworkspace.cs,e757fe6b8e91e765 ) i tried import service using mef, described @ https://joshvarty.wordpress.com/2014/09/12/learn-roslyn-now-part-6-working-with-workspaces/ , that's not working @ all. [import(typeof(microsoft.visualstudio.languageservices.visualstudioworkspace))] public visualstudioworkspace myworkspace { get; set; } no. visualstudioworkspace exists in vs2015 , newer.

angular - How to reference Angular2 component properties/methods without 'this' keyword? -

i building application on angular2 , have been running problem 'this' keyword keeps giving me trouble. since in components (properties, methods) properties on class, if want reference them within method, have use 'this' keyword, lose reference because nested far multiple functions. use closures lot fix problem (shown below) closures don't work because closure function looses reference method uses inside of (like call service). example: export class mycomponent implements oninit { private data; getinfofromservice() { this.data = this.myservice.fetchallinfo(); } retrieveinformation() { var getinfo = this.getinfofromservice; settimeout(function() { getinfo(); }, 5000); } ngoninit() { this.retrieveinformation(); } } basically getting @ is, there anyway reference method on class without 'this' keyword? example, write like: retrieveinformation() { sett...

python - Access HDF files stored on s3 in pandas -

i'm storing pandas data frames dumped in hdf format on s3. i'm pretty stuck can't pass file pointer, url, s3 url or stringio object read_hdf . if understand correctly file must present on filesystem. source: https://github.com/pydata/pandas/blob/master/pandas/io/pytables.py#l315 it looks it's implemented csv not hdf. there better way open hdf files copy them filesystem? for record, these hdf files being handled on web server, that's why don't want local copy. if need stick local file: there way emulate file on filesystem (with real path) can destroyed after reading done? i'm using python 2.7 django 1.9 , pandas 0.18.1.

c++ - Vignetting correction on RGB image with OpenCV -

first of all: i'm new opencv :-) want perform vignetting correction on 24bit rgb image. used area scan camera line camera , put image 1780x2 px parts complete image 1780x3000 px. because of vignetting, made white reference picture 1780x2 px calculate lut (with correction factor in it) vignetting removal. here code idea: mat white = imread("white_ref_2l.bmp", 0); mat lut(2, 1780, cv_8uc3, scalar(0)); lut = 255 / white; imwrite("lut_test.bmp", lut*white); as understood, second last line (hopefully) do, divide 255 every intensity value of every channel , store in lut matrice. want use lut to calculate “real” (not distorted) intensity level of each pixel multiplying every element of src img every element of lut matrice. obviously not working how want it, memory exception. can me problem? edit: i'm using opencv 3.1.0 , solved problem this: // read white reference image mat white = imread("white_ref_2l_d.bmp", im...

php - Laravel & VestaCP HTTP Error 500 -

i set vps on centos 7 vestacp, i've heard many great things it. great except can't run laravel project on it. i've followed couple of tutorials on how set laravel project on vestacp, doesn't anything. i have contents of public folder in public_html , , have else in private/laravel folder, outside of public_html . edited index.php file include bootstrap/autoload , bootstrap/app when uploading projects hosting, time doesn't work @ all, , throws me http error 500. my initial thoughts must apache permissions, didn't work @ all. if can me out @ all, i'd grateful. the error occurs because php not given access private/laravel directory. can check in logs in /var/log/httpd/domains/yourdomain.com.error.log . if log message says open_basedir restriction in effect can confirm problem. to resolve need add private/laravel directory open_basedir path in /home/username/conf/web/httpd.conf , /home/username/conf/web/shttpd.conf . in .conf file,...

tfs - Binary File Merge in GIT in Visual Studio 2013 Ultimate -

Image
we using tfs git source control. i trying pull latest version having issue dll files being out of sync. i have done following; tried pull latest commits team explorer menu. message; an error occurred: 33 uncommitted changes overwritten merge so ran commit , included excluded files. included dlls etc.i did going team explorer -> changes then added 33 untracked files, , committed locally. next, clicked sync , pull incoming commits menu. i message; pull completed conflicts. resolve conflicts , commit results. i click 'resolve conflicts' link , gives list of 77 files (dlls csproj , pdb files). see screenshot below; however, when click keep local or keep remote link nothing happens. if select merge button message can direct me how resolve this? git repositories do not handle binaries well. git optimized text files, can diff , compress. binaries cannot diffed , compressed, cause repository bloat -- git has store entire binary ev...

c# - Convert SQL code to LINQ - Group By and Sum -

can not convert code linq , preview data grid view. i have looked @ this answer not helping me select tbl_user.id,tbl_user.name,tbl_user.family, sum(tbl_price.price) tbl_user,tbl_price tbl_user.id=tbl_price.user_id_fk group tbl_user.name+''+tbl_user.family,tbl_user.id,tbl_user.name,tbl_user.family please me convert code linq you need join 2 tables, group result userid , call sum method on price property value each items user. something this var userswithtotalprice = (from in db.users join b in db.userprice on a.userid equals b.userid select new { userid = a.userid, familyname = a.name + " " + a.familyname, price = b.price} ).groupby(f => f.userid, items => items, (a, b) => new { ...

How to return the second non-blank cell from row excel for Mac -

Image
to return first non-blank cell in row use: =index(c1:f1,match(true,index((c1:f1<>0),0),0)) however, how return second non-blank cell in row? have text in cells. when attempt =index(c1:f1,aggregate(15,6,column(c1:f1)/sign(len(c1:f1)),2)), suggested. i don't next non-blank cell returned, f cell returned, if there others should have been returned before it. if there nothing in f, 0. use aggregate function 's small subfunction . =index(a1:a13, aggregate(15, 6, row(1:13)/sign(len(a1:a13)), 2)) the 2 k small subfunction. replace row(2:2) , tighten of other cell references if want fill down third, fourth, etc. when returning column index number index function , aggregate function uses column function instead of row function .. column($a:$d) give position within columns c:f; e.g. 1, 2, 3 or 4.

java - How to set variables from multiple text fields in single jPanel -

brand new coder here. i've been searching around, cannot seem find topics on how set multiple variables line of textboxes in jpanel use later algorithmic functions. in case, need 5 unique variables later use. setting these variables highly appreciated. here's code have setting text fields , gathering user input: import java.util.scanner; import javax.swing.*; //used create jpanel public class simplemath { public static void main(string[] args) { //setup text boxes jtextfield afield = new jtextfield(5); jtextfield bfield = new jtextfield(5); jtextfield cfield = new jtextfield(5); jtextfield dfield = new jtextfield(5); jtextfield efield = new jtextfield(5); //creating jpanel jpanel mypanel = new jpanel(); mypanel.add(new jlabel("1:")); mypanel.add(afield); mypanel.add(box.createhorizontalstrut(15)); //a spacer mypanel.add(new jlabel("2:")); ...

java - Best place to store custom objects so all activities can see them -

i ios developer trying learn android , make sure following best practices. i have custom objects need accessible 1 -> m activities , need saved when application closes. using sharedpreferences, code below, save them not sure if best route. should using singleton? there better way? sharedpreferences mprefs = getpreferences(mode_private); editor prefseditor = mprefs.edit(); gson gson = new gson(); string json = gson.tojson(userprofile); prefseditor.putstring("userprofile", json); prefseditor.commit(); gson = new gson(); json = mprefs.getstring("userprofile", ""); userprofileobject outobject = gson.fromjson(json, userprofileobject.class); a singleton won't saved when application exits. options are: *sharedpreferences. small number of key/value pairs *database. relational data *file on disk, in whatever format prefer. amount of data, may need write custom parser. storing json in shared preference bit weird. not horrible l...

sorting - laravel 5.3 collection sort UTF8 strings -

folks, want sort following nested collection by string alphabeticaly : $collection = collect([ ["name"=>"maroon"], ["name"=>"zoo"], ["name"=>"ábel"], ["name"=>"élof"] ])->sortby("name"); i expect : 1=> "ábel" 2=> "élof" 3=> "maroon" 4=> "zoo" i got instead : 1=> "maroon" 2=> "zoo" 3=> "ábel" 4=> "élof" i seen php threads this, curious if there laravel workaround this. thanks. here's solid way it: $blank = array(); $collection = collect([ ["name"=>"maroon"], ["name"=>"zoo"], ["name"=>"ábel"], ["name"=>"élof"] ])->toarray(); $count = count($collection); ($x=0; $x < $count; $x++) { $blank[$x] = $collection[$x][...

system verilog - Casting to a fixed width signed number -

i reading register field uvm ral model. field 14 bit signed number, ral has no sense of sign need grab relevant bits , cast them signed number uvm_reg_data_t reg_value; int destination; reg_value = reg_field.get(); assign destination = signed'(14'(reg_value)); is there way 1 cast? know define type , use that, wondering if there syntax work: assign destination = (14's)'(reg_value); there no such syntax in single cast without typedef . do assign destination = signed'(reg_value[13:0]); but think creating typedef field type best show intent.

.htaccess - htaccess redirect using not english characters -

htaccess works without problem when i`m using english characters. when use not english characters, cant redirect , shows : not found requested url these sample code. have tasted different types nono of them works : redirect 301 "/مقاله-انواع-دسته-بندی-برج-های-خنک-کننده" /destination redirect 301 "/%d9%85%d9%82%d8%a7%d9%84%d9%87-%d8%a7%d9%86%d9%88%d8%a7%d8%b9-%d8%af%d8%b3%d8%aa%d9%87-%d8%a8%d9%86%d8%af%db%8c-%d8%a8%d8%b1%d8%ac-%d9%87%d8%a7%db%8c-%d8%ae%d9%86%da%a9-%da%a9%d9%86%d9%86%d8%af%d9%87" /destination add following line in apache configuration file: adddefaultcharset utf-8 then restart apache server. after this, may use htaccess file contains redirects utf-8 characters, , should recognized. should make sure save htaccess file in format supports utf-8.

amazon web services - Ruby on rails project deploy to server -

i have ruby on rails project. runs on pc command "rails s". decided deploy aws using capistrano. server side, using puma + nginx + mysql stack. (i following guide: https://www.sitepoint.com/deploy-your-rails-app-to-aws/ ) i got error when run "cap production deploy": tasks: top => deploy:assets:precompile (see full trace running task --trace) deploy has failed error: exception while executing deploy2@111.21.5.197: rake exit status: 1 rake stdout: rake aborted! sass::syntaxerror: invalid css after "...e bootstrap.min": expected "{", "" (sass):6648 i found out file app/assets/stylesheets/application.css causes error. in file, have 1 line: *= require bootstrap.min i think correct. because app can run on pc. if remove line, there no error when run "cap production deploy". app can deploy server , run on server. no css web pages. new ruby on rails. don't know details after these files. can suggest should in orde...

javascript - Resizing view in three.js shrinks image -

i trying create online 3d manipulation tool. have got three.js view set rotating cube , grid. when run code works 100% fine, if resize view not adjust three.js screen it. (it shrinks length or width of scene depending on how browser view changes.) causing view distorted. $(function(){ var scene = new three.scene(); var camera = new three.perspectivecamera(45, window.innerwidth / window.innerheight, .1, 500); var renderer = new three.webglrenderer(); renderer.setclearcolor(0xdddddd); renderer.setsize(window.innerwidth, window.innerheight); renderer.shadowmap.enabled = true; renderer.shadowmapsoft = true; var axis = new three.axishelper(10); scene.add(axis); var color = new three.color("rgb(255,0,0)"); var color2 = new three.color(0xd3d3d3); var grid = new three.gridhelper(50, 15, color, color2); scene.add(grid); var cubegeometry = new three.boxgeometry(5, 5, 5); var cubematerial = new three.meshlambertmaterial({color: 0...

visual studio 2015 - asp.net core 1.0 publishing to IIS 7.5 -

Image
i have created simple asp.net core 1.0 application individual user account authentication setting. if run using iis express runs fine. i following article https://docs.asp.net/en/latest/publishing/iis.html deploy application iis on browsing, below error- this added configureservices method of startup. services.configure<iisoptions>(options => { options.forwardwindowsauthentication = false; options.forwardclientcertificate = false; options.automaticauthentication = false; }); project.json { "usersecretsid": "aspnet-aspnet_core1_461_6sep-9ce5b13e-6499-42b3-bf79-944ffded008c", "dependencies": { "microsoft.netcore.app": { "version": "1.0.0", "type": "platform" }, "microsoft.applicationinsights.aspnetcore": "1.0.0", "microsoft.aspnetcore.a...