Posts

Showing posts from 2012

sh - Bourne Shell script doing the job but producing extra message -

so, script should take in file extension , possibly multiple files change extensions. works most, when file has space in it, changes , says file not exist. heres have... #!/bin/sh fileextension="$1" shift oldname="$@" extension=${oldname##*.} totalfiles=$# totalfiles=$(( totalfiles+1 )) num=1 while [ $num -lt $totalfiles ] in "$oldname" extension=${i##*.} if test -e "$i" newname="${i%.*}.$fileextension" if [ "$i" = "$newname" ] : else mv "$i" "$newname" fi else echo "$i": no such file fi num=$(( num+1 )) shift done done you cannot iterate string, least not way are. oldname needs array # other stuff oldname=("$@") # other stuff in "${oldname[@]}" # other stuff

Ruby on Rails Tutorial by Michael Hartl Chapter 7.1.3 - Failing Test -

i've spent couple hours trying figure out tiny little piece of puzzle before moving on in tutorial doesn't blow on later. because of that, know issues tests failing these dime dozen, apologize. in "7.1.3 testing user show page (with factories)" section of tutorial (link provided below), cannot signup page tests pass. seems it's trivial, can't find wrong in of seemingly endless files there issue (the controller, routes, test itself, user model, , on). no 1 online seems have had issue either, figure it's got random setting or on rails project. anyway, here believe relevant code: the error running user_pages_spec test in sublime: failures: 1) user pages signup page failure/error: { should have_content('sign up') } expected #has_content?("sign up") return true, got false # ./spec/requests/user_pages_spec.rb:18:in `block (3 levels) in <top (required)>' 2) user pages signup page failure/error...

.htaccess - creating nice looking URLs -

i trying make friendly looking urls ugly urls. mod directory contains index.php , user.php file. index.php has links, of various formats, user page. path mod directory : http://localhost/mod/ at time user's urls this.. http://localhost/mod/user.php?id=ricky etc.. i need make ugly 1 nice looking 1 this.. http://localhost/mod/user/ricky i tried in htaccess file, , code far in file. # enable rewriting rewriteengine on # rewrite user urls # input: user/name/ # output: user.php?id=name rewriterule ^user/([a-z]+)/?$ user.php?id=$1 this not working me. hope me. thank you. rewriterule ^user/([a-za-z]+)/?$ user.php?id=$1 [nc,l] state end of line , case insensitive [nc,l] you can use \w match text chars (non digit) rewriterule ^user/(\w+)/?$ user.php?id=$1 [nc,l] here's cheat sheet regex: http://www.regular-expressions.info/reference.html

Debugging Groovy scripts running in a ScriptEngine from IDEA -

in app, load script file classpath string, pass scriptengine. howerver, breakpoint set in script file doesn't trigger. how can make work? use intellij idea. scriptengine engine = ...; string script = fileutils.readfiletostring(file); bindings bindings = engine.createbindings(); object result = engine.eval(script, bindings); since scriptengine.eval() method takes script string or generic reader , don't think possible achieve this. groovyscriptengineimpl class generate script name , compile class @ runtime, make hard (impossible?) debugger know breakpoint(s) associated running script. it might not solution you, if instead invoke script using groovyshell , pretty works out of box. example: file file = new file(scriptdir, "scripttorun.groovy"); binding binding = new binding(); object result = new groovyshell(binding).evaluate(file); just remember set correct package in script if not located @ root.

css - laying out html elements without using inline styles -

Image
i'm coming ios background , having trouble laying out elements in html , using css. want create "simple" this: i want able split screen in separate divs have fieldsets align each other. (they fieldsets didn't draw them in primitive mockup. didn't put in third box there's more stuff in there). but here of questions: box 1 questions: have style="display:block;" in elements. if have overarching div style=display:block , don't same effect. there better way that? box 2 general question: ended hardcoding styles sort of achieve image shown. doesn't seem usable or scalable. general principals should start with? <div style="display:inline-block; vertical-align:top; float:left; width:25%"> <fieldset> <legend>first fieldset</legend> <div style="display:block;">field 1 <input type="text" style="display:block;" /> ...

php - guestbook returning database data to flash -

i've been struggling problem long , unable make work, hope can me it. first, know php files correct , mysql database works fine. in flash, able submit comment database comments not display. did many tests such making returned_database flash separately , worked fine - can see old comments. long combine submitting 1 , returning 1 together, flash doesn't show comments more. put lower version flash effects on frame thinking doesn't collaborate returning flash, submitting flash works fine. since pretty complex problem hard me copy actionscript code because on different frames in flash. if has ideas fixing maybe can send file you?

java - Entering multiple values into a url post -

