Posts

Showing posts from June, 2010

Fix Highcharts dataLabels to the bottom -

i've been searching , can't find easy way fix highcharts datalabels bottom of graphic. i'm looking following, column chart: 80 - ┌──┐ ┌──┐ ┌──┐ 40 - | | ┌──┐ | | | | 0 -|_|__|_|__|_|_|__|_|__|_| 80 40 80 80 cat 1 cat 2 thank you help. you can iterate on each elemetn, , use translate function, allows "move" svg elements. var bottom = chart.plotheight - 20; $.each(chart.series[0].data,function(i,data){ data.datalabel.attr({ y: bottom }); }); take @ simple example: http://jsfiddle.net/wmlg6/39/

symfony - Doctrine MongoDB ODM do not change state of referenced object -

i'm using symfony2 doctrinemongodb bundle. made service receives informations in json format (objects). the object i'm sending got property referencing object in different collection in database. changing reference works. in case send field, "title" objectb - sets title new value in database. how can prevent this? i want set new reference, no manipulation on object ever. here code (shortened) class fun{ /** * @mongodb\id(strategy="auto") */ private $id; /** @mongodb\embedmany(targetdocument="jokeembedded", strategy="set") */ private $jokes = array(); } class jokeembedded { /** * @mongodb\referenceone(targetdocument="jokepattern", cascade={"persist"}) */ private $ref; /** * @mongodb\string */ private $title; } class jokepattern { /** * @mongodb\id(strategy="auto") */ private $id; /** * @mongodb\st

perl - How to build up a hash data structure -

i having trouble figuring out how create several %th2 structures (see below) each of values of $th1{0} , $th1{1} , , on. i trying figure out how traverse keys in second hash %th2 . running error discussed in so, can't use string ("1") hash ref while "strict refs" in use also, when assign %th2 each key in %th1 , assuming copied %th1 anonymous hash, , not overriting values re-use %th2 . use strict; %th1 = (); %th2 = (); $idx = 0; $th2{"suffix"} = "a"; $th2{"status"} = 0; $th2{"consumption"} = 42; $th1{$idx} = %th2; $idx++; $th2{"suffix"} = "b"; $th2{"status"} = 0; $th2{"consumption"} = 105; $th1{$idx} = \%th2; $key1 (keys %th1) { print $key1."\n\n"; $key2 (keys %$key1) { print $key2->{"status"}; } #performing $key2 won't work. strict ref error. } change: $th1{$idx} = %th2; to: $th1{$idx} = \%th2;

pickle - Python for the absolute beginner, Chapter 7 challenge 2 -

i've been going through exercises in book , i've hit bit of road block. challenge to: "improve trivia challenge game maintains high-scores list in file. program should record player's name , score. store high scores using pickled object." i've managed save scores list , append list dat file. however, when try view scores/read file seems show first score entered. took @ bat file , seems dumping list correctly, i'm wondering if i'm messing retrieval part? thanks reading here's code (before): def high_score(): """records player's score""" high_scores = [] #add score name = input("what name? ") player_score = int(input("what score? ")) entry = (name, player_score) high_scores.append(entry) high_scores.sort(reverse=true) high_scores = high_scores[:5] # keep top 5 # open new file store pickled list f = open("pickles1.dat", &qu

testing - Accessing Javascript global variables from Selenium IDE -

i'm using latest selenium ide 2.2.0, and i'm having trouble trying access javascript global variable set in script. this variable acts success flag, i've put command: waitforcondition target: test value: 2000 but [error] test not defined i've tried looking @ access javascript variables selenium ide , replacing target: this.browserbot.getuserwindow().test but get [error] this.browserbot undefined i try different method of setting success flag throwing out alert, i'd know how access javascript variables. the docs mentioned storedvars, variables stored in selenium i'm @ wits' end. i looked around bit more , found following documentation for command: waitforeval note that, default, snippet run in context of "selenium" object itself, refer selenium object. use window refer window of application, e.g. window.document.getelementbyid('foo') if need use locator refer single element in application page, can us

c++ - Conditional weak-linked symbol modification/redeclaration -

i have following weakly linked declaration: extern __attribute__((visibility ("default"))) type* const symbolname __attribute__((weak_import)); the problem is, symbol may or may not defined, depending on operating system. so, when use func(symbolname); , signal 11 crash because attempting dereference of null. ask if(&symbolname != null) { func(symbolname); } , require using symbol remember asking question, not optimal. i looking wizardly magic conditionally modify or redeclare symbol, if unavailable, have default value func work with. i understand ugly solution , not recommended. @ point, want know if there way it, no matter how ugly or low-level.

Wrapping methods up in a JavaScript object -

i have need this: <script src="apiwrapper.js"></script> <script> apiwrapper.init('api_key'); apiwrapper.dosomethingelse(); </script> essentially, have singleton style object in page can add methods , properties , have available anywhere within page. what's best way this? you use approach (which gives way of having private properties/functions): var apiwrapper = apiwrapper || (function () { /* private functions here */ var privatefunction = function () { } /* public functions here */ return { init: function (opts) {}, dosomethingelse: function () {} }; })();

