Posts

Showing posts from April, 2013

jquery - Problems with Views Slideshow: Cycle -

i want create slideshow view. installed , set next modules: views 7.x-3.7 views slideshow 7.x-3.1 i installed module views slideshow: cycle 7.x-3.1 and downloaded jquery.cycle.all.min.js , jquery.cycle.all.js, , put /sites/all/libraries/jquery.cicles/. these 2 files have 755 permissions. but, when try set module views slideshow: cycle 7.x-3.1, message appears in module admin page: "you need install jquery cycle plugin. create directory in sites/all/libraries called jquery.cycle, , copy jquery.cycle.all.min.js or jquery.cycle.all.js it. can find plugin @ http://malsup.com/jquery/cycle ." is can me? thanks the problem name of folder. you have this: /sites/all/libraries/jquery.cicles/ and correct /sites/all/libraries/jquery.cycle/ (note last "s" removed, , "cycle" not "cicle"). try , think work. regards.

asp.net - HTML helper DropDownList explained -

can please explain how works? (which overload being used) @html.dropdownlist("financialyearid", "select fy") financialyearid selectlist in view bag. why passed string? also how can add custom attributes on input element? adding 3rd parameter new { @class = "foo" } doesn't work? is possible add data- attributes using default helpers? thanks you're calling this overload. creates dropdown list name "financialyearid" (which means selected value bind model or viewbag property called "financialyearid") , "select fy" placeholder (empty) selection text. if want add class, need dropdown(string, ienumerable, string, object) helper: @html.dropdownlist("financialyearid", null, "select fy", new { @class = "foo" }) here, can populate dropdownlist passing in ienumerable (such selectlist ) have passed null . yes, entirely possible pass data attribute. replace h...

excel vba - Replace a letter with another in for a range of cells VBA -

i have these formulas entered range of cells in excel. i'm trying write using vba paste these formulas range of cells 1 letter changed. for example, i'm trying change =min(compareinputs!i3:j8) =min(compareinputs!m3:n8) , =min(compareinputs!k3:k7) =min(compareinputs!o3:o7). i'm trying copy , paste new version range of cells formulas in same position relative each other. i realize using replace function change letters i'm having trouble loop this. have suggestions? thank you! with little gave might work set range a3:a8 formula. worksheets(1).range("a3:a8").formula = " =min(compareinputs!m3:n8)" and if dont want formula stay in cell can copy , paste data down road can use like with ws.range("a") .value = .value end

C++ routine to place all short into a set -

it should possible, since number of short int s less max_size() of std::set<short int> : #include <iostream> #include <set> #include <limits.h> #include <math.h> int main() { std::set<short int> myset; std::cout << "max size of myset " << myset.max_size() << std::endl; std::cout << "number of short ints " << pow(2.0, double(sizeof(short int) * char_bit)); return 0; } outputs max size of myset 4294967295 number of short ints 65536 now, i'd place short int s set, meaning need routine iterate on short int s. if possible, general routine iterating on elements of given type. have insight? just fun: template <typename t> void fill_all_values( std::set<t> &s ) { t t = t(); s.insert( t++ ); while ( t != t() ); } one more fun solution: template <typename t> void fill_all_values_2( std::set<t> &s ) { typedef std::set...

c - Why accessing fields of struct through a typedef-ed pointer does not work? -

i have these declarations: typedef struct egobject { int magicnumber; } egobject; typedef struct egobject* ego; ego e; //printf("%d",e->magicnumber); i want magicnumber out of e , e->magicnumber doesn't work. what's right way of doing this? when declare struct , allocate memory struct : egobject e; when declare pointer struct , typedef -ed or not, allocate space pointer , not struct . in order access field of struct need allocate struct first. particular way in not matter - allocate statically, dynamically, or in automated storage, must allocate memory it: ego e = malloc(sizeof(*e)); that enough access field writing. reading field requires initialization, because malloc -ed block contains uninitialized bytes in area allocated magicnumber : e->magicnumber = 123; now can print magicnumber way code did: printf("%d",e->magicnumber); note: if choose dynamic allocation malloc , need free object once done usin...