working on taking input users edittext , formatting go url $_get can save mysql database. of right app store first value in each edittext fields. if give me pointer doing wrong sweet! public class newidea extends activity{ /** called when activity first created. */ private list<edittext> edittextlist = new arraylist<edittext>(); private button button; private edittext idea, des; private object mpassword; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_add_screen); button = (button) findviewbyid(r.id.btncreateidea); idea = (edittext) findviewbyid(r.id.inid); des = (edittext) findviewbyid(r.id.indis); button.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { //stringbuilder params = new stringbuilder(); //for (int = 0; < des.length(); ...

android - Put method replacing the previous object of the jsonarray -

i trying form type of jsonarray . [ { "useridentity":"bbb", "admin":true/false }, { "useridentity":"bbb", "admin":true/false } . . . ] i used code in android giving input hashmap toadd: jsonobject inerobj=new jsonobject(); jsonarray jsonarray=new jsonarray(); (string s : toadd.keyset()) { // log.d("userid",s); inerobj.put("useridentity", s); inerobj.put("admin", boolean.parseboolean(toadd.get(s))); log.d("inerobj.tostring",inerobj.tostring()); jsonarray.put(inerobj); log.d("jsonarray.tostring",jsonarray.tostring()); } the hashmap toadd has: towhid37:value=true towhid32:value=true in inerobj value ok.but when appending inerobj jsonarray, adds 1st value(towhid37) ok. bt when puts 2nd value(towhid32) replaces 1st value ie 1st element o...

visual studio 2010 - Why isn't the "!=" operator working for me in C++ VS2012 -

a simple example: #include <iostream> #include <cstring> int main(void) { using namespace std; string a="abc"; string b="abc"; if(a!=b) cout<<"abc"; } this code can compiled mingw g++ ,but can not compiled vs2012 , vs2010. dont know why. what should make code can compiled vs2012 or vs2010 i found problem headfile why can work in g++? try change #include <cstring> which old, c-style string.h by #include <string> which describe string class resides in std namespace in c++.

Understanding, Recursion in Ruby -

in recursion, method calls itself. i'm not following when there return values. example, in "learn program" book chris pine, there example on factorials. def factorial num if num < 0 return 'you cant\'t take factorial of negative number!' end if num <= 1 1 else num * factorial(num-1) end end if call method factorial(3) , go else portion of code , this: 3 * factorial(3-1) and should return 6 since 3*2=6 . factorial(3-1) calls factorial method passing 2 within recursion. num = 2 , , 2 * factorial(2-1) , 2*1=2 . what happens 6 got our first run through code? num = 1 , looks return 1 , go end of code. understanding, still have 6 , 2 previous recursions. correct in assumption, since called factorial function when multiplied num ? can me understand better? called factorial(10) , how work out? first, should replace return 'blabla' raise 'blabla' because function returns numeric, not stri...

javascript - jQuery click handlers not triggered inside a modal window -

i have simple click handler makes ajax get request on click so: $('span.switch-option').click(function() { $(this).parents('div.log-in-option').hide(); $(this).parents('div.log-in-option').siblings('div.log-in-option').fadein(); }); this works anywhere else on website. however, when try click <span> element class switch-option inside modal window, event not fire. entering contents of click-handler function in console , running them perform desired behavior, however. why click handler not fire in modal window? using popular simplemodal plugin http://www.ericmmartin.com/projects/simplemodal/ , jquery 1.9.1. a live example here: http://ec2-107-22-8-70.compute-1.amazonaws.com/thread/19 . if click 50,000 reps or user's reputation try click big blue link in dialog, click handler not fire. behavior happens other click handlers in different modal windows well. when script(main.js) running elements 'li.log-in, a.log...

wpf - datagrid view with 2 data sources -

i'm writing app want compare data 2 different data sources see if there differences. examples have seen of similar functionality place 2 datagrids next each other can see each row side side. this makes hard spot differences. show rows 1 above other in agridview. is, alternate rows in datagrid bound 1 other datasource matched pair. add check box 1 row pair can selected futher processing. i know controls customisable possible ? or need combine 2 data sources single 1 , bind ? what you're looking multibinding this enable bind multiple items , using converter return new single item. essentially, yes, combine 2 data sources 1 inside converter.

java - How do I make JVM use the IPv4 stack in isolated scope? -

i have application runs on jvm/tomcat , machine(s) runs on have ipv6 stack enabled. i'm trying make request machine supports ipv4 , jvm prefer ipv6 stack make request (i'm using apache httpclient class make request). i know -djava.net.preferipv4stack=true property reasons won't go here, can not pass when jvm starts. can't set programatically (for short period of time) so: system.setproperty("java.net.preferipv4stack", "true"); ...since potentially affect other threads running on jvm/tomcat instance (as understood this question , others). so question is, how make single request go through ipv4 stack (meaning use ipv4 interface, not connect ipv4 endpoint)? i thought using curl (via exec or via libcurl binding) since curl doesn't use jvm @ all. any other ideas? flexo's mention valid! eventually realized real problem not jvm make request form ipv6 interface, impossible since proxy have dns entry (as flexo pointed ou...

How do I exclude certain text in an HTML p tag with Nokogiri using CSS selectors? -

i dealing html follows structure below. want ignore "random text" , want pull "text want" css selector. the selector using right pulling of text: variable = page.css('div.eight.columns.listingdetail p') this html: <div class="eight columns listingdetail"> <p> <span class="bold">random text</span> text want 1 </p> <p> <span class="bold">random text</span> <span class="bold price"> text want 2 <span></span> </span> </p> <p> <span class="bold">random text</span> </p> <p> <span class="bold">random text</span> text want 3 </p> </div> so first p , inside find last element , text: puts page.css('div.eight.columns.listingdetail p').first.children.last.text and find span bold , price classes inside 1 of p element , text: puts page.css(...

arrays - incompatible types in assignment c -

i have following structs defined in header file, struct nl_packet { int seq; frametype type; cnetaddr dest; cnetaddr src; uint32_t checksum; size_t length; char data[nl_maxdata]; }; struct seq_info { int seqnum; size_t length; char data[nl_maxdata]; }; struct msg_received { cnetaddr src; struct seq_info seqinfo[bufsiz]; int lastreceived; }; and in file, have following assignment comes "incompatible types in assignment error", msgrec[i].seqinfo[j].data = packet.data; i have other statements in same method work fine, msgrec[i].seqinfo[j].seqnum = packet.seq; msgrec[i].seqinfo[j].length = packet.length; even though both, data fields in nl_packet struct , seq_info struct have same type, error coming ?? thanks in advance you assigning arrays. can not that. have copy array contents. may this: memcpy(msgrec[i].seqinfo[j].data, packet.data, sizeof(char)*nl_maxdata);

render - iOS: rendering a subview at the proper resolution -

i have view has few subviews. using transforms scale view 400%, works perfectly, not sure how scale "drawing" of sub-views. when render scaled view subviews come out fuzzy because drawing still @ 100%. i have tried [view setneedsdisplay] on view , subviews, drawing still low resolution. any ideas on how fix render? try: cgfloat myscale = 4.0; [view setcontentscalefactor:myscale*[[uiscreen mainscreen] scale]]]; additionally, if embedding view within uiscrollview allow user zoom in/out put implementation in uiscrollviewdelegate: - (void)scrollviewdidendzooming:(uiscrollview *)scrollview withview:(uiview *)view atscale:(float)scale { scale *= [[[scrollview window] screen] scale]; [view setcontentscalefactor:scale]; }

python - enthought traits UI, add values dynamically to 'values' trait of CheckListEditor -

how can add 'values' dynamically checklisteditor? instead of static 'values', have dynamically bclass options attr. from enthought.traits.api import hastraits, instance, str enthought.traits.ui.api import view, item, checklisteditor class bclass: options = ['one', 'two'] class aclass(hastraits): bclass = instance(bclass) abc = str view = view( item(name='abc', editor=checklisteditor(values=['one', 'two']) ), style='simple', ) instead of giving checklisteditor list of values , can give name of trait containing values: from traits.api import hastraits, instance, str, list traitsui.api import view, item, checklisteditor class bclass(hastraits): options = list(['one', 'two']) class aclass(hastraits): bclass = instance(bclass) abc = str traits_view = view( item(name='abc', editor=checklisteditor(name='object.bclas...

jquery - select two different color value with in four select box and give same option rest of two select option -

<select name="form_textcolor1"> <option value="">select color</option> <option value="red">red</option> <option value="pink">pink</option> <option value="yellow">yellow</option> <option value="orange">orange</option> </select> <select name="form_textcolor2"> <option value="">select color</option> <option value="red">red</option> <option value="pink">pink</option> <option value="yellow">yellow</option> <option value="orange">orange</option> </select> <select name="form_textcolor3"> <option value="">select color</option> <option value="red">red</option> <option value="pink">pink</option> ...

ActionScript 3: Adding eventListener to a child with For loop -

i error code 1009 when run code... for(var aobj:int = 1; aobj < 50; aobj++){ this["elementssb.netdev"+aobj].addeventlistener(mouseevent.mouse_down, dragobject); this["elementssb.netdev"+aobj].addeventlistener(mouseevent.mouse_up, stopdragobject); } but when run in way... elementssb.netdev1.addeventlistener(mouseevent.mouse_down, dragobject); elementssb.netdev1.addeventlistener(mouseevent.mouse_up, dragobject); it works. though, don't want make way because it's bit messy, , have 49 netdev objects. any proper way deal guys. in advance. when use fences access properties of objects dot . withing string identifier doesn't work. the correct path must be: this["elementssb"]["netdev"+aobj]

Some doubts about the graph generated by gprof and gprof2dot -

Image
i used gprof2dot generate graph below, visualized program's profiling output. i have doubts graph: first, why root of call tree isn't main(), , root bat_read() not appeared in program, declared in .h file. second, gmatrix c++ class without explicitly destructor, , unreasonable call 2 functions in graph. half of time spending illogic. third, long function @ bottom of graph, spends 6.94 percentages of time ? you can read graph in new tab , magnify it, can see clearly. i magnified image read it. the function @ bottom wide because has extremely long name, method _m_erase of red-black tree. called half million times galois_w16_region_multiply . size draws attention it, in fact appears on 7% of samples. if take every block in diagram has no parents, , add inclusive percents, 100%. of indicates gprof 's method of propagating time upwards through call graph flaky, thinks things @ top, when in fact couldn't figure out caller was. you can't te...

javascript - HTML5 Audio Mixing -

i make web application people can add recorded sounds , samples timeline. want output 1 soundfile (approximately 3min long) send server. now html5 audio api , found out audiocontext audiocontext supported in chrome. now dislike flash , wanted ask if there way html5 decent browser support (so newest chrome, ie , firefox). some thoughts: record audio using html5 audio api , user can add timeline. when finished client upload audio files server including location on timetable. server can combine audio files make 1 file. solution, prefer kind of work on client side at moment in opinion not possible (if should html5 , supported ie , firefox), see list of browser support audio api browsers audio api support . information outdated already.(these browsers update frequently) you wait, first serve chrome , hope other browser, catch up(ie might problem). or use java (if dont flash). other technologie out there silverlight, "dead", wouldn't recommend it. i hop...

java - How to use ConversationScoped EntityManager inside StatelessBean -

we inject entitymanager bean (located inside service layer) below: @inject entitymanager entitymanager and use these services inside managedbean (located inside view layer). works fine. the problem occurs when inject these services inside stateless webservice. entitymanager injected in stateless webservice using same way above code. because of entitymanager conversationscoped, getting following error: org.jboss.weld.context.contextnotactiveexception: weld-001303 no active contexts scope type javax.enterprise.context.conversationscoped @ org.jboss.weld.manager.beanmanagerimpl.getcontext(beanmanagerimpl.java:598) [weld-core-1.1.5.as71.final.jar:2012-02-10 15:31] @ org.jboss.weld.bean.proxy.contextbeaninstance.getinstance(contextbeaninstance.java:71) [weld-core-1.1.5.as71.final.jar:2012-02-10 15:31] @ org.jboss.weld.bean.proxy.proxymethodhandler.invoke(proxymethodhandler.java:104) [weld-core-1.1.5.as71.final.jar:2012-02-10 15:31] how can solve problem? how can u...

youtube api - android : youtubeplayerview api configuration change issue -

i using youtubeplayerview display youtube videos. having issue handling orientation change . initially video open in portrait mode , expected. if click full screen button, video opens in full screen in landscape mode . ( not change orientation of phone, full screen opened in landscape mode ). now watch video , rotate phone 90 degrees left , watch full screen video. if rotate phone , full screen automatically change small scree in portrait mode. so looks full screen in landscape mode , portrait mode have small screen. not want behavior. want change video size based on user clicking full screen or not. not based on phone orientation please how fix it. saw setting flags player not working . you can use manifest activity android:screenorientation="nosensor".

Is it possible to update an existing Zimbra ZCS contact using the REST API? -

is possible update/modify existing zimbra contact (or appointment etc) using rest api? i can add contact not update contact - though url use add contact requires parameter specific record: https://myzimbraserver.com/service/home/user@mydomain.com/contacts/mycontactsfolder/?fmt=csv&id=176010 you think id=176010 cause record updated doesn't - adds new record instead. without id error "no such item"! strange... documentation poorly written doesn't either. know can use soap want avoid pain of xml! (xml great, until have work it) ps. i'm using zimbra services 01.com it not possible. @ least support people @ 01.com told me.

xaml - Resize buttons styled with AppBarButtonStyle -

i appbarbuttonstyle idea of using font character button icon because of scaling abilities, of no use if cannot resize them properly. changing width or height of button not work, because appbarbuttonstyle resizes padding between button icon , button borders. changing fontsize of button not work either. is there way of resizing buttons styled appbarbuttonstyle in winrt application? dont mind if have override or modify appbarbuttonstyle , long preserves ability use font character button icon. any useful advices appreciated! you can create own custom button appbarbuttonstyle original in standardstyles.xaml . i did create custom smaller button no text , hard part aligning everything: you're not adding shapes, you're adding character, may not aligned think. default buttons contain 3 charatctes: outline, fill , glyph. if want, can share simplified code control.

testing - How to remove object from database in test in Grails -

i have got domain: myclass fields string string b i got test: void testremovemyclass() { myclass x = new myclass() x.setid(3) x.seta("aaa") x.setb("bbb") x.save() if (!myclass.exists(3)) { fail "object not exist" } x.delete() if (myclass.exists(3)) { fail "object exists" } } and second 'fail' fails. how can delete object id? first of all: not use typed references, use: def x = new myclass() very reading topic: http://blog.springsource.org/2010/07/28/gorm-gotchas-part-3/ your object still exists, should not persisted anymore. try end of test, instead of second exists() : def y = myclass.findbyid(3) assert y == null btw, can create domain objects eaisier via map in constructor: def x = new myclass(id: 3, a: 'aaa', b: 'bbb')

scala - How to perform a custom check of the arguments being passed to mockito mocks -

i have problem writing tests scala project using specs2 , mockito. there way perform complex checks arguments passed method being tested mocked service method? example: session = .... sessiondao.getbyuid(sessionuid).returns(some(session)) val result = service.refreshsessionfor(token) result must beleft got{ one(sessiondao).getbyuid(sessionuid) one(sessiondao).update(any[session]) } the problem is, want check whether field "lastused" of session object updated or not. way check parameter fields of sessiondao.update method. cannot find how in mockito manual. you can pass specs2 matcher mocked method: got{ one(sessiondao).getbyuid(sessionuid) one(sessiondao).update(belike[session] { case s: session => s.lastused must be_>(last) }) }

javascript - Why I can't disable multiple checkbox with IE with this JS script? -

i did simple script in order disable multiple checkboxes on .asp app. here's code : function updatecheckboxes(cb) { if (cb.checked) { document.getelementbyid("cb1").disabled = true; document.getelementbyid("cb2").disabled = true; document.getelementbyid("cb3").disabled = true; } else { document.getelementbyid("cb1").disabled = false; document.getelementbyid("cb2").disabled = false; document.getelementbyid("cb3").disabled = false; } } and html : <input type="checkbox" name="test" onchange="updatecheckboxes(this)"/> it works on firefox not on ie. don't understand why, can explain me problem , how find alternative ? best regards, alex ok find solution, problem onchange() ie. function updatecheckboxes(cb) { var ischecked = cb.checked; document.getelementbyid("cb1").disabled = ...

asp.net - Display a modal popup using AJAX -

i have designed modal popup in asp.net. task when click button, has display modal popup box. used ajax extender control kit also. below coding. approval.aspx: <form id="form1" runat="server"> <asp:scriptmanager id="scriptmanager1" runat="server"/> <div> <asp:button id="approvebutton" runat="server" text="approve" /> <ajaxtoolkit:modalpopupextender id ="mp1" runat="server" popupcontrolid="panel1" targetcontrolid="approvebutton" cancelcontrolid="cancelbutton"> </ajaxtoolkit:modalpopupextender> <!--modal panel "panel1"--> <asp:panel id="panel1" runat="server" height="170px" width="506px"> &nbsp; <table style="width: 100%; height: 164px;"> <tr> ...

iis 7 - IIS 7 + Windows Server 2008 - Sending Emails from Classic ASP using CDO -

on our existing platform decided upgrade our development server windows server 2003 2008 time ago. the problem facing asp scripts used send emails before when had windows server 2003 worked. now, stopped working no error on page or on smtp logs. if use telnet send email manually works fine. but it's not working our classic asp scripts. this our asp code sub sendemail(fromemail, toemail, ccemail, bccemail, subject, body, somefiles) set m_mailer = server.createobject("cdo.message") m_mailer.configuration.fields .item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1 .item("http://schemas.microsoft.com/cdo/configuration/smptserver") = request.servervariables("server_name") .item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")=smtp_server_pickup_directory .update end if m_characterset <> "" m_mailer.bodypart.charset = ...

How to find out which maven artifact/plugin is requesting for the download of a no longer available dependency -

i compiling "old" open sourced project, while encountered problem: [error] failed execute goal on project .... can not transfer artifact x:y:z ... the artifact x:y:z not found repositories defined in project pom.xml. after looked effective pom.xml, not find references x:y:z. how can find out artifact or plugin requesting missing dependency without analyze transitive dependencies? if use eclipe - can see dep tree this: open pom.xml , tick "dependency hierarchy" tab. also can try use mvn dependency:tree not totally sure work if of deps missing. update: seems both eclipse , dependency:tree require sucessfull artifact resolution work whch not case. in case guess you're left 3 opttions: clean cache (wipe under ~/.m2/repository ), run build , occurence search (search "problematic-artifact-id") on files in ~/.m2/repository . 1 or couple of artifacts should reference problematic artifact in pom. should give hint. clean cache , ...

javascript - How to make closure compiler to remove all dead code with advanced optimization in larger projects? -

the following code: function f(a) { a.a = 5; return a; } f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); f(function() {}); is optimized closure compiler this: function a(){return function(){}}function b(c){c.a=5}b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a());b(a()); (it leaves dead code.) however, if remove last line (repeat calling 24x), removes dead code. result empty. how can force closure compiler remove dead code in larger projects? the difference whether comp...

sql server - Invalid column name when where condition while using case in SQL -

select sdate, sum(case when cgrp!='township' , cdcode=0 , sdate between '4/1/2013' , '4/1/2013' billamt end) bill, sum(case when cgrp!='township' , cdcode!=0 , sdate between '4/1/2013' , '4/1/2013' billamt end) net indent bill != null group sdate the error message points line bill != null you need use subquery access alias name in select list . alias used in select list bill , net not accessible in clause . select sdate,bill,net ( select sdate, sum(case when cgrp!='township' , cdcode=0 , sdate between '4/1/2013' , '4/1/2013' billamt end)as bill, sum(case when cgrp!='township' , cdcode!=0 , sdate between '4/1/2013' , '4/1/2013' billamt end)as net indent group sdate )z z.bill not null this because in sequence of query execution , clause executed first , select . general sequence of query execution. 1 . 2 . 3 . group 4 . select 5 . order in query...

javascript - jquery "listview" and charts -

i have troubles display charts (jquery charts) web. i have 2 pages (1.html , 2.html). first contain listview links second page. 2.html displays chart. here problem: when page 2 launched through page 1, chart doesn't appear!! if reload page 2.. chart appears! if work page using "href=#page" references chart works fine , it's displayed, intention have different html files, 1 of them listview , other 1 chart. possible? i have tested many types of jquery charts , of them had same behavior. any idea? thanks all, best regards. here files: 1.html ---- <head> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /> </head> <body> <div data-demo-html="true"> <ul data-role="listview" data-inset="true"> <li><a href="2.html">chart</a></li> </ul> </div>...

Add elements in 'a tree in Ocaml -

so, here problem.. need write function add elements in tree , binary tree, must organized. problem in how tree defined. have tree: type 'a tree = { mutable cont:'a; mutable left:'a bin_tree; mutable right:'a bin_tree } , 'a bin_tree = empty |node of 'a bin_tree;; so, when write function add elements in tree says tree of type 'a tree , using function 'a bin_tree. i tried lot of different ways write function , same error. function used last is: let rec dodajvdrevo x = function empty -> node{cont=x; left=empty; right=empty} |node{cont; left; right} -> if x < cont node{cont; left= dodajvdrevo x left; right} else if x > cont node{cont; left; right = dodajvdrevo x right} else node{cont; left; right};; please me , give clues. thank you! the node constructor should take 'a tree instead of 'a bin_tree .

How does CUDA profiling work "under the hood"? -

can explain how profiler works. how measures time , instructions etc given executable. know how run profiler. wanted know background working. i want develop profiler of own. need understand how existing profiler works. i provided executable , need develop profiler profile executable. you can start reading cupti documentation . the cuda profiling tools interface (cupti) enables creation of profiling , tracing tools target cuda applications. cupti provides 4 apis: activity api, callback api, event api, , metric api. using these apis, can develop profiling tools give insight cpu , gpu behavior of cuda applications. cupti delivered dynamic library on platforms supported cuda. and cupti metric api should read, , should aware of cuda version target, because of api different previous or next version.

java - How to get cross-domain JSON from jQuery? -

i trying json (getjson()) server doesn't have support jsonp implemented. namely, when adding callback=? url, server return data, returns pure json without padding. i understand must corrected server-side - there no way resolve in jquery. correct? if cors support not supported server jsonp , might try proxy approach in such cases. 1 example http://www.corsproxy.com/ , there should other proxy alternatives too. what do? cors proxy allows javascript code on site access resources on other domains blocked due same-origin policy. how work? cors proxy takes advantage of cross-origin resource sharing, feature added along html 5. servers can specify want browsers allow other websites request resources host. cors proxy http proxy adds header responses saying "anyone can request this".

How could I fix these broken RSS head links in Joomla 2.5? -

in weird situation links rss in page appear wrongly formatted. page job search tool in company. in lines 12 , 13 can see links are <link href="/index.php/bolsa-trabajo/rss/1?type=rss?format=feed" rel="alternate" type="application/rss+xml" title="todas las categorías feed (rss)" /> and <link href="/index.php/bolsa-trabajo/rss/1?type=atom?format=feed" rel="alternate" type="application/atom+xml" title="todas las categorías feed (atom)" /> well, second parameter format=feed is after ? makes server respond 500. i've been searching , researching days now, , have found no similar problem on net. have not got knowledge joomla have walked through many different files on server , couldn't find solution. the site using template rt_ionosphere rockettheme , module jobboard tandolin . joomla version 2.5.9 . any appreciated. ok, after week @ least found solution. seems bug in ta...

database - Counts over a large set of records in DB -

i have table [id,item_name,item_price,item_status,item_type,item_owner,item_date] the application can query table number of search conditions item date and/or item owner etc. in resultset, need fetch counts different status in item_status. its causing timeouts when try counts based on status. how case handled in large volume applications. y mail. have counts of how many in inbox, how many read/unred/sent , not..almost instantly. how can such experience achieved? other indexing, , bitmap indexes flexible , performant kind of thing if can deal concurrency issues in maintaining them, consider materialised views cover common aggregation levels. defining multi-level materialised views can give instant response times, , allow effective indexing on having clauses.

cookies - php keep session alive for multiple days -

i have app enable users choose stay logged in long period of time, 3 days similar google mail, facebook or linkedin. (it meant accessed phone , data far less sensitive other stuff on phone.) right setting 4 session variables on log in, such id of user, name, etc. avoid lot of recoding , lost functionality, i'd of these variables remain accessible. is there way increase session length 72 hours when setting session variables? alternatively, if need set cookies, best practice achieve long logged in time when there number of session variables set. thanks. you can set session various ways. 1 of ways set in php.ini session.gc_maxlifetime = 360*72 with php can with ini_set(’session.gc_maxlifetime’, 360*72); you can use session_set_cookie_params(360*72,"/"); http://pl1.php.net/session_set_cookie_params it sets session cookie. can serialize $_session , set in cookie.

translate const delphi 7 gnugettext -

i have constants such code below. need translate them , have tried _() don't work. in advance. const system_name = 'system name'; business_name = 'business name'; if need handle constants, have translated, declare them resourcestring : resourcestring system_name = 'system name'; business_name = 'business name'; dxgettext handles these without tweaking.

sockets - Android Bluetooth Can't Connect using createRfcommSocketServiceRecord -

i managed working using method @ android 2.3.3 version, testing using device 2.2 version.. , can find many devices using discovery, can't connect other devices using: bluetoothsocket socket = devicetoconnect.createrfcommsockettoservicerecord(uuid.fromstring(my_uuid)); on other side, using proper thread accept connection using : mbluetoothadapter.canceldiscovery(); bluetoothserversocket ss; try { ss = mbluetoothadapter.listenusingrfcommwithservicerecord(mainpage.sd_foldername, uuid.fromstring(my_uuid)); new thread(new listenerhandler(ss, this, resultcode)).start(); } catch (ioexception e) { toast.maketext(this, "there problem opening bluetooth server socket!", toast.length_long).show(); finish(); } then on listenerhandler have this: bluetoothsocket clientsocket = ss.accept(); but connection never stablished, thoughs? in advance!

php - Input type=text not passing values with some values -

This summary is not available. Please click here to view the post.

laravel - Populate select element -

i want populate <select> element using results categories table. in order use following code. $catlist = categories::where('type','=',$content_type) ->get(array('id','name'))->toarray(); the result structure array of rows. array 0 => array 'id' => int 1 'name' => string 'article' 1 => array 'id' => int 2 'name' => string 'news' a foreach statement surely solve problem i'm looking better solution. you use lists(string $column [, string $key ]) method this, found under "retrieving list of column values" in documentation... $catlist = category::where('type', $content_type)->lists('name');

Numbers formatting in C# -

i have numbers this: -1.0001 -10000.01 and need this: -1.0001 -10000,01 requirements: - decimal separator "," - group separator " " - part of number after comma can have different length, depends actual data. i tried use mask: "### ### ##0.####" format numbers. when number big - ok, when small - spaces left of number. this: "- 1,0001" "- 10 000,01" as understand these spaces mask used. there workaround ways not beautiful , aesthetically wright. is there way correctly? thank you! try using numberformatinfo class format number. used code below check answer , worked large/small cases tested with: static void main(string[] args) { double smallnumber = -1.01; double smallnumbermoredigits = -1.0001; double bignumber = -100000.001; double longnumber = 2.2347894612789; thread.currentthread.currentculture = new cultureinfo("ru", false); ...

How to extract a command from a string - python -

i have command this: test = ('print( "it works!" )' ) and want use command inside of string. know how can extract , use it? thank much, remus use exec make sure trust code, ie. don't run on user submitted code security reasons >>> test = ('print( "it works!" )' ) >>> exec test works!

javascript - Pause animation when mousemove event occurs -

i have following code: $(source) .on('mouseenter', start) .on('mouseleave', stop) .on('mousemove', zoom.move); here attach few mouse event listeners. when 'mouseenter' event occurs, following function executed: automove: function myautomove() { var xpos = rand(0, outerwidth); var ypos = rand(0, outerheight); $(img).animate({ 'top': (ypos - offset.top) * -yratio + 'px', 'left': (xpos - offset.left) * -xratio + 'px' }, defaults.speed, myautomove); } it works great now, when 'mousemove' event occurs, following executed: move: function (e) { var left = (e.pagex - offset.left), top = (e.pagey - offset.top); top = math.max(math.min(top, outerheight), 0); left = math.max(math.min(left, outerwidth), 0); img.style.left = (left * -xratio) + 'px'; img.style.top = (top * -yratio) + ...

c++ - File Binary vs Text -

there situation have prefer binary file text file? i'm using c++ programming language? example if have store large text file better use text file or binary file? edit file moment has no requirment readable human. performance difference, security difference , on? edit sorry omit other requirment (thanks carey gregory) the record save in ascii encoding the file must crypted ( aes ) the machine can power off time. i've try prevents errors. i've know if file change outside program, think i'll use sha1 digest of file. as general rule, define text format, , use it. it's easier develop , debug, , it's easier see going wrong if doesn't work. if find files becoming big, or taking time transfer on wire, consider compressing them. compressed text file smaller can binary. or consider less verbose text format; it's possible reliably transmit text representation of data lot less characters xml uses. and finally, if end havin...

unity container - Problems integrating NServiceBus with ServiceStack IRequiresRequestContext -

i looking integrate nservicebus existing servicestack web host. servicestack using built in funq ioc container. nservicebus has been configured (elsewhere in system) use unity ioc. servicestack has feature whereby irequestcontext automatically injected when finds irequiresrequestcontext interface on class. nservicebus has similar feature message mutators, via imutateoutgoingtransportmessages interface. the application multi-tenant application. single application, via api key, passes account code through nservicebus handler (indirectly via provider called on construction of handler's constructor injection using unity). my problem arises in servicestack. using request filter drag api key out of request headers, look-up in database, , write ihttprequest.items collection: apphost.requestfilters.add((req, res, requestdto) => { var tenant = tenantrepository.getbyapikey( req.items.add("accountcode", tenant.accountcode); } i have nservicebus transpor...

twig - Silex optional locale route -

i might approaching wrong way open alternatives. i match following sample urls using single route: / /welcome /en/welcome /fr/welcome /my/arbitrarily/deep/path /en/my/arbitrarily/deep/path /fr/my/arbitrarily/deep/path etc here have far: $app->get('/{_locale}{path}', function (request $request) use ($app) { $path = $request->attributes->get('path'); // stuff path here }) ->value('_locale', 'en') ->assert('_locale','^(en|fr)?$') ->value('path', 'index') ->assert('path', '.*') ->bind('*'); now seems work expected, when try use twig path() or url() fails build correct url, example:# on /foo (no locale specified on url defaults en): {{ path('*', {path:'foo/bar'}) }} will result correctly in foo/bar on /fr/foo, same call: {{ path('*', {path:'foo/bar'}) }} results in frfoo/bar this because of missing / betwe...

continuous integration - TeamCity error: %1 is not a valid Win32 application -

i'm trying configure git vcs teamcity 7.1.2. when running build, i'm seeing following error: jetbrains.buildserver.vcs.vcsexception: 'git fetch' command failed. exception: cannot run program "c:\teamcity\jre\bin\java" (in directory "c:\programdata\jetbrains\teamcity\system\caches\git\git-5bb95c96.git"): createprocess error=193, %1 not valid win32 application if cd path in terminal on build server , attempt run referenced java binary, runs properly. the full stack trace is: jetbrains.buildserver.vcs.vcsexception: 'git fetch' command failed. exception: cannot run program "c:\teamcity\jre\bin\java" (in directory "c:\programdata\jetbrains\teamcity\system\caches\git\git-5bb95c96.git"): createprocess error=193, %1 not valid win32 application @ jetbrains.buildserver.buildtriggers.vcs.git.commandlineutil.getcommandlineerror(commandlineutil.java:44) @ jetbrains.buildserver.buildtriggers.vcs.git.fetchco...

jquery - IE8 toggleClass not working properly -

well have menu , there want have class called active , when active, obviously. to toggle class using jquery toggle function, activate in js element. if check dom element, class never set. need class, because of css styles. i know there many topics toggleclass jquery, doesn't fit (at least couldn't find suitable) here code: $('#menu').on('click', '.tab span', function (e) { e.stoppropagation(); var $tab = $(this).parent('.tab'); $tab.siblings('.tab.active').removeclass('active'); $tab.toggleclass('active'); }); html markup <div id="menu"> <div class="tab"> <span></span> </div> </div> its working in browsers, except ie8 in advance. try instead: $('#menu').on('click', '.tab span', function (e) { e.stoppropagation(); var $tab = $(this).parent('.tab'); $tab.addclass(...

Hibernate JPA maven -

i want use hibernate jpa provider glassfish server. added hiberante-entitymanager dependency maven keep getting error every time run project. missing dependency. severe: exception while deploying app [jobmanager-ear] severe: invalid ejb jar [jobmanager-ejb-1.0-snapshot.jar]: contains 0 ejb. note: 1. valid ejb jar requires @ least 1 session, entity (1.x/2.x style), or message-driven bean. 2. ejb3+ entity beans (@entity) pojos , please package them library jar. 3. if jar file contains valid ejbs annotated ejb component level annotations (@stateless, @stateful, @messagedriven, @singleton), please check server.log see whether annotations processed properly. java.lang.illegalargumentexception: invalid ejb jar [jobmanager-ejb-1.0-snapshot.jar]: contains 0 ejb. note: 1. valid ejb jar requires @ least 1 session, entity (1.x/2.x style), or message-driven bean. 2. ejb3+ entity beans (@entity) pojos , please package them library jar. 3. if jar file contain...

jobs - How to run a C# script periodically? -

is possible run c# script under windows periodically? mean sql job etc. know solution via ssis it's not looking for. basically, if task more periodical running of small piece of code, going end windows service having backgroundworker thread, running task on timer. here links start with create windows server how use background worker

Lightweight window animation in Titanium for Android -

i'm trying follow guides window animation android in appcelerator titanium, none of them mentions lightweight vs heavyweight windows. in case, simplest example doesn't work: // in mainwindow do: var wininfoview = ti.ui.createwindow({ title : "info", url : 'infoview.js', // notice don't set window fullscreen or modal property window remains lightweight }); wininfoview.open({ animated : true }); neither more complicated one: // in mainwindow do: var wininfoview = ti.ui.createwindow({ title : "info", url : 'infoview.js', // notice don't set window fullscreen or modal property window remains lightweight }); var slideleft = ti.ui.createanimation(); slideleft.left = 0; slideleft.duration = 300; wininfoview.open(slideleft); so, possible animate opening of lightweight window? how? as explained @ docs : http://docs.appcelerator.com/titanium/latest/#!/api/titanium.ui.window be sure had add code tiapp.xml, can us...

java - Map an AbstractHandler to specific path for an embedded Server (Jetty) -

for junit tests want add handler embedded jetty server. can code: server server = new server(8080) handler h = new abstracthandler() { @override public void handle(string target, request baserequest, httpservletrequest request, httpservletresponse response) throws ioexception, servletexception { // } }; server.sethandler(h); then every call server handled handler. want handle requests specific path e.g.: 'http:// localhost:8080/test'. found examples using 'org.mortbay.jetty.servlet.context' class archiev this. guess old , doesn't exist anymore? pretty simple, example of how can done: http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/examples/embedded/src/main/java/org/eclipse/jetty/embedded/manycontexts.java and general documentation: http://www.eclipse.org/jetty/documentation/current/embedding-jetty.html

excel - Matching values from multiple columns to populate another -

Image
i trying compare column against column b. when there match, i'd populate resulting column (column d) data column c. i have partial parts list (column a) comparing against complete parts list (column b). when match occurs, i'd extract corresponding data complete parts list, nomenclature (column c) , place next matching part number in column a. before column column b column c column d part number description part number description 123456 bolt 123456 after column column b column c column d part number description part number description 123456 bolt 123456 bolt i'll bite, assuming you've mis-labeled examples, want can done enough using formulas. in cell d2, put formula: =index(b:b,match(c2,a:a,false)) how works: match function returns relative row ...