Wordpress update user meta through woocommerce checkout process -

i'm creating points based system woocommerce in wordpress. based on usermeta added manually. (the idea being, people recycle products gain points, use points purchase products on seperate woocommerce shares user data). i have created checkout disables if not enough points, or adds amount user have left after purchasing products (possibly vunerable @ stage besides point). the problem i'm having updating user meta after purchase has been made. i.e every user has box called 'points' in user table admins can see - needs updated new formula of (current points - order total). heres code came not sure how implement or whether work.. planted in 'thankyou page' occurs after order has been 'placed' <?php $user_id = wp_get_current_user(); $pointsafterorder = $current_user->points - $woocommerce->cart->total; // return false if previous value same $new_value update_user_meta( $user_id, $current_user-&g

java - How to replace the first word from each sentence (from input file) -

my problem have input file , must rewrite text, in output file without 4 words("a"),("the"),("a"),("the").i managed solve "a" , "the", not "a" , "the". plz me code? in advance. below problem,the input , code: problem: the english, words "a" , "the" can removed sentences without affecting meaning. opportunity compressing size of text files! write program inputs text file, line-by-line, , writes out new text file each line has useless words eliminated. first write simple version of program replaces substrings " " , " " in each line single space. remove many words, these words occur @ beginnings or ends of lines, , words start capitals. so, improve first program handles situations well. c:>java remover < verbose.txt > terse.txt note: there various replace() methods of class string simplify program. try write program without using them. input file

jquery trigger or click not working? -

i struggling why can't trigger or click work? here js: $(document).ready(function () { function libertypop(){ var popup = jquery("#lightbox-30835684809970"); popup.click(); popup.trigger('click'); console.log("should work"); } libertypop(); }); this should triggering click on anchor: <a id="lightbox-30835684809970" style="cursor:pointer;color:blue;text-decoration:underline;"> liberty pop-up </a> in page, when click on link, pop appear, don't understand why jquery 'trigger' or 'click' not doing same? if want trigger native click event of anchor tag, use js event: var popup = jquery("#lightbox-30835684809970")[0]; //<< [0] retruns dom node popup.click(); but didn't have setted attribute href, nothing! if want trigger click handler attached using jquery, first set one. using code: $(document).r

javascript - Three.js gui disappearing in background behind reloaded textures -

Image
so i'm guessing normal behavior, wanted ask make sure, , figure out how fix problem. in mapping app, have plane gets pre-loaded textures, , creates gui, 1 here: gui however in reality, program creates bunch of "layers" each own textures , places them in same spot. 1 layer corresponds 1 zoom level. when user zooms in amount, loops through current visible layer , makes meshes invisible, while making new ones next zoom level visible. the problem i'm having gui gets pushed background, behind textures. how keep gui in front? i cannot click on on gui. i've inspected html, , there's nothing indicative of causing this. changed z-index sure , had no effect. i've turned off textures, still having problem. strange part is, working gui example linked above has html looks mine. no clue be

javascript - How to get value of 'this' inputbox? -

i writing web application user clicks on div, holding input text box predefined text in it. when user clicks on div code printed in separate text box. trying write function grabs value of the clicked on div's text input. have working clicking on input box using $(this).val(); want click on div , gets value of (this)('input[type=text].provided_code').val(); is there way text input inside div? there 20 div's on page 20 inputs in each div, , each have same class name etc. yes can specify selector context: by default, selectors perform searches within dom starting @ document root. however, alternate context can given search using optional second parameter $() function documentation: http://api.jquery.com/jquery/#jquery1 so code this: $('input[type=text].provided_code', this).val() performance: http://jsperf.com/jquery-find-vs-context-sel/38

javascript - Get a complete a tag and not only the href attribute -

i going through string container tags contains. var links = container.find("a"); links.each(function(i, txt){ alert(txt); //shows http://some.com instead of <a href="http://some.com">some</a> }); any idea how solve one? thanks try - alert(this.outerhtml);

c# - Combo box causes app to crash when accessed using a touch interface, but works with a mouse -

i have combo box displays list of repositories on database, , event have dropdownopened event, during access database list of items display. everything works great using mouse open combo box , select item, when use touch screen (either on windows 8 or surface) there problems. the first time open combo box , select there no issues, after i've selected item, if try open list again, app crashes. here xaml combo box: <combobox x:name="repositorycombobox" grid.row="3" grid.column="1" selecteditem="{binding selectedrepository, mode=twoway}" itemssource="{binding repositorylist, mode=twoway}" style="{staticresource comboboxstyle}" isenabled="true" dropdownopened="reposdrop"/> and code drop down opened event: private async void reposdrop(object sender, object e) { viewmodel.repositorylist = null; try { await

iphone - Expand section UITableview getting crash when reloadSections -

trying expand sections each section have 2 rows when expanded. giving crash. below code trying. -(nsinteger) numberofsectionsintableview:(uitableview *)tableview { return [self.marrques count]; } -(nsinteger) tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { if(!helpon) return 1; else if(section == selectedcellindexpath) { return 2; } else{ return 1; } return 1; } -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cellidentifier"; uitableviewcell *cell; cell = [self.mhelptable dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } else{ cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } uiview* mybackgroundview = [[uiview alloc] i

How to build reverse mapping URLs inside JSP using spring mvc router? -

i'm using spring-mvc-router have urls in centralized location. how can make reverse mapping of controllers inside jsp files? it's described in readme page of project, section integrating jsp : in jsp, declare taglib: <%@ taglib prefix="route" uri="/springmvc-router" %> then use reverse method generate urls: <a href="<route:reverse action="usercontroller.listall" />">list users</a> dynamic parameters can used: <a href="<route:reverse action="usercontroller.showuser" userid="42" />">show user 42</a>

java - EOFException in readUTF -

i getting below eofexception while using readutf() method, please let me know how overcome problem , please suggest how readutf() transfers socket information on other networks import java.io.*; import java.net.*; public class greetingserver { public static void main(string args[]) { string servername =args[0]; int port = integer.parseint(args[1]); try { system.out.println("server name "+ servername +"port"+port); socket client = new socket(servername,port); system.out.println("just connected to"+ client.getremotesocketaddress()); outputstream outs = client.getoutputstream(); dataoutputstream dout = new dataoutputstream(outs); dout.writeutf("hello from"+client.getremotesocketaddress()); inputstream in = client.getinputstream(); datainputstream din = new datainputstream(in); system.out.println("se

mysql - Distinct with a group by -

i need write query filter data. in table have data grouped val1 multiple values of val2 witch have remove. my table this: | id | val1 | val2 | other | |------------------|------- | 1 | a1 | b1 | ... | 2 | a1 | b1 | ... | 3 | a1 | b2 | | 4 | a2 | b1 | | 5 | a3 | b1 | | 6 | a3 | b1 | | 7 | a3 | b2 | | 8 | a4 | b1 | | 9 | a4 | b3 | | 10 | a5 | b1 | and need this: | id | val1 | val2 | |------------------| | 1 | a1 | b1 | | 3 | a1 | b2 | | 4 | a2 | b1 | | 5 | a3 | b1 | | 7 | a3 | b2 | | 8 ... | 9 ... | 10 ... it's sort of select *,distinct(val2) table group val1.. you on right track using group by following should return results per question select min(id) id, val1, val2 yourtable group val1, val2 breakdown use aggregate function on column don't wish group on. in our example min aggregate function on id column. returns lowest id each group group by columns

PHP: function glob() on Windows - patterns with multiple ranges -

i want list of images in directory ($path). want perform case-insensitive research file extension. code below works on linux, not on windows. foreach ( glob("$path/{*.[jj][pp][gg],*.[jj][pp][ee][gg],*.[gg][ii][ff],*.[pp][nn][gg],*.[bb][mm][pp],*.[tt][ii][ff][ff]}", glob_brace | glob_nocheck ) $file ) { echo $file; } i added glob_nocheck flag view computed patterns. here's response: fotogallery/dir/[gg] fotogallery/dir/[gg] fotogallery/dir/[ff] fotogallery/dir/[gg] fotogallery/dir/[pp] fotogallery/dir/[ff] it seems last range ([...]) of each comma-separated expression considered! why happens? thank you! :-) this may fix problem php manual comment sort of issue

iphone - UIWebView back button not getting enabled -

in application have uiwebview in need add browser functionality( user can goback,forward or reload page ). achieve have used code tutorial. in code have 1 change in viewdidload : i loading data local html file this: nsstring *htmlfile = [[nsbundle mainbundle] pathforresource:@"file name" oftype:@"html" indirectory:no]; nsdata *htmldata = [nsdata datawithcontentsoffile:htmlfile]; [self.webview loaddata:htmldata mimetype:@"text/html" textencodingname:@"utf-8" baseurl:[nsurl urlwithstring:@""]]; instead of: nsurl* url = [nsurl urlwithstring:@"http://iosdeveloperzone.com"]; nsurlrequest* request = [nsurlrequest requestwithurl:url]; [self.webview loadrequest:request]; after loading initial html file if making click on page button should enabled, instead of getting enabled after second url click , not able go original home page. please me this. thanks. i got answer. it's because load data webview w

java - Injection of touch events using screen driver -

using android-event-injector library, wrote application inject touch event when event triggered. problem need inject touch @ absolute coordinates of given view , following location on screen: view v = /* find view*/; int [] coords = new int[2]; v.getlocationonscreen(coords); this gives me absolute coordinates on screen. problem touch injection doesn't work. i can inject correctly touches in screen driver, reason coordinates misunderstood , touches injected elsewhere. here examples (my screen 1024x600 landscape oriented): coords (0,0) -> injected in (0,0) coords (0,600) -> injected in (0,351) coords (1024,0) -> not injected (most x out of range) coords (1024,600) -> not injected (most x out of range) coords (640,480) -> not injected (most x out of range) coords (512,300) -> injected in (872,175) coords (100,100) -> injected in (170,58) based on sample values appears touchscreen (600, 1024), mapped (1024,600) display. to gen

java - How to fix gap in GridBagLayout -

Image
i using gridbaglayout create jpanel, called 'preset' gets replicated several times in jframe. each preset have multiple rows (jpanels). goal 1 line (the first) show up, when edit button clicked show. right now, edit button works, there massive space between lines. want when lines collapsed, each preset directly above each other (no space). can see in following picture talking about. this how looks: this how want look: i need gridbag don't know what. have read several tutorials , have written thought should be, no luck. in advanced. package sscce; import java.awt.borderlayout; import java.awt.component; import java.awt.dimension; import java.awt.flowlayout; import java.awt.gridbagconstraints; import java.awt.gridbaglayout; import java.awt.gridlayout; import java.awt.toolkit; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.io.ioexception; import javax.swing.jbutton; import javax.swing.jcombobox; import javax.swing.jframe; im

How to replace space/character with specified character after first numeric value in string using C#? -

i have string containing special characters & numeric values . eg: 3-3 3 3-3"3/4 3-3-3/4 3-3 3/4 3 3 3 3'3 3 output must be: 3f3 3 3f3"3/4 3f3-3/4 3f3 3/4 3f3 3 3f3 3 i have tried using : public static string replacefirst(string text, string search, string replace) { int pos = text.indexof(search); if (pos < 0) { return text; } return text.substring(0, pos) + replace + text.substring(pos + search.length); } using above code replaces first occurrence specified character works fine. eg: 3-3 3 output: 3f3 3 but 3 3-3 output: 3 3f3 according code correct. want replace space/character after first numeric 3f3-3 help appreciated! simple loops should work. for(int =0; < mylistofstrings.count; i++) { char[] chars = mylistofstrings[i].tochararray(); (int j = 0; j < chars.count(); j++) { if (char.isdigi

c# - How to create multiple threads from an application and do not listen to their response? -

i trying following : i have server supposed many messages queue , process them. want create new thread every message , threads handle response queue, want server (core thread) listening messages , creating threads, not caring of happens them. how can achieve this? know can use thread class create thread application keeps listening thread until if finishes. can create async method , run happens when finishes? method supposed static if want async in current application not solution since use many non static variables method. any ideas appreciated. unless have specific reason, i'd recommend using tasks instead of threads. they'll run in background anyway, produce less cpu/memory overhead , (in opinion) easier handle in case of exception,... task t = task.run(() => processmessage(message)); maybe take @ this introduction

android - The ActionMode is being created twice with the ActionBarCompat r18 -

i found bug , posted in android's bug tracker: https://code.google.com/p/android/issues/detail?id=58321 i'm creating q&a-style question having same problem. if have same problem can't wait bug fixed, use patched version i've created solve bug: https://github.com/cybereagle/supportlibraryv7appcompatpatched

Update the preview text in a URL shared on Facebook -

so have client facebook page (currently unpublished). have shared hundreds of links website on wall on last few years. problem preview text on (if not all) of them out of date. i have looked on similar issues on here , have seen things suggest going https://developers.facebook.com/tools/debug , putting in url , clears facebook's cache. so tried on couple of links, , info debugger gets me correct, doesn't update links on facebook wall. question this: there way facebook refresh these already posted link descriptions, or have go through them manually reposting hundreds of links? i hope can help!

c# - DataGridView gives an error if a table field is binary type -

Image
for reasons, need write own sqlquery tool. works. but when select table contains binary type, gives me error i've shown below. i used datagridview. code below. private void button1_click(object sender, eventargs e) { string sql = txtsql.text.trim().tostring(); try { gridresult.datasource = getdataset(sql).tables[0]; } catch (sqlexception err) { messagebox.show("error : " + err.message + "-" + err.number); } } public dataset getdataset(string sql) { sqlconnection conn = new sqlconnection(connstr); sqldataadapter da = new sqldataadapter(); sqlcommand cmd = conn.createcommand(); cmd.commandtext = sql; da.selectcommand = cmd; dataset ds = new dataset(); conn.open(); da.fill(ds); conn.close(); return ds; } i wonder, there way prevent showing binary area or pre

c# - Rx how to create a sequence from a pub/sub pattern -

i'm trying evaluate using rx create sequence pub/sub pattern (i.e. classic observer pattern next element published producer(s)). same .net events, except need generalize such having event not requirement, i'm not able take advantage of observable.fromevent. i've played around observable.create , observable.generate , find myself end having write code take care of pub/sub (i.e. have write producer/consumer code stash published item, consume calling iobserver.onnext() it), seems i'm not taking advantage of rx... am looking down correct path or fit rx? thanks your publisher exposes iobservables properties. , consumers subscribe them (or rx-fu want before subscribing). sometimes simple using subjects in publisher. , more complex because publisher observing other observable process. here dumb example: public class publisher { private readonly subject<foo> _topic1; /// <summary>observe foo values on topic</summary> p

.net - Get Timezone Offset of Server in C# -

how can timezone offset of physical server running code? not date object or other object in memory. for example, following code output -4:00:00 : <%= timezone.currenttimezone.getutcoffset(new datetime()) %> when should -03:00:00 because of daylight savings new datetime() give january 1st 0001, rather current date/time. suspect want current utc offset... , that's why you're not seeing daylight saving offset in current code. i'd use timezoneinfo.local instead of timezone.currenttimezone - may not affect things, better approach. timezoneinfo should pretty replace timezone in code. can use getutcoffset : var offset = timezoneinfo.local.getutcoffset(datetime.utcnow); (using datetime.now should work well, involves magic behind scenes when there daylight saving transitions around now. datetime actually has four kinds rather advertised three , it's simpler avoid issue entirely using utcnow .) or of course use noda time library inst

javascript - HTML automatic site login filling. value with no parameters -

the website im trying login has following username field <input type="text" id="inputemailhandle" name="inputemailhandle" value> im using zombie headless browser , nodejs, zombie cannot find input field named "inputemailhandle" cannot automatically log in, think because of value> there anyway can around it? or know way javascript , nodejs? ps website im trying log craigslist here's code var browser = require("zombie"); var assert = require("assert"); browser = new browser() browser.visit("https://accounts.craigslist.org", function () { browser. fill("inputemailhandle", "person@email.com"). fill("inputpassword", "password"). pressbutton("button", function() { console.log("logged innnnn!!!"); assert.ok(browser.success); }) }); the website running iso-8859-1 encoding, apparently not supported

html - Padding changes when the browser is zoomed in or out -

Image
i have thumbnail image , smaller image overlaps thumbnail image. padding changes smaller overlapping image zoom in , out , problem exist chrome browser. working fine ie , firefox. tried using percentage set padding values smaller image problem still exist. here images. this html <div class="car-item"> <div class=" car-image"> <img src="/~/media/images/thumb.ashx" alt="image 1" /> </div> <div class="car video"> <a href="#">video</a> </div> <div> position car video absolute position car item relative , car-image static you have issues @ times when using percentages. example of when use absolute positioning . i have no idea code looks here basic example of how accomplish have pi

django - FeinCMS Initial Installation: Templates -

so trying feincms , running , have working on backend cannot page load: this how models.py setup: page.register_templates({ 'title': _('standard template'), 'path': 'base.html', 'regions': ( ('main', _('main content area')), ('sidebar', _('sidebar'), 'inherited'), ), }) page.create_content_type(richtextcontent) page.create_content_type(mediafilecontent, type_choices=( ('default', _('default')), ('lightbox', _('lightbox')), )) the error templatedoesnotexist @ /test/ zipfel/base.html django tried loading these templates, in order: using loader django.template.loaders.filesystem.loader: using loader django.template.loaders.app_directories.loader: /opt/local/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/django/contrib/auth/templates/zipfel/base.html (file not exist) /opt/loc

css - How do I resize an image in IE 8 -

i have image 90px x 90px (it's jpg file) , can't figure out how make 60px 60px in internet explorer. looked @ few sites told me use css style: .img { -ms-interpolation-mode: bicubic; } but nothing happened. css i'm using works in fireforx , chrome: .img { horiz-align: center; width: 60px; height: 60px; margin: 10px; border: 1px rgb(218, 218, 218) solid; background: #c4c4c4 no-repeat 0 0; } the issue original code you're specifying img class i.e .img rather img here's 2 ways this. 1st no css: <img src="your-image.jpg" alt="" width="60" height="60" /> 2nd css: <img src="your-image.jpg" alt="" class="image-resize" /> ... img.image-resize { width: 60px; height: 60px; }

python - selenium with scrapy for dynamic page -

i'm trying scrape product information webpage, using scrapy. to-be-scraped webpage looks this: starts product_list page 10 products a click on "next" button loads next 10 products (url doesn't change between 2 pages) i use linkextractor follow each product link product page, , information need i tried replicate next-button-ajax-call can't working, i'm giving selenium try. can run selenium's webdriver in separate script, don't know how integrate scrapy. shall put selenium part in scrapy spider? my spider pretty standard, following: class productspider(crawlspider): name = "product_spider" allowed_domains = ['example.com'] start_urls = ['http://example.com/shanghai'] rules = [ rule(sgmllinkextractor(restrict_xpaths='//div[@id="productlist"]//dl[@class="t2"]//dt'), callback='parse_product'), ] def parse_product(self, response): self.

Velocity: Dereferencing a variable with a concatinated name -

i'm new velocity , couldn't find addressed problem, apologize if it's trivial. have following 200 variables. #set( $a1 = "apple", $b1 = "red", $a2 = "banana", $b2 = "yellow" .... .... $a100 = "plum", $b100 = "purple) i want output fruit followed color. there way concatenate "a" , "b" each of numbers in range(1,100) , dereference variable? like #foreach( $i in [1..100]) #set( $fruit = "a{$i}") #set( $color = "b{$i}") fruit $fruit color $color. #end i've tried many things, can ever manage output $a1 $b1 strings rather refer to. thanks! #set ($d = '$') #set ($h = '#') #foreach ($i in [1..100]) #evaluate("${h}set(${d}fruit = ${d}a${i})") #evaluate("${h}set(${d}color = ${d}b${i})") fruit ${fruit} color ${color}. #end

vba - MS Access runtime error 2115 -

in ms access, have 2 unbound combo-boxes: statebox , dvpcbox . statebox list of u.s. states , dvpcbox contains employee names query based on value of statebox. i'm trying set value of dvpcbox equal first item in list. since list of employees based on value of statebox, need value of dvpcbox update every time statebox changes. tried following: private sub statebox_afterupdate() me.dvpcbox.requery if (me.dvpcbox.listcount = 1) me.dvpcbox.setfocus me.dvpcbox.listindex = 0 //<-error here end if end sub but got runtime error 2115 - macro or function set beforeupdate or validationrule property field preventing microsoft office access saving data in field. the strangest thing me i'm not using beforeupdate event or validationrule (as far i'm aware.) itemdata(0) first combo box value. set combo equal that. private sub statebox_afterupdate() me.dvpcbox.requery if (me.dvpcbox.listcount >= 1) me.dvpcbox.setf

javascript - Angular extending ui.bootstrap.progressbar to support some text on the progressbar -

i'm using ui.bootstrap.progressbar (code here: https://github.com/angular-ui/bootstrap/blob/master/src/progressbar/progressbar.js ) , i'm trying extend support custom html (or text) on progess bar. looks in vanilla bootstrap: <div class="progress"> <div class="bar" style="width: 60%;">this thing @ 60%</div> </div> http://plnkr.co/edit/wurplka0y6ck7hyt3gl1?p=preview i'm new @ directives, tried: in progressbarcontroller added label variable var label = angular.isdefined($attrs.label) ? $scope.$eval($attrs.label) : ''; also modified object controller returns include label. added bar.label in directive's template so: <div class="progress"> <progressbar ng-repeat="bar in bars" width="bar.to" old="bar.from" animate="bar.animate" type="bar.type"> </progressbar>

Android: client-server, user authentication -

i have never built such android application communicate sever. want want send username , password server, match them on server , when username , password matches next screen should shown. next screen should have 1 text view saying "welcome username". i want guys tell me step step guide - what should write in android app? what should write on server side? how , write server code? which language should use server side? how save several usernames-passwords on server? i don't have real server. run entire code on localhost. update: this wrote in android app. don't know how correct. public void clicked(view v) { system.out.println("button clicked"); edittext username = (edittext) findviewbyid(r.id.edituser); edittext password = (edittext) findviewbyid(r.id.editpass); editable user = username.gettext(); editable pass = password.gettext(); httpclient httpclient = new defaulthttpclient(); httppost httppost = new ht

wpf - Binding a nested list into addition columns in xaml -

i have collection binding datagrid (the wpf extended toolkit datagrid). fine standard binding want bind nested list in collection additional columns. for example person name age birthday phonenumbers[] where name, age, , person bind person might have many phone numbers use list instead of single object. strictly speaking "phonenumbers" type stores information "home" or "mobile" , want header in new column. data grid like name age birthday home mobile work john 42 1/2/1234 1234 5678 9012 etc. dont know in advance how long nested list be. clear learning purposes trying figure out if doable in pure xaml. understand add columns @ runtime in code behind. not sure possible however. if understand, think phone numbers collection cannot shown side side other columns, instead need manage using row details in datagrid

Android percent field field fill too much -

in android app finding percent of 2 other counters code double total1 = counter + counter1; double totaal2 = counter / total1 * 100.0; percentfield.settext("" + total2); my codes work great when percent field showing 50%, 25% etc. showing 33.33333333333% there way, short down percent field showing 33.3 edit have short down code under layout.xml android:maxlength="3" try this: totaal2 = totaal2 * 10; totaal2 = math.round(totaal2 ); totaal2 = totaal2 / 10;

Is there reason why you can't declare a static variable within a C# method? -

i've been working in c past couple of years , i've managed use putting single-purpose, static variables near used within code. while writing basic method in need of method-scope static value, bit surprised find compiler didn't tried define static object within method. googling has verified isn't possible within c#. still, i'm curious why code, following, off limits. public int incrementcounterandreturn() { static int = 0; return ++i; } granted, simplistic example redefined same affect that's beside point. method-scope, static values have place , purpose. design decisions have prevented such implementation of static objects within c#? we're on c# version 5.0 , it's 2013. can assume isn't possible because of design choice , not because "that's complex , hard stuff implement." have insider information? the language design team not required provide reason not implement feature. rather, person wants fea

javascript - How to parse html data using jquery? -

i have trouble using broken code extract data html . 1 tell me wrong it? here example in jsfiddle. http://jsfiddle.net/ajm7u/3/ var data = []; var htmldata = '<li>'; htmldata += ' <a href="/mango/" >'; htmldata += ' <img src="./season/123434mango.jpg" width="180" height="148"'; htmldata += ' alt="mango season" class="png"></a>'; htmldata += ''; htmldata += ' '; htmldata += ' <div class="thumbnail_label">ok</div>'; htmldata += ' '; htmldata += ''; htmldata += ' <div class="details">'; htmldata += ' <div class="title">'; htmldata += ' <a href='; htmldata += ' "/mango/"> mango</a>'; htmldata += ' <span class="season">2</span>'; htmldata += '

android - What is the image ratio of xxhdpi? -

what image ratio of xxhdpi? answer should related to: http://developer.android.com/images/screens_support/screens-densities.png ? the image ratio xxhdpi 3.0

c++ - Class template where variable class derives from certain abstract class -

i want ensure in definition of following templated class b, class derives abstract class c. can this? template <class a> class b { // must derive c ... }; i using c++11. use std::is_base_of : template <class a> class b { static_assert(std::is_base_of<c, a>::value , "a must derive c"); //... }; note is_base_of<c, c>::value true, may want use std::is_same ensure a not c itself: static_assert(std::is_base_of<c, a>::value && !std::is_same<c, a>::value , "a must derive c");

javascript - Using jquery append method -

this question has answer here: jquery dom changes not appearing in view source 5 answers in code did like $("#jdoe").append("<h3>test</h3>"); html <html> <head> </head> <body> <div id="jdoe"></div> </body> </html> it worked expected (the text test displays in h3), expecting if view source in browser see <html> <head> </head> <body> <div id="jdoe"><h3>test</h3></div> </body> </html> please correct me if expectations wrong you haven't changed source of page, you've changed dom. if use developer tools preferred browser, you'll see changes there. i think can developer tools browsers hitting f12 .

ruby on rails - Is form data passed through session or params? -

i not understanding difference between session , params in following application. a user submits new movie form. how associated controller access title of movie? session['title'] session.title params['title'] params.title all of above based on stackoverflow answer @ difference between session , params in controller class : params live in url or in post body of form, vanishes query made. session persists between multiple requests (the info stored in cookies depends on configuration). to short: params: 1 request (creation of 1 object, access 1 particular page) session: info persisted (cart, logged user..) i chose (1) session ['title'] on quiz , got answer wrong. chose (1) because thought involved accessing information had persist. am misinterpreting question , maybe falls more under "one request only" answer should (3) params['title'] ? to attempt answer questio

wordpress - Virtual Page Within Theme Template -

i creating plugin needs virtual page in order dynamically create "review order" page (orders custom post type created). able create virtual page using following code: // set rewrite rules order page add_action( 'init', 'action_init_redirect' ); function action_init_redirect() { add_rewrite_rule( 'orders/?', 'index.php?orders=new', 'top' ); } add_filter( 'query_vars', 'filter_query_vars' ); function filter_query_vars( $query_vars ) { $query_vars[] = 'orders'; return $query_vars; } add_action( 'parse_request', 'action_parse_request'); function action_parse_request( &$wp ) { if ( array_key_exists( 'orders', $wp->query_vars ) ) { //beginning of page code echo "hello"; exit; } } the problem creates page blank template, is, above code creates blank page text hello . virtual page within theme of site , displayed regular page within wordpress fram

How to import a Stata file into SAS 9.0? -

i have converted stata file old version saveold the following doesn't work sas 9.0 proc import datafile="d:\hsb.dta" out=mydata dbms = dta replace; run; proc print data=mydata; run; error: dbms type dta not valid import. sas did not add support importing stata files until version 9.1.3 (see this tech support note ). need either upgrade version of sas 9.1.3 or newer (current version 9.3 9.4 in process of being released), or export stata in format such text file nick suggests. assuming version of sas validly licensed, should able upgrade contacting sas site representative. there's little reason use 9.0; replaced 9.1.3 due several significant issues 9.0. you need have licensed sas/access pc file formats. optional license base sas. can verify license running: proc setinit; run; if see entry for sas/access interface pc files then have licensed. if not need contact site rep or consider alternative direct import.

join - SQL: Randomly assign value of table to another table -

i have 2 tables, , b a pretty large, 200,00 rows, columns x1 x2 , x3. column x1 has 50 unique values, repeated. b smaller table, 50 rows (same unique values of x1), columns x1, x4, x5 what looking accomplish to, join , b that, of unique values of a.x1 , b.x1, b.x4 randomly goes b.x5 times a.x6.

c# - AutoPostBack: true vs false -

before begin, have seen this question similar topic (as this one , this one ), none of answer question completely. understand concepts presented in these questions/answers, have more questions. a) happens if have multiple controls autopostback="false" , change number of them before postback? take following brief example (assume else needed page written correctly , trivially; e.g., page_load ): default.aspx: <asp:dropdownlist id="ddlfoo" runat="server" onselectedindexchanged="ddlfoo_changed" autopostback="false" > <asp:listitem text="a" /> <asp:listitem text="b" /> <asp:listitem text="c" /> </asp:dropdownlist> <asp:dropdownlist id="ddlbar" runat="server" onselectedindexchanged="ddlbar_changed" autopostback="false" > <asp:listitem text="1" /> <asp:listitem text="2&quo

PHP Template Engine built by url -

i searching kind of dynamic template engine want built url. if url localhost/root/this/is/the/path/to/signup.php php code should watch file signup.php in directory this/is/the/path/to/ for time using arrays of url following code shows: $url = isset($_get['url']) ? $_get['url'] : null; $url = rtrim($url, '/'); $url = explode('/', $url); if (empty($url[0])) { $url[0] = "path/startpage.php"; } if (isset($url[2])) { require "path/error.php"; } else if (isset($url[1])) { $file1 = 'path/' .$url[0].'/'.$url[1].'/'.$url[1].'.php'; if (file_exists($file1)) { require $file1; } else { require "error.php"; } } else if (isset($url[0])) { $file0 = 'path/'.$url[0].'/'.$url[0].'.php'; if (file_exists($file0)) { require $file0; } else { require "path/error.php"; } } but script have every case

wpf - WinAPI Copy System Menu to new Window -

i docking application's window inside of wpf window using hwndhost. this, have set ws_child style attribute of window docking , lose system menu of window not acceptable. using hwndhost there no way around since throw exceptions if attribute not set. my question is; since application doesn't use system menu, there way directly copy system menu of docked application app's window? winapi menu functions i'm aware of require me build menus scratch , don't know how hook menu hosted application. i'm not sure if matters, 2 windows within same process. application plugin of application window docking. use getsystemmenu hmenu system menu given window. should able cross-reference own window's system menu docked application's system menu, copy across own window doesn't have, , forward them on handling , forwarding relevant wm_syscommand messages. or maybe copy whole system menu , forward of them on. this require bit of trial , error

iphone - Safely call method of later UIViewController from GCD of object init -

thanks lock nsmutablearray of object not rest of object when using gcd have user object populates array of locations via gcd @ init in hope time modally locationviewcontroller locations present in user.locations (where user passed along viewcontrollers), if aren't there display 'loading...' in picker. i ideally force refresh within gcd of user in dispatch_sync method. can added method locationviewcontroller refresh picker etc i'm not sure how safely access this. my first thought in locationviewcontroller if locations aren't there (i.e. nil) set reference locationviewcontroller in user. within dispatch_sync call method [loccont mymethod] if loccont isnt nil. i'm not sure how set property in user class? @property (strong, nonatomic) locationsviewcontroller * loccont; what worries me user can @ anypoint logout , return root view. i'll set user.loccont = nil will arc sort hungover memory nicely? my other concern happen if don't choose

android - Can't align ImageViews to the left in ListView Row (RelativeLayout) -

Image
this how have view @ moment. as can see, icons not aligned way left. red line objective. if go way left, no problem, because can solve later marginleft . this xml code ( layout/listview_style_listview.xml ): <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/backgroundcolor" android:orientation="vertical" android:scaletype="center" > <linearlayout android:id="@+id/titlelayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="2dp" android:layout_marginbottom="2dp" android:layout_marginleft="7dp" android:layout_marginright="7dp"

c++ - How to access a member variable of a class even after class destruction? -

i have question regarding usage of member variable of class. suppose, have class abc , have member variable buffer declared public within class, how can use variable buffer after class has been destroyed? can declare variable buffer static? allow me access variable after class has been destroyed? perhaps examples help. class abc { public: std::queue<int> buffer; }; // of above class void foo() { { abc c; // c instance of class abc. c //object created class abc c.buffer.push_back(0); // can change public members of c } // c destroyed. not exist. there nothing access // abc still exists. class has not been destroyed } but, here's possibility: void foo() { std::queue<int> localbuffer; { abc c; // c instance of class abc. c //object created class abc c.buffer.push_back(0); // can change public members of c localbuffer = c.buffer; } // c destroyed. n

css - Weebly: Edit individual elements in navigation bar -

i'm trying edit border-top of each element in navigation bar in weebly can style each of them different color. however, when jump html file, see "{menu}" within navigation div. want able id out each individual element can style it. thanks! got it! used :nth-child(). awesome!