Posts

Showing posts from August, 2011

php - How to solve Submitted a post into database in Laravel 4? -

when submit question database, show error me problem? illuminate \ database \ eloquent \ massassignmentexception question e:\xampp\htdocs\laravel\vendor\laravel\framework\src\illuminate\database\eloquent\model.php // assignment model, , others ignored. if ($this->isfillable($key)) { $this->setattribute($key, $value); } elseif ($totallyguarded) { throw new massassignmentexception($key); } } you not showing error there, can guess there , getting error on model. may haven't set fillable correctly. can set model in way class user extends eloquent{ protected $table = 'users'; protected $fillable = array('firstname','lastname','address'); }

python - use a matplotlib Figure in PyQt -

programming noob here. i'm trying use matplotlib widget in pyqt4 gui. widget similar matplotlib's example qt . at point user needs click on plot, thought ginput() handle. however, doesn't work because figure doesn't have manager (see below). note similar another question never got answered. attributeerror: 'nonetype' object has no attribute 'manager' figure.show works figures managed pyplot, created pyplot.figure(). i'm assuming "normally" there's way around this. another simple script demonstrate: from __future__ import print_function matplotlib.figure import figure import numpy np import matplotlib.pyplot plt x = np.arange(0, 5, 0.1) y = np.sin(x) # figure creation plt (also given manager, although not explicitly) plt.figure() plt.plot(x,y) coords = plt.ginput() # click on axes somewhere; works print(coords) # figure creation w/o plt manualfig = figure() manualaxes = manualfig.add_subplot(111) manualaxes.plot(x,y) ma

java - Click event being fired even not clicking -

i have code fires if don't click on on page, hovering on page trigger: event.addnativepreviewhandler(new event.nativepreviewhandler() { @override public void onpreviewnativeevent(event.nativepreviewevent event) { switch (event.gettypeint()) { case event.onclick: $(".hopscotch-bubble").fadeout(new com.google.gwt.query.client.function() { @override public void f() { jsnihelper.infonotify("info", "fade out method invoked!"); } }); } } }); i not entirely sure why happens, reason? add clickhandler on root panel called when native click event fired anywhere on page. sample code: import com.google.gwt.event.dom.client.clickevent; import com.google.gwt.event.dom.client.clickhandler;

windows - How to connect to Oracle in go -

i gather there 2 ways connect oracle db in go (on windows): github.com/tgulacsi/goracle github.com/mattn/go-oci8 but of level (beginner in open source+golang), 2 methods/drivers awfully tricky. it's burden having go through of deployment, development on different machines etc. (also assuming work). is there better way connect oracle db in golang or if there not can explain me in high level view or view matter make easier? pointers appreciated. tq. if still interested, have been working go , oracle on windows few months now. favorite driver far go-oci8. faster goracle , seems more active. some of our applications need deployed on computers don't have access to. both native sql drivers compiled application without need external configuration, huge plus. computer still need oracle client installed, external dependency. i won't go-oci8 production ready yet, it's stable enough when know limitations. 1 example panics when running on multiple go

Set selected value from JSP dropdown -

i'm trying narrow down why i'm unable print or set selected value string dropdown menu i've wrapped jsp code around. i'm able display dynamic filelist dropdown options successfully, i'm unable figure out how can set selected value in order pass down dynamic jsp lists based on file selection. found few suggestions on topic i've tried out below, i'm curious if there's more being dropdown list generated dynamically? for i'm testing out println verify whether "environment" string being set after selection has been made. <select id="environment" name="environment_drop" onchange="document.productform.submit();"> <% string path = filepath + "\\config"; // directory path here string f; file folder = new file(path); file[] listoffiles = folder.listfiles(); (int = 0; < listoffiles.length; i++) {

how to create ticket using vtiger CRM web service -

