Posts

Showing posts from September, 2014

Singleton object for database class - but for multiple databases -

Singleton object for database class - but for multiple databases - background: writing c# class windows application deed customized sql server class includes custom error checking. , class allow general sql functions: executing queries, connecting database, closing connections, etc. my scenario this: have 2 separate databases need connect @ same time. want implement singleton pattern 1 connection can established each database (so total of 2 connections open @ once, 1 each database). want prevent sec connection either database beingness established. i thought flyweight pattern, don't think apply in case , if can singleton pattern work somehow improve solution... can not utilize singleton , have 2 database objects, or can create "open" flag in class checked when new connection requested see if existing connection open, , handle based on that... ideas / how can this? you can utilize mill pattern this. http://www.tutorialspoint.com/design_patter...

ios - Objective C - How to change image from another class (another UIViewController) -

ios - Objective C - How to change image from another class (another UIViewController) - i'm using nsobject class handle few server methods. one of methods download images db (parse.com). the problem uiviewcontroller nowadays image loaded faster download process (the image nil ), , 2 sec after image in device. how can update uiimageview image (userprofile class) nsobject class (the 1 download method)? i'm not using navigation bar - uiviewcontroller image in uitabbar i know how observe end of downloading process don't know how reach uiimageview property other class. use delegate requirement. check implement delegate or ios_delegates how can done. some understanding given below : say u have delegate method in nsobject class handle few server methods @protocol younsobjectclassdelegate <nsobject> @required -(void)imagedownloaded:(uiimage*)image; @end add @property (nonatomic,strong) id<younsobjectclassdelegate> delegate;...

Jquery countdown plugin, how to synchronize to server time? -

