Posts

Showing posts from June, 2011

html - Change free text sorting - OTRS ITSM -

hi want show free text fields in change overview , edited agentitsmchangeoverviewsmall.dtl file , added code change free text. change free text field visible in change overview enable sort can other attributes. here code: <th class="changefreetext1 $qdata{"css"}"> <a href="$env{"baselink"}action=$env{"action"};$data{"linksort"};sortby=changefreetext1; orderby=$lqdata{"orderby"}">$text{"changefreetext1"}</a> </th> <td> <div>$text{"$data{"changefreetext1"}"}</div> </td> can tell me whats missing in code. the backend kernel::system::itsmchange changesearch() not support ordering freetext fields, unfortunately, should add well.

android - how to set layout for a fragment? -

it's multi tap activity >> i'm trying set layout each tab doesnt work ! shows nothing in both tabs ! here's code public class game extends activity { public static context appcontext; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.game); //actionbar gets initiated actionbar actionbar = getactionbar(); //tell actionbar want use tabs. actionbar.setnavigationmode(actionbar.navigation_mode_tabs); //initiating both tabs , set text it. actionbar.tab roundtab = actionbar.newtab().settext("round 55"); actionbar.tab scoretab = actionbar.newtab().settext("score 55"); //create 2 fragments want use display content fragment roundfragment = new roundfragment(); fragment scorefragment = new scorefragment(); //set tab listen

Copy comments that are after the end of root tag using XSLT -

i have xml needs reordered , stored in file. have done xslt , works fine. if there comments after xml ends these comments not copied. need xslt statement copies comments present after root tag ends below code explains following original xml <company> <employee id="100" name="john" > <salary value="15000"/> <qualification text="engineering"> <state name="kerala" code="02"> <background text="indian"> </employee> </company> <!--this file contains employee information--> <!--please refer file information employee--> xslt transformation code <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxs

java - Multiple ports and threading -