i trying use docreate method in vtiger crm web services using java ws client. when have tried create faq map valuemap = new hashmap(); valuemap.put("faqstatus", "draft"); valuemap.put("question", "this ws client question"); valuemap.put("faq_answer", "this ws client answer"); jsonobject result = client.docreate("faq", valuemap); no error return in console result null.. what may issue. how resolve null. try adding element faqcategories hashmap. json representation works me: { "faqcategories" : "general", "faqstatus" : "draft", "question" : "how that?", "faq_answer" : "this how that" } without adding faqcategories , postman result creation request of new entity "malformed json"

ms access - Selected value to stay selected in Datagridview after updating in database c#? -

i have datagridview , getting of data database. did create method show data thing is, after calling method, scroll returns top dont want happen. created method purpose of showing newly added data , updating color. private void showalldata() { try { using (oledbconnection conn = new oledbconnection(globalvar.connectionstring)) using (oledbdataadapter sda = new oledbdataadapter("select * tbltest", conn)) { datatable dt = new datatable(); sda.fill(dt); datagridview1.datasource = dt; (int x = 0; x < datagridview1.rowcount; x++) { if (datagridview1.rows[x].cells["color"].value == "green") datagridview1.rows[x].defaultcellstyle.backcolor = color.green; else datagridview1.rows[x].defaultcellstyle.backcolor = color.red;

qt - what's the meaning of `QNetworkReply::ProtocolUnknownError`? -

i use object of qnetworkaccessmanager post json data website. when handle reply pointer of qnetworkreply class in slot function, value of reply->error() 301 , value of 'reply->errorstring()' error downloading http://www.example.com/query - server replied: service unavailable . i check documentation of qnetworkreply , description of error is: qnetworkreply::protocolunknownerror|301|the network access api cannot honor request because protocol not known and known error different form http status 301. and have add http:// before url. e..., can give info this?

YouTube JavaScript API - play not fired when player hidden -

i'm controlling youtube iframe player via yt api. works fine on normal cases, in process, there state when player must display:none; after show player again display:block; works fine except doesn't fire usual events. http://jsfiddle.net/wdduw/ test case: start video normal play button on player - play start event fired stop video the button below, make .stopvideo(); , hide parent element of youtube iframe. click on show button, set display:block; again start video again play control, there won't event youtube player anymore. do know way solve problem? (do not hide video's parent element not option :( ) <div> <div id="test" style="width: 300px; height: 200px;"></div> </div> <button id="stop">stop</button> <button id="show">show</button> <br /> <textarea id="console" style="height: 500px;"></textarea> js: var vars =

iphone - Convert .mov to base64 encoded string IOS -

i trying convert media files in ios app base 64 encoded strings. when convert image, see encoded string on console. nsdata *videodata = [nsdata datawithcontentsoffile:[[nsbundle mainbundle] pathforresource:@"photo" oftype:@"jpg"]]; nsstring *base64encoded = [videodata base64encodedstringwithoptions:0]; nslog(@"%@", base64encoded); but when try give .mov file, not print anything. nsdata *videodata = [nsdata datawithcontentsoffile:[[nsbundle mainbundle] pathforresource:@"movie" oftype:@"mov"]]; can please tell me doing wrong? or how can convert .mov file base64 encoded string? thanks check below link , able find solution. http://cocoadev.com/basesixtyfour

How to access the Variable in inner function PHP? -

how access variable in inner function of outer function variable? i want access $arr variable in inner function. <?php function outer() { $arr = array(); function inner($val) { global $arr; if($val > 0) { array_push($arr,$val); } } inner(0); inner(10); inner(20); print_r($arr); } outer(); codepad link this kind of "inner function" not expect. global(!) function inner() defined upon calling outer() . means, calling outer() twice results in "cannot redefine inner()" error. as @hindmost pointed out, need closures, functions can access variables of current scope. also, while normal functions cannot have local scope, closures can, because stored variables. your code closures: function outer() { $arr = array(); $inner = function($val) use (&$arr) { if($val > 0) { array_push($arr,$val); } } $inner(0); $inne

Other ways to write css to checked checkbox? -

pls help. css not functioning once uncheck/check. retains default load value. input[type="checkbox"][checked] + label{} this 1 fine but, found weird not functioning on ie input[type="checkbox"]:checked+label try below css : input[type="checkbox"]:checked { background-color: red; }

android - When I Change visibility of a linear layout and add to list all past items visibility will be changed -

i have android program simulate chat. use list , items of list in xml file named activity_chat_conversation in layout have linear layout in each of them have edittext , imageview . code: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/llmain" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:ignore="usecompounddrawables" > <linearlayout android:id="@+id/llfrom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingtop="7dp" android:visibility="gone" > <imageview android:id="@+id/imgchatconversationfrom" android:layout_width="32dp"

javascript - For Pusher.com service how can I push data to a public channel and know if any connected clients received the message successfully? -

i need make sure clients able receive messages can take action if not. there way determine that? i know webhooks concern may not bulletproof if connections drop off time i'm sending data. how sending confirmation event specific client or message id?

javascript - Angularjs access res.render variables -

i passing variable data res.render this res.render('employment/employment', { title: 'sheet | employee',username: req.session.name,datetime:result-date,time-sheet:time-sheet}); the above first render. , in angularjs have route this $routeprovider .when('/employeetimesheet',{ controller:'mainctrl', templateurl:'/partials/employeetimesheet.html' }) .when('/employeelogin',{ controller:'mainctrl', templateurl:'/employeedashboard' }) .otherwise({redirectto:'/employeelogin'}); }); so redirects employeelogin. here have partial , route on expressjs app.get('/employeedashboard', function(req, res){ res.render('employelogin/employeedashboard'); }); here problem partial keeps on loading..many times , need pass data 1 render render.

Get responsive html blocks with css -

Image
i need display 3 simple text html blocks in 3 columns such image, need responsive behaviour i need behaviour responsive, running one... teach me css code responsive behaviour? thank in advanced! <p><strong>cartelera</strong></p> <table border="0"> <tbody> <tr> <td> <p>pelicula1<br />nombre1<br />dirextor1<br />españa</p> </td> <td>pelicula2<br />nombre2<br />dirextor2<br />españa</td> </tr> </tbody> </table> generally should post code here , give it. site isn't teaching resource. that said, give point in right direction. use bootstrap it's pre-built responsive framework. if want have go @ doing yourself, @ code starting point. <div id="container"> <ul class="section"> <li>item 1</li> <li>item 2</li> <li>i

jquery - ie8 addClass and removeClass not working, jQuery1900969595128946837 added to the div instead of class -

i have footer slide if bottom of page reached, , if element clicked. works adding / removing class active / footer. but not work in ie8. class not assigned, , whenever bottom of page reached, goes , down, if has been clicked twice. the class gets assigned if page @ bottom, , page refreshed automatically @ bottom on page refresh. class never gets removed. again, bottom line adding / removing class not working in ie8 in case. my code: $(window).scroll(function() { if($(window).scrolltop() + $(window).height() == $(document).height()) { $('.footer .open').click(); } }); $('.footer').click(function(){ if($(this).hasclass('active')){ $('.footer').removeclass('active'); $('#page-footer').slideup(); }else{ $(this).addclass('active'); $('#page-footer').slidedown(); } }); edit: i noticed added footer div in ie8. jquery1900969595128946837 instead of cl

android - Proguard Returned With Error Code 1 Without Any Specific Information -

i have problem proguard, have tried many possible solutions still not solve problem. the information console is proguard returned error code 1. see console nothing more, bad error message ever met. i have set proguard.config=proguard-project.txt and nothing in proguard-project.txt believe couple of comments. # enable proguard in project, edit project.properties # define proguard.config property described in file. # # add project specific proguard rules here. # default, flags in file appended flags specified # in ${sdk.dir}/tools/proguard/proguard-android.txt # can edit include path , order changing proguard # include property in project.properties. # # more details, see # http://developer.android.com/guide/developing/tools/proguard.html # add project specific keep options here: # if project uses webview js, uncomment following # , specify qualified class name javascript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # publ

Magento pre-order enterprise version -

i give facility purchase 'out of stock' products. have enabled system->configuration-> inventory->display out of stock products 'yes' system->configuration-> inventory->backorders set 'allo qty below 0' cleared cache , rebuild indexing. still can't see 'add cart' button when taking out of stock product. front end product page shows message 'availability: out of stock' please advice. magento enterprise version 1.11.2.0 you need magento’s order capabilities. back order – business order yet fulfilled because stock unavailable. to enable backorders, go to: admin panel -> system -> configuration -> catalog tab -> inventory -> product stock options -> backorders = allow qty below 0 , notify customer now in product -> inventory tab edit product qty = 0 and stock availability = in stock when add particular product cart, product added cart , see following message

load testing - Can SAP BO Object Application be recorded using Web Performance Test (VS 2012)? -

i tried recording using bi launch pad getting "an error occurred while retrieving document storage token. (error: rwi 00313) (error: inf )",_err_report, okcb sap bo object application version of 4.1 version , above error fixed in version 4.1 still getting same error? after increasing stack_size limit , maximum document per user limit in sap bi application in doubt whether visual studio support web testing of sap bo objects? have tried set values wid_faiapplover_size = 20, wid_storage_token_stack_size = 0 in "webi.properties" file @ webappserver ? try article: https://bosap-support.wdf.sap.corp/sap/support/notes/1200359

php - Wordpress WPML, Custom post type multiple languages - that aren't switched on -

have multilingual wordpress website using wpml, running in 5 specific languages ( english, english us, spanish, german, french). we have custom post type need able convert several more languages. premise being have drop down on post saying "view post in : brazilian, " etc. googling & searching has found no solution, want able keep header / footer in english (or current wpml language) , switch custom post types content . any appreciated , if needs clarifying please ask. please note not brazilian, it's portuguese.

Python - split string and return int -

x='2013:02:01' y,m,d=x.split(':') produces y,m,d strings. how produce them ints using 1 line failed: y,m,d=int(y.split(':')) y,m,d=int(y),int(m),int(d)=y.split(':') y, m, d = map(int, x.split(':')) map applies function each of elements in iterable. in case apply int each of values returned split , give result.

sql - Convert Variable varchar2 to number or vice versa | ORA-01722: invalid number -

this question has answer here: check if “it's number” function in oracle 15 answers i'm migrating column 1 sql table update command. while updating below query, ora-01722: invalid number error . issue pid field in project table has varchar2 datatype , xproject_id in docmeta table has number data type. options have migrate data now. begin x in(select projecttype,pid project) loop update docmeta d set d.xprojecttype=x.projecttype d.xproject_id=x.pid , x.projecttype not null; end loop; end; you can catch exception: begin x in (select projecttype ,pid project procecttype not null) loop begin update docmeta d set d.xprojecttype = x.projecttype d.xproject_id = x.pid; exception when others if sqlcode = -1722

c# - How to change DataTable type? -

how clone datatable , change column , row type decimal ? private static datatable getdatatabletfromcsvfile(string csv_file_path) { datatable csvdata = new datatable(); using (textfieldparser csvreader = new textfieldparser(csv_file_path)) { csvreader.setdelimiters(new string[] { "," }); csvreader.hasfieldsenclosedinquotes = true; string[] colfields = csvreader.readfields(); foreach (string column in colfields) { datacolumn datecolumn = new datacolumn(column); datecolumn.allowdbnull = true; csvdata.columns.add(datecolumn); ; } while (!csvreader.endofdata) { string[] fielddata = csvreader.readfields(); //making empty value null (int = 0; < fielddata.length; i++) { if (fielddata[i] == "") { fielddata[i] = null; }

PHP Simple DOM Parser extract single value from two url -

i use dom parser grab text 2 html documents same li class , retrieved double value. <?php include_once('simple_html_dom.php'); $links = array ( "model_one" => "car.html", "model_two" => "car/edition.html" ); foreach ($links $key=>$link) { $html = file_get_html($link); $ret[] = $html->find('ul li[class=dotcar]',0)->plaintext; $pattern = '/.\d+(?:\.\d{2})?((?<=[0-9])(?= usd))/'; preg_match_all($pattern, $ret[0], $result); $price = array(); foreach($result[0] $k=>$v) { $price[] = $v; echo $price[0]; } } // $price[0]= 10.55 11 ?> how can associate model_key $links array value $price obtain result: model_one 10.55 model_two 11.00 in way can retrieve single value insert in mysql table. perhaps this: foreach($result $k=>$v) { //$v price (10.55 etc.) foreach($links $kk=>

java - Understand openDeclarartion functionality (f3). How can I debug the openDeclaration in eclipse -

i'm trying add opendeclaration function own eclipse plugin editor. until didn't understand how f3 functionality works (i read hyperlinking, openaction , , compilationunit.finddeclaringnode() ), cannot put pieces , understand how work. until thought works this: while parsing code, tokens read added ast. hierarchy level ijavaproject/ipackagefragmentroot/ipackagefragment/icompilationunit/{itype / ifield / imethod} jdt possible work ast. each java file represented compilation unit. if press f3, actionhandler started takes ijavaelement hover in moment. right have ijavaelement in editor plugin don't know how jump corresponding type/method associated declaration in compilation unit. , don't know happen if declaring node not in same compilation unit, if it's basic type (such string or integer). maybe if if more clear, follow way how default java editor doing task. how pieces or how can debug functionality?

php - laravel textbox disabled field mandetory -

my textbox code <tr valign="top"> <td>{{ form::label('city', 'city:') }}</td> <td colspan="3"> {{ form::text('city', 'united states', array('class' => 'field','disabled')) }} @if($errors->first('city'))<br/><span class="error">{{ $errors->first('city') }}</span>@endif </td> </tr> model profile.php public static $rules = array( 'first_name' => 'required|max:32', 'city' => 'required|max:1', ); already city fields have value united states , still validation showing "the city field required." , mistake did here.. frnds.. you disabled form field on front side only! attribute disabled on input element tells user cannot edit or change value. check rules public static $rules = array( 'first_name' => 'required|max:

c# - UserManager.CreateAsync(user, password) stuck in infinite loop -

i'm trying make simple implementation of iuserstore essentially: use nhibernate save users in single table (no claims/logins) store role names in same table, in nvarchar column (pipe ( '|' ) separated if multiple items). when run following method: [fact] public void create_a_user() { // _session valid nhibernate isession object using (var userstore = new simpleuserstore<simpleidentityuser>(_session)) using (var usermanager = new usermanager<simpleidentityuser>(userstore)) { var user = new simpleidentityuser { username = "kenny_mccormick", rolesstr = "admin", }; var createtask = usermanager.createasync(user, "the_password"); var result = createtask.result; // never finishes... } } the last line never finish executing. the weird thing usermanager never calls of functions in simpleuserstore ; gets stuck before that. here compone

asp.net web api advanced routing -

can 1 please me route trying setup i have know if can , how go configuring route list so localhost/api/device/1/commands/turnon {hostname}/{api section}{i multiple types of devices diiferent commands} so examples: localhost/api/device/1/commands/turnoff localhost/api/device/1/commands/turnon localhost/api/device/1/info/ (will return info on device) localhost/api/device/1/info/name (will return name of device) localhost/api/device/1/commands/display/1 (will display 1 on device) the above random examples of things want do. but underlying structure correct. want have multiple devices device specific commands , options i don't know how portray in controller? think along long of controller each device under device have different sections command, info ,etc under each 1 of woudl have action methods. but dont know how that. any apperecited: also better practice: [httpget] public httpstatuscode arm() { return httpstatuscode.ok;

android - MediaCodec signalEndOfInputStream() error -

i'm trying use live camera recording ( opengl ) sample code grafika. every things works fine on moto g try in other device (galaxy tab 2 cyanogendmod 11) it's seems method : signalendofinputstream() not working , encoder never stop. it's there way send signal mediacodec in other way ? sorry bad english. you can work around it. if @ decodeeditencodetest , can see mysterious boolean called work_around_bugs . it's used this: if (work_around_bugs) { // might drop frame, @ least won't crash mediaserver. try { thread.sleep(500); } catch (interruptedexception ie) {} outputdone = true; } else { encoder.signalendofinputstream(); } this used during development of cts tests, when vendor-specific code wasn't yet working end-of-stream signal. added exercise other features while vendors worked on patches. flag disabled before tests shipped in 4.3. you're running unpatched codecs on cyanogen. the workaround never send end-of-strea

c# savefiledialog lock to particular directory? -

this question has answer here: c# savefiledialog in specific folder 3 answers how save files particular directory using savefiledialog in c#. path user should not change directory when savefile dialog opened. there no direct way (a property keepsamefolder=true example). option write event handler fileok event , cancel click on save button if folder not 1 like. cancelling event doesnt't close savefiledialog , user fix error // declare @ global class level string allowedpath = @"c:\temp"; private void openfiledialog1_fileok(object sender, canceleventargs e) { if (!path.getdirectoryname(openfiledialog1.filename) == allowedpath ) { messagebox.show("you should save file in or sub folder of: " + allowedpath); e.cancel = true; } } edit: following comment of mr hofman , if allow subfolder of

android - How to pass my menu.xml to Sherlock actionBar in NAVIGATION_MODE_LIST -

i create actionbar library sherlock. work fine, i'll insert dropdownlist menu top of bar. examples construct drop down menu string array: /** array of strings populate dropdown list */ string[] actions = new string[] { "bookmark", "subscribe", "share" }; arrayadapter<string> adapter = new arrayadapter<string>(getbasecontext(), r.layout.sherlock_spinner_item, actions); i would: arrayadapter<string> adapter = new arrayadapter<string>(getbasecontext(), r.layout.sherlock_spinner_item, r.menu.list_news); where r.menu.list_news: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/classifica" android:title="@string/classifica" android:showasaction="withtext" /> <item android:id="@+id/next_match" android:tit

python - OpenERP - NotImplementedError on evaluating result of object.browse(...) -

i'm browsing records, perform specific code if browsing return results. here code : sub = self.pool.get('subscription.subscription').search(cr,uid,[('partner_id','=',partner.id),('active','=',true)]) if sub: mtp.send_mail(cr, uid, level.email_template_id.id, partner.id, context=ctx) but not work, when evaluating if condition, exception raised : notimplementederror: iteration not allowed on browse_record(res.partner, 15918) i don't understand, because i'm not iterating on result checking if result exist, neither calling __iter__ method. thank help cheers in general cases problem invoking browse method 1 id, not list of ids, return value 1 record, not list of records, not iterable.

android - How can I launch fragment in broadcast receiver -

how can use broadcast receiver start/lunch fragment example : if need start/luanch activity , can use intent : public void onreceive(final context context, intent intent) { this.context = context; this.intent = intent; try { bundle bundle = intent.getextras(); int messageid = bundle.getint("id"); intent = new intent(context, getalarm.class); intent.putextra("id",messageid); intent.setflags(intent.flag_activity_new_task); context.startactivity(intent); } catch (exception e) { toast.maketext(context, "there error ", toast.length_short) .show(); e.printstacktrace(); } } but don't know how fragment you must luanch intent , putextera , sendactivity . can launch fragment activity.

c# - Equals sign magically appears in message sending to pager -

i sending mail email address forwards messages pager. message sending is "oth info; thankyou testing complete aware 34a door open , shut when pager messages sent cfsres lt1". but client receives on pager as "oth info; thankyou testing complete aware 34a door op= en , shut when pager messages sent cfsres lt1". does know why equals sign shows in open changed op= en . know special characters may times changed, spaces can become %20 , open not contain special character, far know, nothing should happen it. this sign of quoted-printable encoding qp works using equals sign "=" escape character. limits line length 76, software has limits on line length. so may try split message multiple lines in attempt prevent escape characters being added forwarder.

IE8 shows standard error page instead of declared one in Spring Security -

i have configured spring security show custom error page during authorisation process. works fine in firefox, opera , chrome not in ie8. browser shows default page 403 http code instead of defined 1 in spring config file. make use of preauthenticated scenario time check user privileges, or authenitcated , make decision whether permit him/her access requested url. here configuration of web.xml <filter> <filter-name>filterchainproxy</filter-name> <filter-class>org.springframework.web.filter.delegatingfilterproxy</filter-class> </filter> <filter-mapping> <filter-name>filterchainproxy</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <login-config> <auth-method>basic</auth-method> <realm-name>testing realm</realm-name> </login-config> <security-role> <role-name>*</role-name> </security-role> <security-cons

javascript - Sails.js 0.10 generators -

the upcoming sails.js 0.10 features custom generators. (at time of writing @ rc4) there's migration page on sails github describing how wonderful generators are, not how go installing them own application. a few interesting custom generators start pop up: sails-generate-auth sails-generate-gulp-bower the first 1 available on npm. matter of npm install , generator available in app right away. i wanted try out second 1 replace grunt gulp , couldn't install generator. can explain how install custom generator , hook sails.js app? you can install sails-generator other npm package: npm install sails-generate-auth the problem sails-generate-gulp-bower hasn't been released npm yet. can trick npm using following url install latest version of anyway. npm install https://github.com/paulavery/sails-generate-gulp-bower/archive/master.tar.gz --save but keep in mind author has reason why didn't release it.

javascript - How to stop screen from moving up? -

i working on dashboard using highcharts library, when click on chart screen moves up. using example code can found here : $(function () { $('#container').highcharts({ chart: { plotbackgroundcolor: null, plotborderwidth: null, plotshadow: false }, title: { text: 'browser market shares @ specific website, 2010' }, tooltip: { pointformat: '{series.name}: <b>{point.percentage:.1f}%</b>' }, plotoptions: { pie: { allowpointselect: true, cursor: 'pointer', datalabels: { enabled: true, color: '#000000', connectorcolor: '#000000', format: '<b>{point.name}</b>: {point.percentage:.1f} %' } } }, series: [{ type: 'pie', name: 'browser share', data: [ ['firefo

bit - VHDL: std_logic_vector Leftshift and right shift operator? -

how peform rightshift or left shift in vhdl on std_logic_vector... it not work , why??` an <= "0001"; counterprocess: process(clk,switch) begin if rising_edge(clk) if prescaler < limit prescaler <= prescaler + 1; else prescaler <= (others => '0'); counter <= counter + 1; sll 1; end if; end if; end process; <= anode; segment <= counter; end behavioral; i error message: sll can not have such operands in context. in context can used in, , how can perform left shift? these includes: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; isn't 1 needed perform leftshift operations included?? complete code entity main port( clk: in std_logic; led: out std_logic_vector (7 downto 0); switch: in

Android Eclipse - How to share an assets folder? -

i have number of different android applications building in eclipse / adt share common code , assets. sharing common source code folder easy can use link source in build path set-up. works great. these programs share content that's in assets folder. @ moment i'm duplicating, bit inelegant , error-prone. is trivially possible tell eclipse / adt use common assets folder in similar way trivial have share source code folder? can't find similar option or tool. notes: i not looking 'library' solution (indeed seems fraught issues anyway, , did try , hit issues this one). in case that's less relevant assets, , i'm looking simplicity . it doesn't matter if shared assets folder has contain superset of needs of applications. assets. not "resources". i'm using adt version 22.2 for many complex reasons, symbolically linking folders not suffice. (you not want know details. you'd never believe them anyway.) s

javascript - Accessing all inner elements in Polymer? -

i have: <k-myelement> <k-anotherelement></k-anotherelement> </k-myelement> when define template this: <polymer-element name="k-myelement"> <template> <content select="k-anotherelement" id="anotherelement"></content> </template> </polymere-element> i can access inner element this.$['anotherelement'] but approach have predefine, inner elements can used. what want template technique, allows me access inner elements. <content> ( insertion points ) rendering elements in light dom @ specific locations in shadow dom. using <content select="k-anotherelement"></content> says "render <k-anotherelement> elements here. if want light dom nodes invited rendering party, use <content></<content> . the other issues snippet: the name of element needs defined on <polymer-element> , not <templat

MYSQL: Cannot add foreign key constraint -

i've read many of questions talk problem none seem solve mine. basically, receive following error: error code: 1215. cannot add foreign key constraint when trying execute following query: create table if not exists privacy ( biography varchar(20), birthdate varchar(20), email varchar(20), location varchar(20), realname varchar(20), sex varchar(6), user varchar(255), primary key (user), foreign key (user) references users(username) on delete set null on update cascade ) character set utf8; i thought couldn't have primary key , foreign on same column, made searches , found out it's fine. maybe i'm doing in wrong way. edit: this users table: create table if not exists users (" avatar varchar(255), biography text, birth_date date, email varchar(255), location varchar(255), password varchar(20), profile_views int(11), real_name varchar(255), reputation int(11), signup_dat

node.js - Express logging with storing the request information -

background yes, there lot of different node.js logging library winston, bunyan , console.log. it's easy log down information of specific request when has called , when , information in response. the problem the problem begins sub function calls. when under 1 request calling multiple functions uses same logging, how pass request meta - data these log calls (function parameters seems 1 possible way these messy) ? example small visual coders: // middleware set request based information app.use(function (req, res, next) { req.rid = 'random generated request id tracking sub queries'; }); app.get('/', function (req, rest) { async.series({ 'users': async.apply(db.users.find), 'posts': async.apply(db.posts.find), }, function (err, dbres) { console.log('api call made ', req.rid) res.end(dbres); }); }); // database functions in other file need track down request id in there (db.js) module.exports = {

matlab - ArrayFun with multiple input -

i have problem while using arrayfun in matlab. have vector of angles , want avoid for loop , apply: rmatrix1 = arrayfun(... @(x) anglesloop(iblade, iradius, jradius, ifrequency, x, rot), ... angles, 'uniformoutput', false); where iblade = 1 , iradius = 1 , jradius = 1 , ifrequency = 1 , rot = 0.5 . the function looks like: %% angles loop function rmatrix = anglesloop(iblade, iradius, jradius, ifrequency, angles, rot) global frequency blade fshifted =(frequency(ifrequency)-angles*rot); s11 = kaimal(fshifted); s22 = s11; r = distance(iradius,jradius,angles); aux = (3/(2*pi)).*coherence(r).*exp(-1i*angles*ifrequency*blade(iblade)/3); rmatrix = (sqrt(s11).*sqrt(s22).*aux.*exp(1i*2*pi.*angles.*1/3)); end with subfunctions %% distance coherence function function r=distance(x1,x2,theta) r = sqrt(x1^2+x2^2- 2*x1*x2*cos(theta)); end and %% coherence function gamma=coherence(r) global frequency v10 l1 if r==0 gamma=1; el