Posts

Showing posts from April, 2012

laravel 4 - Mass assignment enter value in guarded field -

laravel 4 - Mass assignment enter value in guarded field - is possible fill guarded field ::create method elequent models, if user model so: $guarded=['password','id'] $fillable=['username'] is possible this? user::create(['username'=>'mynewusername','password'=hash::make($password)]) no - cannot that. but this $user = user::create(['username'=>'mynewusername']); $user->password = hash::make($password); $user->save(); laravel-4 eloquent scoped-mass-assigment

php - Creating exceptions when comparing a variable to a string? -

php - Creating exceptions when comparing a variable to a string? - the php code excerpt below triggers "call price" select manufacturers on our magento site. so, how "exclude" select products these vendors? instance, within our manufacturer "xmarks" there 10 products not want show "call price" instead sale price, list cost & add together cart button. how do this? i'm finish beginner. give thanks you! <p class="special-price"> <span class="price-label"><?php echo $this->__('special price:') ?></span> <span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getidsuffix() ?>"> <?php if($manufacturername == 'xmarks' || $manufacturername == 'maxtor' || $manufacturername == 'trixfx' || $manufacturername == "oouph" || $manufacturername == "groffer" || $manufacturername == &quo

Running MySQL query from Python 2.4 while not installing modules (MySQLdb) -

Running MySQL query from Python 2.4 while not installing modules (MySQLdb) - i need run mysql query python 2.4 cannot download/install modules python. the reason cannot download because script run on servers (redhat) , our customers not allow download , install anything. i've been trying utilize subprocess , query i'm using giving me syntax error . the query works outside of python if run query browser, adding quotes , commas within subprocess command [] makes things little confusing. the command i'm trying run follows: subprocess.call(['mysql', '-d db', '--user="user"', '--password="password"', '-e', '"select cu, control_name presetprofile not cu='' , not control_name='' outfile '/directory/for/output.file' fields terminated ':' lines terminated '\n';"', shell=true]) the syntax error points single quote before : after fields terminat

apache - Redirecting multiple old pages to new pages -

apache - Redirecting multiple old pages to new pages - i'm changing construction of pages , need re-direct old ones new pages. here illustration of of next pages need move, in pages folder needs moved down, old pages showed php extension. www.example.com/pages/index.php www.example.com/index www.example.com/pages/contact_us.php www.example.com/contact_us here have far options +followsymlinks -multiviews rewriteengine on rewriterule ^pages/(.*)$ /$1 [l,r=301] edit the rewrite above works makes pages such example.com/contact_us unusable, have set extension .php @ end, not problem had prior rule you can utilize code in document_root/.htaccess file: rewriteengine on rewritebase / rewritecond %{the_request} \s/+pages/(.+?)\.php[\s?] [nc] rewriterule ^ /%1 [r=302,l,ne] rewritecond %{request_filename} !-d rewritecond %{document_root}/pages/$1\.php -f [nc] rewriterule ^(.+?)/?$ pages/$1.php [l] apache .htaccess mod-rewrite