i designing android software have listen n-amount of ports, lets 10. every 100ms want check out if ports have new udp-packet. after receiving packet, data inside should passed ui-thread. my question should use 1 thread receive data different ports or should create own thread every port, each timed run @ 100ms interval? practice in these cases? when port has data, deserialized object, used update data in views in ui-thread. i'm quite new socket-programming , more advanced concurrent-programming have been hesitating time without finding answers web. having thread per socket seems overkill , unless time de-serialize object excessive won't see benefit. personally (and bas pointed out; there's not in it) start out simple , have single thread checking 10 ports round-robin , sleeping between checks. if start find thread taking time processing data , time between each port being checked high can add more threads pool @ point.

android - Grid item not clickable -

i have used 1 gridview calendar in application.the gridview calendar working correctly , displayed element want.my problem when click grid item not clickable.thanks my gridview: <linearlayout android:id="@+id/gridlayoutid" android:layout_width="fill_parent" android:layout_height="fill_parent" > <gridview android:id="@+id/gridviewid" android:layout_width="fill_parent" android:layout_height="match_parent" android:horizontalspacing="-1px" android:numcolumns="7" android:stretchmode="columnwidth" android:textdirection="anyrtl" /> </linearlayout> my grid rows: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="200dp" android:layout_height="fill_parent" android:background="@drawable/gridcal" andr

c# - DevExpress Updating on Gridview with combobox column -

<dx:aspxgridview id="grid" clientinstancename="grid" runat="server" keyfieldname="projectid" width="100%" enablerowscache="false" onrowupdating="grid_rowupdating" autogeneratecolumns="false" oncelleditorinitialize="grid_celleditorinitialize"> <settings showgrouppanel="true" /> <settingsediting mode="inline" /> <columns> <dx:gridviewcommandcolumn visibleindex="0"> <editbutton visible="true" /> </dx:gridviewcommandcolumn> <dx:gridviewdatatextcolumn fieldname="projectid" readonly="true" visibleindex="0"/> <dx:gridviewdatacolumn fieldname="projectname" visibleindex="1" /> <dx:gridviewdatacolumn fieldname="projectinfo" visi

python - Error: command 'gcc' failed: No such file or directory -

i'm trying run a python setup.py build --compiler=mingw32 but results in error mentioned in subject: error: command 'gcc' failed: no such file or directory but capable of running gcc command prompt (i have added path env var): >gcc gcc: fatal error: no input files compilation terminated i'm running on windows 7 64-bit. python27. specific source i'm trying build: openpiv previous post on issue. any help/advice/solutions appreciated. after hours , hours of searching, i've discovered problem between mingw , python. don't communicate 1 another. there exists binary package of mingw (unofficial) meant use python located here it fixes problem!

Wait for process to finish before proceeding in Java -

essentially, i'm making small program that's going install software, , run basic commands afterwards prep program. however, happening program starts install, , moves on following lines (registration, updates, etc). of course, can't happen until it's installed, i'd find way of waiting on first process before running second. example, main.say("installing..."); process p1 = runtime.getruntime().exec(dir + "setup.exe /silent"); //wait here, need finish installing first! main.say("registering..."); process p2 = runtime.getruntime().exec(installdir + "program.exe /register aaaa-bbbb-cccc"); main.say("updating..."); process p4 = runtime.getruntime().exec(installdir + "program.exe /update -silent"); call process#waitfor() . javadoc says: causes current thread wait, if necessary, until process represented process object has terminated. bonus: exit value of subproce

javascript - Bookmarklet not working on IE9 -

this code works on firefox , chrome not ie9. works on same domain in ie9 fails on other domains. console shows me script1002 : syntax error. have code in jsp , loading script tag using {domain}/path controller. ( function(){ var v = "1.9.1"; if (window.jquery === undefined || window.jquery.fn.jquery < v ) { var done = false; var script = document.createelement("script"); script.src = "http://ajax.googleapis.com/ajax/libs/jquery/" + v + "/jquery.min.js"; script.onload = script.onreadystatechange = function(){ if (!done && (!this.readystate || this.readystate == "loaded" || this.readystate == "complete")) { done = true; initbookmarklet(); } }; document.getelementsbytagname("head")[0].appendchild(script); } else { initbookmarklet();

mysql - Reduce SQL statement with sum of col of result -

select *, (a / 100) a_calc, (select sum(a_calc) foo c = ? , d = ?) a_calc_sum foo c = ? , d = ? order a; the purpose here want return rows matching original query (without sum) , have mysql calculate sum of a_calc me instead of issuing separate query. without subselect seems first row in query correct sum attached. any ideas how reduce above query? i think want avoid running subquery every row - here's how: select *, / 100 a_calc, a_calc_sum foo join (select sum(a / 100) a_calc_sum foo c = ? , d = ?) x c = ? , d = ? order a;

Access MemberName/PropertyMap from ResolutionContext in an Automapper custom ValueResolver -

i need trace complex (i.e. non-default) mappings in our project. to achieve this, i'm using custom value resolver, , publishing out log event during resolution. part of message i'd know destination member being mapped, hoping find in source.context.membername - null. valueresolver: public class resolver : ivalueresolver { public event mappingeventhandler mappingevent; public delegate void mappingeventhandler(mappingmessage m); public resolutionresult resolve(resolutionresult source) { var src = (sourcedto)source.context.sourcevalue; if (!string.isnullorwhitespace(src.status) && src.status == "alert") { var newvalue = source.value + " - fail"; var fieldname = source.context.membername; //always null mappingevent(new mappingmessage(fieldname , newvalue)); return source.new(value, typeof(string)); } return source; } } ... , usag

c# - How to cache .Count() queries in NHibernate.Linq? -

how cache result of such query: session.query<entity>().count(e=> e.property == someconstant) i cannot place cacheable() after it, , if place before count(), fetch entire result set, wouldnt it? adding cacheable before count will cause aggregate count results cached . can seen sql generated example below. domain , mapping code public class entity { public virtual long id { get; set; } public virtual string name { get; set; } } public class entitymap : classmap<entity> { public entitymap() { id(x => x.id).generatedby.identity(); map(x => x.name); cache.readonly(); } } the test code itself. using (var session = nhibernatehelper.opensession()) using (var tx = session.begintransaction()) { session.save(new entity() { name = "smith" }); session.save(new entity() { name = "smithers" }); session.save(new entity() { name = "smithery" }); session.save(new ent

windows - WinAPI: InternetCloseHandle function closes the handle but not the connection -

i call wininet\internetopenurla , wininet\internetreadfile , when i'm done call wininet\internetclosehandle returns true. means handle closed, connection still in established state. why doesn't connection close when call wininet\internetclosehandle ? wininet can cache , reuse connections future requests same server.

sql server - SQl , multiple questions ( parameters in a join and putting a column into a row -

i trying group table date (mm/yyyy) , invoicetype, have tried putting in code below keep getting error 'invalid column date'. select right(convert(varchar(10), case_createddate, 103), 7) date, case_invoicetype, sum(case_totalexvat) cases ca case_primarycompanyid = 1111 group ca.date, case_invoicetype i tried this: group year(case_createddate), month(case_createddate) but error: case_createddate invalid in select list because not contained in either aggregate function or group clause any ideas ? thanks you need include non aggregated columns select in group clause. ca.date not in select, suspect want this: select right(convert(varchar(10), case_createddate, 103), 7) date, case_invoicetype, sum(case_totalexvat) cases ca case_primarycompanyid = 1111 group right(convert(varchar(10), case_createddate, 103), 7), case_invoicetype

javascript - Recursive function causes other calls to fire multiple times -

i'm working on quiz game, wherein user presented quote , has guess author: function startgame(quotes) { askquestion(quotes[0], 0, 0); function askquestion(quote, question, score) { var q = "<span class='quo'>&ldquo;</span><em>" + quote.quote + "</em><span class='quo'>&rdquo;</span>"; $('.choice').css('visibility', 'visible'); $('#questions').html(q); $('.choice').click(function(e){ $('.choice').css('visibility', 'hidden'); e.preventdefault(); var nextq = (question + 1); var btntxt = (nextq < number_of_questions ? 'next...' : 'final results'); if ($(this).attr('data-author') === quote.author) { score++; $('#questions').html('<h1>correct.</h1><a class="btn next">' + btntxt

javascript - Return checked option from array -

Image
i using radio boxes save values array, issue having trying automatically check checkbox corresponding value after page refresh or whatever i have tried following; <h3 style="margin-bottom: 0px;">floating</h3></br> <input type="radio" name="lu_ban_data[noticetype]" value="multi"<?php echo ('multi' == get_option( 'noticetype' ))? 'checked="checked"':''; ?> /></input> <h3 style="margin-bottom: 0px;">floating</h3></br> <input type="radio" name="lu_ban_data[noticetype]" value="floating"<?php echo ('floating' == get_option( 'noticetype' ))? 'checked="checked"':''; ?> /></input> the value being saved when click either 1 array (size=6) 'noticetype' => string 'multi' (length=5) corresponding checkbox isnt being checked. anyone

wait - QuickTest Professional - Using Type method on SwfObject -

i'm developing automated test suite application uses text fields are, however, rather recognized swfobjects. part of automation, i'd type person's name 1 of objects. naturally, i'm using type method it's 1 available swfobject. sometimes, if swfobject("edit_field").type "joe smith" application glitches , qtp manages fill field in structurally similar yet different string instead, such "jo smith" or "joe snith". rather nondeterministic , results produced can vary significantly. sometimes, editable field gets filled correct text, of times doesn't. no amount of wait or waitproperty(visible) managed solve far. has come across issue before , if so, offer insight solving it? might worth mentioning application queries db in background whenever types text field. many thanks, paul. hi paul try out.. set keyboard = createobject("wscript.shell") swfobject("edit_field").click keyboard.sendkeys

c++ - Timezone issue: `$ date -R` says `+0300`, but `timezone` says `-7200` -

executing $ date -r gives me +0300 but when print timezone global variable timezone , shows me -7200 . ideas what's happeninig? it looks dst not included , timezone sign different, why? timezone not know d(aylight)s(aving)t(ime) defintion. time zones constant sections on earth on year ( update : @ least naming constant during days sandford fleming invented them ). referring offset greenwich common, not make sense add temporary dst offset. the different sign dues different view point , direction of date/time , timezone. the offset given date referring from to greenwich. the timezone measured to from greenwich . regarding c system calls: gettimeofday() provides dst info. ( update : in not case glibc implementation)

.net - What type should i use for "database-like" behaviour in C#? -

i'm working on experimental setup, used write complex microstructures glass femtosecond laser. the output power of laser regulated filterwheel control (c# console)application. not know position of wheel, need initalize on startup, measuring power predefined number of points on wheel. this information (power values , corresponding position on wheel) should stored during runtime. if output power requested, controller 2 points in between desired value can found , increments position until reached. this achieve using database. initialization takes place on every startup , not need persisted, prefer keep in-memory list. so question is: is possible somehow "index" power values retrieve them quickly? you may @ using sorteddictionary<int, int> if you're going have calculate "in-between" values keys. look @ similar question here example on finding points between 2 keys using sorteddictionary

ios - UIViewImage push to new UIViewController IN STORYBOARD -

Image
from questions this , this , know how have uiviewimage push new uiviewcontroller programatically. but how can in in storyboard ? storyboard , not have multiple xib files everywhere. i've enable user interaction through storyboard , still can't create transition... drag uiviewcontroller object onto storyboard canvas select viewcontroller , in top menu bar, click editor > embed in > navigation controller. drag uiviewcontroller onto storyboard control drag first uiviewcontroller new uiviewcontroller , select push resulting options. click on segue created , go attributes inspector , enter identifier segue. in viewcontroller code you're handling uiimageview tap, call [self performseguewithidentifier:@"yoursegueidentifier" sender:self];

django - Count multiple terms -

class term(models.model): created = models.datetimefield(auto_now_add=true) term = models.charfield(max_length=255) hey guys, try count duplicate/multiple terms db table still list of items ( {term: a, count: 1, term: a, count: 1,term: b, count: 1,...} ) of table , not {term: a, count: 12, term: b, count: 1} has idea? edit: ee = term.objects.annotate(count("term")).values("term", "term__count") result: [{'term': u'tes', 'term__count': 1}, {'term': u'tes', 'term__count': 1}, what expected: [{'term': u'tes', 'term__count': 2}, {'term': 'b', 'term__count': 1} https://docs.djangoproject.com/en/dev/topics/db/aggregation/ says order being important. also, if have order_by on model, affect it. how ... ee = term.objects.values("term").annotate(count("term")).order_by()

entity framework 5 - from a point of view of performance, is the same extended methods than linq to entities? -

when work entity framewrk, if not wrong terminoly, can use linq entities , extended methods. i name linq entities query: var myresult = (from c in mycontext.customers c.id >= 35 select c).list(); and name extended methods way: list<customers> lstresult = mycontext.customers.where(c=>c.id >= 35).tolist(); in both cases same result, wonder if 1 way more efficient other, because in both case ef must convert query t-sql. thanks. it's same. declarative query syntax (your first code snippet) gets translated @ compile time methods call standard query operators/extension methods (your second code sippet) (brief reference here ). in end compiled code same , code (linq entities), when runs, performs translation sql. choosing snippet 1 or 2 matter of personal taste , preference. however, can use extension method syntax because not supported methods have counterparts in query syntax.

Adding calculated field from VBA in an Excel 2011 macro to a pivot table in an Excel 2003 book -

i have macro running in excel 2011 workbook manipulating pivot table in excel 2003 book. far haven't add issues adding or hiding fields. i'm trying add calculated field (as here - http://msdn.microsoft.com/en-us/library/ff834479(v=office.14).aspx ) , not working. ws.pivottables("retailermgmt").calculatedfields.add "asp", " = tydsmtd/tyusmtd", false gets me error 450 - wrong number of arguments or invalid property assignment. when recorded same task, result was: executeexcel4macro "(""retailermgmt"",1,""asp"",""=tydsmtd/tyusmtd"",true)" which recorded , saved in 2003 file, i'm sure it's excel 2003 business (doesn't work when run 2011). so, there way add calculated field pivot table in 2003 workbook macro being run in 2011 workbook? thanks! i ended finding easier save source data book .xlsx file within macro, dealing there.

ios - Using UISegmentedControl to show/hide buttons -

how can use uisegmentedcontrol in objective c programming show or hide buttons on screen? another question on site showed code: if (selectedsegment == 0) { [firstview sethidden:no]; [secondview sethidden:yes]; } else { [firstview sethidden:yes]; [secondview sethidden:no]; } but how put firstview , secondview? please add uibutton example if shows me example. note: cannot use view based application this, due fact program pretty far along. in advance. after @implementation line in view controller: uibutton *firstbutton; uibutton *secondbutton; in view controller, in viewdidload function (or wherever want initialize buttons), initialize buttons so: firstbutton = [uibutton buttonwithtype:(uibuttontyperoundedrect)]; [firstbutton setframe:cgrectmake(20, 100, 50, 50)]; secondbutton = [uibutton buttonwithtype:(uibuttontyperoundedrect)]; [secondbutton setframe:cgrectmake(20, 150, 50, 50)]; obviously, change style choosing , use cgrectmake position butto

c# - __doPostBack not being included as part of control -

i have been scratching head on 1 few hours , issue seems interesting. seem missing __dopostback event should come control not. have suggested adding: clientscript.getpostbackeventreference(this, string.empty); this however, while create function definition looking for, no matter page reloads on postback event. have mentioned in: __dopostback not defined this because control id not match/not found. i doing wrong considering 1) postback function not render without being brute forced in 2) when brute forced in, postback cannot find appropriate setup. here snippets of code: class definition [parsechildren(true)] [persistchildren(true)] [toolboxdata("<{0}:accordion runat=server></{0}:accordion>")] public class accordion : databoundcontrol, ipostbackeventhandler events public event jqui_event itemclick; click handler, raisepostbackevent, , onload appends __dopostback public void raisepostbackevent(string eventargument) { itemcl

c++ cli - Workaround for not having lambdas that can capture managed variables -

in c++/cli, cannot create managed lambdas (like can in c#), , can't capture managed variables. can create regular methods (rather lambdas), still left without being able capture managed variables. is there standard workaround employ in c++/cli code? in other words i'm looking standard pattern use in c++/cli following c#: class { } class b { void foo() { a = new a(); func<a> afunc = () => a; // captures } } i create member variable each variable want capture, , in delegate use member variable. wouldn't work in general case might have 2 invocations of method want work on different captured a's, work common case. create nested class capturing in ctor, , use method of nested class delegate. should work in general case, means need nested class every time want capture different variables. question: there better option ones above, or option above go-to approach? related questions: lambda expressions clr (.net) de

android - Is there a way to modularize code with the ability to run both asynchronously and on the main thread? -

suppose have object i've created. we'll call myobject . i'd able save myobject database's corresponding table. don't want happen on activity 's main thread. easy enough. created asynctask this. however, application has intentservice used sync data between device's database , cloud database. i'd save myobject s have synced down cloud device's database here, too. however, not wish happen asynchronously in intentservice . want happen on intentservice 's main thread. the purpose, obviously, modularize code doesn't need duplicated. how can modularize save code can called both asynchronously , synchronously? i suspect create saveme() method inside myobject , declare static . intentservice , call saveme() . activity , launch asynctask passes in myobject , calls saveme() . sound right? besides static sounds me, don't wish access instance variables? i don't know how application designed in general, i&

winforms - print preprinted invoice, field in position x,y c# from a file format -

excuse me, english well, see in program when need print first thing read file contain line , column of fields print in matrix printer (a printer of points, don't find correct word) my idea write in file position of fields need print this (x,y) fields1, (x,y) fields2, (x,y) fields3, and way print every fields, program need read file print, way allow me change position of fields in format if preprinted document need print change something i wanna because have many diferent preprinted invoice , need adjust printer way i read printdocument don't found explanation of , read this , simple example i hope can guide me in right direction i don't think type of printer matters (matrix vs. inkjet vs. laser). here more complete code example. http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.printpage.aspx for specific scenario, need parse x,y position information out of invoice format file each field. once have x , y, draw prin

java - Will while-loop stop mid-execution? -

when executing while loop, java check if parameter(s) true? example if while loop while(k=7) { thread.sleep(5000); } but during 5 seconds thread changes k 8, loop continue waiting or exit immediately? no, check when execution path takes there. thus, check every 5 seconds in example. if wanted notified immediately, have use wait(), notify(), or other synchronization method. here example

python - Remove call() when using Mock -

in python 2.6 or 2.7, want rid of 'call' stuff when using mock.call_args_list. i want check if mock called when argument. i have like: a = mock() ... self.assertequal(a.call_args_list, ...) but call_args_list looks like: [call(arg1, arg2, arg3), call(...)] how can access arg2 value precisely without recreating complete call object? if there way iterate in "call" object , list of argument , extract whatever need? the thing had no problem, call_args_list returned me lists without "call" stuff , able wanted do, reason "call" started appearing , don't know how handle correctly. you can do: >>> import mock >>> my_call = mock.call('test', example=3) >>> name, args, kwargs = my_call >>> name '' >>> args ('test',) >>> kwargs {'example': 3} this give name (not available), positional arguments , keyword arguments of call. according the d

php - Preg_replace not working as wanted -

basically have following text stored in $text var : $text = 'an airplane accelerates down runway @ 3.20 m/s2 32.8 s until lifts off ground. determine distance traveled before takeoff'. i have function replaces keywords on text array named $replacements (i did var_dump on it) : 'm' => string 'meter' (length=5) 'meters' => string 'meter' (length=5) 's' => string 'second' (length=6) 'seconds' => string 'second' (length=6) 'n' => string 'newton' (length=6) 'newtons' => string 'newton' (length=6) 'v' => string 'volt' (length=4) 'speed' => string 'velocity' (length=8) '\/' => string 'per' (length=3) 's2' => string 'secondsquare' (length=12) the text goes through following function : $toreplace = array_keys($replacements); foreach ($toreplace $r){ $text = preg_replace("/\b

image - Issues with PhotoUrl -

i'm trying edit tumblr layout able see image @ full height/width scaled down. far understand can done max-width/max-height being set 100% while still staying inside it's original container. my problem every time try change settings under photourl other pre-prescribed -500, -250, etc. entire image goes blank. this coding: {block:photo} <center>{block:indexpage}{linkopentag}<a href="{permalink}"> <table width="500" height="200" "border="0" cellspacing="0" cellpadding="0"> <tr> <td background="{photourl-500}" style="background-position:center center;">&nbsp;</td> </tr> </table> </a>{linkclosetag} {/block:indexpage} thank can help! this should use high res image: {photourl-highres} also, you're going run problems {linkopentag} , {permalink} link. should remove 1 or other. {linkopentag} render anchor tag, in ca

codenameone - Does codename one cloud bind to other cloud storage services? -

can bind codename 1 apps cloud storage services other provided codenameone? sure can. e.g. dropbox support https://code.google.com/p/dropbox-codenameone-sdk/

android - Resource scope for @+id/ declarations? -

when working through tutorial build first android application reached section states @+id/ prefix not references resource defined in gen/r.java file, + sign indicates first encounter create it. consider code snippet: <edittext android:id="@+id/edit_message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/edit_message" /> after reading through side-bar in first link, related resources, , article linked named providing resources (at cursory level), i'm unable clear statement documentation on scope of resource @+id/ prefix. understand can have resource same name scoped inside each prefix: note: string resource has same name element id: edit_message. however, references resources scoped resource type (such id or string), using same name not cause collisions. but i'm driving @ this. based on documentation appears can't have 2 controls resourced edit_me

asp.net mvc 4 - Custom errors on MVC 4 Web API before controller action is invoked -

based on this article i've implemented own exceptionfilterattribute , registered filter in globalconfiguration custom exception handling in mvc 4 web api. however exceptionfilterattribute gets invoked exceptions thrown in controller action, after request resolved framework. i'd implement custom error handling exceptions thrown before controller action called. example, exception thrown in delegatinghandler returns me following html: <!doctype html> <html> <head> <title>exception of type 'system.exception' thrown.</title> ... what need return own custom error scenario? if delegatinghandler exceptions generated filters you've written, can add filter "trap" of these exceptions shown in answer . as you've found out , documented in answer, limited in exceptions you'll "trap" web api pipeline. option see try you're describing write custom httpmessagehandler demon

How to make asynchronous HTTP GET requests in Python and pass response object to a function -

update: problem incomplete documentation, event dispatcher passing kwargs hook function. i have list of 30k urls want check various strings. have working version of script using requests & beautifulsoup, doesn't use threading or asynchronous requests it's incredibly slow. ultimately cache html each url can run multiple checks without making redundant http requests each site. if have function store html, what's best way asynchronously send http requests , pass response objects? i've been trying use grequests ( as described here ) , "hooks" parameter, i'm getting errors , documentation doesn't go in-depth . i'm hoping more experience can shed light. here's simplified example of i'm trying accomplish: import grequests urls = ['http://www.google.com/finance','http://finance.yahoo.com/','http://www.bloomberg.com/'] def print_url(r): print r.url def async(url_list): sites = [] u in url_list

wolfram mathematica - Using Evaluate with a Pure Function and SetDelayed -

i want evaluate f below passing list function: f = {z[1] z[2], z[2]^2}; = % /. {z[1]-> #1,z[2]-> #2}; f[z_] := evaluate[a] & @@ z ; so if try f[{1,2}] {2, 4} expected. looking closer ?f returns definition f[z_] := (evaluate[a] &) @@ z which depends on value of a , if set a=3 , evaluate f[{1,2}] , 3 . know adding last & makes evaluate[a] hold, elegant work around? need force evaluation of evaluate[a] , improve efficiency, a in fact quite complicated. can please out, , take consideration f has contain array[z,2] given unknown calculation. writing f[z_] := {z[[1]]z[[2]],z[[2]]^2} would not enough, need generated automatically our f . many contribution. please consider asking future questions @ dedicated stackexchange site mathematica . questions less become tumbleweeds , may viewed many experts. you can inject value of a body of both function , setdelayed using with : with[{body = a}, f[z_] := body & @@ z ] check

asp.net mvc - There is no build provider registered for the extension '.jpg' -

when approached jpg image www.demo.net/images/1.jpg on web site, gave me error: server error in '/' application. there no build provider registered extension '.jpg'. can register 1 in <compilation><buildproviders> section in machine.config or web.config. it asp.net mvc 4 site. worked in localhost failed on hosted server. so modified <compilation debug="true" targetframework="4.5"> <buildproviders> <remove extension=".jpg"/> <add extension=".jpg" type="system.web.compilation.webhandlerbuildprovider"/> </buildproviders> </compilation> the image not still shown , error became wild. server error in '/' application. parser error description: error occurred during parsing of resource required service request. please review following specific parse error details , modify source file appropriately. parser error message: page must have

wpf - Telerik RadDaigram does not contain definition for SwitchGridVisibility -

i trying switch off grid visibility of raddiagram have. i creating user control using telerik controls within silverlight project (sharing control wpf library). it seems raddiagram property not found. ( raddiagram commands - found property here) ps : creating , filling shape programmatically. therefore, need approach switch grid off apply style attribute in resource dictionary or simple programmatic property set / function call. thanks, the way turn off backgroundgrid or backgroundpagegrid use these attached properties: <telerik:raddiagram x:name="diagram" margin="30" primitives:backgroundgrid.isgridvisible="false" primitives:backgroundpagegrid.isgridvisible="false" where primitives defined so: xmlns:primitives="clr-namespace:telerik.windows.controls.diagrams.primitives; assembly=telerik.windows.controls.diagrams" if need bind command

java - How to use lazy loading in Spring MVC -

how use lazy loading in spring mvc? i'm using eager @ moment, makes app works slowler. part of domain: @manytomany(fetch = fetchtype.eager) @jointable(name = "news_tag", joincolumns = @joincolumn(name = "news_id"), inversejoincolumns = @joincolumn(name = "tag_id")) private list<tags> tags = new arraylist<tags>(); public list<tags> gettags() { return this.tags; } and dao: public list<news> getsomenews(long b, long hm) { list<news> news = (list<news>) sessionfactory .getcurrentsession() .createquery( "from news title!='about' order publish_time") .setmaxresults((int) hm).setfirstresult((int) b).list(); return news; } servlet-context: <context:annotation-config /> <context:component-scan base-package="net.babobka.blog" /> <import resource="../../db/db-config.xml" /&g

postgresql - Postgres not following search_path to locate tables -

i'm not sure exact point @ starting happening ( believe may have been after launching pgadmin3 first time ). seemed happen of sudden , seems configured correctly.. postgresql seems no longer following search_path locate tables. \d no relations found. my search path has been set (persistently @ that): show search_path; "public, myschema1, myschema2" (1 row) not owner of tables in question, have run: grant on schema public myusername; grant on schema myschema1 myusername; grant on schema myschema2 myusername; the data there. can see schemas when running \dn. can run queries if qualify schema , table names. biggest issue created functions reference unqualified table name won't work. can think of might not have tried? thoughts caused issue start happening? thanks help! -hightech probably entered search_path 1 string postgres=# set search_path public, s1; set postgres=# show search_path ; search_path ------------- public, s1 (1 row) po

c# - How to inject the same instance of a class with Ninject? -

i using ninject ioc. have following classes. // repository public class efproductrepository : iproductrepository, iunitofworkrepository { private iunitofwork unitofwork; private efdbcontext efdbcontext; public efproductrepository(iunitofwork uow) { unitofwork = uow; efdbcontext = new efdbcontext(); } // } // controller public class productcontroller : controller { private iunitofwork unitofwork; private iproductrepository productrepository; public productcontroller(iunitofwork uow, iproductrepository repo) { unitofwork = uow; productrepository = repo; } } currently ninject bindings follow assign new instance of concrete class interface. ninjectkernel.bind<iunitofwork>().to<unitofwork>(); ninjectkernel.bind<iproductrepository>().to<efproductrepository>(); using ninject controller factory, need inject same instance of iunitofwork class productcontroller , efproductrepository. please guide me.

java - Dialog Fragment Not Displaying on Launch -

so have application, on startup launches splash screen activity , checks see if user account has been linked app. if 1 has app launches main activity , bypasses splash silently. if there no user account pulls down database in asynctask , asks user login/create account. on first startup app syncs server , pulls down database. i'm trying dialogfragment indeterminate progress bar display database pulled down. right dialogfragment created in onpreexecute() of asynctask , asynctask executed in activity's onstart() method problem i'm having dialog not being drawn screen. i have debug logging shows dialog's oncreate() executing , sync successful. dialog shown/dismissed in onpreexecute() , onpostexecute() respectively both of execute on ui thread. realize if database download fast won't display long i'm not seeing brief flash of dialog in emulator. could 'problem' emulator dialog's frames being skipped or not creating dialog @ point drawn

How to debug in sql(Oracle) -

i writing long sql query , i'm getting incorrect output fields. how debug query? there no right answer question. think deep down know that. when have complicated break down uncomplicated pieces. once comfortable these pieces 1 one start put complicated thing again. main point keep breaking complicated things more , more simple things. not embarrassed have broken things down select sysdate dual , start build up! good luck.

ruby on rails - Nokogiri adds characters during parsing on Heroku -

it seems nokogiri has problem utf-8 conversion of nbsp character. i've gathered issue related libxml2. nokogiri recommends upgrading libxml2 2.7.7 instead of 2.7.6 that's running on heroku. anyone know how can use libxml2 2.7.7 (or higher) on heroku? the problem follows -- doc = nokogiri::html("<html><p>hi hello</p></html>") doc.inner_html => "<html><body><p>hi hello</p></body></html>" doc.inner_html = "<p>hello&nbsp;world</p>" => "<p>hello&nbsp;world</p>" doc.inner_html => "<p>helloĂ‚ world</p>" looks related: https://github.com/sparklemotion/nokogiri/issues/306 this doesn't happen on local machine. rails has 'utf-8' set config.encoding , page that's rendered has utf-8 charset meta tag. on local machine i'm running nokogiri 1.6 limxml2 2.8.0 , on heroku i'm running nokogiri 1

google analytics - How can I use regex for "contains this word" -

i'm trying setup tracking in google analytics. the goal url is: www.example.com/jdsfdf?sdfffs#/thankyou every time google analytics sees #/thankyou in url, want attribute conversion. how can use regex if url contains #/thankyou, it's conversion ? you don't need regex exact string match, if must : /#\/thankyou/ or @sundar points out , may not need escape anything: #/thankyou

nginx - Windows Authentication with Ruby on Rails -

i have website running in intranet, users login website using ldap - need write down username , password. i know in asp.net, can have windows authentication, remove login process in intranet. how can in ruby on rails using nginx? saw options using iis proxy.. before quit , this, have idea? this answer question: http://wiki.phys.ethz.ch/readme/devise_with_ldap_for_authentication_in_rails_3

css - How to put #foo:media(min-available-width:350px and max-available-width:750px) into SCSS -

i'm using element query project allows use @media queries @ element. it's how it's handled: #foo:media(min-available-width:350px , max-available-width:750px) { background:red; } but such syntax generates error (no wonder): (line 1: invalid css after "...available-width": expected ")", ":350px , max-...") the problem : , space . how make possible put own syntax scss files? or how tell preprocessor parts of code should left are? or @ least, how make particular piece of code work? other cases: #foo:media(min-available-width:350px) { background:red; } #foo:media(max-available-width:750px) { background:red; } #foo .bar:media(min-available-width:350px) { background:red; } don't use element query. you can achieve same result valid css , basic sass: #foo { @media (min-width:350px) { background:red; } } this results in following css: @media (min-width: 350px) { #foo { background:

css - How do I get IE < 10 to apply negative margins? -

i have list of items, want present in grid. keep flexible, i'd prefer have elements float inside container , control width percentage. e.g.: <div style="overflow:hidden"> <div style="float:left ; width:25%">element 1</div> <div style="float:left ; width:25%">element 2</div> <div style="float:left ; width:25%">element 3</div> <div style="float:left ; width:25%">element 4</div> <!-- etc. --> </div> now, have gutter between these cells. again, simple enough - apply margin or padding cells. however, gives me gutter on edges of container, not want. to around this, have created 2 containers within each other, inner container gets negative margin equal padding of cells. works in modern browsers, fails in ie 9 , older. don't care ie 7 , backwards, ie 8 + 9 still have big market share ignore. so question is: why ie 8 + 9 not give me negative horizonta

php - paypal ipn developer script to long? -

hey there ask specific script, here is: http://www.phpbuilder.com/articles/application-architecture/shopping-carts/setting-up-paypal-ipn-in-php.html i understood everything, quite nice structured , it, looks safe well, have 1 question else-part: } else { // paypal payment valid // process order here } what have here? insert values in database?? done before?! : } else { // transaction not processed, store in database $payer_email = mysql_real_escape_string($_post[‘payer_email’]); $gross = mysql_real_escape_string($_post[‘mc_gross’]); greetings ! edit: ok , prevent replay attack well? : if($f[‘count’] > 0) { $errors[] = “transaction processed”; } else { if (count($errors) > 0) { // ipn data incorrect - possible fraud // practice send transaction details e-mail , investigate manually $message = "ipn failed fraud checks"; mail(‘youremail@examp

Javascript/jQuery: ensuring unique option added to pulldown -

i have html pulldown menu along text element allows users add new options menu. i'd make sure every option added unique. following 2 lines first option thought of worked (option value = innhtml of options). i'm wondering if there's more elegant solution -- second line seems clunky. doesn't handle spaces in new_name string. var new_name = document.getelementbyid("preset_name").value var unique_name = $("option[value="+new_name+"]").length === 0 ? true : false do need this? html: <select id="myselect"> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="mercedes">mercedes</option> <option value="audi">audi</option> </select> <input id="newoption" type="text" /> <button id="check">check</button> jquery: $(document).ready(

adding custom page's link in homepage in opencart -

i new in opencart , , trying build new ecommerce site using opencart need add custom static page ( additional page ). follow link new page opencart , opencart php custom page without using "information" feature , , can create new custom page. problem is, how can page's link on home , others page people view page. creating link depend on how page has been created, , it's located. urls built based on location ie: route of controller. let's new page has been built in: catalog/controller/common/mypage.php obviously you'll need follow code standards listed in posts referenced created correct class extends controller, language file, model class (if page needs interact database) , view file. once correct via previous posts can create link anywhere on catalog (front) calling url class , passing in required information. you'll need pass in route, arguments such id or customer, , whether url should secure. $link = $this->url->link(&

Appengine Cloud Endpoints & core data -

when using cloud endpoints generated libs, there anyway use core data without manually creating models? there easy way integrate 2 objects endpoint can persisted core data? i not aware of generic solution. seems me 2 philosophies - appengine cloud endpoints relational database vs. core data object graph - different facilitate solution without manual adaptation. so there no "easy way integrate two". being said, if write own conversion solution, complicated part seems change foreign keys relationships. apart should not difficult.

html - phpstorm french characters formating issue -

Image
i'm using phpstorm 6. when try format code contains french characters, got issue see on pictures. nb : got when put text tag : <span>génie informatique</span> so before formatting : and after formatting got this thanks what kind of file -- html? in case: have light green background between tags. suggests have another language injected between tags (language injection functionality), may use different formatting rules (not html -- e.g. javascript or whatever may have injected there). possible solution: place cursor somewhere between such tags, alt+enter (or click on light bulb icon) , use "uninject language" option. alternatively: settings | language injections -- find , disable (or delete) offending entry there (will "global" or "project" type in last column).

Loading a UIWebView from a UITableView -

i've come part of code i'm bit stumped, i'm trying load once tap example google in uitableview, load google separate view controller uiwebview. i've coded think right although when tap on google, nothing happens. i'm not getting errors, app runs fine it's said once tap selected field doesn't lead anywhere & before did remember import uiwebview controller first view controllers .m file. this first view controller .h @interface yomafifthviewcontroller : uitableviewcontroller { nsarray *data, *sites; } @end this first view controller .m - (void)viewdidload { [super viewdidload]; data = [nsarray arraywithobjects:@"website", @"developer", nil]; sites = [nsarray arraywithobjects: @"https://www.google.co.uk/", @"https://www.google.co.uk/", nil]; ` - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellid