Posts

Showing posts from April, 2012

c# - Bitmap Image on Border not updating in UI -

i have wpf application images downloaded threadpool.queueuserworkitem(). in ui, have dispatchertimer, checks folder images supposed cached, , if found, suppose show them backgrounds 2 border elements , button element. i can see files getting downloaded filepath , can step through code creates bitmapimage object, not see rendered on screen. the relevant code pasted below.. <border x:name="leftimage" borderbrush="transparent" borderthickness="0" horizontalalignment="left" height="220" verticalalignment="top" width="99"> <button template="{staticresource leftarrow}" width="20" height="20" horizontalalignment="left" margin="10,0,0,0" /> </border> <border x:name="rightimage" borderbrush="transparent" bordert

how to upload file into googlecloud through java -

i want upload file bucket in google cloud storage api. when run servelet class deployed , shows output in browser " see here file content, have uploaded on storage.. file uploading done" . but problem servelet class not establish connection google cloud storage.and file not uploaded bucket.once check the code , give suggestion how connect bucket source code. public class testcloudstorageservlet extends httpservlet{ private static final long serialversionuid = 1l; private storageservice storage = new storageservice(); private static final int buffer_size = 1024 * 1024; private static final logger log = logger.getlogger(testcloudstorageservlet.class.getname()); @override public void dopost(httpservletrequest req, httpservletresponse resp) throws ioexception { log.info(this.getservletinfo()+" servlets called...."); resp.setcontenttype("text/plain"); resp.getwriter().println("now see here file content, have uploade

javascript - Waiting for models to load before rendering app in Ember.js -

i have number of different application-level models — i.e., current user, current account, etc. — want load before rendering application. how , should done? this question/answer helped lot, doesn't cover async aspect. the following code accomplishes want, loading models in beforemodel (to take advantage of waiting promise resolve) doesn't seem right. should loading these models in applicationroute ? app.applicationcontroller = ember.controller.extend({ currentaccount: null }); app.applicationroute = ember.route.extend({ beforemodel: function () { var self = this; return app.account.find(...).then(function (account) { self.controllerfor('application').set('currentaccount', account); }); } }); thanks help! the trick return promise route's model method. cause router transition app.loadingroute route, until promise resolves (which can used loading indication bars/wheels etc.) when promise resolves, app.loadingrout

php - Codeigniter Form Dropdown Error After Validation -

i'm trying adapt form_dropdown form in codeigniter. when i'm adding new page, doesn't show errors in parent dropdown section, after form validation, instance if user forgets enter title label, if empty or, after validation gives foreach error in dropdown section. i've read that, second variable must array , on form_dropdown. mine array , not giving errors in page before validation. can't figure problem out. a php error encountered severity: warning message: invalid argument supplied foreach() filename: helpers/form_helper.php line number: 331 my_controller : class my_controller extends ci_controller{ public $data = array(); function __construct(){ parent::__construct(); } } admin controller : class admin_controller extends my_controller{ function __construct(){ parent::__construct(); $this->data['meta_title'] = 'my website control panel'; $this->load->helper('form'); $this->load->library(&#

xml - Output the difference in character XSLT -

i have 2 variables $word1 , $word2 , values are: $word1 = 'america' $word2 = 'american' now using xslt have compare both variables , output difference in character. for example output has 'n'. how in xslt 1.0 ?? i found function called index-of-string in xslt 2.0!! depends on mean 'difference'. check if $word2 starts $word1 , return remaining part can do: substring-after($word2,$word1) that returns 'n' in example. if need check if $word1 appears anywhere within $word2 - , return parts of $word2 before/after $word1 have use recursive template: <xsl:template name="substring-before-after"> <xsl:param name="prefix"/> <xsl:param name="str1"/> <xsl:param name="str2"/> <xsl:choose> <xsl:when test="string-length($str1)>=string-length($str2)"> <xsl:choose> <xsl:when test="substring($str1,1,s

ember.js - Updating a property is not visible in the DOM -

i have following drop-downs: {{view settingsapp.select2selectview id="country-id" contentbinding=currentcountries optionvaluepath="content.code" optionlabelpath="content.withflag" selectionbinding=selectedcountry prompt="select country ..."}} ... {{view settingsapp.select2selectview id="city-id" contentbinding=currentcities selectionbinding=selectedcity prompt="select city ..."}} the bound properties defined in controller: settingsapp.serviceseditcontroller = settingsapp.baseeditcontroller.extend(settingsapp.servicesmixin, { needs : ['servicesindex'], selectedcountry : null, selectedcity : null, currentcountries : null, currentcities : null, init : function () { this._super(); }, setupcontroller : function (entry) { this._super(entry); var locator = settingsapp.locators.getlocator(this.get('

jquery - AJAX - cart Magento totals and items in cart -

i'm working on ajax cart magento. i'm not interested in extensions, cart has author made, it's custom. can tell me what's best way acquire such info grand item total in cart , number of items? in fastest , relevant way. i can create external php file gather info user's session , ajax script gonna display on header every time when user adds or deletes product. i can think of that's not best solution. is there api, or what's best way this? thanks, adam if referring mini-cart of sorts, have accomplished on multiple projects using below code: <?php // gets current session of user mage::getsingleton('core/session', array('name'=>'frontend')); // loads products in current users cart $items = mage::getsingleton('checkout/session')->getquote()->getallvisibleitems(); // counts total number of items in cart $totalitems = count($items); // can loop through products, , load them attributes fo

NoClassDefFoundError when hudson runs a maven project -

i have project running tests. it's maven project uses selenium. runs correctly when launched locally, hudson platform, throws noclassdeffounderror: parsing poms [elsevier-selenium] $ "c:\program files\java\jdk1.7.0_25/bin/java" -xmx1024m -cp e:\hudson\plugins\maven-plugin\web-inf\lib\maven-agent-1.353.jar;e:\maven\boot\classworlds-1.1.jar hudson.maven.agent.main e:\maven e:\hudson\war\web-inf\lib\remoting-1.353.jar e:\hudson\plugins\maven-plugin\web-inf\lib\maven-interceptor-1.353.jar 1753 e:\hudson\plugins\maven-plugin\web-inf\lib\maven2.1-interceptor-1.2.jar <===[hudson remoting capacity]===>channel started executing maven: -b -f e:\hudson\jobs\tests-selenium\workspace\elsevier-selenium\pom.xml integration-test [info] scanning projects... [info] ------------------------------------------------------------------------ [info] building selenium-elsevier [info] task-segment: [integration-test] [info] ----------------------------------------------------------

javascript - Return value from deferred nested function -

i'm writing caching function loads invisible content dom div sizes can calculated correctly (including images). using jquery's deferred object run function once caching complete. the problem having can't work out how return props object once caching function complete. return props @ bottom want return properties object, it's returning undefined _obj function hasn't completed time return called. my complete function near bottom correctly logging props object (inc cacheheight var), can't work out how return props object deferred function. i'd return _obj(content).done(complete); , returns deferred object, not return complete function. cache : function(content) { // vars var props; // deferred switch var r = $.deferred(); /* * cache object */ var _obj = function(content) { cacheheight = 0; cache = document.createelement("div"); cac

d3.js - What Is Causing D3 To Not Work Properly In IE10? -

i working on large codebase , have been cross-browser testing. works, including ie9, except ie10. it uses d3 create timeline line current date, line selected date , rectangles ranges. problem nothing being created, cannot post code since big. ideas? worked out posted question. the latest versions of d3 require .insert have parametres, using one. fix have decided change .append since not change performance , still has 1 parameter. not sure why ie10 picks though.

JGraphX: How can I get a vertex by mouse coordinates? (mouseMoved method) -

i have mousemoved(mouseevent e) method coordinates e.getx() , e.gety(). want check if mouse on vertex. there way this? i don't want check if cell (vertex) selected, want check if mouse on 1 vertex. mgraph = new mxgraph(); // create vertexes ... mgraphcomponent = new mxgraphcomponent(mgraph); //mgraphcomponent.getgraphcontrol().addmousemotionlistener(new mouseadapter() { mgraphcomponent.getgraphcontrol().addmousemotionlistener(new mxmouseadapter() { @override public void mousemoved(mouseevent e) { system.out.println(integer.tostring(e.getx()) + " " + integer.tostring(e.gety())); // here want check if mouse position on cell // want check if mouse on 1 (or more?) cells } } ); mpanel.add(mgraphcomponent); you can so: object cell = mgraphcomponent.getcellat(e.getx(), e.gety(), false); cell should mxcell , can use model.isvertex() or model.isedge() .

multithreading - Qt signal and slot issue -

i have issue signals , slots, want use backgroundworker thread. suppose send signal few double values should updated in main gui. code compiles , thread starts gui not updating values. first gui slot: void mainwindow::slot_set_values(double ptm_temp, double ptm_hv, double heat_temp, double nomtemp, double current, double voltage) { ui->pmtvaluelabel->settext(qstring::number(ptm_temp)); ui->hvvaluelabel->settext(qstring::number(ptm_hv)); ui->heatvaluelabel->settext(qstring::number(heat_temp)); ui->nomvaluelabel->settext(qstring::number(nomtemp)); ui->currenvaluelabel->settext(qstring::number(current)); ui->vvaluelabel->settext(qstring::number(voltage)); } the worker code: void dworker::run() { qsrand(qdatetime::currentdatetime().totime_t()); mdata.set_pmt_temp(qrand()%100); mdata.set_pmt_hv(qrand()%100); mdata.set_heat_opt_temp(qrand()%100); mdata.set_heat_nominal_temp(qrand()%100); (int =

javascript - magic jquery image uploading? -

i'm trying make else's code work ipad (and other mobile devices). 1 of things works on desktop fails on ipad clicking 'import image' button. on desktop, opens dialogue box you'd expect , allows select image, on ipad clicking 'import image' nothing. the code can find called in response clicking button follows: var clickimport = function() { //breakpoint here hits when write "var test=9;" , 'import image' clicked }; nothing happens in function. when step past end of function goes straight jquery.js, appears open dialogue box. all image handling file reader happens after click 'ok' in dialogue box. problem can't dialogue box open @ on ipad. there's no " <input type='file'> " sort of thing in html either. does know how working?? or how function on mobile devices? thanks!

java - Why can't I use the selenium.(etc...) library? -

when try use selenium. library perform commands, don't work. i've imported import com.thoughtworks.selenium.*; library java: can't find symbol error. selenium.open("http://google.com/"); string alllinks[]=selenium.getalllinks(); for(int i=0;i<alllinks.length;i++){ selenium.click(alllinks[i]); thread.sleep(3000);

Creating a list using HTML or SVG that looks like the attached image -

Image
how can create this: i don't want use absolute positioning, need modular , easy use. googled have no clue search for. before down voting, attempt see if that's possible create using html. searched clueless i don't have time work out, figured point right way. disclaimers: have errors in - haven't tested or , i've been working in other languages recently. , first post. anyway, i'd use javascript make this. jquery, can make them move little. make simple link list in html: <ul class="radiallinks"> <li class="firefox"><a href="firefox.com">firefox.com</a></li> <li><a href="#">link2</a></li> <li><a href="#">link3</a></li> <li><a href="#">link4</a></li> <li class="active"><a href="#">link5</a></li> <li><a hr

Sharing session value between two different asp.net solutions using "SQL Server" mode -

i testing. created text box , button in first asp.net application , on button event stored value of text box in session got stored in database. now created asp.net application text box. want call value of text box in first asp.net application. how it? i have read theoretical application. if write down code it, great help. i have used <mode="sqlserver" sqlconnectionstring="data source=.;integrated security=true"> in web.config. i have created aspstate database in sql server 2008 r2. protected void button1_click(object sender, eventargs e) { session["mydb"] = textbox1.text; } i storing value of textbox this. getting stored in database under table "aspstatetempsessions" in encrypted form in column sessionid. now not getting how call value stored in database in text box in second web application. i hope understand problem. please me!! i have found solution:- i changed procedure i.e. use aspstate go alter

How to set current time to some other time in javascript -

i trying set current time other time , whenever try access current time need new time. suppose current time 2 in local machine. want change 10 , current time should keep ticking 10 instead of 2 whenever access it. ex: var x = new date(); if see x.gethours() fetches local time 2 , every time keeps ticking 2 base. but need change 10 new date() gives 10 , keeps ticking every second based on that. i not want use setinterval() purpose. sure have solution setinterval(). thing have multiple setintervals , other 1 stopping updating time in setinterval() trying update 10 every second. you can't change system time javascript, not if it's running browser. you'd need special environment, 1 ability interface javascript , operating system's api that. that's no simple thing , way out of scope of application you're working on. i suggest create function/object means fetch current date offset. this: foo = function () {}; foo.prototype.offset = 8; foo.pr

ruby - Best way to handle foreign number in Rails? -

i wonder something. have rails app had been translated in 30/40 languages including exotic languages. wonder what's best way handle numbers , number translation. for example, have in english, string 3 items , in persian or arabic, become Ù£ سلع ‎. unfortunately, getting 3 سلع using i18n gem. i using file locale: https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/ar.yml the locale correclty set ar output 3 in place of Ù£ (the arabic/persian character) any ideas?

CQRS - Domain Exceptions Vs Events for Exceptional Scenarios -

i'm wondering if it's preferable publish events rather throw exceptions aggregates. say, have domain there requirement students of grade level can enroll sports. if call enrollforsports on student not satisfy criteria, should aggregate throw exception or publish event, particularly if other aggregates or process managers interested in result of process? if event published, doesn't mean there need corresponding internal event handler handle event when we're replaying, though event wouldn't change state of aggregate? if exception thrown, how other parties notified? can command handler catch exception , raise event? can events raised command handlers? principally speaking, command should either valid , executed, or invalid , not executed. idea spawning error events leaves somewhere in middle , feedback whomever sends command ambiguous , delayed. unnecessary complexity in domain. if throw exception come immediate feedback to client code sent command.

wpf - Can you please explain why the Binding not working for DisplayMemberPath of ItemsControl? -

can 1 please explain why binding not working displaymemberpath of itemscontrol? and checked reflector displaymemberpath of itemscontrol dependency property,and bindable attribute set true only. xaml: <combobox x:name="display" displaymemberpath="{binding newaddress.telephone}" itemssource="{binding persons}"/> person class: public class person { public person() { persons = new observablecollection<newaddress>(); persons.add(new newaddress() { telephone = "myno" }); persons.add(new newaddress() { telephone = "myno1" }); persons.add(new newaddress() { telephone = "myno2" }); persons.add(new newaddress() { telephone = "myno3" }); } private observablecollection<newaddress> persons; public observablecollection<newaddress> persons { { return persons; } set { persons = value; } } } address class:

php - Why using createElement value doesn't show my input element properly? -

i've following code: $newdom = new domdocument('1.0', 'utf-8'); $foo = $newdom->createelement('input', 'this value'); $newdom->appendchild($foo); echo $newdom->savehtml(); this outputted only: <input> but when change createelement 'div' works okay this outputted 'div' or other input: <div>this value</div> this var_dump($foo) : object(domelement)#5 (17) { ["tagname"]=> string(5) "input" ["schematypeinfo"]=> null ["nodename"]=> string(5) "input" ["nodevalue"]=> string(16) "this value" ["nodetype"]=> int(1) ["parentnode"]=> string(22) "(object value omitted)" ["childnodes"]=> string(22) "(object value omitted)" ["firstchild"]=> string(22) "(object value omitted)" ["lastchild"]=> s

php - upload a file form - doesn't recognize the $_FILES variable -

i've got following form: <form method="post" action="index.php"> product name: <input type="text" name="product_name" value="<?php echo $product_name;?>"/> <br /> <br /> product details <textarea rows = "6" cols = "30" name="product_details" > <?php echo $product_details;?></textarea> <br /> <br /> product price <input type="text" name = "product_price" value="<?php echo $product_price;?>"/> <br /> <br /> cn: <input type="text" name = "product_cn" value="<?php echo $product_cn;?>"/> <br /> <br /> image <input type="file" name="filefield" /> <br /> <br /> <input type="submit" name="submit" value="register

ruby on rails - Has and belongs_to many or has_many through example with active record -

let's have fictional car rental application. i have users, cars, , addresses. user (id, name, email) has_many :addresses has_many :cars car (id, name) belongs_to :user address (id, name, user_id) belongs_to :user each user has multiple addresses , cars. address location user can lend car. now, model, following (let's user #1 has 2 addresses , 3 cars): settings user #1 : (specify @ address each of cars available) /-------------------------------------------\ | | car #1 | car #2 | car #3 | |-----------+----------+---------+----------| | address 1 | yes | yes | no | |-----------+----------+---------+----------| | address 2 | no | no | yes | \-------------------------------------------/ i think achieve create table cars_addresses (id, car_id, address_id, available:bool) but don't know how specify active record. questions are: is right schema structure ? how can implement through active record ?

java - Rule variables in ANTLR4 -

i'm trying convert grammar v3 v4 , having trouble. in v3 have rules this: dataspec[datalayout layout] returns [dataextractor extractor] @init { dataextractorbuilder builder = new dataextractorbuilder(layout); } @after { extractor = builder.create(); } : first=expr { builder.addall(first); } (comma next=expr { builder.addall(next); })* ; expr returns [list<valueextractor> ext] ... however, rules in v4 returning these custom context objects instead of explicitly told them return, things messed up. what's v4 way this? there multiple cases here: accessing passed-in variables ( layout ) accessing current rule's return value ( extractor ) accessing local variables ( first , next ) passed-in variables , current rule's return value when accessing passed-in variables or return value of current rule need prefix name given in rule definition $ . layout becomes $layout extractor becomes $extracto

python - Getting first row from sqlalchemy -

i have following query: profiles = session.query(profile.name).filter(and_(profile.email == email, profile.password == password_hash)) how check if there row , how return first (should 1 if there match)? use query.one() one, , exactly 1 result. in other cases raise exception can handle: from sqlalchemy.orm.exc import noresultfound sqlalchemy.orm.exc import multipleresultsfound try: user = session.query(user).one() except multipleresultsfound, e: print e # deal except noresultfound, e: print e # deal there's query.first() , give first result of possibly many, without raising exceptions. since want deal case of there being no result or more thought, query.one() should use.

python - Django View is not getting processed completely after HttpResponse() call -

i have view named scan takes modelform input and sends view processscan supposed getting value of input scan view , process in processscan view. currently, processscan getting input scan view , outputting value, isn't going past line: return httpresponse("we got processor domain: " + entereddomain) process view looks like: def scan(request): form = submitdomain(request.post or none) # form bound post data if request.method == 'post': # if form has been submitted... if form.is_valid(): # if form input passes initial validation... domainnmcleaned = form.cleaned_data['domainnm'] ## clean data in dictionary form.save() #save cleaned data db dictionary try: return httpresponseredirect('/processscan/?domainnm=' + domainnmcleaned) except: raise validationerror(('invalid request'), code='invalid') ## [ todo ]: add custom

oracle - Is the use of the RETURNING INTO clause faster than a separate SELECT statement? -

1) update foo set bar = bar + 1 = 123; select bar var foo = 123; 2) update foo set bar = bar + 1 = 123 returning bar var; i assume second faster appears require 1 less trip database. true? just thought: often, applications need information row affected sql operation, example, generate report or take subsequent action. insert, update, , delete statements can include returning clause, returns column values affected row pl/sql variables or host variables. eliminates need select row after insert or update, or before delete. result, fewer network round trips, less server cpu time, fewer cursors, , less server memory required. taken oracle docs here

hyperlink - Preserve spaces in html links for operating system call arguments -

i built html index page german rtp iptv broadcast addresses works well, can @ here: http://lan7even.homenet dot org/server7even/test/iptv.php for links work 1 have have german telekom entertain dsl/vdsl connection , 1 have register rtp:// protocol handler in browser call vlc media player. there configured 1 argument vlc open in minimized view works well. now trying set additional argument has different each link: iptv stream title (channel name) but spaces replaced browser %20 automatically , therefore vlc not recognize argument. everything find informations known stuff preserve spaces in html display purposes, can not find alter space substituting behavior when called via html link. any hint? spaces not valid characters in urls. url standard : the url code points ascii alphanumeric, "!", "$", "&", "'", "(", ")", "*", "+", ",", "-", "."

How to include a rendered php file that has been cached to HTML -

i’m creating offline web-app , working on caching method… since use jquery, being updates time, , want use cookies these: <link rel="apple-touch-icon" href="themes/images/apple-touch-icon.png"/> <link rel="apple-touch-startup-image" href="themes/images/tstartup.png" /> <meta name="mobile-web-app-capable" content="yes" /> <meta name="mobile-web-app-status-bar-style" content="black" /> <meta name="apple-mobile-web-app-capable" content="yes" /> so send iphone… need server side php me… problem php file if it’s cached it’s not calculated… question, there way let server pre calculate site store it? ps sorry english you can still call php code , variables in cached files. there way how "bypass" this. don't know how cache, using php it's this: <?php /*start caching*/ ob_start(); php or html code here

javascript - Select the same option twice using chosen.js? -

i've been working jquery plugin called chosen.js, i'm wondering if there way select 2 of same options, example: right if have multiple selection box, can select many options want , added select box, each option select gets greyed out, there way not make option greyed out can select again? i've looked through documentation , can't seem find answer, appreciated.

Adding SWT Canvas to JPanel -

i'm trying add nattable (which extends org.eclipse.swt.widgets.canvas) jpanel (the majority of program's graphics in swing, , i'm rather unfamiliar swt). attempted use code below test swt_awt class, got error: org.eclipse.swt.widgets.canvas canvas = new org.eclipse.swt.widgets.canvas( new org.eclipse.swt.widgets.shell( display.getdefault(), 1264), swt.none); java.awt.frame frame = swt_awt.new_frame(canvas); //error here jpanel returnme = new jpanel(); returnme.add(frame); return returnme; exception in thread "awt-eventqueue-0" java.lang.illegalargumentexception: argument not valid i not understand why have error passed swt composite. can explain did wrong , how fix it? in order embedding succeed, composite must have been created swt.embedded style. also, going other way: embeddin

Print value of json with jquery in tag <p> -

i wanted inside tag "p" referring first value: query > results > guitars > guitar > second make. possible ? javascript: $.getjson("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3d'http%3a%2f%2fcristianoveloz.com%2fpodcast5%2fscripts%2fguitars.xml'&format=json&diagnostics=true&callback=?", function(data){ console.log(data); }); jsfiddle to ask should use: $(".make-text").html(data.query.results.guitars.guitar[1].make); of course can see data.query.results.guitars.guitar array can go though items , print them if you'd like.

PHP login form issue with coding -

notice: undefined index: myusername in c:\xampp\htdocs\login_in2.php on line 14 wrong username or password <?php $host="localhost"; // host name $username="root"; // mysql username $password=""; // mysql password $db_name="test"; // database name $tbl_name="members"; // table name // connect server , select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select db"); // username , password sent form $myusername=$_post['myusername']; $mypassword=$_post['mypassword']; // protect mysql injection (more detail mysql injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="select * $tbl_name username='$myuserna

Deserializing SQL varbinary in form of XML to C# byte[] -

i'm working on small proof of concept project, in client sends image file in byte[] format , server inserts data database in image column, varbinary(max) . part works fine, however, i'm having issues trying convert data byte array , sending client. in database, there stored procedure responsible getting data , returning in xml: select ... asset.image 'image' assets asset asset.id = @id xml path('asset') a sample query result looks (the actual value image lot longer this, shortened make more readable): <asset> ... <image>/9j/4aaqskzjrgabaqeayabgaad/2wb</image> </asset> and in code, have generic method deserializes xml corresponding object: internal static t executequery<t>(storedprocedures storedprocedure, parameterlist parameters) { using (var connection = getsqlconnection()) { using (var command = new sqlcommand(storedprocedure.tostring(), connection)) {

Android: add admob in application -

this question has answer here: android: how integrate admob in app? 5 answers can post here working code of application integrated admob banner? need application show admob banner nothing more. trying write such thing , posted question ( android: how integrate admob in app? )but nothing helps. please check below link might : 1) http://mangaarun.blogspot.in/2012/04/how-to-integrate-admob-ads-in-android.html 2) http://jmsliu.com/209/add-google-admob-in-android-application.html

kohana 3.2 - Wrong kohana3 error when i have syntax error -

everytime when have syntax error, kohana show this: http_exception_404 [ 404 ]: unable find route match uri why? before see syntax error... my route fine, whats happening every time there sort of syntax error , instead of showing error stack it's telling me can't find route. think older versions of kohana able see that i guess it's pretty normal don't see syntax error, because kohana don't know start application. go bootstrap file in application folder , fix specific route.

php - How does Laravel implement clean URL and redirect them to Controllers -

the title says pretty well... how laravel implement clean url , redirect them right controllers. some frameworks cakephp use .htaccess redirect frontcontroller dispatch requests laravel doesn't use .htaccess bit confused. laravel use concept of "routing", clean url usually defined , mapped resolve view, such controller action, anonymous functions, plain string, etc... each request caught file located at: public/index.php (that done .htaccess file located @ same location). index.php file boostrap or illuminate laravel framework, , laravel run code. how done? routing . the routing configuration stored in file located @ app/routes.php route might follows: route::get('/users', 'usercontroller@showusers'); route::get('/users/create', 'usercontroller@createuser'); route::post('/users/create', 'usercontroller@processcreateuser'); route::get('/users/edit/{id}', 'usercontrolle

wordpress - PHP function missing bracket? Crashes page -

i'm using woocommerce in wordpress , trying add 2 pieces of code documentation functions.php file see here 2 pieces of code want add. i added first file , worked great. add second 1 , entire site smashes, assume because functions.php file vital , there syntax error... can't spot it, , documentation comes site! this have added: add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); function woo_custom_cart_button_text() { return __( 'add basket', 'woocommerce' ); } add_filter('single_add_to_cart_text', 'woo_custom_cart_button_text'); function woo_custom_cart_button_text() { return __('add basket', 'woocommerce'); } you can see full file here see them in context, starts line 61. can see why adding these 2 functions might causing entire site smash? seems weird adding 1 fine add 2 , breaks file. maybe not error coming from, t

python - Is there any graphite web ui which dosn't require graphite-webapp? -

i want deploy statistics visualization solution. @ first glance i'm playing graphite. i have more interactive standard django graphite-webapp. looking @ dashboard alternatives http://dashboarddude.com/blog/2013/01/23/dashboards-for-graphite/ but seams of them clients django graphite-webapp. is there graphite web ui dosn't require graphite-webapp? there no alternate dashboards graphite don't require django webapp because django webapp serves api /render url every dashboard requires retrieve data graphite. there's experimental go-based graphite api server, graphite-ng , isn't feature complete.

python - The Django Way To Write This Query? -

i have obscure database in django. database read , created property managements software. in view need write query specific record. select * propuserdefinedvalues propid = propid , userdefinedid = 49 is there django way execute instead of having raw sql? looping through "property" table. these records in "userdefinedcalues" table. here models. class property(models.model): propid = models.integerfield(primary_key=true) name = models.charfield(max_length=35l, blank=true) shortname = models.charfield(max_length=6l, blank=true) street1 = models.charfield(max_length=50l, blank=true) street2 = models.charfield(max_length=50l, blank=true) city = models.charfield(max_length=50l, blank=true) state = models.charfield(max_length=2l, blank=true) zip = models.charfield(max_length=50l, blank=true) phone = models.charfield(max_length=21l, blank=true) fax = models.charfield(max_length=50l, blank=true) email = models.charfield

ios - Does my Base Internationalization storyboard have to correspond to a fallback language for all unlocalized languages and strings? -

i've looked through internationalization documentation , videos on apple developer, never found explicit answer question. in apple's tutorials see base.lproj folder alongside en.lproj , zh.lproj -- example translation (localization) english chinese. tell me there's file en.lproj/mystoryboard.strings , , confusing. can't see point in creating english localization storyboard (that in english). so questions if user ever see strings in base.lproj/mystoryboard.storyboard ? do strings in file have default strings shown user if system cannot find user's preferred language folder in bundle? can explicitly "never use base.lproj/mystoryboard.storyboard , fall on en.lproj/mystoryboard.strings "? in other words: let's want app display in english whenever user's language isn't available, base.lproj/mystoryboard.storyboard in swedish. have localize base storyboard sv.lproj/mystoryboard.strings , translate strings in base storyboard english

python - Writing Percentages in Excel Using Pandas -

when writing csv's before using pandas, use following format percentages: '%0.2f%%' % (x * 100) this processed excel correctly when loading csv. now, i'm trying use pandas' to_excel function , using (simulated * 100.).to_excel(writer, 'simulated', float_format='%0.2f%%') and getting "valueerror: invalid literal float(): 0.0126%". without '%%' writes fine not formatted percent. is there way write percentages in pandas' to_excel? you can following workaround in order accomplish this: df *= 100 df = pandas.dataframe(df, dtype=str) df += '%' ew = pandas.excelwriter('test.xlsx') df.to_excel(ew) ew.save()

unix - getopts not working in bash script -

#! bin/bash # code train.sh while getopts "f:" flag case $flag in f) echo "hi" startpoint = $optarg ;; esac done echo test range: $4 echo train range: $3 #path of experiment folder , data folder: exp_dir="$1" data_dir="$2" echo experiment: $exp_dir echo dataset: $data_dir echo file: $startpoint ran command > ./train.sh test1 test2 test3 test4 -f testf and got output test range: test4 train range: test3 experiment: test1 dataset: test2 file: so getopts option not seem work reason can see nothing printed after file , echo "hi" command not executed in case statement. can please me this? you need put options before naked parameters ./train.sh -f testf test1 test2 test3 test4 with output hi test range: test4 train range: test3 experiment: test1 dataset: test2 file: testf you need coup

ios - Add Tableview cell from a xib file in a static tablebview Controller which is being loaded from a storyboard -

i working on tableview controller inside being loaded inside storyboard file. for purpose of reusability, 1 of cells in storyboard load nib file. how can that? my current implementation uses viewdidload , none of other tableview delegate methods - (void) viewdidload { [super viewdidload]; self.title = self.requesttypedescription; self.itemdescriptionlabel.text = self.currentitem.articledescription; self.modelnumberlabel.text = self.currentitem.partnumber; noteshistorystring = @"valerie young woman lives..."; self.partnumbercell.count.text = [nsstring stringwithformat:@"%@", self.currentitem.sapcount]; self.serialnumberscell.count.text = [nsstring stringwithformat:@"%lu", (unsigned long)self.currentitem.serialnumbers.count]; } register nib registernib:forcellreuseidentifier: (in viewdidload place), , in cellforrowatindexpath, dequeue cell same identifier passed in method when want cell of type.

php - Prepared statement not populating DB -

i'm trying make first prepared statement work, far i'm unsuccesful. hope you're able me out. have index.html simple form parses it's data insert.php. however, data not being written db. here's i've got: insert.php if (isset($_post['submit'])) { $mysqli = new mysqli("hosts","user","pass","db"); /* check connection */ if (mysqli_connect_errno()) { printf("connect failed: %s\n", mysqli_connect_error()); exit(); } $stmt = $mysqli->prepare("insert mail_platform (first_name, last_name, email, preference_exchange, preference_news) values (?, ?, ?, ?, ?)"); $stmt->bind_param('sssii', $first_name, $last_name, $email, $preference_exchange, $preference_news); $first_name = isset($_post['first_name']) ? $mysqli->real_escape_string($_post['first_name']) : ''; $last_name = isset($_post['last_name']) ? $mysqli-&g

Is a language without interfaces a bad choice for teaching OOP (Python)? -

perhaps dated on information, going learn oop language, concepts, etc. wanted use dynamic. thought python read has no interfaces. isn't interface needs know learn oop concepts? my thought python read has no interfaces. well, can use interfaces in python. standard library has abc module, , there third-party modules pyprotocols (and frameworks zope , twisted have own similar ideas). the point aren't required, , aren't necessary. "wanted use dynamic"? that's means dynamic: functions take object right interface, without needing interface statically defined anywhere, less needing object statically declare supports interface. so, when ask: isn't interface needs know learn oop concepts? the answer "no". interface needs know learn java-style oop , it's not needs know learn oop in general. consider different angle: it's possible, not easy, javascript-style oop in python; in java, classes fundamental python li

python - py2exe with different parts of apps -

let's have 5 different python files: main.py, first.py, second.py, third.py, last.py each of files, after main.py , different through button on main.py 's screen. know how use py2exe: from distutils.core import setup import py2exe setup(console=['main.py']) now, how compile of these exe files such still use buttons open other .py files? you compile each file seperately exe file , modify code in main.py call exe files instead of functions in .py files.

c++ - header for loop same as body duplicate code -

i'm trying output 2d table file, including header row , column. rather not check in loop if it's header file, distracting reader; rather not write inner loop twice because fear may accidentally diverge in maintenance. both loops spanning range in double, use integer in parallel avoid round off problems @ loop end. below code 'header row condition' i<0 in loop. xi = range.xi.min(); for(int = -1; i< 128; i++, xi += range.xi/128) { if(i<0) file.write( format_blank, strlen(format_blank) ); // write top corner of table else write( file, format_nth_csv, xi ); // write 1st column dxi = range.dxi.min(); for(int j=0; j < 64; j++, dxi += range.dxi/64) { if (i<0) write( file, format_1st_csv, dxi); // write header row else

android - Why can't we just call new Activity() -

so, kind of noob situation, today, out of curiosity, tried like: new activity().runonuithread( new runnable{...}) mostly because don't have access activities (working on 3rd party library). have applicationcontext, don't think allows me make runonuithread call. so guess i'm kind of wondering if there way somehow fake out minimally-invasive activity can run on ui thread (or other things, pop dialog...etc.) ?? if not, know what's wrong making new activity() ? ( mean, aside fact that, yes, null pointer because haven't set base context since oncreate activity never got called ). if possible, accept answer can provide little more detail , more "context" (no pun intended) new handler(context.getmainlooper()).post(new runnable() { @override public void run() { } });

django - Change form input attribute 'name' to 'data-encrypted-name' -

this tricky question title, please read before assuming duplicate :). i'm using braintree payments on django site, , payment form html needs credit card number: <input type="text" size="20" autocomplete="off" data-encrypted-name="number" /> mine looks this: <input type="text" size="20" autocomplete="off" name="number"> can somehow rename name data-encrypted-name ? alternatively, can hide/remove name attribute altogether? if so, add custom attribute braintree-friendly attribute: class signupform(forms.form): ...snip... def __init__(self, *args, **kwargs): super(signupform, self).__init__(*args, **kwargs) self.fields['number'].widget.attrs['data-encrypted-name'] = "number" fyi tried in __init__ no luck: self.fields['number'].widget.attrs['name'] = none per braintree : important: not