sql - How to delete a record along with all related records in ASP.NET (C#) -

sql - How to delete a record along with all related records in ASP.NET (C#) - i have code delete photographer table, however, photographer_id foreign key table 'images', , when delete photographer want delete images in 'images' table photographer deleting. how do that? ... else if (e.commandname == "slet") { sqlconnection conn = new sqlconnection(); conn.connectionstring = configurationmanager.connectionstrings["databaseconnectionstring1"].tostring(); sqlcommand cmd = new sqlcommand(); cmd.connection = conn; cmd.commandtext = "delete photographers photographer_id = @photographer_id"; cmd.parameters.add("@photographer_id", sqldbtype.int).value = e.commandargument.tostring(); conn.open(); cmd.executenonquery(); conn.close(); repeater1.databind(); } this images table : create table [dbo].[images] ( [image_id] int identity (1, 1) not null, [image] nvarchar (50

sonarqube - Soaarqube upgrade from 3.7.2 to 4.4. Hung during db upgrade -

sonarqube - Soaarqube upgrade from 3.7.2 to 4.4. Hung during db upgrade - i upgrading sonarqube 3.7.2 4.4. db migration taking more 2 hours on "mergemeasuredataintoprojectmeasures". here log. 2014.10.07 23:31:27 info [dbmigration] 2014.10.07 23:31:27 info [dbmigration] == removeactivedashboardslinkedonunshareddashboards: migrating =============== 2014.10.07 23:31:27 info [dbmigration] == removeactivedashboardslinkedonunshareddashboards: migrated (0.0320s) ====== 2014.10.07 23:31:27 info [dbmigration] 2014.10.07 23:31:27 info [dbmigration] == mergemeasuredataintoprojectmeasures: migrating ============================ 2014.10.07 23:31:27 info [dbmigration] -- add_column(:project_measures, "measure_data", :binary, {:null=>true}) 2014.10.07 23:31:27 info [dbmigration] -> 0.0080s 2014.10.07 23:31:27 info [dbmigration] -> 0 rows please allow me know solution, if had faced similar issue. thanks vimal thanks quick reply

google spreadsheet - Create in-cell dropdown with filtered range -

google spreadsheet - Create in-cell dropdown with filtered range - i'm using google spreadsheet. to illustrate problem, utilize range a2:a8 info validation of d2 , e2 . but because in cell d2 , supposed select animal only, i'd filter range b2:b8 . what i've tried, using own formula : =filter(a2:a8;is("b2:b8";"animal")) but won't work , cannot pick "dropdown" alternative if utilize custom formula. i've tried formula in range selection, it's not valid. right formula utilize have dropdown filtered data? any thoughts? as stands, in google sheets, way natively (that is, without resorting google apps script) populate drop-down lists utilize comma-separated list, or reference range. in case need reproduce filtered list somewhere in spreadsheet (could on hidden sheet): =filter(a2:a8;b2:b8="animal") and reference range of output in info validation. the ability utilize formula generate

javascript - Remove HTML Elements from JQuery AJAX load() Response -

javascript - Remove HTML Elements from JQuery AJAX load() Response - is there possibility remove specific html elements ajax (load) response before placing in container? in case want remove "#containertop", including content, response. response (html): <html> <head></head> <body> <div id="containermain"> <div>...</div> <div id="containertop">content-to-remove-including-container-div...</div> </div> </body> </html> i've tried this, without success. <div id="middle"></div> <script> $( "#middle" ).load( "http://<url>", function(response, status, xhr){ $response.remove('#containertop'); }); </script> any ideas? .load() inserts content straight you. not give chance modify before inserted. such have 2 options: you can modify content after inserted, b

javascript - Trying to run a function after a promise fail in array -

javascript - Trying to run a function after a promise fail in array - i have array of promises , function need phone call after promises complete. however, whenever single promise fails out of array, $q.all(promise) not launch callback function. function searchlibraries(library) { //console.log(library); console.log('inside searchlibraries'); var librarycount = library.length; (var = 0; < librarycount; i++) { //console.log(i,library[i].siteurl,library[i].listid,library[i].listname) itempromise[i] = $().spservices({ operation: "getlistitems", weburl: library[i].siteurl, listname: library[i].listid, camlviewfields: cviewfieldslimited, camlquery: cqueryallcheckedoutdocuments, camlqueryoptions: cqueryoptions, cachexml:true, completefunc: function (xdata,status){ if($(xdata).hassperror()){

Solr indexing multi value fields -

Solr indexing multi value fields - i'm starting larn solr , i'm trying model info prices of products in different bundles. e.g. product { allprices: { 12, 13, 14 } bundles: {bundle_1, bundle_2, bundle_3} price: ???? } i left price field because how initialy faceted search worked. there 1 cost value indexed , used filtering. i have products page have dropdown of bundles can select. depending on bundle select corresponding cost needs shown. how cand model behavior create possible have faceted search , utilize solr ranges . i recommend take @ block bring together approach in solr. work needs. model product parent document, , 3 bundles kid products. each have it's own price, show easily. problem here is, solr still don't have kid level facet, need implement on own. also, solr couldn't sort docs children fields, need create aggregation i recommend article start - http://blog.griddynamics.com/2013/09/solr-block-join-support.html

Connection problems from a netty client in Android -

Connection problems from a netty client in Android - i using netty server in linux 1 netty client in android. (netty 4.0.23). works perfect of time. however, sometimes, client not able connect server. the channelfuture received when trying connect tells me connection done not success (with cause not null) completed failure. failure received java.net.socketexception - ehostunreach error (no route host). i quite sure problem not in server. important: i run server , client in same lan wifi network local ip addresses. i have tested in 2 different wifi networks. in 1 of them, reported error occurs , in other occurs quite often. connect_timeout_millis configured plenty time in both contexts i attach way connection client: class="snippet-code-html lang-html prettyprint-override"> ............. final channelfuture futureconnection = bootstrap.connect(host, port); futureconnection.awaituninterruptibly(); if (futureconnection.isdone()){ if (fut

php - CakePHP: validation of form upload field if file exists not working -

php - CakePHP: validation of form upload field if file exists not working - cakephp 2.x: struggling validating image upload field in form adding users. upload field not manditory. validates field false while image uploaded. seems whole validation working partially. help appreciated user.php model : public $validate = array( 'picture' => array( 'required' => false, 'allowempty' => true, 'custom' => array( 'rule' => array('imageexist'), 'message' => 'there image name on server' ) )); // function check if file exists public function imageexist($check) { $picturename = $check['picture']; $path = www_root . 'userimages/'; $file = $path . $picturename; if (file_exists($file)) { homecoming false; } else { homecoming true; } } add.ctp: <?php echo $this->form->crea

java - Controlling usb device from a website. -

java - Controlling usb device from a website. - hey guys have question has been asked 1000000 times have little twist can not seam find. i building pos scheme web based. need able open cash drawer. know can not command usb device web site im thinking work if utilize microsoft visual basic , utilize web browser built in programme how utilize event listener wait button hey time open cash drawer. way button passing action programme program installed on customers computer trigger usb port open cash drawer? java javascript php visual-studio usb

javascript - Bootstrap Drop Down Menu Collapsing Before Link Can Be Clicked On Mobile Devices -

javascript - Bootstrap Drop Down Menu Collapsing Before Link Can Be Clicked On Mobile Devices - this problem persist in screen width less 990 using startup framework built on bootstrap have drop downwards menu in navigation bar. works on desktop versions of site on mobile versions when drop downwards menu clicked drops shows links collapses again. makes impossible navigate website mobile device. the link navbar here this html navigation <div class="collapse navbar-collapse pull-right"> <ul class="nav pull-left"> <?php $pages = array( "home" => "home", "about" => "about" ); $p = (isset($_get['p'])) ? $_get['p'] : ""; foreach ($pages $url => $label) { ?> <li><a <?= $p == $url ? 'class="active"' : ""?> href="index.php?p=<?=$url?>

mysql - PHP bind_result and fetch multiple rows (array) -

mysql - PHP bind_result and fetch multiple rows (array) - i'm new php , mysql. i'm trying create rest api php, , because server doesn't have mysqlnd installed, have utilize bind_result , fetch . $stmt = $this->conn->prepare("select * d d.id = ?"); $stmt->bind_param("i", 1); if($stmt->execute()){ $stmt->bind_result($a, $b, $c); $detail = array(); while($stmt->fetch()){ $detail["a"] = $a; $detail["b"] = $b; $detail["c"] = $c; } $stmt->close(); homecoming $response; } else { homecoming null; } above code works can homecoming 1 line of info @ time. for illustration if statement return: a b c 1 test test 1 test1 test1 it returns a: 1 b: test1 c: test1 where supposed be: { a: 1 b: test c: test }, { a: 1 b: test1 c: test1 } you're overwritting them, instead: $detail

Need help in Drools Guvnor changeset -

Need help in Drools Guvnor changeset - i m new drools rule engine , guvnor. have written basic rules in drl file , works fine standalone application. in order add together / update rules @ runtime have deployed guvnor on tomcat 7.0.21. via ui, have imported drl file , required pojo model jar. created new changeset via guvnor , added imported rules through assets. final xml construction formed below <change-set xmlns='http://drools.org/drools-5.0/change-set' xmlns:xs='http://www.w3.org/2001/xmlschema-instance' xs:schemalocation='http://drools.org/drools-5.0/change-set http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd'> <add> <resource source='http://localhost:8080/guvnor-webapp-drools-5.5.0.final/rest/packages/com/assets/rule1/source' type='drl' basicauthentication="enabled" username="admin" password="admin"/>

c# - Multithread adding nodes to LinkedList? -

c# - Multithread adding nodes to LinkedList? - for illustration have var linkedlist = new linkedlist<int>(); then add together 1 node. linkedlist.addlast(1); after have 2 threads respectively calling linkedlist.addlast(2); (same statement). so can safely expect becomes 1->2->2 linked list? or can become 1->2 when race status happens? (maybe has visibility issue, before firstly wonder if such race status can happen.) this question can answered quick little test app. reply 1->2 happen sometimes. private static void runtest() { (int = 0; < 100; i++) { var lst = new linkedlist<int>(); parallel.for(1, 51, j => { lst.addlast(j); }); if (lst.count < 50) { console.writeline(lst.count); } } } as has been mentioned, collection not thread-safe. need serialize access or utilize built-in thread-safe collection. c# .net

database - Excluding tables from flyway:clean -

database - Excluding tables from flyway:clean - i looking way create table, manually added , not managed flyway impossible drop when flyway:clean executed. i looking solutions , think somehow related issue http://docs.oracle.com/cd/b12037_01/server.101/b10759/statements_9015.htm prefer have solution within flyway tool. ideas appreciated. this not supported. database flyway

Pause and resume a running script in Python 3.42 in Windows -

Pause and resume a running script in Python 3.42 in Windows - i'm new python , have been googling couple of days , read can find on forum. might don't understand haven't found solution problem yet. inquire forgiveness if there's reply problem, haven't understood it. i want create pause function programme tennismatch. programme when it's beingness run print score of lawn tennis match this: "15-0, 15-15 etc ongoing till match ends. print score line line. i want user able pause after x number of balls, games, etc. don't know when user wants pause , after user has paused want user able resume tennismatch was. have seen time.sleep() have understood must know when want pause utilize , ain't indefinetie pause want. input() it's same. am going create gui later on when code finished. happy leads me solving problem. i utilize windows , python 3.42 , run programme in shell. a piece of code (haven't written yet, it's more

java - Make a Login Activity in Android using my own API -

java - Make a Login Activity in Android using my own API - i've done api , want utilize android. first of want create login , access mainactivity don't know how utilize api check if info introduced in android login right compared 1 i've stored. how can access info i've stored in database through api? for example, i've method called getuser in api returns user , it's running in local tomcat. i'd access method android through server , user , compare 1 introduced in android login. for i've next in login activity: public class loginactivity extends activity { private final static string tag = loginactivity.class.getname(); private button btnlogin; private edittext inputusername; private edittext inputpassword; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.login_layout); inputusername = (edittext) findviewbyid(r.id.e

c# - How to change the CheckBox and CheckBox tick's color in LongListMultiSelector? WP8 -

c# - How to change the CheckBox and CheckBox tick's color in LongListMultiSelector? WP8 - is possible alter checkbox , checkbox tick's color in longlistmultiselector. i've tried george nikolaides solution not able approach needed. there other way this? please can explain in little bit more detail? if it's possible. in advance, next george nikolaides solution: can alter checkbox color in longlistmultiselector? wp8 remember have xmlns:toolkit , xmlns:toolkitprimitives defined so: class="lang-xaml prettyprint-override"> <phone:phoneapplicationpage xmlns:toolkit="clr-namespace:microsoft.phone.controls;assembly=microsoft.phone.controls.toolkit" xmlns:toolkitprimitives="clr-namespace:microsoft.phone.controls.primitives;assembly=microsoft.phone.controls.toolkit"> then re-create entire mess <phone:phoneapplicationpage.resources> <style x:key="phonebuttonbase" targettype="but

java - How to add Material Design on my app -

java - How to add Material Design on my app - i have big problem. eclipse (i have latest api , sdk of android 5.0) trying transform app material design. problem eclipse seems unable recognize code. i'll seek detailed: principal code: main activity.java public class mainactivity extends activity implements onclicklistener { private final static string radio_station_url = "http://178.32.137.180:8665/stream"; private progressbar playseekbar; private button buttonplay; private button buttonstopplay; private mediaplayer player; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); initializeuielements(); initializemediaplayer(); } private void initializeuielements() { playseekbar = (progressbar) findviewbyid(r.id.progressbar1); playseekbar.setmax(100); playseekbar.setvisibility(view.invisible); buttonp

mysql - Comparison Query For Last 1000 Records -

mysql - Comparison Query For Last 1000 Records - i'm looking compare users in database based on lastly 1000 actions. basic construction of query follows: select p.id, p2.id, round(avg(1000 + abs(p2.ss - p.ss)/6.1 * -50)) sim_score (select * p id = 519000 order p_date desc limit 0,1000) p, (select * p id = 279000 order p_date desc limit 0,1000) p2 in case specify both users (519000 , 279000). homecoming 1 record each id , similarity score. options returning 1 record every user comparing (u^2-u) in database, goal of dumping result in table? can see using nested cursors in nightly batch job, i'm hoping there more efficient. you can create tables of lastly 1,000 actions each user using rank variable , grouping compare each user. notice status @ bottom create sure don't duplicate comparisons. a note on efficiency: query in original question takes 1 sec execute. when adding 1 of tables below, execution time takes 30 minutes. sec table ba

javascript - How to create a row isolated heatmap with Highcharts -

javascript - How to create a row isolated heatmap with Highcharts - i have page has highcharts.com heat map on. works enough, create each row independent independent heat map, on bottom row, heat map low value of 59 , high value of 621 spanning yellowish red. wise, sec row have low value value 1 yellowish , 27 reddish value. in effect, visually normalized through sequences. does create sense? unfortunately @ moment can utilize single coloraxis. javascript html highcharts

plot - Is there any package and function that produce this image in R? -

plot - Is there any package and function that produce this image in R? - is there bundle produce image in r? i wanna see correlation, distribution , scatter plot of variable. you use library(psych) pairs.panels(iris[,-5], hist.col="white", scale=true) r plot distribution correlation scatter-plot

c# - storing scores for several players in a - -

c# - storing scores for several players in a <list> - i'm making programme keeping scores in dart game can input x number of players , each player gets throw 3 arrows in order input names , repeats until reaches 501 points ends game. list players seems working fine somehow can't list arrows/score work. no error in visual studio , can run programme fine, if seek print out values in arrowlist foreach loop nil happens. far can tell i've done arrowlist did players list seems work intended, why isn't arrowlist working?? i've been stuck on task c# course of study week - i've found several questions here regarding similar task still can't suggestions work code (and don't want copy&paste whole programs, after i'm here learn). code whole program: class programme { static void main(string[] args) { game game = new game(); game.playgame(); } } class game { public game() { //default

c# - A Generic Error Occurred in GDI +. Saving a BMP image -

c# - A Generic Error Occurred in GDI +. Saving a BMP image - i have bmp image. have draw rectangles (more 1) on based on conditions. code i'm using. using (image image = image.fromstream(stream)) { image.save(strfilenamebmp); stream.close(); } seek { image image = image.fromfile(strfilenamebmp); pen black = new pen(color.red, 4); using (graphics graphics = graphics.fromimage(image)) { graphics.drawrectangle(black, ix, iy, iw, ih); image.save(strfilenamebmp); // line } } grab (exception e) { } problem 1- if seek save final image bmp, shows "a generic error occurred in gdi+". problem 2- if seek save png in line a, overwrites image , can see on 1 rectangle. can help? c# graphics

c# - Differentiate between base and derived class when passing as parameters to overloaded methods -

c# - Differentiate between base and derived class when passing as parameters to overloaded methods - i'm implementing visitor pattern in c# lecture in university. works fine @ moment, have question task had do. @ moment have this: public class treestructure<t> { protected treestructure<t> _left; protected treestructure<t> _right; public t myvalue; public treestructure(treestructure<t> left, t value ,treestructure<t> right) { this._left = left; this._right = right; this.myvalue = value; } public virtual void inorder(myvisitor<t> visitor) { if(!isempty(this._left)) { _left.inorder(visitor); } visitor.visit(this); if(!isempty(this._right)) { _right.inorder(visitor); } } protected bool isempty(treestructure<t> node) { homecoming node == null; } } public class specialtree<t> : treestructure<t> { public specialtree(treestructure<t>

ios - Is it possible to change the timeout of Bluetooth Pairing Request with CoreBluetooth? -

ios - Is it possible to change the timeout of Bluetooth Pairing Request with CoreBluetooth? - i want know if possible alter timeout of alert popup of "bluetooth pairing request". couldn't find related this. thanks! sadly pairing process controlled ios. there no setting or parameter change. ios objective-c bluetooth-lowenergy core-bluetooth

html - Looping through labels of a div -

html - Looping through labels of a div - i have div tag id set run @ server can accessed code behind in asp.net. <div id="mytst" runat="server"> <asp:label id="lbl1" text="hello" runat="server" /> <asp:label id="lbl2" text="world" runat="server" /> </div> i trying load command , loop through it, finding of label kid controls of div , reading text values. wondered if knew of approach doing this. in code behind doing like... dim myplaceholder contentplaceholder = directcast(master.findcontrol("contentplaceholder1"), contentplaceholder) dim cntrldiv htmlcontrol = directcast(myplaceholder.findcontrol("mytst"), htmlcontrol) it sounds need this. ''' <summary> ''' returns recursive list of controls within current control. ''' </summary> ''' <param nam