jquery - Use html in JavaScript function -

i face little problem in below code. write below code. unable find out what's wrong in code : html: <div class="all"> <div class="info"> <label>degree <input type="text" class="row[0][degree]"></label> <label>school <input type="text" class="row[0][school]"></label> <label>grade <input type="text" class="row[0][grade]"></label> </div> </div> <button class="add_button" onclick="add_new()">add another</button> javascipt: var counter = 1; function add_new() { $('.all').append(' <div class="info">/ <label>degree <input type="text" class="row[' + counter + '][degree]"></label>/ <label>school <input type=...

xcode - Struggling with CoreData relationships and deleting objects -

Image
i'm relatively new objective-c , trying work way through learning coredata, albeit tons of google searches. have grasp of mysql , relational tables, can't seem wrap mind around how entities relate each other in coredata. i create little projects myself when learning coredata, put simple concept of automotive service tracker (like oil changes, brake work, etc). i've got 2 entities representing vehicles , oil changes ... and ... respective relationships. i'm not if require one-to-one or one-to-many relationship vehicle have many oil changes, there many vehicles ... i'm guessing that's first thing need understanding. i'm using sqllite manager watch what's going on data model. when add vehicles vehicle entity (basically saving uitextfields) can see objects in correct entity ... ... , when add oil changes particular vehicle, can see objects being put in proper entity ... .. can see following, there seems disconnect when trying associ...

android - startForeground() throws RemoteServiceException -

