Posts

Showing posts from July, 2010

Loop through Column A in Excel VBA, get a random word from Column B and output the row in Column C -

i'm new vba macros , excel, , have small problem need solve. say have column a has 20 rows of single word/letter, , column b has 5 rows of single word/letter. how loop through column a , starting a1 , randomly select row in column b add form new string output in column c ? meaning want output in column c : a1 (for each a) + b2 (random) a2 (for each a) + b4 (random) a3 (for each a) + b1 (random) a4 (for each a) + b3 (random) a5 (for each a) + b4 (random) a6 (for each a) + b2 (random) ... and on , forth. anyone has idea how achieve this? try: sub hth() dim rcell range dim irandom integer each rcell in range("a1:a20") irandom = application.worksheetfunction.randbetween(1, 5) rcell.offset(, 2).value = cstr(rcell.value & cells(irandom, "b").value) next rcell end sub as have tagged excel 2007 may need use instead: irandom = round((5 - 1) * rnd + 1, 0)

string formatting - iOS NSLog %hd %hhd %ld and %lld format specifiers -

what meaning of these format specifiers? %hd %hhd %ld %lld %hd used short integer or unsigned short integer %hhd short short integer or unsigned short short integer %ld long integer or unsigned long integer %lld long long integer or unsigned long long integer simple that. here h , hh , l , ll length modifiers in %d source: http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/strings/articles/formatspecifiers.html

How to correct syntax error due to tab order in python? -

i experience problem tab when programming python (when editing .py file different editor possibly). it frustrating! want manually put tabs first line end of file if need edit. is there better way of solving problem? yes, not use tabs when indenting. too easy mix tabs , spaces. quoting pep 8 python style guide : never mix tabs , spaces. the popular way of indenting python spaces only. second-most popular way tabs only. code indented mixture of tabs , spaces should converted using spaces exclusively. when invoking python command line interpreter -t option, issues warnings code illegally mixes tabs , spaces. when using -tt these warnings become errors. these options highly recommended! for new projects, spaces-only recommended on tabs. editors have features make easy do. emphasis mine. first, detect inconsistent indentation running code python -tt scriptname.py . fix errors. then convert tabs spaces, , configure editor use spaces indentation. p

c - Making function behave like a scope -

i'm working on project becoming more , more complicated. project consists of independent each other sections of code containing lot of math computations followed complicated output generation. wrapped inside socket pthread. whole thing looks this: main() -> socket -> thread -> request processing -> 1 or more of independent sections i wanted enclose each independent section of code inside function, , function inherit variables caller function, didn't work. below simplified version of want achieve: void func_a(){int c;b+=a;c=1;b+=c;} int main(){ int a,b,c; a=3;b=2;c=0; func_a(); printf("b:%d c:%d\n",b,c); return 1; } above code doesn't work, 1 works fine, , want: int main(){ int a,b,c; a=3;b=2;c=0; {int c;b+=a;c=1;b+=c;} printf("b:%d c:%d\n",b,c); return 1; } i put code function file, , { #include ... }, perhaps there's better way that? any other ideas , suggestions on managing such thing appreciated too. t

coding style - Is it considered good practice to unset PHP variables in this scenario? -

right now, using modified version of oscommerce has lot of variables declared in application_top.php file (which included when going every file on website first thing). so instance, if go mypage.php , application_top.php included in top. i want of variables defined application_top.php file accessible inside mypage.php file, since used temporary calculations or whatever, whereas others meant accessible page. what best practise? unset variables meant used in local scope after use, , leave variables meant accessed alone? use of classes best way, , passing variables need though assume major rewrite ? what this $vars = array_keys(get_defined_vars()); $whitelist = array("var1", "var2" ...); $vars = array_diff(array_keys($whitelist), $vars); foreach($vars $var) { unset($$var); }

ios - 3'panels view for iPad like in the Mail.app for Mac Os -

Image
i need implement 3'panels view ipad in mail.app mac os: it seems can not put splitviewcontroller inside splitviewcontroller, other ideas? in advance. you don't need uisplitviewcontroller resembles uisplitviewcontroller . 3 uiviewcontrollers more enough. can create 4th 1 host other 3 , use mediator between other 3.

html - hover not working properly -

Image
when copied necessary codes jsfiddle works correctly not working in website. my key problem tab menus our rooms, our gems not working when hover there. this site in hover not working correctly this working jsfiddle edit i think main problem difficult understand. i'm giving hint. change #tabs li a height: 200px; you'll see pointer not hovering on text below text. i assume want pointer on entire tab, need modify class on line 1877 in template.css #tabs li { color: #e79d34; display: block; font: 20px/50px calibri; height: 100%; text-decoration: none; } it works in fiddle because css not normalized, in website, css normalized. demo of not working fiddle the issue h1 tag having class logo , overlapping tabs

jQuery - override preventDefault() when click + ctrl pressed -

Image
i using preventdefault() preventing default behavior of an anchor button, want make button default behavior when clicked keyboard ctrl button, js code $('a').click(function(e){ e.preventdefault(); }); html code <a href="http://google.com">go best search engine</a> here playground: http://jsfiddle.net/skdua/ $('a').click(function(e) { if (!e.ctrlkey) { e.preventdefault(); } }); other intertesting options: e.altkey - check if alt pressed e.shiftkey - check if shift pressed e.button - distinguish between right, left of middle mouse clicks e.which - same above, works keyboard full documentation here one more note, asked documentation seem interested ;) it's possible debug in jsfiddle - put debugger in js code , run usual. browser (i use chrome) stop on debugging line, , examine e object in watches:

spring - java.lang.ClassCastException: java.lang.String cannot be cast to -

i got error while retrieving data database. java.lang.string cannot cast com.rahul.model.myuser] root cause java.lang.classcastexception: java.lang.string cannot cast com.rahul.model.myuser. integracontroller.java @requestmapping("/users") public modelandview users() { list<myuser> p =dq3.usersa2(); (myuser p1 : p){ system.out.println(p1.getusername()); } modelandview m=new modelandview(); m.setviewname("users"); m.addobject("list",p); return m; } dao.java @transactional @repository public class dao { private session session; @autowired private myuser u; @autowired private post p; @autowired private person per; @autowired private roles r; @autowired private answer a; @autowired private hibernatetemplate ht; public list<myuser> usersa2() { list<myuser> p2; p2 = ht.executefind(new hibernatecallback<obj

php - Additional elements to URLS? -

i'm not sure terminology is, have site uses "tag-it" system, can click on tags , takes user to topics.php?tags=example my question sort of scripting or coding required able add additional links? topics.php?tags=example&tags=example2 or topics.php?tags=example+example2 here code in how site linked tags. header("location: topics.php?tags={$t}"); or <a href="topics.php?tags=<?php echo $fetch_name->tags; ?>"><?php echo strtolower($fetch_name->tags);?></a> thanks hints or tips. you cannot pass tags 2 times parameter although can pass array topics.php?tags[]=example&tags[]=example2 assuming want try $string = "topics.php?"; foreach($tags $t) { $string .= "tag[]=$t&"; } $string = substr($string, 0, -1); we iterate through array concatenating value our $string. last line removes & symbol appear after last iteration there option looks bit more dirty

mysql - grocery crud with AES Encryption -

how match data in table using mysql aes decrypt in grocery crud ? error getting on crud set realtion follows: $crud->set_relation(aes_decrypt(departments.department_id,'key'),'users.department_id','deparmtnet_name'); not found: departments.aes_decrypt(departments.department_id,'key') select user_name,department_name users j333 left join departments jd333 on departments.aes_decrypt(departments.department_id,'key')=j333.department_id grocery crud doesn't recognize "aes decrypt" function

java - Cardlayout and objects? -

hi doing small project using forms. presently used netbeans classes became complex jpanel ie cards within 1 class frame. asked simplify. my question if put 1 jpanel , contents in 1 class.and make objects. can use cardlayout on these objects? cards change within single frame? this problem stems using netbeans gui editor manage top-level container , in it. instead, use approach shown here manage multiple separate forms can used in frame's layout. see card layout actions , cited here .

php - How delete messages from an AMQP (RabbitMQ) queue? -

this thing. i reading results queue rabbitmq using php amqp in order process vital information on every email sent. after done, need delete or mark message written next time read queue don't messages processed. as rabbitmq server sending on 10.000 emails hour, every time read queue process result sendings, script can running @ lease 5 minutes in order process messages in queue, after done, several hundred of new messages places during 5 minutes. makes impossible me purge queue after script finishes because delete messages places during script running not processed. that leaves me 1 choice. mark or delete message after being processed or read amqp script. is there way that? (here script) <?php /** * result.php * script connects rabbitmq, , takes result message * result message queue. */ // include settings require_once('settings.php'); // try set connection rabbitmq server try { // construct connection rabbitmq server $connection = new amqp

zend framework - Zend_Dom_Query to check schema.org markup -

i want check if website contains schema.org markup? doing following: $domain = 'http://agents.allstate.com/william-leahy-mount-prospect-il.html'; $client = new zend_http_client(); $client->seturi($domain); $response = $client->request(); $html = $response->getbody(); $dom = new zend_dom_query($html); $resultschema = $dom->query('body'); foreach($resultschema $r){ $data = $r->hasattribute('itemprop'); if($data) echo 'yes'; else echo 'no'; } i not understanding how find this. correct way of doing it? schema.org markup used on website may use html element. how can query elements , find 1 contains schema.org markup? finally after long search , reading able answer! how done if someone's still looking answer. $seperator = '|

c# - Why doesn't the watch window in sharpdevelop show the value of this variable? -

firstly let me code developed in sharpdevelop 4.3 , code runs ok , gives results supposed to, getting point little more difficult in terms of debugging because watch window doesn't seem present values expected. can tell me whether there should inspect values in loop? the value of mailitem.subject instance shown in watch as: object not of type microsoft.office.interop.outlook._mailitem (i bit confused underscore read naming convention , believe have removed underscores throughout project own preference) note mailitem in watch showing system.__comobject - clue lost on me? //looping through mail items in folder. foreach (microsoft.office.interop.outlook.mailitem mailitem in fldmailitems.items) { if (mailitem.body != "") { mymail mail = new mymail(); mail.subject = (mailitem.subject == null) ? string.empty : mailitem.subject; //mail. mailitems.add(mail); } } to further illustrate issue applying redemption rdomail , message box disp

css - H&FJ fonts from typography.com look awful on iOS -

Image
i'm using cloud-based gotham screensmart on website i'm building. looks fine on desktop browsers, looks on ios safari... any ideas why happening , can sort it? turns out because hf&j split fonts 2 when delivering them via cloud. i had added 1 font css instead of 2. font-family: "gotham ssm a", "gotham ssm b"

c# - WCF sending object through pipe communication -

i got big issue trying make work. have wcf scenario, callbacks, trying send message struct made of string , object. seems object can't serialized. i following error trying call function sending data: type '<>f__anonymoustype01[system.string]' cannot serialized. consider marking datacontractattribute attribute, , marking of members want serialized datamemberattribute attribute. see microsoft .net framework documentation other supported types. the code client is: using system; using system.servicemodel; using system.servicemodel.channels; using system.runtime.serialization; using system.io; namespace wcfclient { [datacontract] public struct message { private string messagetype; private object param; public message(string _messagetype, object _param) { // todo: complete member initialization this.messagetype = _messagetype; this.param = _param; } [datamember]

Get all missing values between two limits in sql table column -

so trying assign id numbers records being inserted sql server 2005 database table. since these records can deleted, these records assigned first available id in table. example, if have table below, next record entered @ id 4 first available. | id | data | | 1 | ... | | 2 | ... | | 3 | ... | | 5 | ... | the way prefer done build list of available id's via sql query. there, can checks within code of application. so, in summary, sql query retrieves available id's between 1 , 99999 specific table column. first build table of n ids. declare @allpossibleids table (id integer) declare @currentid integer select @currentid = 1 while @currentid < 1000000 begin insert @allpossibleids select @currentid select @currentid = @currentid+1 end then, left join table real table. can select min if want, or limit allpossibleids less max table id select a.id @allpossibleids left outer join yourtable t on a.id = t.id t.id null

wpf - Why doesn't my dependency property change propagate to my usercontrol -

i'm building windows phone 8 app. have usercontrol contents should updated asynchronously. model implements inotifypropertychanged. when update value in model propagates textbox control should not contents of usercontrol. part of puzzle missing or not possible? here's reproduction scenario. app page: <phone:phoneapplicationpage x:class="bindingtest.mainpage"> <grid x:name="contentpanel" grid.row="1" margin="12,0,12,0"> <button click="button_click" content="click" horizontalalignment="left" margin="147,32,0,0" verticalalignment="top"/> <textblock horizontalalignment="left" margin="69,219,0,0" textwrapping="wrap" text="{binding bar}" verticalalignment="top" height="69" width="270"/> <app:mycontrol x:name="snafu" horizontalalignment="left" margin="6

c# - Request.Form returning no values -

i working on online registration form in html. of fields dynamically added using foreach data-binding in knockout.js based on collection of values. have jquery part complete add of text fields , collections. the dynamic part of form looks this: <div class="form_section" id="familymembers" style="display:none;" > <div class="wfamilymember" data-bind="foreach: $root.familymembers" > <h2>family member <span data-bind="text: ($index() + 1)"></span> information</h2> <div class='form_section'> <div class="eccform_column"> <div class="eccform_label">first name*</div> <div class="eccform_field"><input class="fmfirstname" title="first name" type="text" data-bind="value:firstname" /></div

join - use of case when else in sql , not getting intended result -

Image
i have following db table: in questionmaster table, there language=1 english , language=2 spanish question. i wanted display as: srno englishquestion spanish question 1 english question spanish question 2 live? kuthe rahatos? for used following query: select row_number() on (order qmid) srno, case language when 1 question end,case language when 2 question end questionmaster but failed result. please me. you need aggregation want. 1 row can have 1 language on it. try this: select row_number() on (order qmid) srno, max(case language when 1 question end) english, max(case language when 2 question end) spanish questionmaster group qmid

configuration - Java ini without spaces -

i have attempted use ini4j , inieditor alter java ini configuration file. unfortunately, both libraries rewrite file putting spaces besides = sign... this breaks c library attempting configure. #this sample of get: [root] role = administrator last_login = 2003-05-16 #this need: [root] role=administrator last_login=2003-05-16 i saw ini4j has named fancyiniformatter apparently unable find proper documentation on usage... http://www.jarvana.com/jarvana/view/org/ini4j/ini4j/0.4.0/ini4j-0.4.0.jar!/org/ini4j/addon/fancyiniformatter.class?classdetails=ok i hoping natively library can load file , perform regex operation if can avoid great. thanks, the ini4j formater based on config . in config separator set char '=', in class iiniformatter have declaration of separator string " = ". type used when config#isstrictoperator set false. config config = new config(); config.setstrictoperator(true); iniformmater formater = iniformmater.newinstance(out,

python - Deleting specific text from text file -

i have text files text file >e8|e2|e9d football game health can play every day >e8|e2|e10d sequence unavailable >e8|e2|ekb cricket i wrote following code detecting sequence unavailable text file , write in new text file lastline = none open('output.txt', 'w') w: open('input.txt', 'r') f: line in f.readlines(): if not lastline: lastline = line.rstrip('\n') continue if line.rstrip('\n') == 'sequence unavailable': _, _, id = lastline.split('|') data= 'sequence unavailable|' + id w.write(data) w.write('\n') lastline = none it work fine , detect sequence unavailabe text file , write in new file , want delete file read like input.txt >e8|e2|e9d football game health can play every day >e8|e2|e10d sequence unavailable >e8|e2|ekb cricket i

c - what does sleep do by default? does it goes for sleep for actual timing -

this question has answer here: why printf not flush after call unless newline in format string? 9 answers hi following simple code while 1, when execute , first should print first line in printf , sleep 1 sec , print second line , should keep on doing here don't in terminal , after few seconds printed , goes sleep . happening not understanding . int main(void) { while(1) { printf("hello before sleep"); sleep(1); printf("hello after sleep"); } } but in same code above if use \n after every line in printf works fine expected . why ? printf , more output functions buffered. if want see expected behavior should flush output before going sleep. fflush(stdout); sleep(1);

html - Can i put text after <li></li> tag? -

i'm wondering, can put text after li tag , correct? example <ul> <li>text</li> text here after tag <li>text</li> text here after tag </ul> writing such code return dots li tags indented , that's want achieve. regarding screenshot - following code want <ul> <li>text</li> <span>text here after tag</span> <li>text</li> <span>text here after tag</span> </ul> css span { margin-left: -15px; } and here fiddle: http://jsfiddle.net/p2cxf/ note w3c markup validator throw errors. <span> tag not allowed child of <ul> edit: this 1 validate (thank @ma3x) <ul> <li>text<br /> <span>text here after tag</span></li> <li>text<br /> <span>text here after tag</span></li> </ul> you can use <p> instead of <span> .

git - Point current repo to a different repo -

this question has answer here: how move remote git repo remote git repo? 4 answers i have repository (a) have been building code, have same older code version in different repo (b) best way bring repo (a) repo (b). repo (a) should go away. want point towards b. out of these options 1 practice: edit .git/config file url - instead of url (a) use url (b) , push changes do pull request , bring in changes (not sure repo repo can done (a) not branch of (b). maybe there are better ways above two. there bunch of ways, "correct" add new remote repo b, , push it $ git remote add repo-b http://my-address-for-repo-b $ git push repo-b master

android - Pure java adb client -

adb split server part , client part talks each other via tcp protocol described more in detail here . is there pure java adb client out there? can usefull if want drive packet manager or activity manager junit or testng test case example. we have adb command line client binary on major development platforms, there pure java implementaion of adb client. i created small java project called jadb available here implements parts of adb client does, including sending files. requires adb server running (the adb binary)

How to (temporarily) stop Elasticsearch from expunging deleted documents? -

in my usecase i'm trying synchronize 2 elasticsearch indices. due versioning acutally quite simple . however, want keep writing @ time while i'm doing this. okay, steps want perform in chronological order: clients write (index, delete, update) cluster c1 create new index c2 (clients keep writing c1) copy data cluster c1 c2 (clients keep writing c1) switch clients c2 synchronize changes c1 c2 (clients keep writing c2) shutdown c1 step #5 step i'm looking at. have make sure changes written c2 aren't overwritten data c1. using versioning it's rather simple writes index operations fail (versionconflictengineexception). assuming following situation: a document updated on c1 right after #3 (v2 on c1, v1 on c2) the same document deleted right after #4 (v2 on c1, deleted on c2) synchronizing try reindex v2 on c2 i know elasticsearch keeps deleted documents around while: # index document 1:4 $ curl -xput 'http://localhost:9200/test/test/1?vers

Expiring cookies with AngularJS? -

i need able store authentication information in cookie , set expiration date. from have seen $cookie , $cookiestore doesn't support this. are there alternatives or way possible on server side? i hoping maybe there module exposes functionality? thanks in advance you create cookie standard javascript within angular ctrl using window.document.cookie. https://developer.mozilla.org/en-us/docs/web/api/document.cookie example documentation: document.cookie = "somecookiename=true; expires=fri, 31 dec 9999 23:59:59 gmt; path=/";

c# - listview wrappanel not working when ungrouped -

Image
i'm adapting solution needs: http://www.abhisheksur.com/2010/08/woring-with-icollectionviewsource-in.html the xaml part of listview is: <listview grid.row="1" name="lvicons" itemssource="{binding}"> <listview.groupstyle> <groupstyle> <groupstyle.headertemplate> <datatemplate> <textblock text="{binding name}" /> </datatemplate> </groupstyle.headertemplate> </groupstyle> </listview.groupstyle> <listview.itemspanel> <itemspaneltemplate> <wrappanel width="{binding (frameworkelement.actualwidth), relativesource={relativesource ancestortype=scrollcontentpresenter}}" itemwidth="{binding (listview.view).itemwidth, relativesource={relativesource ancestortyp

javascript - parsley.js - manually display a message without having to validate -

i want display parsley message in else clause of javascript code: if ( ...is valid ) { //do things } else { //display parsley error } i know parsley allows custom validators documented here: http://parsleyjs.org/documentation.html#javascript but merely want display message until field modified. create validator such as: $( '#myinput' ).parsley( { validators: { alwaysfalse: function ( val ) { return false; } } , messages: { mymessage: "form invalid" } }); but how trigger , validator? (there validator attached) your messages object should mirror of validators object messages display. messages: { alwaysfalse: "form invalid" } and try validators: { alwaysfalse: function(val){ return false; }, required: function ( val ) { return false; } } also warning : must remove parsley-validate auto-binding code in forms dom allow override default processing , use parsley pu

Scaled (or toggle display) html5 video on ipad not Visible -

<video width="910" height="544" controls> <source src="resources/videos/movie1.mp4" type="video/mp4"> </video> i have html5 video need hidden tried webkit transition on scale up: vidwrapper { -webkit-transition: .5s ease-in-out; -webkit-transform: scale(0); } .vidwrapper.active { -webkit-transform: scale(1); also here .js code use scale video. had use timeout because after displaying video, dom seems need chance catch before can scale up: settimeout(function(){ debugger; scope.m_vidwrapper.addcls('active'); },200,scope) **note if remove settimeout, , call scope.m_vidwrapper.addcls('active'); start transition, video appear. , not scale 0 1 nicely , work on chrome , safari not ipad . tried toggling display none block , still won't show up. have seen if leave page i'm trying display video flash visible , seems there ma

Android change image in a ImageView? -

i have picture resource, need modify opencv, put new image in original imageview. i tried way, : public class verifianceactivity extends activity { /** called when activity first created. */ private baseloadercallback mloadercallback = new baseloadercallback(this) { @override public void onmanagerconnected(int status) { if (status == loadercallbackinterface.success ) { // can call opencv code ! bitmap mbitmap = bitmapfactory.decoderesource(getresources(), r.drawable.cmc7); mat mymat = new mat(); utils.bitmaptomat(mbitmap, mymat); imgproc.cvtcolor(mymat, mymat, imgproc.color_bgr2gray); utils.mattobitmap(mymat, mbitmap); imageview miv = (imageview) findviewbyid(r.id.imageview); miv.setimagebitmap(mbitmap);//npe //this line suppose work, app crashes. setcontentview(r.layout.main);

c++ - Enumeration access in different class -

i have enumeraion in class , class b have class instance member. how can access class enumeraion in class b using instance class a{ enum ab{ 1, b 2 }; } in class b need enumeraion #include <iostream> using namespace std; class a{ public: enum ab{ a= 1, b= 2 }; }; class b{ public: void test() { enum a::ab x=a::a; cout << "test a::a = " << x << endl; x=a::b; cout << "test a::b = " << x << endl; } }; int main() { cout << "a::a = " << a::a << endl; cout << "a::b = " << a::b << endl; class b b; b.test(); } the enumerated names a,b reside in class namespace so, can access them using a:: prefix a::a .

android - Can anyone help me how to create a map for a building? -

does know how create 2d building map example mall, , locate or pinpoint user current location? classmate told me use google maps api, prefer not use it. i've friend swears openstreetmap if don't want follow google route option. interested in creating maps indoor space , lots of information can found here: http://wiki.openstreetmap.org/wiki/indoorosm i'm no expert, looks of it, seems if there tools, such josm , allow create indoor maps - quick start guide using josm indoors can found here . seem assume have floor plans of building. far i'm aware (correct me if wrong) there no software, lets walk around building creating map! locating users current location difficult. gps tends not work in indoor spaces, need consider best option. additionally if working multi-floored building need method work out floor user on. there number of possible solutions: attach gps antennae buildig , use repeater boost coverage rest of building google uses wi-fi networks

sitecore6 - User does not have access to Content Editor in sitecore -

user has page editor access. tried adding different roles user still not work. way give user access content editor set him admin , not want give admin rights user. you need assign standard role sitecore\author acount. see sitecore security reference more details.

if include three statments ruby or compare arrays? -

my code lists documents in folder: arr = [] file = dir.entries('c:\sites\what\upload').reject{|entry| entry == "." || entry == ".."} file.each |f| = file.read('c:\sites\what\upload' + '/' + f) + f and searches files patient.name , patient.vorname , , patient.birthday present. if so, program assigns document patient: @patients.each |patient| if a.include?(patient.name) || a.include?(patient.vorname) || a.include?(patient.birthday) my program somehow assigns documents users have nothing documents or better said, not mentioned in text. think problem if statement wrong. would better if split text before , compare new array [patient.name, patient.vorname, patient.birtday] ? arr << patient.id first = patient.find_by_id(patient.id) second = first.images.create(:url => 'c:\sites\what\upload' + f) end end end try below: if [patient.name,patient.vorname,patient.birthday].all? {|i| a.include? }

Retrieve queue length with Celery (RabbitMQ, Django) -

i'm using celery in django project, broker rabbitmq, , want retrieve length of queues. went through code of celery did not find tool that. found issue on stackoverflow ( check rabbitmq queue size client ), don't find satisfying. everything setup in celery, there should kind of magic method retrieve want, without specifying channel / connection. does have idea question ? thanks ! pyrabbit looking for, python interface rabbitmq management interface api. allow query queues , current message counts.

c# - Detect Usage of Specific Methods -

Image
in visual studio know whether code in project uses methods. example, know "==" being used in string comparisons, have team rule ".equals" should used when comparing strings. do tools exist accomplish goal? given following code block var x = "s" == "a"; var y = 1 == 2; var z = "a" == "b"; if right-click on first == , click find usage , following results. if right-click on second == , click find usage , tool-tip states this usage . i'm not sure features has, there new free command-line version of resharper. http://www.jetbrains.com/resharper/features/command-line.html

AngularJS - How to render a partial with variables? -

for example, have partial in car-list.html , , want render in several places different collections of cars. maybe this: <h1>all new cars</h1> <div ng-include="car-list.html" ng-data-cars="allcars | onlynew"></div> <h1>all toyotas</h1> <div ng-include="car-list.html" ng-data-cars="allcars | make:toyota"></div> the main difference normal include partial doesn't need know list of cars it's displaying. it's given array of cars, , displays them. possibly like: <!-- car-list.html --> <div ng-repeat="car in cars" ng-controller="carlistcontrol"> {{car.year}} {{car.make}} {{car.model}} </div> you can achieve directive . something that: angular.module('mymodule') .directive('cars', function () { return { restrict: 'e', scope: { 'cars': '=data' }, template: "<div ng-repe

Escaping underscore for Java interoperability in Scala -

suppose i've got scala code calls java library uses _ identifier (and do—it's long story). here's simplified example: public class stupidunderscore { public static string _() { return "please give me real name!"; } } no problem, right? escape it: scala> stupidunderscore.`_` res0: string = please give me real name! and has worked, until tried update scala 2.10.2 morning: scala> stupidunderscore.`_` <console>:1: error: wildcard invalid backquoted identifier stupidunderscore.`_` ^ this due a change showed in 2.10.1 , fixes this issue . commit message: prohibit _ identifier, can bring badness. well, sure, don't know why means can't escape it—i thought that's backquotes for. am going have write java wrapper work? there other way can refer java library's _ method in scala? as footnote, i've confirmed it's possible work around issue without writing new java: object aw

c# - Search button function -

i have search button on web page , should return subject name db similar entered search word, please me it... this c# code protected void button1_click(object sender, imageclickeventargs e) { mysqlconnection connection = new mysqlconnection("server=localhost; database=e-learningsystem; uid=root; password=123;port=3307;"); connection.open(); string srh = editbox_search.type; try { mysqlcommand cmd = new mysqlcommand("select * subject name='" + srh + "'", connection); } catch { } } my asp code <input name="editbox_search" class="editbox_search" id="editbox_search" maxlength="80" type="text" style="background-color: #99ccff; margin-top: 0px;" runat="server" enableviewstate="true" title="search courses:"

facebook - Like Button and edge.create No Longer Returns Widget -

anyone know whats this? the widget variable no longer being returned when clicking button. can see in fiddle, button has id set. when callback fires widget variable undefined though, has facebook removed var stop people tracking buttons clicked? jsfiddle: http://goo.gl/rsvtuh facebook messing it's javascript api without updating developers agains breaking changes policy. 2 weeks ago found out stopped sending widget parameter through edge.create , breaking app. today found out went returning widget parameter returns dom element instead of wrapper holds dom element, again, breaking app. in case, widget back, should weary when using it. because looks different now, , change unexpectedly later.

Ant property with multiple values each on separate line -

i have property has contain long list of strings , improve readability define each value (that quite long) in separate line, like: <property name="items" separator=","> <item>a</item> <item>b</item> </property> as equivalent to <property name="items" value="a,b" /> or similar <path> + <pathconvert> not expanding paths. is possible ? turns out there string resources , generic resource container: <resources id="items"> <string>a</string> <string>b</string> </resources> <pathconvert property="items" refid="items" pathsep="," />

sql server - Query slowdown when joining small table -

Image
i've hit strange problem. have query uses 4 tables (sorry latvian names): kl_precesizejvielas: 20 rows parvietots_details: 27897 rows razots: 282 rows kl_simple: 25 rows tables have clustered index (primary key), no other indexes. i'm executing query: select kl_precesizejvielas.apraksts precenosauk , count(*) razosanuskaits , sum(skaits) kopskaits , mervienibas.apraksts mervieniba kl_simple mervienibas inner join ( kl_precesizejvielas inner join ( parvietots_details inner join razots on parvietots_details.id_parvietots_master = razots.id_preces_ieks_kust_id ) on kl_precesizejvielas.id = parvietots_details.id_prece_izejviela ) on mervienibas.id = kl_precesizejvielas.default_mervieniba razots.id_atbildpersona = 27 , razots.datumslaiks >= ( select top 1 datums

batch file - how to bring back value of the variable that was set in child cmd prompt? -

in example result rest of script doesn't see variable changed. set testvar=initial_value start "" /b /belownormal /wait cmd /c set testvar=im'changed echo %testvar% is there way bring it's value main command prompt ? (this simplified example of app must run in lower cpu priority, , need receive it's errorlevel value using && this: start "" /b /belownormal /wait cmd /c myapp.exe && set elevel=ok || set elevel=fail try this: @echo off &setlocal set testvar=initial_value /f "delims=" %%a in ('start "" /b /belownormal /wait cmd /c echo(im^'changed') set "testvar=%%a" echo %testvar% .. or errorlevel : @echo off &setlocal start "" /b /belownormal /wait cmd /c exit /b 322 echo %errorlevel%

sql server - Writing CASE Statement in SQL -

i have requirement display 2 columns in report,whose values determined using same input expression following: select case when id>10 'aaaa' else 'bbbb' end 'firstcolumn', case when id>10 'bbbb' else 'dddd' end 'secondcolumn' can construct expression without repeating input expression twice same? you need repeat case statment each field while condition might same teh results differnt. other alternative use union statement whenre first select takes records id<=10 , other 1 id>10. can bea viable alternative littel hareder maintain, if performance enough, iwoudl stick repeating teh case condition.

asp.net - UpdatePanel in EditItemTemplate of Gridview causing full page refresh -

i tried search solutions, couldn't find any. everywhere talking gridview within updatepanel. in case have updatepanel within edititemtemplate of gridview , dropdownlist in edititemtemplate causing postback on selectchange event. want cell or @ row of gridview partially rendered, whole page flashes. i have used update panel elsewhere on page, outside gridview, , working fine. is updatepanel not supported within gridview templates? thanks! you need specify asyncpostbacktrigger inside <triggers> element updatepanel . tried same , working. <asp:updatepanel id="upsetsession" runat="server"> <contenttemplate> <asp:dropdownlist id="ddlmylist" runat="server" onselectedindexchanged="ddlmylist_selectedindexchanged" autopostback="true"> <asp:listitem>one</asp:listitem>

Dynamically apply a common dependent gradle file? -

i have gradle file (common-utils.gradle) bunch of useful functions common across various projects. i've got file in artifactory. now, want project's build.gradle pull down common-utils.gradle file , "apply from: 'common-utils.gradle'" can use utility methods. is there way dynamically, first time run "gradle test" fetches common file , applies it? or have have sort of 1 time "init" task run after clone repository go fetch file? well easiest way apply *.gradle file have in artifactory reference remote file in apply method: apply from:'http://yourartifactory/repo/path/to/1.0/common-utils.gradle' one downside of is, gradle not cache file atm. resolve every single gradle invocation. there open issue listed in gradle issue tracker. can vote caching @ http://issues.gradle.org/browse/gradle-835 cheers, rené

Unhanded Exception during list push_back C++ -

i implementing 2 lists of class objects in project. originally, had 1 vector container 1 group of class objects , list other have converted vector implementation list. everything worked fine vector , list implementation, however, when converted vector list (and changed subsequent code) unhanded exception when try push_back (or insert) object list. unhandled exception @ 0x004184e2 in pn_test.exe: 0xc0000005: access violation reading location 0x00000004. this results following: in .hpp file: class ssmcsection { public: data8* sectstartaddress; data32 sectsize; }; std::list<ssmcsection> sections; in .cpp file: ssmcsection sec0; sec0.sectstartaddress = memheadaddress; sec0.sectsize = 0; sections.push_back(sec0); //<- dies in call exception in list library: void _insert(const_iterator _where, const _ty& _val) { // insert _val @ _where #if _iterator_debug_level == 2 if (_where._getcont() != this) _debu

asp.net - Why would Razor View Engine have incorrect search locations -

Image
totally bizarre behavior today when working on vb.net mvc app. added partial view , got this. has seen before? ended naming files _savedsearchesgrid.vbhtml.vbhtml savedproperties.vbhtml.vbhtml and worked.. go figure... <div class="container-fluid"> @html.partial("_savedsearchesgrid.vbhtml") @html.partial("savedproperties.vbhtml") </div> don't specify .vbhtml @ end when call partial . <div class="container-fluid"> @html.partial("_savedsearchesgrid") @html.partial("savedproperties") </div> this attempting of different view engines have been installed.

amazon web services - How to detect when an AWS instance is fully functional -

we using bamboo spin (through powershell on buildserver) aws windows 2008 r2 instance target web deployment. what best method determining target instance ready deployment (all services , running, etc). there's no real easy way windows instances. best bet write infrastructure test looks see if service running on target environment , keep retrying until either verifies service available or timeout has occurred. @ point start deployment. i cucumber script check service's status continually until gets answer you set timeout appropriate amount of time, although option wouldn't recommendation

Finding underlying reason for obscure MS access crashes -

i asked similar question here: how diagnose ms access crashes apologize if there better way ask closely related question. have been having crashes in ms access database use extensively in our business. have narrowed 1 crash down odd behavior -- when form opened, , user opens new email ms outlook cause ms access have hard crash , close completely. behavior seems happen in office 2013. there way determine causing crash? i'd think best way handle more unexpected/ unaccounted bugs set form of error handle logger 1 suggested allen browne http://allenbrowne.com/ser-23a.html the basic idea have normal error handling routine rather showing user error number in messagebox you: on error # familiar this on error #2 familiar this if unexpected happens write information error (you can capture additional info here might helpful in debugging code line references) this not allow document issues (rather relying on error messages , remembering them etc.) makes users expe

c# - EF5 MVC4 Child/Parent navigation properties -

i have 3 classes can child of multitude of parent classes. there way find id/type of child's parent class without adding navigation property every possible parent type? for example: i'm making browser based space strategy game. parent classes (fleet,asteroid,planet) inherit class called 'ownablespaceobject' defined here: public abstract class ownablespaceobject : spaceobject { public int? userid { get; set; } public int? resourcesid { get; set; } [foreignkey("userid")] public virtual userprofile user { get; set; } [foreignkey("resourcesid")] public virtual resources resources { get; set; } public virtual icollection<structure> structures { get; set; } public virtual icollection<ship> ships { get; set; } } given each of child classes (resources, structure, ship) can belong 1 of parent classes inherited base class entity framework has given them columns "asteroid_id", "planet_id&qu