Posts

Showing posts from February, 2011

Spring Integration IMAP - Receive from multiple email accounts -

i've managed use spring's imap mechanism. is possible receive emails 3 different email accounts? my xml looks this: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:mail="http://www.springframework.org/schema/integration/mail" xmlns:int="http://www.springframework.org/schema/integration" xmlns:util="http://www.springframework.org/schema/util" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/integration/mail http://www.springframework.org/schema/integration/mail/spring-integration-mail-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"> <util:prope

python - Django Admin Filter by Related Field Count -

i using django 1.27 have 2 models class publisher(models.model): name = models.charfield(max_length=100) def book_count(self) return self.book_set.all().count() class book(models.model): publisher = models.foreignkey(publisher) and in publisther admin want able filter book count class publistheradmin(admin.modeladmin): list_filter = ('book_count') .... how can work ?

windows - When exporting a Java Scala project it failed to get scala/ScalaObject -

i'm working on eclipse scala 2.9.3 plugin installed. have scala project work fine eclipse when export project "runnable jar file" , try run i'm getting following exception: java.lang.noclassdeffounderror: scala/scalaobject i tried 3 library handling options: extract required libraries... package required libraries... copy required libraries... all end in same exception. what need in order make standalone jar file project? i've used sbt-assembly plugin in past, found quite easy use.

.net - Remainder operator in C# perform different than MOD in Visual Basic -

i have found strange situation converting piece of code c# vb.net, code small class convert base 10 base 36 , vice versa. the key point function : /// <summary> /// base36 de- , encoder /// </summary> public static class base36 { private const string charlist = "0123456789abcdefghijklmnopqrstuvwxyz"; /// <summary> /// encode given number base36 string /// </summary> /// <param name="input"></param> /// <returns></returns> public static string encode(long input) { if (input < 0) throw new argumentoutofrangeexception("input", input, "input cannot negative"); char[] clistarr = charlist.tochararray(); var result = new stack<char>(); while (input != 0) { result.push(clistarr[input % 36]); input /= 36;

ios - My project files are not display in project navigator within xcode after setting up cocoapods -

Image
when open .xcworkspace see "pods" in project navigator without files displaying. know files still associated project because when search project files display in find navigator. when build project, still builds , project works fine. problem seem files not displaying in project navigator. this podfile looks like: platform :ios, '7.0' pod 'afnetworking', '~> 1.3' pod 'facebook-ios-sdk' here screenshot of see in xcode: any idea going on here?

python - File upload - Bad request (400) -

when try upload file via filefield of model using django administration following response django development server: <h1>bad request (400)</h1> the output in console is: [21/jul/2013 17:55:23] "post /admin/core/post/add/ http/1.1" 400 26 i have tried find error log, after reading few answers here think there nothing because django prints debug info directly browser window when debug=true (my case). how can debug problem further? in case leading '/' character in models.py. changed /products/ products/ in: product_image = models.imagefield(upload_to='products/')

ios - How do I make the model classes in my library reusable for Core Data? -

if create reusable ios library how create model objects useable core data i.e. model objects inherit nsobject or nsmanagedobject? at least know won't able override isequal: , hash since nsmanagedobject uses them. the preferred way let core data management features in xcode create model classes you, add methods generated classes necessary. example, if had model class 'thing', might: create core data model thing entity , appropriate attributes select thing entity , choose editor > create nsmanagedobject subclass save file; you'll new thing.h , thing.m in project edit classes normal, being careful not override of these methods

javascript - <li> active masterpage jQuery not working -

i got menu on mastepage, below: <div class="navtop"> <ul class="nav"> <li class=""><a href="default.aspx">home</a></li> <li class=""><a href="test.aspx">link</a></li> <li class=""><a href="hello.aspx">link</a></li> <li class=""><a href="world.aspx">link</a></li> </ul> </div> to set class of <li></li> active using javascript code: <script> $("li").click(function () { alert("this message"); if ($("li").hasclass('active')) { $("li").removeclass('active'); } $(this).addclass('active'); }); </script> this should work, because saw somewhere , should work. doesn't work me, menu stays

git - Maintaining patches of third-party Java library dependencies -

my java project has dependency on third-party library, let's call xyz.jar. project maintained in git , xyz in svn. xyz included in project maven dependency gets downloaded automatically part of build process. i need make minor tweaks source of xyz, still want updates project maintainers. options have? currently, best option seems to this: fork svn repo xyz new git repo using git svn clone . hack on git repo. build xyz-hacked.jar git repo , export artifact maven library server. when new changes come out xyz, can git svn rebase keep git repo date. what best practices here? can improve on approach? edit i know there some manual work involved, e.g. resolving merge conflicts , ensuring patches compatible latest xyz. i'm not looking general, automated code merge solution. i'm trying find out best practices , tools in situation. gradle i don't think gradle-specific question, in case there's gradle-specific answer: i'm using gradle include x

html - Why does this look different on FF vs. Chrome vs. IE? -

i'm trying make graphs on number line (think math class) html , css. here's i've got: http://jsfiddle.net/3pkrj/2/ 1.) looks on ff. 2.) on chrome it's good, arrowheads @ beginning , end of line 1 px high. there tiny dots in middle of red line. 3.) of course, ie fails miserably. 4.) don't know safari b/c don't have it. it seems top: ___px; part being interpreted differently different browsers. ideas on how make browsers display ff does?

javascript - AJAX and setInterval slows down the script -

i'm working on script reads things database, instantly. i connect using ajax , reload function interval. i'm using multible setinterval() information. i know that slows down page , because seems impossible use on mobile devices because laggs much. but how can that? have suggestions thanks. i advise against using ajax intervals. there various methods obtaining data server. scenario suggests trying new data server. there several ways , has been discussed here on , in other places thoroughly. the main methods server push (mainly via web-sockets) , fallback methods long polling , normal polling. you can use asynchronous framework has fallback support older browsers. to specific question, if insist on using polling (which repeated request of data @ interval), advised set timeout when response arrives , not use interval. way, if communication lags, won't out of sync , won't have simultaneous requests.

Function generators Python -

i trying implement function generator used n times. idea create generator object, assign object variable , call re-assigned variable function, example: def generator: [...] yield ... x in xrange(10): function = generator print function(50) when call print function, observe function(50) not called. instead output is: <generator object...> . trying use function 10 times assigning generator function, , using new variable generator function. how can correct this? generator functions return generator objects. need list(gen) convert them list or iterate on them. >>> def testfunc(num): in range(10, num): yield >>> testfunc(15) <generator object testfunc @ 0x02a18170> >>> list(testfunc(15)) [10, 11, 12, 13, 14] >>> elem in testfunc(15): print elem 10 11 12 13 14 this question explains more it: the python yield keyword explained

javascript - Js : hide/show of windows -

can me tutorials or code or create same of hide/show of windows in bottom left of page of site (why work us?) : http://blueowlcreative.com/wp/aqua/ any idea? you can use jquery tabs this.

jquery - d3.js equivalent to $(this) -

i modify state of text node when clicked upon, apparently fail access correctly. when click, nothing happens (unless use jquery selector, , not command work). question is: d3.js equivalent $(this) ? var buttons = svg.selectall(".button"); buttons.on("click",function(d){ var target = $(this).attr('target'); var visible = $(this).attr('visible'); if(visible==='1'){ svg.selectall(".bar."+target) .transition() .duration(500) .ease("elastic") .style('display','none'); $(this).attr('visible','0') .style('text-decoration','line-through'); }else{ svg.selectall(".bar."+target) .transition() .duration(500) .ease("elastic") .style('display','inline');

c# - Can't load images from project during vs2012 load test -

i'm trying load test wcf service visual studio 2012 web performance , load test project. added unit test file shown below , execute them load test. seems work fine except populating image byte[] in test object. unit test [testmethod, testcategory("wcf - primary tests")] public void eventitem_insert() { //arrange var service = new eventservicereference.servicecontractclient(); var item = unittesthelpers.eventitemfactory(guid.newguid(), guid.newguid()); debug.writeline(item.data.length.tostring()); //act guid pk = service.saveeventitem(item); //assert assert.arenotequal(guid.empty, pk, "the key returned empty"); } snippet calls image load routine eventitemfactory. eventitem.data = (byte[])loadtestimagefromproject(); code issues is. works when run unit test test explorer throws invalid parameter when called load test. public static byte[] loadtestimagefromproject(

string - Python's "re" module not working? -

i'm using python's "re" module follows: request = get("http://www.allmusic.com/album/warning-mw0000106792") print re.findall('<hgroup>(.*?)</hgroup>', request) all i'm doing getting html of this site , , looking particular snippet of code: <hgroup> <h3 class="album-artist"> <a href="http://www.allmusic.com/artist/green-day-mn0000154544">green day</a> </h3> <h2 class="album-title"> warning </h2> </hgroup> however, continues print empty array. why this? why can't re.findall find snippet? the html parsing on multiple lines. need pass re.dotall flag findall this: print re.findall('<hgroup>(.*?)</hgroup>', request, re.dotall) this allows . match newlines, , returns correct output. @jsalonen right, of course, parsing html regex tricky problem. however, in small cases one

memory leaks - Objective-C @autoreleasepool? -

i new obj-c , starting out making little useless programs further knowledge. wanted make sure wasn't making memory leaks. in '@autoreleasepool' automatically release it's memory when program ends? also if there bad habits, please let me know! int main(int argc, const char * argv[]) { @autoreleasepool { fraction* fractionone = [[fraction alloc]init]; fraction* fractiontwo = [[fraction alloc]init]; fraction* fractionthree = [[fraction alloc]init]; [fractionone setto:1 over:2]; [fractiontwo setto:1 over:4]; [fractionthree setto:1 over:8]; [fraction numberoffractions]; return 0; } } see apple's discussion of using autorelease pool blocks in advanced memory management programming guide. in short, no, not case "anything in @autoreleasepool automatically release[s] memory when program ends" (or @ least not function of @autoreleasepool ). purpose in having autorelease poo

regex - How to use javascript to calculate the next revision number -

i have revision number attribute in application , string. need pass in current value , calculate next valid 1 , return that. here valid progression: .a .b .c 0 0.a 0.b 1 1.a etc forget whole numbers, controlled elsewhere. deals ones periods. restrictions are: the first component number (or nothing) then period then letter, excluding , o (since resemble 1 , 0) , once reach z should go aa, ab, ac, ..., zz so if pass in .a should return .b if pass in 1.h should pass 1.j if pass in 1.z should pass 1.aa any appreciated. here's have - don't know how "increment" letter portion: function calcnextrev(currentrev) { var revparts = currentrev.split("."); var majorrev = revparts[0]; var currentminorrev = revparts[1]; ??? return majorrev + "." + newminorrev; } try this: (demo here) var alfab = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k',

c# - Workaround or alternative to spreadsheetgear image(chart).GetBitmap()? -

i'm crawling "lots" (100k+) of excel files using spreadsheetgear, found out when spreadsheetgear hits chart lots of points, breaks loose: memory isn't released & takes lot of memory being slow. for example have 63mb excel file, containing 35 charts 96k points each, getting bitmap each of taking 100mb+ per , not released (at least not untill close worksheet). if let program run on charts end >9gb commited! , definately can't ask customers upgrade 32gb+ required support files. are there alternatives doing this? i'd fine skipping files slow & tried (checking count on points in seriescollection) seems points access issue didn't (just checking points.count seems load points associated data!). any appreciated, either able grab graph in alternate way (with spreadsheetgear or library doesn't require installed , supports excel file formats) or way check graphs have many points without using points.count. it's bit of wild shot asking s

fibonacci - How to get nth result from simple function in python? -

i apologize simplicity of question, have searched multiple times may simple hasn't been asked before. i wrote fibonacci function prints every fibonacci number under 3000. def fibonacci(): a, b = 0, 1 while b < 3000: a, b = b, + b print return how can make returns first n fibonacci numbers? also, how can make print nth value? example print [6], return 8. tried make string: a = str(fibonacci()) print a[6] but didn't work, , i'm not sure why. helping. there several ways this; here's semi-clever one: first, change print yield , function returns numbers instead of printing them: def ifibonacci(): a, b = 0, 1 while b < 3000: a, b = b, + b yield then use itertools.islice slice out numbers want: import itertools print list(itertools.islice(ifibonacci(), 10)) # prints [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] print list(itertools.islice(ifibonacci(), 6, 6+1)) # prints [13] isn't quite rig

backbone.js - Fat Free router blocks Backbone router, how/when does Backbone router.js work? -

i have backbonejs (bb) project setup. have fat free framework (f3) running server-side code. ask this, please keep in mind i'm learning these 2 web dev tools: when bb router routing? have link in web page matches route in bb router, f3 router keeps trying handle , failing. how these 2 routers work , not interfere? thanks lot help. if not using pushstate, backbones routes easy differentiate server routes: /route1 /route2 /route1#route/a /route1#route/b the part before hash 1 transmitted server (f3 routes). part after hash corresponds backbone routes. //f3 routing $f3->route('get /route1',…) $f3->route('get /route2',…) //backbone routing routes: { "route/a": "routea", "route/b": "routeb", } note backbone router doesn't generate http request server (unless define of course). what generates automatically http requests backbone model. backbone model mapped server resource using urlroot .

linking CSS into django .html file -

i lost in finding out how link external .css file in html template. have read (or @ least tried read) https://docs.djangoproject.com/en/dev/howto/static-files/ , still lost. .html file in c:\users\me\documents\mysite\templates and .css file in c:\users\me\documents\mysite\templates\static\css in settings.py, made static_root = 'c:/users/me/documents/mysite/templates/static' static_url = '/static/' in .html file, trying link css doing <link href="{{ static_url }}css/style.css" rel="stylesheet" type="text/css" /> any idea missing or doing wrong? static folder must myapp folder @ same level templates folder , views.py

python - Flask Passenger WSGI on Dreamhost -

first followed instructions in tutorial on matt carrier's blog (although assumed making subdirectory on domain, when i'm not). erased , started on instructions on dreamhost wiki page flask. each time, message in browser reading: "an error occurred importing passenger_wsgi.py". answer topic on stackoverflow did not work me. my passenger_wsgi.py file is: import sys, os interp = os.path.join(os.environ['home'], 'flask_env', 'bin', 'python') if sys.executable != interp: os.execl(interp, interp, *sys.argv) sys.path.append(os.getcwd()) flask import flask application = flask(__name__) sys.path.append('penguicon-trax') penguicon-trax.penguicontrax import app application penguicon-trax name of directory git creates when clone app virtualenv installed flask (not in public dir). app penguicontrax.py without dash. i made sure indent on fourth line of passenger_wsgi.py tab, not spaces. i used dreamhost webpanel (where i&

actionscript 3 - Why isn't my MovieClip displaying images? -

i made image in photoshop, , imported flash cs6. made movieclip pressing "f8" , set class name , everything, usual. however, when try add in stage background image, won't show @ all. class name there in autocomplete, nothing shows up? i've verified image in symbol, again, nothing showing up. when run debugger, keep getting error: unable open 'c:\src'. i thought might have path imported image in flash, don't know how change it. it's not letting me edit path. can please tell me what's wrong? i'm absolutely clueless! help! (and yes, did add child display list -- that's not issue.) edit: should note i'm using flash-builder. :) when do: var bg:backgroundbase = new backgroundbase(); addchild(bg); ...that's not working @ all, though should, , other movieclips in swc. i ended having embed image. there's tutorial on how here: http://www.streamhead.com/embedding-images/

ios - Core Data error message -

i created core data entity named: "athlete". here error getting: terminating app due uncaught exception 'nsinvalidargumentexception', reason: '+entityforname: nil not legal nsmanagedobjectcontext parameter searching entity name 'athlete'' this line @ breaks: athlete *detail = [nsentitydescription insertnewobjectforentityforname:@"athlete" inmanagedobjectcontext:context]; delegate.h @property (readonly, strong, nonatomic) nsmanagedobjectcontext *managedobjectcontext; @property (readonly, strong, nonatomic) nsmanagedobjectmodel *managedobjectmodel; @property (readonly, strong, nonatomic) nspersistentstorecoordinator *persistentstorecoordinator; delegate.m -(void)createdata{ nsmanagedobjectcontext *context = [self managedobjectcontext]; athlete *detail = [nsentitydescription insertnewobjectforentityforname:@"athlete" inmanagedobjectcontext:context]; detail.first = @"joe"; detail.last =

java - Running in SuperDevMode -

i tried superdevmode when url: http://localhost:9876/ accessed and dev mode on clicked, i'm getting this: can't find gwt modules on page. what missing? did $mvn gwt:compile $mvn gwt:run-codeserver i have these versions in pom: <gwt.version>2.5.0</gwt.version> <gwt.maven.version>2.5.0</gwt.maven.version> do need update gwt version or gwt maven version? or missing? as page explains, "dev mode on" , "dev mode off" should added bookmarks browser. you'll use bookmark when visiting gwt app start super dev mode session. i wrote while how super dev mode works ; should clarify things you. update: note gwt 2.7, superdevmode enabled default within devmode, launch devmode "as usual" , uses superdevmode under-the-hood, "compile on load" hook no longer use bookmarklets. "compile on load" hook can enabled codeserver using -launcherdir argument (point war folder). note in

html - How can I do this for my website? -

i have little design question. make website has header line 2 both sides of it. ------------- similar ----------------- i don't know how should go this, , couldn't find sites implementing able peek html/css.. how should this??? thank you markup: <div class="section-heading"> <h1>your heading</h1> </div> css: .section-heading { text-align: center; margin-bottom: 15px; border-bottom: solid 1px #dcdcdc; position: relative; top: -2.2em; } .section-heading h1{ display: inline; padding: 0 15px; bottom: -15px; position: relative; background: #fff; } http://jsfiddle.net/9ss5h/

svn - How to find which revision of a file a line of code was moved? -

i'm using visualsvn server , tortoisesvn, , i'm trying find specific line appears, across multiple revisions of specific file. i'm trying see where, in past revisions, save(12); appears, , in revisions it's moved, compared working copy. a unified diff between r1 , working copy shows initial location. i've tried viewing diffs individually, there hundreds of revisions. is there way this? if run tortoisesvn blame tool on current revision of file should see revision that line became now, (and did it).

mysql - How to optimize SQL Query with INNER JOINs -

i have large database table access document. includes different tables each attribute fitment of auto part. 1 can imagine, fitment data contains lot of specifications , such, spread out. now building query map values database becoming difficult. have following query seems contains many joins... , add more, seems take bit longer run. there better way going this? select import_values.base_vehicle_id, import_values.qty, import_values.part_type_id, import_values.part_id, import_values.position_id, import_values.note, parts.partterminologyname, basevehicle.yearid, make.makename, model.modelname, submodel.submodelname, enginedesignation.enginedesignationname, enginevin.enginevinname, enginebase.liter, enginebase.cc, enginebase.cid, enginebase.cylinders, enginebase.blocktype, enginebase.engborein, enginebase.engboremetric, enginebase.engstrokein, enginebase.engstrokemetric, fueldeliverytype.fuelde

Asp.net Can't save image from browser to local machine -

me have projects web use codefile on me browser photos local save path file images on database successful. on me developers project there in host can not insert path file images database of me. although project on local machine works my. can me. thank here chunk codes of me: html code: <%@ page title="" language="c#" masterpagefile="~/ad/admin.master" autoeventwireup="true" codefile="editproduct.aspx.cs" inherits="editproduct" %> <asp:image id="image1" runat="server" height="91px" width="96px" /> <asp:fileupload id="fileupload1" runat="server" /></td> code c#: using system; using system.data; using system.configuration; using system.collections; using system.web; using system.web.security; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts; using system.web.ui.htmlcontrols; using bal; usi

Entering dependent answer in SPSS -

how should enter data questionnaire in spss respondent answer question number 10 if answer qno.8 yes else answer question no. 9 , skip 8. example: 8. have ever tried online shopping?(if yes go q 9 else q 10) 1. yes 2. no 9. if yes, reason 1. 2. 10. if no, reason 1. 2. if enter value in 9 10 missing data in cross tab generation spss can have multiple types of missing values, , here instance in use them. example, below value labels plus missing values command give labels describing whether missing data due skip pattern or due actual missing. value labels q8 q9 q10 1 'yes' 2 'no' 8 'skip' 9 'missing'. missing values q9 q10 (8,9). note if 9 , 10 string values, can still define strings missing. if want categories displayed in crosstabs , see integer mode , missing subcommand.

asp.net - I have a stored procedure how to store its output and display in .NET -

i have form section called search, user enters name , search 3 tables , displays output based on search in exist or not. in below example taking query input " joe " , lookup in table existence , give tabular format. stuck have created table, sqlprocedure don't know how call sql procedure when user enter name , click on search button, , sqlprocudure called , output displayed without refreshing page. please code appreciated. description in eg: have table: create table table1 (name nvarchar(10)); create table table2 (name nvarchar(10)); create table table3 (name nvarchar(10)); insert table1 values ('joe'); insert table3 values ('joe'); and have sql procedure: select case when t1.name null 'no' else 'yes' end table1 ,case when t2.name null 'no' else 'yes' end table2 ,case when t3.name null 'no' else 'yes' end table3 table1 t1 full join table2 t2 on t1.name = t2.name full

php - no error message but all of data fail to import -

i want import data excel file phpmyadmin. use library excel_reader2. when click import button there no error message data fail import. here code <?php include "excel_reader2.php"; mysql_connect("dbhost", "dbuser", "dbpass"); mysql_select_db("dbname"); $data = new spreadsheet_excel_reader($_files['userfile']['tmp_name']); $baris = $data->rowcount($sheet_index=0); $success = 0; $fail = 0; ($i=2; $i<=$row; $i++) { $id = $id->val($i, 1); $name = $name->val($i, 2); $address = $address->val($i, 3); $query = "insert student values ('$id', '$name', '$address')"; $result = mysql_query($query); if ($result) $success++; else $fail++; } echo "<h3>import data finished</h3>"; echo "<p>sum of success data : ".$success."<br>"; echo "sum of fail data : ".$fail."</p>"; ?> and here resu

javascript - mod_auth_cas redirects random requests to CAS login -

i'm using mod_auth_cas authentication system on applications have problem, when i'm logged in cas , making ajax requests server requests being redirected cas login page. problem cas on origin requests not jsonp fail. have solution this? thanks :) we have had same problem. solution simple: configure apache use mpm prefork. the problem happens when apache configured use mpm worker. when many requests arrive simultaneously (i.e. 20 requests), of them randomly redirected sso server.

How to get a subset of a javascript object's properties -

say have object: elmo = { color: 'red', annoying: true, height: 'unknown', meta: { one: '1', two: '2'} }; i want make new object subset of properties. // pseudo code subset = elmo.slice('color', 'height') //=> { color: 'red', height: 'unknown' } how may achieve this? using object destructuring , property shorthand const object = { a: 5, b: 6, c: 7 }; const picked = (({ a, c }) => ({ a, c }))(object); console.log(picked); // { a: 5, c: 7 }

c# - Time display format -

i want display time in mvc4 appication in particular format. [displayformat(dataformatstring = "{0:f}")] public datetime eve_date { get; set; } i use above format. i want date in following format: sun, 11 july 2013, 5.30 pm . how possible? try code, [displayformat( dataformatstring="{0:ddd, d mmmm yyyy, hh.mm tt}", applyformatineditmode=true )] public datetime eve_date { get; set; } usage, @html.editorfor(m => m.eve_date)

c - unix gcc file overwrite -

i did stupid during development. i wrote on terminal gcc source.c -o source.c instead of gcc source.c -o source.bin or that i editing file using nano.is there way restore ? either using possible autosaves or decompile .? i did myself not long ago. luckily still had emacs editor opened re-save file. can't recover source object file unfortunately. check around in source file's directory files named special characters, perhaps beginning "."

c# - Is it possible to render a view when the server is down -

i have render simple view when server down. there global filter checks server connection. inside filter redirect should performed show view when server is. problem redirect controller never occurs. code inside filter executed several times , many requests error in browser. if redirect image or text goes fine. rendering view no-go. global filter: public override void onactionexecuting(actionexecutingcontext filtercontext) { using (var connection = new sqlconnection configurationmanager.connectionstrings["incbbsconnection"].tostring())) { try { connection.open(); } catch (sqlexception) { // works, text shows: //var content = new contentresult {content = "server down!", contenttype = "text/plain"}; // filtercontext.result = content; // works, image appears: //filtercontext.result = new redirectresult("~/content/images/loginlogo1.png");

Take unique value to consider only second column in shell -

i have file contain below data. want take unique data consider second column. may 23, 2013|380565195-00001 may 23, 2013|386277814-00001 may 15, 2013|370674334-00001 may 23, 2013|370674334-00001 may 23, 2013|422011458-00001 may 21, 2013|620734890-00001 may 23, 2013|721962541-00001 may 22, 2013|820591328-00001 may 23, 2013|820591328-00001 may 10, 2013|900544559-00099 may 23, 2013|900544559-00099 may 23, 2013|981242670-00001 output should below. may 23, 2013|380565195-00001 may 23, 2013|386277814-00001 may 15, 2013|370674334-00001 may 23, 2013|422011458-00001 may 21, 2013|620734890-00001 may 23, 2013|721962541-00001 may 22, 2013|820591328-00001 may 10, 2013|900544559-00099 may 23, 2013|981242670-00001 please me on this. awk -f"|" '{if (!h[$2]) {h[$2]=1; print;}}'

sql - Old Access Update Statement -

we switched oracle sql server , had old update statement used work giving error 'operation must updateable query'. query type set update, have tried running administrator no success , able run select statements no problem, connection must ok? i'm not sure if i'm missing simple i'm used working in ssms , not access. code update statement below: update dbo_learner_aims inner join dbo_registration_units on dbo_learner_aims.rul_code = dbo_registration_units.rul_code set dbo_learner_aims.end_date = [exp_end_date], dbo_learner_aims.completion = "10", dbo_learner_aims.outcome = "40", dbo_registration_units.fes_progress_code = "ext", dbo_registration_units.fes_progress_date = [exp_end_date], dbo_registration_units.progress_status = "x" (((dbo_learner_aims.end_date) null) , ((dbo_learner_aims.funding_year)="17") , ((dbo_learner_aims.learning_aim) = [enter aim]) , ((dbo_learner_aims.exp_end_date) between #8/1/20

ruby - Unable to find buttons of system popup using rautomation -

Image
i'm writing tests using selenium webdriver , rautomation handle system popup. tried on irb following: require 'selenium-webdriver' require 'rautomation' driver = selenium::webdriver.for :firefox driver.get "http://rubygems.org/gems/rautomation-0.9.2.gem" window = rautomation::window.new :title => "opening rautomation-0.9.2.gem" ok_button = window.button(:text => "&ok") ok_button.exists? cancel_button = window.button(:text => "&cancel") cancel_button.exists? ok_button.exists? , cancel_button.exists? returning false. hence can't click on buttons. i tried: window.buttons.length to find number of buttons, it's returning 0. could please me why buttons aren't detected using rautomation? please correct me if i'm doing wrong. here popup: the problem dialog not use native windows controls. when use spy++ or autoit window info tool not show controls in window either.

android - How to display changed state of checkbox before other code executes in OnCheckedChangeListener.onCheckedChanged -

i need add new view after clicking on checkbox. , want show changed state of checkbox , display new view, when click on checkbox, ui stops second or few, , @ same time showing new view , checkbox displaying checked. my code simple { checkbox = (checkbox) findviewbyid(r.id.select_param_value_checkbox); if (checkbox != null) { checkbox.setoncheckedchangelistener(new oncheckedchangelistener() { @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { oncheckboxchanged(ischecked); } }); } } protected void oncheckboxchanged(boolean ischecked) { //this listener adding in constructor , creates in view want add child on_change_listener.onfilterparamvaluechanged(this); } and code listener is: public void onfilterparamvaluechanged(myclass obj) { addview(new myview(getcontext(), obj.gettitle())); } code of myview: class myview extends linearlayout{ private textview title; publ

c++ - wcscat_s function - buffer error -

the question simple: what's frong piece of code? size_t buff = 1; size_t new_buff; wchar *var_path; wchar *dir_path; var_path = new wchar[buff]; new_buff = getenvironmentvariablew(l"appdata", var_path, buff); if (new_buff == 0) { return 1; } else if (new_buff > buff) { delete[] var_path; var_path = new wchar[new_buff]; getenvironmentvariablew(l"appdata", var_path, new_buff); } dir_path = new wchar[new_buff]; wcscpy_s(dir_path, new_buff, var_path); wcscat_s(dir_path, new_buff, l"\\directory"); it says buffer small on wcscat_s you allocate new_buff characters dir_path (and tell wcscat_s size), want append more characters it. need allocate new_buff plus length of l"\\directory" , tell wcscat_s actual size.

selenium - WebDriver - sendKeys to browser not work in Firefox? -

i trying send keys browser(not element) using code: actions action = new actions(driver); action.sendkeys("hello! world!"); action.perform(); it works in chrome , ie8, result world in firefox! i using firefox 22 , selenium webdriver 2.32.0 is bug? thank you. firefox 22 not supported until selenium 2.34.0 (it may work scenarios @ moment, speaking doesn't work). i suggest rolling ff20 if want selenium 2.32.0 work, or ff21 if want upgrade selenium 2.33.0.

mysql error 1064 - Can't create/write to file '/var/tmp/#sql_2f6_0.MYI -

for past 3 4 months, have our application live , running, haven't deployed new fixes / changes on live . ever unfortunately, noticed application has stopped running. following issue observed our logs : "can't create/write file '/var/tmp/#sql_2f6_0.myi" . it appreciable if of can extend help. check services , user mysql giving error. possible of services might down, or user using db not getting authenticated.

c++ - Linking a function to a timer with Qt -

i have function declaration above: double image_function(double sum, double avr, double &value) i have read signals , slots must have same arguments, how possible adjust condition when applyinh timer function follow: connect(timer, signal(timeout()), this, slot(image_function())); timer->start(0); that's not possible. function needs 3 parameters, have give them. how timer know function's parameters? create slot function (without parameters) timer's timeout. there call image_function parameters want. let's class mainwindow. need declare slot qtimer's timeout signal: class mainwindow : public qmainwindow { q_object public: ... private slots: void timer_image_function(); }; then in .cpp, somewhere create qtimer , connect signal new slot: connect(timer, signal(timeout()), this, slot(timer_image_function())); timer->start(0); and of course, need implement slot function, calls image_function : void mainwindo

.net - Exception when trying to deserialize the JSON object -

i trying deserialiaze json object on line ser.writeobject(ms, inpjsonobj); exception thrown edit: suggested created new memory stream , copied modified object in new stream . "out" string still blank ! datacontractjsonserializer ser = new datacontractjsonserializer(typeof(testjson)); memorystream ms = new memorystream(encoding.unicode.getbytes(inpstr)); ms.position = 0; testjson obj = (testjson)ser.readobject(ms); obj.var11 = 99; obj.var21 = 199; memorystream ms1 = new memorystream(); ser.writeobject(ms1, obj); ms1.position = 0; streamreader sr = new streamreader(ms1); out = sr.readtoend(); ms1.close(); ms.close(); without knowing exception details can guess, looks problem creating instance of non-resizable memory stream , trying write updated object - result of serialization larger original string , stream canno

ibm mobilefirst - How to sort items of EdgeToEdgeStoreList -

i built edgetoedgestorelist , works. want sort items or filter label. have setted parameter query : var samplestore = new memory({data:listini_data, idproperty:"label"}); storeelencolistiniclienti = new edgetoedgestorelist({store:samplestore,query:{label:/1$/}}, "ulelencolistiniclienti"); storeelencolistiniclienti.startup(); but displays items , not label ending in '1'. why? how set correctly query parameter ordering items? if use method: storeordinicliente.setquery('label:/1$/'); this message displayed on browser's console: error: no filter function label:/1$/ found in store this listini_data: [object { label="1537 | imm | 14/07/2011", codice_ordine="16537", stato_ordine="imm", more...}, object { label="12790 | imm | 24/04/2012", codice_ordine="16790", stato_ordine="imm", more...}, object { ..... try this.filter label , order att. works me var samplestore;

c# - WPF richTextBox cant identify as UIElement -

i have following code attaches adorner s uielement s have on canvas . private void slidecanvas_previewmouseleftbuttondown(object sender, mousebuttoneventargs e) { { selected = false; if (selectedelement != null) { alayer.remove(alayer.getadorners(selectedelement)[0]); selectedelement = null; } } if (e.source != slidecanvas) { _isdown = true; _startpoint = e.getposition(slidecanvas); selectedelement = e.source uielement; _originalleft = canvas.getleft(selectedelement); _originaltop = canvas.gettop(selectedelement); alayer = adornerlayer.getadornerlayer(selectedelement); alayer.add(new resizingadorner(selectedelement)); selected = true; e.handled = true; } } for reason though when cl

exit - perl script is not terminating after finishing -

i calling perl script using xinetd port. observed file not terminated automatically after finishing. pasting code of file below. #! /usr/bin/perl -w use warnings; use time::piece; use dbi; use diagnostics; $env{tz} = 'asia/kolkata'; $today = localtime->strftime(); # local time zone $todaysecs = localtime->epoch(); # local time in secs(total secs) $line = <stdin>; #input xinetd $line =~ s/^\s+//; $line =~ s/\s+$//; if($line ne "") { $connet_db = dbi->connect('dbi:mysql:db_name','db_user','db_password'); $connet_db->do("insert `table_name` (`column1` , `column2`, `data_time`) values ('$line', '$today', $todaysecs)"); $connet_db->disconnect(); } i pasting output of cmd shows processes not terminated. 14848 /usr/bin/perl -w /home/abhi 48:34 15225 /usr/bin/perl -w /home/abhi 46:02 15836 /usr/bin/perl -w /home/abhi 43:31 1616

c# - How to obtain the Document Interface when Hosting the WebBrowser Control? -

please have @ following excellent article available on msdn i in process of creating ie toolbar of bandobjects i have access webbrowser control not able instantiate htmldocument require modify dom. here excerpt of code: // registering documentcomplete envent explorer.documentcomplete += new shdocvw.dwebbrowserevents2_documentcompleteeventhandler(explorer_documentcomplete); // not sure following function. // trying suggested in msdn article - // http://msdn.microsoft.com/en-us/library/aa752047%28v=vs.85%29.aspx#document void explorer_documentcomplete(object pdisp, ref object url) { ipersiststream pstream; string htmltext = "<html><h1>stream test</h1><p>this html content being loaded stream.</html>"; htmldocumentclass document = (htmldocumentclass)this.explorer.iwebbrowser_document; document.clear(); document.write(htmltext); ihtmldocument2 document2 = (ihtmldocument2)pdisp;

java - Access string from key value json response -

i'm getting simple json response , can't access value easily. response this {"email":"ted@ted.com"} that's after doing json.tostring(). i'm trying access value of email , keep getting errors. thought json.getstring("email") also in java. edit: here errors i'm getting 07-22 06:45:11.524: e/androidruntime(9977): fatal exception: asynctask #2 07-22 06:45:11.524: e/androidruntime(9977): java.lang.runtimeexception: error occured while executing doinbackground() 07-22 06:45:11.524: e/androidruntime(9977): @ android.os.asynctask$3.done(asynctask.java:299) 07-22 06:45:11.524: e/androidruntime(9977): @ java.util.concurrent.futuretask$sync.innersetexception(futuretask.java:273) 07-22 06:45:11.524: e/androidruntime(9977): @ java.util.concurrent.futuretask.setexception(futuretask.java:124) 07-22 06:45:11.524: e/androidruntime(9977): @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:307) 07-22 06:45:11.

replication - Detecting VM Copied / Replicated -

i looking detect unique constraint if , when vm image copied 1 location another. doing part of product licensing service modification prevent license tampering. licensing service uses mac id uniquely identify license. works fine on physical machine in case of copied vm licensing service unable identify os separate os , invoke license blocking. need unique element gets changed when vm copied / replicated. (i have omitted details on simplification). thoughts appreciated. the way aware of approach have licensing server. when enter license code client (on vm), contacts server , sends license code , other information. contacts repeatedly (you define interval -- maybe once every few hours) asking 'am still valid"? along request, sends unique id. server replies 'yes, valid', , sends new unique id client. client sends unique id next request server. if vm duplicated, next time asks server 'am valid?', unique id incorrect either it, or other vm. both not

css - Gap between difference in paragraph size -

here's fiddle: http://jsfiddle.net/be4sy/ essentially, eliminate gap between these 2 paragraphs. realise inexperienced question, can't figure out how. here's code: html: <p id='big'> big text </p> <p id='small'> small text </p>` css: #big { font-size:100px; } #small { font-size:20px; } simply give them margin: 0 , have look: http://jsfiddle.net/be4sy/2/

I'm trying to get the innerHTML function in Javascript to work -

i want heating answer appear next heating surface (mm) can't make work. following error message chrome console uncaught typeerror: cannot read property 'value' of null i know else works because added alert box, need innerhtml work though. here html: <html> <head> <script type="text/javascript" src="pipeheaterfunction.js"> </script> </head> <body> <table> <tr><td>inner diameter (mm):</td> <td><input id="dia" onkeypress="pipeheater();"></td> <tr><td>pipe thickness (mm):</td> <td><input id="thi" onkeypress="pipeheater();"></td> <tr><th>calculate heater:</th> <td><button onclick="pipeheater();">calculate</button></td></tr> <tr><td>heating surface(mm):</td> <td><span class="output" id="surf

c# - SMB/CIFS serverside implementation -

is there opensource, preferrably managed smb/cifs implementation use simulate windows share server application? not have folders/files locally on disk drive, rather return content on request. you can python using impacket smbserver implementation. an example can found here: https://github.com/coresecurity/impacket/blob/master/examples/smbserver.py

hibernate - Incorrect format date in java -

i trouble work. : in proj , got strange exception(below),i check code, found entitymanager.flush() method throw out exception.i find may entitymanager.persist() method trouble. our customer told me exception occurs when run job, , when run job again,it successed.i think should not problem code,because if ,it not successed when run job twice. think if there exist bug when calendar.addmonth() or calendar.addday(). can't clear. have ever see ? why there incorrect format date ? 2013-07-11 20:35:50,504 error [org.hibernate.util.jdbcexceptionreporter] batch entry 0 insert statementitem (account_accountid, amountdue, amountpaid, createdate, financiatransactiontype_transactiontypeid, information, pending, periodend, periodstart, relatedstatement, sequencenumber, statementitems_statementid, verification_verificationid, statementitemid) values (null, '15.0', '0.0', null, 'statement fee', 'direct_debit_statement_fee', '0', '0008-07-28 00:00:0