Jquery countdown plugin, how to synchronize to server time? - i want have countdown until 22:00 (10:00 pm) on server. i couldn't understand documentary should exact way so, i've managed define time pulled server (though in fiddle doesn't work, maybe refuses grab servertime.php), and define 22 hr value, doesn't work, adds +22 hours current time. how should done? do need code, , external php (that comes 2 additional .js resoruces) accomplish want? html: <span id="vvv"></span> js: $('#vvv').countdown({ until:new date(2014, 11 - 1, 9, 22, 0, 0), serversync: servertime, layout: '{hn} {hl}, {mn} {ml}, {sn} {sl}'} ); function servertime() { var time = null; $.ajax({url: 'http://keith-wood.name/servertime.php', async: false, datatype: 'text', success: function(text) { time = new date(text); }, error: function(http, message...

excel vba - Copying Dynamic Rows Into New Workbook and save it -

excel vba - Copying Dynamic Rows Into New Workbook and save it - i'm new in here. have search solution find needed. i found part of reply in post : copying dynamic cells/rows new sheet or workbook but there 2 more specific actions need , cant figure out in way. first thing save new workbooks name of "key" @ same place original file. sec thing re-create first line every new workbooks. here illustration : in db, key sorted alpha , bravo , rest... original database (db): name position key bruce 1 alpha bruce 2 alpha alfred 2 alpha alfred 3 bravo robin 1 bravo robin 1 bravo in first workbook like: name position key bruce 1 alpha bruce 2 alpha alfred 2 alpha and workbook save "alpha.xlsx" in same directory original database (in file on desktop) , close window then 2nd workbook be name position key alfred 3 bravo...

c# - Dynamically set the table name in LINQ query -

c# - Dynamically set the table name in LINQ query - i working on info warehouse application , have 4 tables schema identical. difference between tables table name. table example: ps_contractor ps_employee ps_union ps_nonunion schema id hourly benefit total now need generate 4 reports based on these tables. instead of writing 4 separate linq queries write single query can pass table name dynamically. the question how pass table name dynamically in next linq query ? var info = ( q in _dbcontext.ps_contractor bring together _l in _dbcontext.log on q.id equals l.tablelogid q.hourly = 8 select new{ hourly=q.hourly, benefit=q.benefit, total=q.total, log = l.message }.tolist(); i have looked @ similar questions suggested stack overflow. not want utilize executestorequery. what options have ? if tables have same columns, i'd extract interface out of tables , create partial entity classes implement interface, utilize interface query. fo...

jquery - Hide an element (in this case button) with visibility -

jquery - Hide an element (in this case button) with visibility - wanted hide button while maintaining space between buttons. $(document).ready(function(){ $('#hide').click(function(){$('#btn').css('visibility','hidden');}); $('#show').click(function(){$('#btn').css('visibility','visible');}); } looked visibility css tag. doesn't seem work way (or maybe i'm getting .css() function wrong). js fiddle here just utilize jquery's hide , show set visibility you: http://jsfiddle.net/uyoezedy/12/ $(function(){ $('#hide').click(function(){$('#btn').hide();}); $('#show').click(function(){$('#btn').show();}); }); behind scenes hide() sets display: none; , show() sets display: inline-block; notes: $(function(){your code here}); nice shortcut $(document).ready(function(){...}); hide collapse space element takes up your original did n...

python - how to check the field "select"? -

python - how to check the field "select"? - please help check field 'select'. model: class message(models.model): reciever = models.foreignkey( user, related_name='recipient', blank=false, null=false, ) theme = models.charfield( 'Тема сообщения', max_length=200, blank=true, null=true, ) text = models.textfield( 'Текст сообщения', max_length=10000, blank=false, ) forms: class createmessageform(forms.modelform): class meta: model = message fields = ( 'reciever', 'theme', 'text', ) def clean_reciever(self): reciever = self.cleaned_data['reciever'] if reciever == '': raise forms.validationerror("Это обязательное поле") ...

scala - Play Framework Ning WS API encoding issue with HTML pages -

scala - Play Framework Ning WS API encoding issue with HTML pages - i'm using play framework 2.3 , ws api download , parse html pages. none-english pages (e.g russian, hebrew), wrong encoding. here's example: def test = action.async { request => ws.url("http://news.walla.co.il/item/2793388").get.map { response => ok(response.body) } } this returns web page's html. english language characters received ok. hebrew letters appear gibberish. (not when rendering, @ internal string level). so: <title>29 ×ר×××× ××פ××ת ×ש×××× ×× ×¤××, ××× ×©×××©× ×שר×××× - ×××××! ××ש×ת</title> other articles same web-site can appear ok. using curl same web-page returns fine makes me believe problem within ws api. any ideas? edit: i found solution in question. parsing response iso-8859-1 , converting utf-8 like-so: ok(new string(response.body.getbytes("iso-8859-1") , response.header(content_encoding).ge...

linux - bash if statement expected unary operator -

linux - bash if statement expected unary operator - i'm trying along lines of if (!regular file || symbolic link) go on what have far is st1=$( -f "${array[$i]}" ) if [ "$st1" -eq 0 ] but i'm getting "expected unary operator error" you don't need create intermediate st1 variable. use: if [[ ! -f "${array[$i]}" || -h "${array[$i]}" ]]; echo "${array[$i]} link exists" fi your utilize of st1=$( -f "${array[$i]}" ) wrong , cause syntax error: -f: command not found since shell consider f command name. linux bash if-statement

c# - Ektron Library images not displaying; filepath not found -

c# - Ektron Library images not displaying; filepath not found - i have bunch of images stored in library in ektron. i'm trying display these images on 1 of webpages in slideshow. here's have: public partial class webassets_usercontrols_uxslideshow : system.web.ui.usercontrol { public list<string> images { get; set; } protected void page_load(object sender, eventargs e) { list<librarydata> libraryimagelist = getlibrarydatalist(1); var imagelist = (from im in libraryimagelist im.foldername == "alumni" select im).tolist(); var imageurls = imagelist.select(image => image.filename).tolist(); slideshowrepeater.datasource = imageurls; slideshowrepeater.databind(); } private list<librarydata> getlibrarydatalist(int librarytypeid) { librarymanager librarymanager = new librarymanager(apiaccessmode.loggedinuser); librarycriteria criteria = ne...

do I have to have main function in my python code? -

do I have to have main function in my python code? - can write python code bunch of functions without main function. purpose of script other scripts import of functions from. phone call setvar_general.py or imported series of other setvar_x scripts. while these setvar_x more specific things, setvar_general not thing other providing building blocks. hence there not need defining main function in setvar_general.py. i guess comes downwards question "do have have main function"? you not have have main function in python , writing separate files without main function, imported other programs, normal , right way of doing python programming. when python file loaded (either using import or getting executed command line) each statement in programme executed at time. statements def or class statements create function or class definition later use. statements are not within def or class executed right away. therefore, equivalent of main() function in oth...

multithreading - Android code not executed -

multithreading - Android code not executed - i making android photographic camera app can show preview , taking photo. there 2 buttons implemented in activity: start preview , stop preview. when users click on stop preview button, app capture photo. however, when testing app, code associated stop preview seems skipped , not executed. below code: suppresswarnings("deprecation") public class cameraopened extends activity implements surfaceholder.callback{ photographic camera camera; surfaceview surfaceview; surfaceholder surfaceholder; boolean previewing = false; static final int request_image_capture = 1; int count; picturecallback rawcallback; shuttercallback shuttercallback; picturecallback jpegcallback; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_camera_opened); button buttonstartcamerapreview ...

c# - Test connection string within Entity Framework for incorrect password -

c# - Test connection string within Entity Framework for incorrect password - i'm beginner entity framework (code first) , have modify application. i have context class inherits dbcontext. in constructor, pass connectionstring. code sample (not mine) : public partial class myentities : dbcontext { public myentities(string paramtype, string connectionstring) : base(connectionstring) { database.connection.connectionstring = connectionstring; } } but don't understand connection done. grab error if password given in connectionstring wrong, seek connect password, , grab event when connected database. how can ? i believe asking, how can observe if connection string valid. the dbcontext.database has property called connection can utilize retrieve connection entity framework use. can phone call open() test connection itself. c# entity-framework database-connection

php - Can't Get ModX Resource ID -

php - Can't Get ModX Resource ID - i'm having problem modx api. i'm trying grab resource id thusly: require_once '/var/www/vhosts/mysite.com/httpdocs/config.core.php'; require_once modx_core_path.'model/modx/modx.class.php'; $modx = new modx(); $data = filter_input_array(input_get); $modx->initialize('web'); $modx->getservice('error','error.moderror', '', ''); $modx->getservice('mail', 'mail.modphpmailer'); $dataobjs = $modx->getobject('modresource', $data['doc']);` the problem is, $data['doc'] returns 1. looks filter_input_array isn't working. ideas what's going wrong? i have never used filter_input_array function , without arguments not sure buying or if work. if goal acquire key 'doc' , have sanitized can following $_get_data = $modx->sanitize($_get); $modx->initialize('web'); $modx->getservice('error...

html - Can an Image in Web Browser use any file extension? -

html - Can an Image in Web Browser use any file extension? - what if rename image custom file extension, choke browsers? for example.. image.jpg rename to: image.xyz then in markup do.. <img src="image.xyz"> the image still jpeg format uses custom file extension. tests pass. cause potential issues? yes, possible, you'd need set mime type in server. browsers don't care extension, care mime type server specifies image should be. when mime type set, returns in content-type header of response image request. html image http browser file-extension

doctrine2 - In symfony2 using jmsSerializerBundle to serialize then deserialize a subentity throws exception when parent entity is saved -

doctrine2 - In symfony2 using jmsSerializerBundle to serialize then deserialize a subentity throws exception when parent entity is saved - my app has entity called "client" injected every request object. to improve performance i've set custom cache, , using jmsserializer serialize , cache client objects. when request comes in, cache returns serialized client object, , jms deserializes it. my application creates other entities, phone call them childentities, , associates them client objects via manytoone relationship on childentity. this working fine until started loading these objects via deserializing cached data, rather using doctrine load them mysql database. doctrine throws error: a new entity found through relationship "\acme\bundle\entity\childentity#client" not configured cascade persist operations entity: clientname. solve issue: either explicitly phone call entitymanager#persist() on unknown entity or configure cascade persist association...

c# - Entity Framework SqlQuery not returning row_number() value -

c# - Entity Framework SqlQuery not returning row_number() value - i have select statement returns row_number() value other fields table. query pretty simple , working in ssms: select *, cast(row_number() over(order tableprimarykey) int) [rownumber] tablename tableprimarykey > 10 (in real application where statement much more complex, simplicity set this) in project created poco class contains rownumber property (with other necessary properties) ... public int rownumber { get; set; } ... and made sure migrations won't create additional columns in table @ entityconfiguration class: this.ignore(x => x.rownumber); problem entity framework's sqlquery() method returns columns table should, rownumber 0. i'm using entity framework 6.1 version. did miss something, or can not done way? this reply question in comment. with main ( select * ,row_number() over(order primarykeyid) 'rownumber' [tablename] [month] =...

uiwindow - Disable window interaction iOS -

uiwindow - Disable window interaction iOS - i have 2 uiwindows on screen , 1 behind other. there way handle user touch window behind? thanks you able take touch events on 1 uiwindow @ time. uiwindow accepts events called keywindow . [behindwindow makekeyandvisible]; your foreground uiwindow remain visible, behindwindow receiving events. ios uiwindow

javascript - how to add multiple filters to mapbox leaflet maps -

javascript - how to add multiple filters to mapbox leaflet maps - i have working mapbox/leaflet map , can filter based on dropdowns 1 of them work, not sure of syntax (or if it's possible) combine filters? i have real estate map populated json info includes property types , neighborhoods. need combine possible filters, selecting different property type won't erase neighborhood filter. $('#propertytype').change(function() { if ($(this).val() === 'all') { console.log($(this).val()); markers.setfilter(function(f) { homecoming f.properties['type'] != null; }); } else { console.log($(this).val()); var ptype = $(this).val(); markers.setfilter(function(f) { homecoming f.properties['type'] === ptype; }); homecoming false; } }); $('#neighborhood').change(function() { if ($(this).val() === 'all') { console.log($(th...

How do we OR filters using rethinkdb and nobrainer in ruby on rails? -

How do we OR filters using rethinkdb and nobrainer in ruby on rails? - following nobrainer docs here: http://nobrainer.io/docs/querying/ i trying or query, articles keyword matches title or text fields... the next query returns no results... s = 'something' @articles = article.where(:or=>[:title=>/(?i)#{s}/, :text=>/(?i)#{s}/]) i checked regex next query , works... @articles = article.where(:title=>/(?i)#{s}/) could help understand how or queries? thanks. update: the query returns results if search term found in both fields... appears working , instead of or! the nobrainer documentation warns of behaviour: :or => [p1,...,pn] evaluates true when @ to the lowest degree 1 of predicates true. be aware [:a => 1, :b => 2] same [{:a => 1, :b => 2}] , not same [{:a => 1}, {:b => 2}] . your query may work if add together curly brackets: @articles = article.where(:or=>[{:title=>/(...

java - What happens when weak referenced object is put itno HashMap as key? -

java - What happens when weak referenced object is put itno HashMap as key? - this programme : public class memoryleakswithmapsweakreference { private map<memoryleakswithmapsweakreference, integer> map = null; public memoryleakswithmapsweakreference() { map = new hashmap<memoryleakswithmapsweakreference, integer>(); } public static void main(string[] args) { memoryleakswithmapsweakreference m = new memoryleakswithmapsweakreference(); while(true) { m.run(); } } private void run() { memoryleakswithmapsweakreference mm = new memoryleakswithmapsweakreference(); weakreference<memoryleakswithmapsweakreference> ref = new weakreference<memoryleakswithmapsweakreference>(mm); mm = null; map.put(ref.get(), 1); system.out.println(map.size()); } } now, if object weakreferenced, should deleted garbage collector. however, in case presented above (ins...

eloquent - Laravel upgrade issue with whereHas -

eloquent - Laravel upgrade issue with whereHas - i changed versions of laravel , getting error: logicexception has method invalid on "belongsto" relations. can explain why getting error? if comment out below 3 lines, no error. version: "laravel/framework": "4.1.7" the piece of code in question this: $ordercount->wherehas('order', function($query) { $query->whereraw("status in ('pending', 'prepaid')"); }); the entire controller logic here: public function show($id) { // fields want $fields = array('id', 'title', 'description', 'msrp', 'brand_id', 'category_id'); // how many products in pending orders $orders = 0; // assume not admin must display = 1 $display = 1; // if logged in add together more fields if(auth::check()) { // add together these fields query if dealer ...

javascript - Bootstrap collapse section and expand another with one button -

javascript - Bootstrap collapse section and expand another with one button - i have bunch of html fields logically separated such: half fields reside in: div id="general" , other half reside in: div id="advanced" what i'm trying implement (and failing) following: the fields in general div shown (by default). button caption "advanced" shown. , fields in advanced div hidden. when button clicked, next should occur: general section collapses hiding it's fields advanced section expands showing it's fields button caption changed "general". subsequent clicks toggles above. e.g. upon next click, advanced section hidden, general section shown, , button caption changes "advanced" notes: seems trivial beingness new web front-end, can't easily. if div section incorrect, scrap it. suspect i'm on right track, , need jquery code collapse , expand divs. below attempts: i used bootstrap collapse plugin acco...

AWK - input variable to pattern from SHELL -

AWK - input variable to pattern from SHELL - i extract text file using awk basicly works correctly create dymamical using variable looking pattern. how should works: file test_input contains (btw: extract hp dp omnimm -show_locked_devs ) type: device name/id: drive1 pid: 28405 host: host1 type: cartridge name/id: lib1 pid: 28405 host: host1 location: 47 ... get "pid" number drive1 => command find pattern (drive1) , display next line file test_input (28405) cat test_input | awk 'c&&!--c;/drive1/{c=1}'| awk '{print $2}' 28405 get "location" number => find "pid" numberes , display next 2 line(record) each match utilize grep filter "location" output , display 2nd field (47) cat test_input | awk 'c&&!--c;/28405/{c=2; print $0}'| grep location | awk '{print $2}' 47 i have noticed double quotes in awk can handle shell variables when utilize sam...

matlab - How to use a logical image as a mask for the original image? -

matlab - How to use a logical image as a mask for the original image? - i have original image , on connected components want utilize sift function. able extract regions , convert them logical format per matlab help file: this section describes how create binary masks define rois. however, binary image can used mask, provided binary image same size image beingness filtered. this original image and here part want, able extract in logical format: now want apply sift function on single connected component of original image. i used createmask function in same format explained in help documentation: img = imread(word.jpg); h_im = imshow(img); e = word_bw; %this image used mask bw = createmask(e,h_im); i error: undefined function 'createmask' input arguments of type 'logical'. how go using mask in way allow me apply functions area in original image? see if works - img_out = img; img_out(~word_bw) = 0; img_out image mask word_...

java - GraphicalEnvironment does not update screen devices after switching off second screen -

java - GraphicalEnvironment does not update screen devices after switching off second screen - i have 2 monitors write little swing java code collect info of screen devices combine changing display mode 1 or 2 display screen setting display in command panel. , code below: import java.awt.graphicsdevice; import java.awt.graphicsenvironment; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jframe; public class main { public static void main(string[] args) { final jframe frame = new jframe("demo info screen devices"); jbutton button = new jbutton("print info screen devices"); button.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { printinfoallscreendevices(); } }); frame.add(button); frame.setsize(500, 300); frame.setvisible(tr...

pdo - PHP 5.5, how to enabled odbc_connect()? -

pdo - PHP 5.5, how to enabled odbc_connect()? - i'm using php 5.5.6 on redhat6. when run next php scrip call undefined function odbc_connect() error. $u = 'smthg'; $p = 'smthgelse'; $conn = odbc_connect('mssql-php', $u, $p , sql_cur_use_driver) ; i configured odbc.ini file following: [mssql-php] driver = sql server native client 11.0 server = 10.33.37.2 database = mydbname i seek connect server pdo class 'pdo' not found error. i thought both odbc , pdo extension included in php5.5, , there no extension add together php.ini file. php -r 'phpinfo();' | grep odbc or same pdo give me nothing. what did miss? php pdo odbc redhat

c# - Button content not displaying when using Control Template as Button Template WPF -

c# - Button content not displaying when using Control Template as Button Template WPF - so have circular button have created in wpf so: <button grid.column="3" width="25" height="25" content="x" margin="10,5,5,5" foreground="red" verticalalignment="center" horizontalalignment="center"> <button.template> <controltemplate> <grid> <ellipse name="ellipse" fill="{templatebinding background}"/> </grid> </controltemplate> </button.template> </button> but button displays is: why has reddish x not appeared in center of button? , possible alter xaml such reddish x appear. (ps. gray background because of button style in resources) it's because there's nil in template display content . need utilize contentpresenter <button grid.column=...

cakephp: find ignores DISTINCT -

cakephp: find ignores DISTINCT - i got next cakephp find situation: $data = $this->find('all', array( 'conditions' => array( 'roster.league_id' => $league_id, 'roster.season' => $season, ), 'fields' => array( 'distinct roster.player_id', 'roster.league_id', 'roster.fflteam_id', 'roster.season', 'roster.modified', 'fflteam.name', 'player.firstname', 'player.lastname', 'player.position' ), 'order' => array( 'roster.player_id', 'roster.modified desc'), 'contain' => array( 'fflteam', 'player' => array( 'stat' => array( 'co...

python - RawArray from numpy array? -

python - RawArray from numpy array? - i want share numpy array across multiple processes. processes read data, want avoid making copies. know how if can start multiprocessing.sharedctypes.rawarray , create numpy array using numpy.frombuffer . if given numpy array? there way initialize rawarray numpy array's info without copying data? or there way share info across processes without copying it? i'm not sure if copies info internally, pass flat array: a = numpy.random.randint(1,10,(4,4)) >>> array([[5, 6, 7, 7], [7, 9, 2, 8], [3, 4, 6, 4], [3, 1, 2, 2]]) b = rawarray(ctypes.c_long, a.flat) >>> b[:] [5, 6, 7, 7, 7, 9, 2, 8, 3, 4, 6, 4, 3, 1, 2, 2] python arrays numpy multiprocessing

arrays - Java-Tile Map Image Flickering-What can i do to stop this? -

arrays - Java-Tile Map Image Flickering-What can i do to stop this? - i making pacman game , have map in array, assign different values in map draw different images, in order create pacman map... keeps flickering on place any help identifying problem wonderful i realize lot of reading, have looked @ hours , not figured out.... new programming think more experienced eyes benefit me code --------------------------------------------------------------------------------------------- draw map public void drawmap(){ bufferstrategy bs = this.getbufferstrategy(); do{ do{ graphics g = null; g = getgraphics(); try{ (int x = 0; x < graphics.map.width; x++) { (int y = 0; y < graphics.map.height; y++) { tile = graphics.map.level1[y][x]; //system.out.println(y + ", " + x); int tilex = x * 21;//(int) (x * 21.42857142857143...

error handling - swift, optional unwrapping, reversing if condition -

error handling - swift, optional unwrapping, reversing if condition - let's have function returns optional. nil if error , value if success: func foo() -> bar? { ... } i can utilize next code work function: let fooresultopt = foo() if allow fooresult = fooresultopt { // go on right operations here } else { // handle error } however there few problems approach non-trivial code: error handling performed in end , it's easy miss something. it's much better, when error handling code follows function call. correct operations code indented 1 level. if have function call, have indent 1 more time. with c 1 write this: bar *fooresult = foo(); if (fooresult == null) { // handle error , homecoming } // go on right operations here i found 2 ways accomplish similar code style swift, don't either. let fooresultopt = foo() if fooresult == nil { // handle error , homecoming } // utilize fooresultopt! here allow fooresult = ...

r - "Inverse" of the transitive closure of a weighted graph -

r - "Inverse" of the transitive closure of a weighted graph - for network, given (non-negative) travel costs between each pair of nodes. travel costs additive. how can prune graph unnecessary edges removed (i.e. have path approximately equivalent length)? in other words, i'm looking smaller (a smallest?) graph shortest-path distance between each pair of nodes preserved. in next example, i'm given sp (or spg , matter), , infer g it: set.seed(144) library(igraph) nv <- 100 ne <- 300 g <- erdos.renyi.game(nv, ne, "gnm", directed = false) edge.attributes(g) <- list(weight = rexp(ne, 1)) sp <- shortest.paths(g) spg <- graph.adjacency(sp, weighted = "weight") i have few one thousand nodes, enumerating connected pairs of edges not alternative (due memory limitations), , iterating on pairs of nodes slow when implemented in r. r algorithm igraph

templates - C++ error: 'iterator is not a type' -

templates - C++ error: 'iterator is not a type' - here's code: template <typename container_type> void transfer(container_type container, iterator begin, iterator end) { (; begin != end; begin++) if (!element_in_container(container, *begin)) container.insert(iterator, *begin); } i error 'iterator not type' . i tried adding std:: or container_type:: before iterator , didn't help. tried defining template template <typename container_type<typename t> > , iterators container_type<t>::iterator , no luck. what's wrong? i think mean following template <typename container_type> void transfer( container_type container, typename container_type::iterator begin, typename container_type::iterator end) { take business relationship in case function wrong because after inserting element in container iterators can invalid. c++ templates

c++ - Arithemtic between equivalent typedefs -

c++ - Arithemtic between equivalent typedefs - i writing c++ compiler compiler class , wondering this. arithmetic between equivalent typedefs so, b/c typedefs have loose name equivalence: typedef int foo; typedef int bar; int test; foo i; bar j; = 1; j = 2; test = + j; // code clarity is supposed work? typedefs glorified base of operations types or cascade hierarchy? yes, work fine, think case when structs. c++ compiler-construction typedef

python - How to put a blank space in a list? -

python - How to put a blank space in a list? - example, want create list: a = [1, 2, 3, , 5] how set in blank space in between 3 , 5 ? want create game of hangman it, , blank space filled in player. list contain hangman question player need solve. you can't leave "empty space" in list; each index has contain something. in general, "empty" index indicated sentinel value, none . for game hangman, have own empty space character, e.g. underscore "_" : word = ["h", "e", "_", "_", "o"] this allows print word , showing user blanks are: >>> print " ".join(word) h e _ _ o python

java - How to check whether date is valid -

java - How to check whether date is valid - i can utilize parseint , if - else -statements , i'm stuck right now. understood logic, can't command illustration feb dates , jump years. wrote statements it. boolean jump = false; if (((year % 4) == 0) && ((year % 100) == 0) && ((year % 400) == 0) && ((year % 4000) != 0)) jump = true; else jump = false; but can't contact february. can help me please? leap year can evaluated by: if ((year % 4 == 0) && (year % 100 != 0)) { jump = true; } else if (year % 400 == 0) { jump = true; } else { jump = false; } java date

javascript - jQuery traversing get variable value from cell -

javascript - jQuery traversing get variable value from cell - i've got html table like: <table id="realtime" class="table table-bordered table-hover"> <tr> <th>agent</th> <th>number</th> </tr> <tbody><tr class="rowid"> <td class="name">joe</td> <td class="extension">agent/1701</td> <td><button onclick="mycall()" class="btn btn-default btn-sm">record</button> </td></tr> <tr class="rowid"> <td class="name">jane</td><td class="extension">sip/1702</td> <td><button onclick="mycall()" class="btn btn-default btn-sm">record</button></td> </tr></tbody></table> and javascript: function mycall() { var table = $('#realtime').datatable(); var extension = $(...

xcode - Removing heightForRowAtIndexPath: compatibility with iOs7 -

xcode - Removing heightForRowAtIndexPath: compatibility with iOs7 - in new ios8, if don't implement heightforrowatindexpath method, row multiple lines displayed right height. but, if want preserve compatibility ios7, need heightforrowatindexpath method implemented... how can implement in ios8? you should utilize define rule: #define system_version_greater_than_or_equal_to(v) ([[[uidevice currentdevice] systemversion] compare:v options:nsnumericsearch] != nsorderedascending) here how should utilize it: - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { if (!system_version_greater_than_or_equal_to(@"8.0")) homecoming 100.0;//your custom height here else homecoming uitableviewautomaticdimension; } xcode uitableview ios8 heightforrowatindexpath

wordpress - Gravityforms field value from another field -

wordpress - Gravityforms field value from another field - i'm trying create field gravity forms gets value(s) other fields in same form. possible merge tags example? reason i'm trying simple list of values multiple fields can store in user_meta (with gf user registration). there 10+ checkbox fields, user can select 1 or all. new field serve hidden field gets info user has entered (checked) in checkbox fields. gf user registration accepts 1 field pointer user_meta value making logic in end no-go. i've written snippet supports this: https://gist.github.com/spivurno/7029518 usage instructions included in comments. wordpress gravity-forms-plugin

wordpress - How to redirect based on URL -

wordpress - How to redirect based on URL - i using wp store locator plugin.and have modified according need.but stuck in redirection. basically plugin works short code.so @ time of listing url : localhost/wordpress/?page_id=391 now there 1 link redirects me http://localhost/wordpress/?wpsl_id=3 here code : add_action("template_redirect", 'my_theme_redirect'); function my_theme_redirect() { $dpath = $_server["http_host"] . $_server["request_uri"] ; $templatefilename = 'single-store.php'; if (strpos($dpath,'wpsl_id') !== false){ $return_template = get_template_directory() .'/' .$templatefilename ; //$nurl = get_permalink($return_template); //echo $return_template; exit; wp_redirect($return_template); exit; } } this code not redirecting me any-where.it stays ...

Unable to upgrade from grails 2.3.4 to 2.4.3 - Cannot find GrailsResourceLoaderFactoryBean -

Unable to upgrade from grails 2.3.4 to 2.4.3 - Cannot find GrailsResourceLoaderFactoryBean - problem i trying upgrade grails app 2.3.4 2.4.3 next instructions @ link http://grails.org/doc/2.4.3/guide/upgradingfrom23.html and not seem able accomplish it. getting @ compile time cannot find grailsresourceloaderfactorybean initialization error. understand no longer nowadays in grails 2.4 still wants somehow. made sure applicationcontext.xml same 1 generated brand new project , error still happens. what have tried 1/ grails set-grails-version 2.4.3 updated application properties 2/ added next buildconfig // plugins build scheme build ":tomcat:7.0.55" // plugins compile step compile ":scaffolding:2.1.2" compile ':cache:1.1.7' compile ":asset-pipeline:1.9.6" compile ":mail:1.0.7" compile ':spring-security-core:2.0-rc3' compile ":spring-security-ldap:2.0-rc2"...

asp.net mvc - Twitterbootstrap input-groups with Razor syntax -

asp.net mvc - Twitterbootstrap input-groups with Razor syntax - i'm trying convert html : <div class="col-lg-6"> <div class="input-group"> <span class="input-group-addon"> <input type="checkbox"> </span> <input type="text" class="form-control"> </div><!-- /input-group --> </div><!-- /.col-lg-6 --> into razor syntax this: <div class="col-lg-6"> <div class="input-group"> <span class="input-group-addon"> @html.checkboxfor(model => model.negotiable, new { @class = "form-control", @checked = "checked" }) </span> @html.textboxfor(model => model.price, new { id = "price", @class = "form-control", }) </div><!-- /input-group --> </div><!-- /.col-lg-6 --> bu...

robotframework - How to use external data source (text file) for robot framework data-driven test? -

robotframework - How to use external data source (text file) for robot framework data-driven test? - based on illustration below. - possible set testcases part in text file? - how? ----------------------------------------------------------------------------------------------------------------------------------- * settings * test setup           go url test teardown     close browser test template      valid input library                 selenium2library * variables * ${url}                  some url ${browser}       firefox * testcases *       name                age  ...

mysql - how to load and edit a sql database from adobe flex builder 4.6 air program -

mysql - how to load and edit a sql database from adobe flex builder 4.6 air program - alright have sqldb hosted online , can access using phpmyadmin create tables , add together items tables via adobe flex builder 4.6 desktop air application. anyone know if able this, thought programme person @ position can come in name , person @ position b can utilize programme read names according accessing mysql adobe flex/air, air unable access mysql servers directly, you'll have utilize web services or custom api this. yeah, sure it's possible want. mysql actionscript-3 flex air flex4.6

css - Telerik controls : Combobox and RadDatePicker not inline on IE 11 -

css - Telerik controls : Combobox and RadDatePicker not inline on IE 11 - my code design : keyword:<telerik:radtextbox id="rtbsearch" runat="server" skin="web20" width="150px" emptymessage="enter client name..."></telerik:radtextbox> <telerik:radcombobox id="rcbprovince" skin="web20" runat="server"></telerik:radcombobox> start <telerik:raddatepicker id="rdpstartday" skin="web20" runat="server"> </telerik:raddatepicker> end <telerik:raddatepicker id="rdpendday" skin="web20" runat="server"> </telerik:raddatepicker> <telerik:radbutton id="rbsearch" text="search" runat="server" skin="web20"></telerik:radbutton> how prepare it, please help me, thanks. p/s: ...

JQuery click for elements added using Ajax -

JQuery click for elements added using Ajax - this question has reply here: jquery getting id of clicked link 6 answers i have div class c , adding code class using ajax ends looking like: <div class="c"> <div class="del" id="1"></div> <div class="del" id="2"></div> <div class="del" id="3"></div> </div> my class c static , divs class delete added using ajax. want id of div class delete click on. i first doing: $(".delete").click(function(){ var id = $(this).attr('id'); } ); but doesn't work. later found out on should utilize .on() content added using ajax. understood, implemented next way: $(".c").on('click','.delete',function(){ var id = $(".delete").attr(...

angularjs - Firebase security rule for array of messages -

angularjs - Firebase security rule for array of messages - i trying display list of messages based on recipient now, let's maintain simple. trying display list of messages. my rule looks this { "rules": { "communications" : { "$communication":{ ".read" : true, ".write": true } } } for reason though, application not want read it fireref = new firebase(url); fireref.auth(my_token); commsref = fireref.child('communications') $scope.communications = $firebase(commsref) it works if have rule looking like { "rules": { "communications" : { ".read" : true, ".write": true } } but cause problem add together status on children node of communication. like: { "rules": { "communications" : { ".read" : true, ### rid of line , have kid handling ".write": true, "$communication...

Excel IF formula with 7 different possible variables -

Excel IF formula with 7 different possible variables - first time here! i'm looking homecoming value if cell contains of 7 different variables. as stands, formula follows: =if(h13=1, "c", if(h13=4, "c", if(h13=7, "c", if(h13=10, "c", if(h13=13, "c", if(h13=16, "c", if(h13=19, "c"))))))) it works, formula unnecessarily long. , combined 5 others part of 1 giant formula. i'm sure there's way consolidate. i've tried if(or) allows 2 variables. how create formula allows 7 variables? thanks!! you can or them together. =if(or(h13=1,h13=4,h13=7,h13=10,h13=13,h13=16,h13=19),"c") the other method using array formula: =if(or(exact(h13,l5:l11)),"c") with l5:l11 beingness {1,4,7,10,13,16,19} you can read using excel docs the first 1 simpler maintain, sec 1 more flexible. excel formula

Is there any potential downsides to using random UUID as temporary file/directory name? -

Is there any potential downsides to using random UUID as temporary file/directory name? - is reasonable utilize random uuid (uuid version 4) based on /dev/urandom or cryptgenrandom name temporary files/directories? name collision highly unlikely, there potential problems? why isn't such scheme used more frequently? random uuid temp

jquery - finding either A or B class within a loop, then executing similar code -

jquery - finding either A or B class within a loop, then executing similar code - i'm next tutorial larn jquery in 30 days on @ tuts+. have completed day #7, goes on how appendto, prependto, , such. the lesson ended "useable scenario" span wrapped around specific text in blog post, , wrapped text taken, , prepended paragraph, , floated side create pretty quote example. here have far @ jsfiddle i've taken , modified little, "pull quote left" function. what question is, how create wrapping loop search either "qo_right" or "qo_left" instead of having 2 duplicate functions. (function() { var qo_right = $('article').find('span.qo_right').each(function (){ var $this = $(this); $('<blockquote></blockquote>', { class: 'qo_right', text: $this.text() }).prependto( $this.closest('p') ); }); var qo_left = $('article').find('span.qo_left').each(func...

c++ - Drawing bitmap fonts from cp-1252 characters -

c++ - Drawing bitmap fonts from cp-1252 characters - i'm developping prototype application generate bitmap fonts giving ttf. i'm using qt library i'm using years. however, realized i've never been involved "characters" issues before. what i'm trying quiet simple: i need draw png file each character of 1252 codepage. i'm bit lost different issues related codec, textdecoder etc. any suggestion welcome ! z. the codec want qtextcodec::codecforname("windows-1252") the characters want char(32) char(255) ; set in char[225] . don't forget zero-terminate them. convert char[225] qstring codec (1) draw qstring (4) c++ qt unicode cp1252

java - GrayScale Images rendering to dark area when written using JAI / ImageIO -

java - GrayScale Images rendering to dark area when written using JAI / ImageIO - can explain why happens. read image , render output writer. if color file (or black , white), renders fine. however, if source image grayscale, black box. sample files available @ https://www.dropbox.com/sh/kyfsh5curobwxrw/aacfwr1nhx8lpuzpzvgwipqia?dl=0 my pom plugin dependancy snippets follow. <dependency> <groupid>javax.media</groupid> <artifactid>jai_core</artifactid> <version>1.1.3</version> </dependency> <dependency> <groupid>com.sun.media</groupid> <artifactid>jai_imageio</artifactid> <version>1.1</version> </dependency> a test program. understand bit of code in of no value, in reality part of larger suite of operations. code represents efforts narrow downwards issue little piece of code. import javax.imageio.iioimage; imp...