so want show custom notification whenever call startforeground fails. i create new layout , set informations collapsed layout. in layout have 3 buttons play/pause next , close. then create expanded layout. same buttons + previous button. (like common music control notifications) on startforeground this: bad notification posted package com.driiinx.musicslide: couldn't expand remoteviews for: statusbarnotification i haven't found answer yet need guys! mnotificationtemplate = new remoteviews(mservice.getpackagename(), r.layout.notification_template_base); mnotificationtemplate.settextviewtext(r.id.notification_base_line_one,trackname); mnotificationtemplate.settextviewtext(r.id.notification_base_line_two,artistname); mnotificationtemplate.setimageviewbitmap(r.id.notification_base_image, albumart); if (apputils.hasics()) { mnotification = new notificationcompat.builder(mservice) .setsmallicon(r.drawable.ic_pla...

range - Formal methods - Map of price relating cars to price with two sets BL and Fiat -

i have question chapter 5 in practical formal methods vdm derek andrews , darrel ince unsure how answer, here is, help! if map price relates cars price, set bl contains cars made british leyland , fiat cars made fiat. write down following descriptions using map facilities , set facilities described in chapter , chapter on sets. (d) number of fiat cars have price between £6000 , £7000 this think far... 1.get prices of fiats i.e. price(fiat) returning subset of price map i.e. {punto -→ 5500, panda -→ 6600} 2.possibly card on map restriction on range of price(fiat)... **{6000...7000} ◁ rng price(fiat)** but not sure legal i think function application not need subset of price map, want restrict map domain of fiats, let's use domain restriction: fiat <: price that should yield {punto → 5500, panda → 6600} now want subset of prices (the right side, i.e. range) restricted 6000..7000: (fiat <: price) :> {6000,...,7000} that gives set ...

html - My magento theme is not able to load CSS -

i building magento website. have uploaded blocks , skin , app folders. but, although have change design parametres, theme hasn`t css style. web is: www.droidotech.com how add css? it seems styles.css calling base means http://droidotech.com/skin/frontend/base/default/css/styles.css i think dosen't set skin (images / css) theme name system>config>design or think there problem base skin url system>config>web . let me know if have query

c++ - Unexpected template behavior with int parameter: conditional expressions ignored? -

the following code not work expected (or @ least expected). versions of g++ tried fail @ template recursion limit. output seems indicate conditional statements ignored , final else block used regardless of value of p. template <int p> inline real const_pow ( real value ); template < > inline real const_pow<0>( real value ) { return 1.0; } template < > inline real const_pow<1>( real value ) { return value; } template < > inline real const_pow<2>( real value ) { return value*value; } template <int p> inline real const_pow ( real value ) { if (p < 0) return const_pow<-p>( 1.0/value ); else if (p % 2 == 0) return const_pow<2>( const_pow<p/2>(value) ); else return value * const_pow<p-1>( value ); } the problem doesn't seem negative values (exclusively.) if re-order conditional such negative-value case last, last block still taken every time. i have working solution us...

Call (or send event) erlang function from C app/library -

i have application , library interacts low-level hardware protocols. i'm writing erlang application fast parsing of data , send distributed databases. however, i'm newbie @ erlang , i've stuck @ simple thing: efficient way connect c library(or application) erlang , how notify erlang block of data ready processing (e.g. how call erlang function c library or trigger event)? time important here, , shall use -- simple ports, driver ports or nifs? or there better ways solving task? as option, can run c application hidden erlang node using erl_interface lib. http://www.erlang.org/doc/apps/erl_interface/ei_users_guide.html#id56593 . , send messages real erlang node http://www.erlang.org/doc/apps/erl_interface/ei_users_guide.html#id60866 , or use rpc - remote proc calls perform http://www.erlang.org/doc/apps/erl_interface/ei_users_guide.html#id57714

Variable scope in a Python generator expression -

i have written function creates dictionary mapping strings -> generator expression. generator expression filters list of items based on 2 criteria, 2 criteria being different each generator in dictionary. def iters(types): iterators = {} tname in types: inst, type = tname.split('|') iterators[tname] = (t t in transactions() if t['institution_type'] == inst , t['type'] == type) return iterators the issue i'm running of generators filtered according last values of inst , type , presumably because 2 variables re-used in each iteration of loop. how can around issue? yes, inst , type names used closures ; time iterating on generators, these bound last values in loop. create new scope names; function can this: def iters(types): def build_gen(tname): inst, type = tname.split('|') return (t t in transactions() if t['institution_type'] == inst , t['type'...

c# - Working with elements inside a control that is bound to a collection -

Image
i have observablecollection<string> bound itemscontrol template button . content of button 2 textblock . i'm trying use previewmouserightbuttonup event of button toggle visibility of 1 of textblocks, without being able use xaml names elements in template i'm hitting wall. there way of getting button's content elements via sender in preview event, or other way of doing this? related previous question had didn't quite usable answer (probably due explanation, hence simplified example). seems me should happen should make control based off button adds property toggle, thought had in previous question wasn't working. feel property , trigger right way go? xaml: <itemscontrol x:name="ic" > <itemscontrol.itemtemplate> <datatemplate> <button previewmouserightbuttonup="button_previewmouserightbuttonup"> <dockpanel> <textblock text="normal...

c++ - _Block_Type_Is_Valid (pHead->nBlockUse) Deleting stack memory? -

this question has answer here: what rule of three? 8 answers i know common error tried create minimal example. think because try free stack memory don't quite understand how differently. maze.h #pragma once class maze { public: maze(); maze(unsigned int height, unsigned int width); ~maze(); private: unsigned int m_height; unsigned int m_width; char *entrance; char *exit; char *m_cells; }; maze.cpp #include "maze.h" using namespace std; maze::maze() { } maze::maze(unsigned int height, unsigned int width) : m_height(height), m_width(width) { m_cells = new char[m_height * m_width]; entrance = nullptr; exit = nullptr; } maze::~maze() { delete entrance; delete exit; delete[] m_cells; //this line causes error } main.cpp causes error #include ...

java - Error: Only the original thread that created a view hierarchy can touch its views on Android app -

i have activity populates listview . works correctly. now, want populate listview using json text php script. have adapter objects (locations) , want add location each json object. when call method add json data adapter ( getdata() ), get: error parsing data android.view.viewrootimpl$calledfromwrongthreadexception: original thread created view hierarchy can touch views. what doing wrong , how can fix it? thanks activity code: public class mainactivity extends actionbaractivity { arraylist<location> arrayoflocations; locationadapter adapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); setcontentview(r.layout.activity_main); // construct data source arrayoflocations = new arraylist<location>(); // create ada...

operations research - Error in Java code StdRandom.uniform -

this question has answer here: stdrandom, stdout, insertion cannot resolved 3 answers i'm trying run java code using eclipse. i'm running code: http://algs4.cs.princeton.edu/65reductions/simplex.java.html got error in line 317/ 319/ 322 "stdrandom cannot resolved" get stdrandom princeton's repository here , compile along simplex.java

metaprogramming - Is it possible to implement dynamic getters/setters in JavaScript? -

i aware of how create getters , setters properties names 1 knows, doing this: // trivial example: function myobject(val){ this.count = 0; this.value = val; } myobject.prototype = { value(){ return this.count < 2 ? "go away" : this._value; }, set value(val){ this._value = val + (++this.count); } }; var = new myobject('foo'); alert(a.value); // --> "go away" a.value = 'bar'; alert(a.value); // --> "bar2" now, question is, possible define sort of catch-all getters , setters these? i.e., create getters , setters property name isn't defined. the concept possible in php using __get() , __set() magic methods (see the php documentation information on these), i'm asking there javascript equivalent these? needless say, i'd ideally solution cross-browser compatible. 2013 , 2015 update (see below original answer 2011) : this changed of es2015 (aka "es6"...

sublimetext2 - sublime linter in windows working in mac -

i using sublimelinter plugin in sublime text. it's working fine in os x it's not working in windows. think problem setting path in windows machine. can guys tell me path should need set up... working code "paths": { "linux": [], "osx": [ "/usr/local/bin/", "/usr/bin/" ], "windows": [] }, provding code below { "user": { "debug": false, "delay": 0.25, "error_color": "d02000", "gutter_theme": "packages/sublimelinter/gutter-themes/default/default.gutter-theme", "gutter_theme_excludes": [], "lint_mode": "load/save", "linters": { "jshint": { "@disable": false, "args": [], ...

angularjs - How to use a variable inside the ng-repeat? -

i'm using ng-repeat list products, , want print out star symbol x times depending on product.rating . so, code looks following: <p class="bs-rating"><i class="fa fa-star" ng-repeat="i in getrating({{ product.rating }}) track $index"></i></p> however, parsed product.rating string : error: [$parse:syntax] http://errors.angularjs.org/1.3.0-beta.8/$parse/syntax?p0=product.rating&p1=is i have tried remove curly brackets, {{ }} : <p class="bs-rating"><i class="fa fa-star" ng-repeat="i in getrating(product.rating) track $index"></i></p> it gave me undefined . getrating() declared following: $scope.getrating = function(rating){ return new array(parseint(rating)); } could me figure out how pass variable ng tag? the problem on getrating function ie on generating array. have developed alternative solution on link rating using ng-repeat @jsfiddle...

Inconsistencies with relative file paths in JavaScript files -

the folder structure of local version site exact same on server, yet have change paths in 1 of js files from: url: "includes/user_process.php" // testing to url: "../includes/user_process.php" // live these part of ajax call. live version url makes sense me, directory structure contains js folder , includes folder--so you'd move 1 folder w/ '..' , includes. php files work consistently development deployment using same directory paths. having change file every time deploy pretty irritating , i'm sure it's simple i'm not picking on. appreciated.

scala - Is the Writer Monad effectively the same as the State Monad? -

there's great tutorial here seems suggest me writer monad special case tuple object operations on behalf of (a,b). writer accumulates values on left (which a) , has corresponding monoid (hence can accumulate or mutate state). if collection, accumulates. the state monad object deals internal tuple. both can flatmap'd, map'd, etc. , operations seem same me. how different? (please respond scala example, i'm not familiar haskel). thanks! your intuition these 2 monads closely related right. difference writer more limited, in doesn't allow read accumulated state (until cash out @ end). thing can state in writer tack more stuff onto end. more concisely, state[s, a] kind of wrapper s => (s, a) , while writer[w, a] wrapper (w, a) . consider following usage of writer : import scalaz._, scalaz._ def addw(x: int, y: int): writer[list[string], int] = writer(list(s"$x + $y"), x + y) val w = { <- addw(1, 2) b <- addw(3,...

How do I turn something into a Ruby Proc? -

if j.job_type_name j.type = j.job_type_name elsif j.type.length > 1 # jty = jobtype.find_by_id(j.type) # don't want relentlessly hit db jobtypes, colors, priorities, etc. use stored 'all' variable jty = alljobtypes.find { |h| h['_id'] == bson::objectid(j.type) } j.type = jty && jty.job_type ? jty.job_type : 'n/a' end if j.priority_name j.priority = j.priority_name elsif j.priority pri = jobpriority.find_by_id(j.priority) j.priority = !pri.blank? && !pri.job_priority.blank? ? pri.job_priority : 'n/a' end i have these 2 if else blocks , think better off procs, i'm still wrapping head around proc is. it's piece of code want call often, , put in 1 place have update in 1 place. it's not method on object per-se, repetitious code. so what's syntax above? the code don't see (where 'j' set) .each loop on database cursor. so job.where(stuff).each |j| etc. the syntax making...

php - Dropdown from DB with first option empty -

$query = mysql_query("select distinct(city) contacts"); echo '<select name="city">'; while ($row = mysql_fetch_array($query)) { echo '<option value="'.$row['city'].'">'.$row['city'].'</option>'; } echo '</select> <br />'; this pice of code show cities database. default, first city selected. first option "select city" no value. how think in context? just add option tag before while loop $query = mysql_query("select distinct(city) contacts"); echo '<select name="city">'; echo '<option value="">select city</option>'; while ($row = mysql_fetch_array($query)) { echo '<option value="'.$row['city'].'">'.$row['city'].'</option>'; } echo '</select> ...

xml - Android: How to use tools with include layout -

how use tools: xmlns:tools="http://schemas.android.com/tools" with <include> ? i have layout a use tools populate text fields test data. , have layout b use include copy layout in it. how ever when do not see test data of a . how can see test data of a included in b ? *both layouts have xmlns:tools="http://schemas.android.com/tools , pushed layout tag. check link, android tools attributes . should give idea how use tools attributes. @ tools:showin attribute. allows render layout_a in layout_b, in layout_b has <include layout="@layout/layout_a"/> somewhere in xml. here's example: layout_a <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:sh...

caching - how to disable web page cache throughout the servlets -

to no-cache web page, in java controller servlet, did somthing in method: public modelandview home(httpservletrequest request, httpservletresponse response) throws exception { modelandview mav = new modelandview(viewconstants.mv_main_home); mav.addobject("testing", "test string"); mav.addobject(request); response.setheader("cache-control", "no-cache, no-store"); response.setheader("pragma", "no-cache"); response.setdateheader("expires", 0); return mav; } but works particular response object. have many similar methods in servlet. , have many servlets too. if want disable cache throughout application, should do? (i not want add above code every single response object). why not via filter ? a filter is object can transform header , content (or both) of request or response.  ... the main tasks filter can perform follows: ... modify response ...

object - C# - Returning mixed types in a function -

i have different data types need in function. data needs processed in function , returned object believe called. this not tested code wrote here, think displays im trying .. hope guys can me out how it. private void button_click(object sender, routedeventargs e) { // here im calling function returns data object object thoseprocesseddata = sometestobject(5, "abc", someotherthing); // when returned want able use different data so. string useitlikethis = thoseprocesseddata.newstring; int numberslikethis = thoseprocesseddata.newnumber; } public object sometestobject(int numbers, string letters, anothertype anothertype) { string newstring = letters.substring(0,5); int newnumber = numbers + 10; anothertype newtype = anothertype.something(); return processeddata; } please guys dont kill me, if stupid question. im still new c# .. if dont im trying do, please ask! since english not best thought way best show want.. ...

c# - Dynamic linq syntax for subquery -

i want have following query in dynamic linq.. have tried solutions have not succeeded yet. select sum([value1]) [sum] ,[dim1] [primary], [dim2] [secondary] ( select value1, dim1, dim2 [budgetline] [budgetid] = 4 ) group [dim1], [dim2] my current code looks this, need rewrite give me sql above. var query = (databaseconnection.datamemorycontext.gettable<budgetlineentity>().asqueryable() .where(string.format("budgetid={0}",filter.budgetid)) .groupby(string.format("new({0},{1})",primarydimension.name,secondarydimension.name), "new(value1)") .select(string.format("new (key.{0} primary, key.{1} secondary, sum(value1) sum)",primarydimension.name,secondarydimension.name))); primarydimension.name , secondarydimension.name contain name of columns group by. consider querying database on subquery, stashing result in datatable can compute off of...

android - Update SQlite database on click of a textview in single item of listview -

i have listview textview in each row. using custom adapter populate each textview different listview items database, has holder.textview.onclicklistener on textview. problem want update database on click of textview different list items, getcontentresolver() method, used update database not work in holder.textview.onclicklistener. any ideas on how update database on click of textview present in listview items? you need context instance call getcontentresolver() . can 1 view passed onclick() method, i.e. @override public void onclick(view v) { contentresolver cr = v.getcontext().getcontentresolver(); ... }

google drive sdk - iOS App using GoogleDrive SDK going to production -

i getting ready launch ios app uses google drive sdk dropbox sdk (and other cloud service sdks). dropbox has limit of 100 users, until apply production status, approve app , remove restriction. however, far can tell, google doesn't require this. correct? there need google before submitting app apple app store? also, familiar caps or limits google drive may put on accounts using google drive? thank you! the limits based around number of requests, rather number of users. can see default courtesy quota looking @ details of drive api in developer console: https://console.developers.google.com at top of page there link quota shows current limit, , has link can request more if approaching limit.

javascript - Firefox and Chrome blocking youtube videos and other media -

how can around this? wan't make sure users see content without having press "disable protection on page" button. what you're trying load youtube on http connection whilst own site served on https connection, making possible man in middle attack change content of youtube , affect site. youtube doesn't allow loading videos on https far can see there no way solve problem if site needs work on https . either have disable secured connection on site or alternatively not use youtube, whatever choose have accept loaded page insecure. (btw, not sure how browser treats mixed content, because loading youtube player possible on https , loading video stream on https not possible, pressume html5 player won't work , flash player work, have more testing make sure of this)

Google App Script - setId on Component not working -

i'm trying create ui spreadsheet. unfortunately, can't seem id set on component when using uiservice. can verify id not set using chrome developer tools. may or may not relevant, i'm using drive in in google apps domain environment. here code: function onopen() { spreadsheetapp.getui() .createmenu('tweet menu') .additem('tweet sidebar', 'tweetsidebar') .addtoui(); }; function tweetsidebar() { var ui = spreadsheetapp.getui(); var app = uiapp.createapplication(); app.settitle('tweet sidebar'); var panel = app.createverticalpanel(); panel.setid('twitterpanel'); panel.setstyleattribute('margin', '5px'); var textarea = app.createtextarea(); textarea.setid('12345'); textarea.setname('tweettext'); textarea.setwidth('290px').setheight('175px'); var keypresshandler = app.createserverhandler('checklength'); keypresshandler.addcallbacke...

android - ACTION_DOCK_EVENT subtypes -

i need know when device connected or disconnected dock (car or desk). have broadcast receiver , line in manifest: <action android:name="android.intent.action.action_dock_event"/> and receiver: @override public void onreceive(context context, intent intent) { if(intent.getaction().equals("android.intent.action.action_dock_event") { //this dock event. //how can know here if event connected or disconnected? //can know if is car or desk dock? } } how can know here if event connected or disconnected? can know if is car or desk dock? you can find both of looking @ intent's extras. explanation , example code found here: http://developer.android.com/training/monitoring-device-state/docking-monitoring.html

bash - Single-quote part of a line using sed or awk -

convert input text follows, using sed or awk : input file: 113259740 qa test in progress 219919630 uat test in progress expected output: 113259740 'qa test in progress' 219919630 'uat test in progress' you try gnu sed command also, sed -r "s/^( +) ([0-9]+) (.*)$/\1 \2 '\3'/g" file ^( +) , catches 1 or more spaces @ starting , stored in group(1). ([0-9]+) - after catching 1 or more spaces @ starting, next matches space after , fetch numbers next space store in group(2). (.*)$ - fetch characters next numbers upto last character , store in group(3). all fetched groups rearranged in replacement part according desired output. example: $ cat ccc 113259740 qa test in progress 219919630 uat test in progress $ sed -r "s/^( +) ([0-9]+) (.*)$/\1 \2 '\3'/g" ccc 113259740 'qa test in progress' 219919630 'uat test in progress'

php - Selecting data that appears on 2 tables in MySQL -

i’m trying figure out how select data if appears in 2 different tables. here’s table structure: here clientinfo table: -------------------------------------------------- | name | region id | other info | -------------------------------------------------- | bob | 12 | likes cookies | -------------------------------------------------- | joe | 20 | scuba diver | -------------------------------------------------- here regions table: ---------------------------------------- | location | region id | published | ---------------------------------------- | california | 12 | 1 | ---------------------------------------- | oregon | 4 | 1 | ---------------------------------------- | washington | 8 | 0 | ---------------------------------------- | colorado | 20 | 1 | ---------------------------------------- i want use query make selection via p...

Python regex: how to replace string except if another string exist on the same line? -

i fixing spell of articles with replace.py by replacing "choeur" "chœur" . there file links in mediawiki syntax : [[fichier:menditte (pyr-atl, fr) choeur de l'église.jpg|thumb|chœur de l'église]] editing kind of thing broke link. can't use [] because there's link description : [[fichier:jeronimosroyaltombs.jpg|thumb|right|tombeaux de [[jean iii de portugal]] (à gauche) et de [[catherine de castille]] (à droite) dans la choeur de l'église]] in case, spell should fixed. need not edit if there is .jpg on same line , after "choeur" . my problem couldn't find way handle boolean expressions inside python regex you can use negative lookahead (?!...) (not followed by) : pattern: (?i)\b(ch)oe(urs?\b)(?!.*\.jpg\b) replacement: $1œ$2 about word boundaries: word boundaries used delimite letters \bchoeurs?\b or \.jpg\b , , job in cases. however, keep in mind word boundaries not work string: __choeur__ . i...

Python Import Error: cannot import name 'literal_eval' -

Image
i'm getting following error while running python program. i'm using python 3.4 , have installed ferenda-0.1.7-py3.4 , error is: file "c:\python34\lib\site-packages\ferenda-0.1.7-py3.4.egg\ferenda\util.py", line 20, in module ast import literal_eval importerror: cannot import name 'literal_eval' appreciate on this. thank you. when tried running in command prompt. can see no errors. attached picture you have named script ast.py (or have script in same directory named ast.py ) , script not contain literal_eval .

java - Painting JFrame Difficulty -

in code trying paint jframe not painting correctly. tell frame paint in beginning create normal grey color once created. think may have fact repainting it, if how can make sure repainted yellow? try figure out why code not painting jframe yellow? thank you! public class evolutioncolor { public static void main(string args[]) { jframe frame = new jframe("bouncing ball"); frame.setdefaultcloseoperation(jframe.exit_on_close); ballpanel bp = new ballpanel(); frame.add(bp); frame.setsize(600, 600); // set frame size frame.setvisible(true); // display frame frame.setbackground(color.yellow); } class ballpanel extends jpanel implements actionlistener { private int delay = 10; protected timer timer; private int x = 0; // x position private int y = 0; // y position private int radius = 15; // ball radius private int dx = 2; // increment...

.htaccess - CakePHP and EasyPHP -

i'm new in php , i'm facing problems. i'm using easyphp (devserver 14.1 -> php 5.5.8 , apache 2.4.7) , cakephp (2.5.1). well, if put cakephp files @ "c:\program files\easyphp\data\localweb\" (then "c:\program files\easyphp\data\localweb\cake_2_0..." example), works fine, should. the problem is: use alias on easyphp, don't want develop @ "c:\program files...". when put cakephp files on application root ("c:\myapps\myproject..." example, alias set on easyphp), "error 404". now, found if remove .htaccess file root, works. i'm sure file there reason, don't feel right removing - might give me more problems later. does know it? can use alias on easyphp if want use cakephp? in advance. edited this apache_alias.conf (c:\program files\easyphp-devserver-14.1vc11\data\conf): alias "/cakeblogtutorial" "c:/programacao/php/workspace/cakeblogtutorial" <directory "c:/programacao...

c++ - Need help operator overloading -

updated code gives me error @ s.push_back(qelem(str)); i trying create += operator in order push string stack having difficult time @ succeeding. keep receiving errors. example, code below receiving error within main.cpp @ (fixed): sta += "clean"; //error states: no viable overloaded '+=' then different code @ different times receive error @ (fixed): s.push_back(qelem(str)); //error states: no matching conversion functional-style cast 'std::__1::basic_string<char>' 'qelem' i having hard time operator, on how make work appreciated. main.cpp #include "queue.h" #include "stack.h" #include <iostream> #include <string> #include <vector> using namespace std; int main() { string more; string task; int priority; string yes; int stack; priqueue<string> que; stack<string> sta; { //do while loop, enter more tasks cout << "would a...

dojo - Adding a custom widget on call back method -

i have call method called other class when event occurs, send objects parameters loadingisdone : function(evt) { console.log(evt); for(var i=0; i<evt.layers.length;i++) { var row = new _layerrow(evt.layers[i].layer); domconstruct.place(row.domnode,this.containerdiv,"last"); } } for each object received need create custom widget called _layerrow, having 1 checkbox , label when debug code pointer not coming 2nd line of loop. and no error in console.. but when call same in different file below testing purpose var obj = new object(); obj.id = "124"; obj.name = "chiru"; var lay = new _layerrow(obj); domconstruct.place(lay.domnode,win.body(),1); the _layerrow widget working fine _layerrow.js define([ "dojo/_base/declare", "dijit/_widgetbase", "dijit/_ondijitclickmixin...

javascript - Single DIV refreshed - e.preventDefault(); -

when user search items in <div class="searchbar"> want post data <div id="auto"> , <div id="auto"> refreshed rather reloading full page. my problem when submit button clicked, entire page loading. need able refresh <div id="auto"> when submit button clicked. main purpose want avoid <div class="menulist"> being reloaded every time submit clicked. below code. <div class="searchbar"> <form action="" method="post"> furniture item: <input type="text" name="val1" id="val1" value="<?=$_post['val1']?>" /> <input type="submit" id="submit" value="submit" name="submit" /> </form> </div> <div class="menulist"> list of furniture: <select id='mylist' name="mlist" onchange='docum...

c# - Mark task as completed -

i’m implementing client protocol myprotocol on tcp/ip. protocol’s connect() method should have signature similar of tcpclient.connectasync() – is, should return task: task myprotocol.connect (…); this method ( myprotocol.connect() ) should make asynchronous tcp/ip connection (via tcpclient.connectasync() ), return non-completed task t , periodically send message m server – again asynchronously (via networkstream.writeasync() ). when response r received server – again asynchronously (via networkstream.readasync() ), myprotocol.connect() should complete task t. i’m doing following: // client of protocol: var task = myprotocol.connect(); // asynchronous call, don’t want wait until connected task.continuewith(t => { // connected – doing onconnected stuff … }); // myprotocol.connect() implementation: public class myprotocol { private task connecttask; public task connect(…) { var tcpipconnecttask = mtcpipprotocol.connect(…); tcpipconnec...

python - does both csrftoken cookie AND csrf_token INPUT type required in django -

what use of csrftoken -cookie in django when have send {% csrf_token %} in every form submission . <form method="post" action="actionfile/"> {% csrf_token %} <button>submit</button> </form> the django processor allways asks {% csrf_token %} do have put {% csrf_token %} in every form , can't django processor utilize csrftoken -cookie {% csrf_token %} might required prevent forgery use of cookie please clarify.,., cross-site request forgery : cross-site request forgery, known one-click attack or session riding , abbreviated csrf or xsrf, type of malicious exploit of website whereby unauthorized commands transmitted user website trusts.unlike cross- site scripting (xss), exploits trust user has particular site, csrf exploits trust site has in user's browser. using secret cookie remember cookies, secret ones, submitted every request. authentication tokens submitted regardless of whether or not end-use...