Posts

Showing posts from April, 2012

backup - Recovering from SQL Server DB -

i have done incorrect update in db , hence restored db backup previous day. have not taken copy of corrupted data before restoring backup. there possibility data lost between creation of file , restoring file. thanks saving job in word no, or 2 words: no , no

linux - Character encoding issue while reading an Excel file in a Java Web App -

in java web app, i'm using jexcel api read excel files sent clients. i'm doing : byte[] excelfile = ... inputstream inputstream = new bytearrayinputstream(excelfile); workbooksettings ws = new workbooksettings(); ws.setencoding("cp1252"); workbook w = workbook.getworkbook(inputstream, ws); ... struts gives me excel file byte array (i use formfile#getfiledata() method). it works ok on windows. quite different on linux. while cells can parsed correctly , content interpreted (even if there non ascii characters 'à', 'ê', etc), sheet names not. bad characters '?' or '�'. i forced workbook encoding utf-8 : ws.setencoding("utf-8"); but there no effect. i changed excel file utf-8 too, nothing happens. don't understand why not work, sheet names, since whole chain in utf-8 (i have servlet filter forces http requests encoding utf-8 too). i had similar problem java excel api. problem excel tries smart ,

xml - Unserialize Error PHP -

can me error bother me. everytime login display erros. works fine in pc when deployed in server production not working way use be. once put wrong password , username works fine , display invalid username , password when enter correct account time display errors. here code: function login_post() { $valid = parent::_check_login($this->post('username'), $this->post('password')); $status = 401; if ($valid) { $this->load->model('users_model'); $user = $this->users_model->get_by_login($this->post('username'), $this->post('password')); if (!$user) { $status = 401; } else { $status = 200; $key = $this->_generate_key($user['user_id']); $valid = array('key' => $key); } } $this->response($valid, $status, 'xml'); } here error a php error encountered severity: warn

uuid - Secure ID in Java with persistency -

i'm preparing java library need assign unique id generated objects serialization purposes. once unique id generated, have ensure next time use library, there no possibility reassign id object saved in past. now, see many in stackoverflow suggest rely on couple of options, i.e. uuid , securerandom , i'm not sure classes suits needs , i'm not sure how use them. please, can address myself right utility use , how generate id? solutions based on utility guava/apache welcome. the probability of generating duplicate uuids pretty low . i'm unaware of probability 2 uuid instances across different machines generate same id, uuids should unique across jvms. not go through trouble of embedding database generate uuids. can use java uuid safely. alternate solution if need unique id across multiple invocations of program, use database sequence. can ask db cache next n numbers of sequence make reasonable fast , value persisted across invocations. uuids more con

slider - Start slide with URL -

i need go slide 5 url. when type url.com/#slide5 or /?start=slide5 code "startslide: 5," needs triggered. $(document).ready(function(){ $('.slider').bxslider({ slidewidth: 300, minslides: 2, maxslides: 3, startslide: 5, slidemargin: 10 }); }); is possible somehow? you can use window.location.hash $(document).ready(function(){ var hash = window.location.hash; $('.slider').bxslider({ slidewidth: 300, minslides: 2, maxslides: 3, startslide: hash, slidemargin: 10 }); }); but have add slide number hash e.g. url.com/#5 or apply logic strip slide number hash.

svg - How can I get numeric values instead of Logarthmic values in D3 axis scale? -

i tried following code, d3.scale.log().domain([1,4]).range([h, 0]); in axis i'm getting values 1e+0, 2e+0, 3e+0, 4e+0 in axis value. need lograthmic values such 10, 100, 1000, 10000 ..etc.... use log.scale 's tickformat in conjunction axis tickformat function. eg. set 1 -> 10000 log scale: var s = d3.scale.log().domain([1, 10000]).range([1000, 0]) then, set axis: var axis = d3.svg.axis().scale(s).tickformat(function (d) { return s.tickformat(4,d3.format(",d"))(d) }) example http://jsfiddle.net/2hvxc/ we want 4 ticks - 1 each power of 10 - , formatted comma digit. learn more formatting here: https://github.com/mbostock/d3/wiki/formatting learn more log scales here: https://github.com/mbostock/d3/wiki/quantitative-scales#wiki-log and axis: https://github.com/mbostock/d3/wiki/svg-axes#wiki-ticksize

c++ - Read ublas vectors from binary file or init it with array[] -

why cannot read ublas vectors binary file in way (instead of reading 1 element @ time): boost::numeric::ublas::vector<double> floatvector(10); myfile.read( (char *)&vector, 10 * sizeof(double)); is there way initialize ublas vector array? double d[10]; you can use this double array[] = {1., 2., 3.}; boost::numeric::ublas::vector<double> v(sizeof(array) / sizeof(*array)); std::copy(array, array + sizeof(array) / sizeof(*array), v.data().begin());

C# serial port data received event handler is being triggered twice -

i receiving 6 bytes array data in c# visual studio 2010 windows forms applications using data received event handler. but when try show data on form label shows repetition of 6 byte data when need 6 bytes. can please tell me how serial port received event works?

Remove "generated by doxygen" and timestamp in PDF -

as title. i've started using doxygen, first test run noticed pdf created has "created doxygen 1.8.3.1" followed date , time, across front page. is possible remove this? or move it, end of document? i have noted other similar questions html (or rtf im not generating) , not pdf you can using custom latex header. first generate default 1 using doxygen -w latex header.tex footer.tex doxygen.sty now edit header.tex , "generated on ..." part , replace of liking. then mention customized header in doxygen's configuration file latex_header = header.tex and run doxygen normal. note : when upgrade newer version of doxygen may need update custom header well.

How to get logically inserted fact or insrt fact in code in Drools guvnor -

my guvnor rule : rule "aa" dialect "mvel" when fund( amount> 10000 ) alert fact0 = new alert(); fact0.setsummary( "hi" ); insert( fact0 ); end and using stateless knowledge session. want fact0 in code. how that? please me. the drools-friendly way using queries. option use ksession.getobjects(). can take answer: retrieving facts of specific type working memory hope helps,

php - How to append characters to the parent window's component -

i have link, when clicks, opens window of browser (specialchars.php) function popup_specialchars() { var ht; if(window.navigator.appversion.indexof("msie 5.01") == -1) ht = 300; else ht = 720; specialcharswindow = window.open ( "/tradesciencejournalsystem/specialchars.php", "special_characters", "resizable=yes,scrollbars=yes,height=" + ht + ",width=650,dependent=yes,alwaysraised=yes" ); specialcharswindow.focus(); } <a href="javascript:popup_specialchars();" class="special">insert special character</a> <textarea name="docarticletitle" cols="60" rows="14"></textarea> specialchars.php function insert_text(str) { alert(str); opener.append(str); // not working this.window.focus(); } &l

php - .val stops form from working -

i have this checkout page (you have add item) uses javascript / jquery seen in this jsfiddle show/hide fields separate shipping address. when showing, set value of fields '' , when hiding set values of fields same respective fields in billing form. when submit form should taken paypal login screen (try filling out form without toggling different shipping address , submitting) if toggle shipping address comes same page. i have debugged enough know modifying fields .val() breaking form. if comment out bits , manually toggle visibility dev tools, or if fill out billing form , never show/hide shipping (so .val() never called), works fine. if going @ page , give try, know successful if paypal screen, otherwise coming same page (the form's action same page, can't find processes data - full php page can found here - modified version of wpec's shopping cart page here (most of) relevant javascript: $('#reveal-shipping').click(function(){ i

Spring Security with HTTPS on CloudFoundry -

i tried access application on cloudfoundry following configuration in spring security xml <intercept-url pattern="/signup*" access="permitall" requires-channel="https" /> but gives me error this webpage has redirect loop however when changed requires-channel="http" can see page normally. in both cases used https on application. expected behavior ? i have same issue when tried secure pages https using spring security. from discussion on cloudfoundry support, seems "terminate ssl connections @ router". see " is possible visit application via ssl (https)? ". and after more year, no further information can find regarding issue.

c# - Open document with word, without path -

i'm searching how open document word, without path. i document : byte[] text = item.doc; the document comes directly database. i found way open path... doc, must open it, , run saveas of word application (choice between pdf, doc etc...). i can store in memorystream , but, can next? found how open file memory stream , not helping me. try this response.clear(); response.buffer = true; response.contenttype = "application/ms-word"; string filename = "test.doc"; response.addheader("content-disposition", "attachment; filename=" + filename); streamreader reader = new streamreader(memorystream, system.text.encoding.utf8, true); string strcontents = reader.readtoend(); reader.close(); response.write(strcontents); response.end(); --sj

Create Property files in grails and display content in main.gsp layout -

how , create property file in grails , have display content of property file in main.gsp(layout) you can store message in grails-app/i18n/messages.properties , use g:message tag, like: <g:message code="my.message.code" /> see docs: http://grails.org/doc/latest/ref/tags/message.html

netbeans - method in main read string expression in java -

this question has answer here: how parse mathematical expression given string , return number? [duplicate] 10 answers i need create method in main read string expression , parse parenthesis first. the expression is: (3+4)*7/2 it has done in java. don't know how it. any ideas on that! try this: scriptenginemanager mgr = new scriptenginemanager(); scriptengine engine = mgr.getenginebyname("javascript"); string foo = "(3+4)*7/2"; double result=0; try { /* seems (on platforms) results in java.lang.runtimeexception because of converting object double, let's replace double.doublevalue() */ //result = (double) (engine.eval(foo)); result = ((double) (engine.eval(foo))).doublevalue(); //result = 24.5 } catch (scriptexception e) { //handle exception here } update before try evaluate expressi

Accessing element from reference array in F# -

was experimenting arrays , references - intent create reference array , use reference inside closure access element of array. fsi attempt: > let dk2 = array.create 5 0 let dk2ref = ref dk2;; val dk2 : int [] = [|0; 0; 0; 0; 0|] val dk2ref : int [] ref = {contents = [|0; 0; 0; 0; 0|];} > !dk2ref.[1] stdin(3,2): error fs0039: field, constructor or member 'item' not defined is there direct way access element of referenced array? (in case, 2nd element of dk2ref)? i'm not sure why need reference array. looking operator precedence table , . operator has higher precedence ! operator. example parsed !(dk2ref.[1]) causes error because 'a ref doesn't implement indexed properties . you need add parentheses @ right places: > (!dk2ref).[1] val : int = 0

asp.net - eBay API upload TrackingId by Sold listing | Sales record -

for uploading tracking numbers ebay via api use copletesale function , pass orderid or transactionid, don't have neither transactionid nor orderid, have sold listing | sales record it looks like: sold listing | sales record 123456 how can upload tracking number used sold listing | sales record value? should first transactionid or orderid? appreciate help. thank you! in case need use call getsellingmanagersoldlistings then salerecord array, contains transactions arrays. there transactionid in each transaction item.

database - Insert SQL (Access) not working using webmethods Asp.net -

i trying insert fields local ms access database using webmethod(services) , website. have tried looking cannot seem spot i've gone wrong. can tell me if doing right. code below not add new data database nor direct me page requested. services webmethod: [webmethod] public void addnewposts(string postusername, string posttitle, datetime postmessagepostdatetime, int subtopicid, string postmessage) { //connection string datbase string database = "provider=microsoft.ace.oledb.12.0;data source=|datadirectory|/forum.accdb;persist security info=true"; oledbconnection myconn = new oledbconnection(database); //execute query string querystr = "insert posts (topicid, posttitle, postusername, postdatetime) values (" + subtopicid + ",'" + posttitle + "','" + postusername + "'," + postmessagepostdatetime + ")"; // create command object oledbcommand mycommand = new oledbcommand(querys

shell - snmptrap SNMPv3 with selected client ip address -

i send trap , specify clientaddress as search there 2 ways: edit /etc/snmp/snmp.conf , set: clientaddr [ip_of_device] specify ip parameter: --clientaddr="[ip_of_device]" when try issue command: snmptrap -v 3 -l noauthnopriv -u someuser -n "" agent_ip .1.3.6.1.4.1.161.5.2 .1.3.6.1.4.1.161.1.2.3.4 5 it gives error getaddrinfo(agent_ip, null, ...): address family hostname not supported when not specify clientadress works expected use ip of machine issed command client ip to rid of have to: define virtual interface ip of device want simulate specify protocol of agent ( default when set clientaddr in /etc/snmp/snmp.conf looks tried use ipv6 agent ) snmptrap -v 3 -l noauthnopriv -u someuser -n "" udp:agent_ip ...

Ajax post data in android java -

i new t ajax, quite familiar android. converting ajax program android app. part of it, need post data server. below given post command in ajax. var postto = 'xyz.php'; $.post(postto,{employee_name: $('[name=employee_name]').val() , phone: $('[name=phone]').val(), employee_type: 'guest' } , function(data) { if(data.success){ window.localstorage["sa_id"] = data.mid; window.location="getempdb.html"; } if(data.message) { $('#output').html(data.message); } else { $('#output').html('could not connect'); } },'json'); i want implement in android under little above statements. @ ajax me out thing. of now, user name , telephone number edit text input. need send php using http client. know how send data using php, not know format send , whether string send or json object send. please in interpreting above code , oblige. apparently, uses urlencodedformentity if using httpclient in a

Removing while iterating issues in java -

i want implement method attack works this: every warrior troop attacks warrior chosen randomly troop. if attacked warrior dies must removed troop. method tried error random number: java.lang.illegalargumentexception: n must positive the troop list <creature> warriors; think not doing remove correctly, because otherwise should not have error. public void atac(troop opponenttroop){ for(creature f : warriors){ creature c = getopponent(opponenttroop); f.atac(c); listiterator<creature> iterator = opponenttroop.warriors.listiterator(); while(iterator.hasnext()){ c = iterator.next(); if(c.isdead()){ iterator.remove(); } } } } private creature getopponent(troop opponent){ int x = rand.getrandomarrayindex(opponent.warriors.size()); return opponent.warriors.get(x); } remo

java - How to handle JDialog opened after setVisible(false)? -

this scenario: add windowopened() handler new instance of jdialog show dialog first time using jdialog.setvisible(true) as expected: windowopened() handler triggered jdialog.setvisible(false) jdialog.setvisible(true) expected, not happened: windowopened() handler triggered how handle situation when modal dialog appeared on screen whenever first time or subsequent times called setvisible(true) ? how handle situation when modal dialog appeared on screen whenever first time or subsequent times called setvisible(true) ? have use componentlistener, , override methods componenthidden() , componentshown() jcomponent must returns true isdisplayable() more here

c# - Can not set cascading property while setting single property works fine -

following code not set property. nothing , @ debugging jumps ahead, f11 job.tdatareference.checkedout = false; job of type tjob class build myself property: public tdatareference tdatareference { { return new tdatareference(this.datareference); } set { this.tdatareference = value; } } tdatareference class build myself property: public bool checkedout { { return (datarow[checkedout].tostring() == "true"); } set { datarow[checkedout] = value.tostring(); } } and , private member datarow of type datarow what funny following code works fine , sets property: tdatareference dr = job.tdatareference; dr.checkedout = false; who can explain me. update many answers! understand problem. :) tdatareference depends on value in this.datareference earlyest time tdatareference can set when this.datareference known. how think changing this: private tdatareference tdatareference; public tdatareference tdatareference { {

c++ - C2106 Error in Simple Math Program -

#include <tchar.h> #include <stdio.h> #include <iostream> using namespace std; int main() { int = (1024^3)-(639^3)-(385^3); short max = 0; cout<< " prints 0 if no answer." << endl; for(int iii = 100; iii < 1000; iii++) { if(a % iii = 0) { max = iii; } } cout<< " " << max; cin.clear(); cin.ignore(); cin.get(); return 0; } just trying write simple program don't have calculate , compiler returns c2106 error line 14. if (a % iii = 0) this invalid assignment. if meant compare, use comparison operator == . if (a % iii == 0) moreover, exponentiation not done ^ in c++. bitwise xor operator. exponentation, use std::pow <cmath> header. #include <cmath> int main() { int = std::pow(1024, 3) - std::pow(639, 3) - std::pow(385, 3); }

xpath - how to click on a specific record that is just entered in selenium in Divs & grids -

in application, have option open popup menu(by clicking in specific column of table) & function called using click on of menu items i added record1, appeared in table other x,y,z records. have 4 rows in table. want open popup menu of record1(which created test) how can that? all of work in app done using divs. finding elements through xpaths in scenario not able needful.

delphi - TGridPanel no transparency if themes disabled in Win7 -

i have form filled timage. put on tgridpanel. if themes enabled in windows 7 tgirdpanel appears transparency. if themes disabled (no visual styles) tgridpanel loses transparency , hides part ocupies. use delphi xe2 is there workaround this? that's basic fact of life panels. it's not special tgridpanel , see same effect control derived tcustompanel . transparency supported when application themed. the grid panel convenient way layout controls. if want support running unthemed simplest solution remove tgridpanel , layout controls manually. that's pretty trivial do. handle onresize event of control contains panel, , position controls desired.

java - Solr: How to show if searched keywords are matched or not? -

i don´t want highlight searched keywords, need information keyword exists in document. my search looks this: q=keyword1 or keyword2 or keyword3 or keyword4 the result should this: document has keyword1 , keyword 3, document b has keyword 3 i didn´t found approach requirement. should parse manually highlight snippet or there others approaches? there seems no out of box way know keywords matched document. options highlight, need configure return search terms found. can run debugquery return matches documents. both of them expensive operations.

Functional programming in Python: returning none instead of correct value -

i wrote functional code in python , not understand why returns none instead of correct value code generates. the purpose of script take line.split(',') csv , reassemble values inadvertently split '{value1,value2,value3}' 'value1,value2 ... valuen'. def reassemble(list_name): def inner_iter(head, tail): if head[0][0] == '{': new_head = [head[0] + ',' + tail[0]] if tail[0][-1] == '}': return [new_head[0][1:-1]], tail[1:] else: inner_iter(new_head, tail[1:]) def outer_iter(corrected_list, head, tail): if tail == []: print corrected_list + head return corrected_list + head else: if head[0][0] == '{': head, tail = inner_iter(head, tail) outer_iter(corrected_list + head, [tail[0]], tail[1:]) else: outer_iter(corrected_list + head, [ta

c# - How to start the main class in WPF application? -

i newbie wpf.i have problem in developing wpf application want start class start object,after want show welcome form. when trying put main method in class set project properties startup object class. getting error "the calling thread must sta, because many ui components require this." . how can resolve error making main method of class startup object? in top app.xaml exit="app_exit" startup="app_startup" in app.xaml.cs void app_startup(object sender, startupeventargs e) private void app_exit(object sender, exiteventargs e) there other events can subscribe to, if needing override app startup need define in program.cs this: public static class program { [stathread] [permissionset(securityaction.demand, name = "fulltrust")] public static void main(string[] args) { and somewhere in there app app = new app(); app.initializecomponent(); app.run();

Print a file (pdf) to a printer with PS driver, grab PS-file and convert to searchable pdf with ghostscript -

when print pdf-file ps-driver , convert ps-file searchable pdf ghostscript (pdfwrite device) wrong final pdf file. becomes corrupt. in cases, space character disappears, , in other cases text width becomes large text overlap text. the settings gs -dnopause -dbatch -sdevice=pdfwrite -dembedallfonts=true -dsubsetfonts=false -soutputfile=output.pdf input.ps i wondering if ghostscript cant produce output when input file pdf. if print word-document works fine! are there other solutions using xps-driver , convert xps file searchable pdf instead? there solutions out there can this? i use gs 9.07. best regards joe why going through step of printing pdf file postscript file? ghostscript capable of accepting pdf file input. this adds more confusion, won't add useful. its not possible problem 'might' without seeing original pdf file , postscript file produced driver. guess whatever application processing pdf hasn't embedded font, or postscript driver has

c# - Foreign key to values using Linq -

i have webpage , site using linq. page contains gridview shows customers , bound list (of customer). i use below code single customer public function getcustbyid(byval id integer) customer implements icustomerservice.getcustbyid return datacontext.customers.singleordefault(function(c) c.id = id) end function i bind gridview passing customer ids method. displays rows need have 1 issue. some columns foreign keys show 1,2 etc, way have overcome in past on different projects adding sub query sql query in data layer you've guessed linq im not sure /not possible in order foreign keys display values using linq? im little new linq appreciate or articles me this. thanks it recommended separate view entity classes (or domain classes if like). define view model class, customerviewmodel , , project customer it. i'm not sure how list of customers (getting each single customer id highly inefficient) somewhere there ienumerable<customer> . let

apache - localhost doesn't work after upgrade to Mountain Lion -

i upgraded mountain lion lion , had on lion, except localhost. start apache terminal , starts fine. however, can't localhost, gives me error "can't connect server localhost". i have checked httpd.conf file , before when used work. difference after upgrade removal of username.conf users folder in apache2 directory, recreated. apache error log file doesn't show either. in fact, there no log file in there. has got solution that?

javascript - FadeIn / FadeOut glitch using basic jQuery Tabs -

i'm working on simple fadein / fadeout tab system using jquery , however, it's not smooth i'd be. here demo see in action. take @ demo. expected fade in , out of 1 another, if click through tab 1 > tab 2 > tab 3 tab 1 , there strange fadein/out glitches along way. any ideas how fix this? jquery is: $(document).ready(function(){ $('ul.tabs').each(function(){ var $active, $content, $links = $(this).find('a'); $active = $($links.filter('[href="'+location.hash+'"]')[0] || $links[0]); $active.addclass('active'); $content = $($active.attr('href')); $links.not($active).each(function () { $($(this).attr('href')).hide(); }); $(this).on('click', 'a', function(e){ $active.removeclass('active'); $content.fadeout("slow");

php - using exec to append data to file not in current directory -

i trying set little script allow php append data file the file etc/httpd/conf/httpd.conf i want to automatically add data file vhost use... echo shell_exec('echo "hello" >> /etc/httpd/conf/httpd.conf'); the code not working, , not outputting anything i have feeling due working directory, i welcome other ways of doing this... must able called via php window probably it's permission problem. permissions on httpd.conf? can check using ls -l /etc/httpd/conf/httpd.conf if you're on linux/mac.

php - Show alert with the content of a Database selection -

i new javascript related it. i have set of dynamic rows , corresponding columns rows. in 1 column have button. when click on it, displays results of select query in page based on posted competence_id . the query works fine , correct results when click on button. however, now, display message in an alert when button clicked , stay on same page rather opening new tab.. here relevant html code shows table use: echo "<table border='1' id='mycompstable' class='sortablee' cellpadding='0' cellspacing='0'>"; echo "<tr><th>id</th><th>competence group</th><th>competence class</th><th>competence description</th><th>own evaluation</th><th>manager's evaluation last year</th><th>target levels</th><th>gap</th><th>action</th><th class='unsortable'>action ready target </th></tr>";

windows - how do I log dir from FTP -

i made ftp script need logging of transfer specially list of files on remote ftp (result of ls or dir) , log of ftp commands, not result get.bat ftp -v -n -i -s:d:\ax\get.ftp >>d:\ax\ftplog.txt get.ftp open ftp.xxxxxx.xx user xxxxxxx xxxxxxxx binary cd /out ascii ls >>d:\ax\ftplog.txt lcd "\import" mget *.* s mdelete *.* bye result: open ftp.xxxxxx.xx user xxxxxx binary cd /out ascii ls >>d:\ax\ftplog.txt lcd "\import" mget *.* s bye and want see is: 230 login successful. ftp> dir 200 port command successful. consider using pasv. 150 here comes directory listing. drwxrwxrwx 2 ftp ftp 4096 apr 25 10:10 in drwxrwxrwx 2 ftp ftp 4096 apr 24 15:39 out 226 directory send ok. ftp: 121 bytes received in 0,02seconds 7,56kbytes/sec. how do that read ftp -? , notice -v parameter that, according documentation, means -v suppresses display of remote server responses. so, remove paramete

javascript to retain form on login failure -

below javascript function authenticate user... wanna retain form on login failure username/password textbox being blank. function authenticate(form) { if (form.username.value == "administrator" && form.password.value == "password") { window.open('orderlist.aspx')/*opens target page while id & password matches*/ } else { alert("error password or username") $("#username").val("") $("#password").val("") form.????????????('login.aspx')//so stays on same page wihout reloading page. tried window.open, opens instance of form. /*displays error message*/ } } i assume firing either onclick or onsubmit . preventing form submission, want use onsubmit , have return results of function. in case of validation failure, javascript fun

Symfony 2 form in eZ Publish 5, CSRF intuition -

i'm working on ez publish 5 project. cms based on symfony 2. have built form without class described in tge page : http://symfony.com/doc/current/book/forms.html#using-a-form-without-a-class on ez publish 5 documentation ( https://confluence.ez.no/display/ezp/legacy+configuration+injection ) read need set csrf intention parameter 'legacy'. can't figure how this. tried use add method on formbuilder : $this->createformbuilder()->add('_token', 'csrf', array('intention'=>'legacy'); but error 'could not load type csrf'. can me on ? thanks. okay, have given try. my first answer question: if don't intend execute legacy kernel code follow-up form, don't need care intention, believe. intentions between symfony , legacy kernels need match if legacy kernel booted (in case check if there token, , if valid). if need use legacy kernel, can set intention legacy passing custom form options: $formopt

collections - Groovy subcollection -

what groovy way collection items without items in subcollection. example: collection: [1,2,3,4,5,6] subcollection: [1,5,6] the result should be: [2,3,4] edit: looks i'm doing wrong. part of code: def report = report.get(params.report.id) def user = user.get(params.user.id) list<user> availableusers = [] availableusers = user.findallbycompany(company)) list<user> addedusers = [] addedusers = (list<user>) session["addedusers"] ?: [] addedusers << user session["addedusers"] = null session["addedusers"] = addedusers availableusers = availableusers - addedusers this code removing last user in addedusers list. availableusers: [john, jack, jim] addedusers: [john, jack] availableusers - addedusers: [john, jim] every time last item in addedusers gets removed. i'm guessing i'm missing obvious cant find it. did try obvious: result = [ 1, 2, 3, 4, 5

eclipse - Set Vaadin default browser as Chrome -

how open vaadin project in browsers chrome, safari rather eclipse's default browser, when run/debug vaadin project? i need project avoid creating multiple instance class when again open vaadin app in chrome. if want change browser eclipse, have go in eclipse "preferences" -> "general" -> "web browser". there can change browser eclipse using.

android - Trying to create a intent in the onPostExecute methed of a AsyncTask -

i'm using asynctask task load response web server. depending on response is, start new activity or display error message. right i'm trying within onpostexecute method of asynctask class. constructor undefined error when try create intent. here code: protected void onpostexecute(string result) { // code thate xcicutes after thread if ( result.contains("ok")) { presave(); intent i; if (chatorgame==1) = new intent(cglobals.mparent ); else = new intent(cglobals.mparent); startactivity(i); } else { if (binterneterror==false) { new alertdialog.builder( cglobals.mparent) .settitle("log in error") .setmessage( "user name or password" ) .setneutralbutton("close",new dialoginterface.onclicklistener() {

can I detect a user on Mobile Safari (iphone) VS UIWebView (WebKit) with javascript? -

i'd able tell difference between user hitting website on normal safari included in iphone or ipad, vs user hitting same content through uiwebview within native ios app. i hoping there'd way javascript , user-agent strings? point in right direction further investigation appreciated! thanks! i suggest send variable in url string in native ios app , save value session variable on webserver. use session variable things different mobile safari , uiwebview in ios app when request site add variable ios nsstring *urlquerystring = @"?browsertype=iosnative"; nsstring *urlpath = [nsstring stringwithformat:@"http://www.yoursite.com/%@",urlquerystring ]; nsurl *requesturl = [nsurl urlwithstring:urlpath]; nsurlrequest *request = [nsurlrequest requestwithurl:requesturl]; [self.webview loadrequest:request]; php if(isset($_request['browsertype'])) { //used tracking ios native app user. //this not set mobile browser user $br

tsql - SQL Server 2008 Column to Row Data -

i have budget table in sql server database looks following: create table #cols ( acctid int, yr int, pd01 numeric(15,2), pd02 numeric(15,2), pd03 numeric(15,2), . . . pd13 numeric(15,2), primary key(acctid, yr)); i need take data in various columns , switch row based format table following: create table #rows ( acctid int, yr int, pd int, amt numeric(15,2), primary key(acctid, yr, pd)); now run 13 sql statements this: insert #rows select acctid, yr, 1, pd01 #cols; . . . insert #rows select acctid, yr, 13, pd13 #cols; but wondering if there more efficient/elegant way this? another option unpivot select acctid,yr,cast(right(pd,2) int) pd, amt #cols unpivot (amt pd in ([pd01],[pd02],[pd03],..., [pd13])) unp

html - css expand text left and preserve container width -

please see fiddle - http://jsfiddle.net/grimmus/vawe9/4/ <div class="refresh"> <div class="date" id="date"> of 1/10/2013 16:44 2013 (gmt + 1) </div> <div class="loading"id="loading"> loading... </div> </div> in blue box trying toggle between date , loading text. date text can varying width , width stay same when text hidden , loading text shown. width of date should expand left far necessary. loading text should aligned left i having difficulty preserving width of box when showing loading text. 1 solution thought applying visibility hidden date text , relatively positioning loading text on div higher z-index. seems quite complicated , hope there easier solution. suggestions/advice/tips welcome. p.s needs work in ie7+ try jsfiddle example : jquery setinterval(function () { $('#date').animate({ opacity

jquery - Moving the scrolling bar up or down -

as going through extjs examples came across behavior http://dev.sencha.com/deploy/ext-4.0.0/examples/grid/array-grid.html when click on row , begin moving cursor or down,the scrolling bar moves along , when arrive @ last record,the scrolling bar down there you. the example using keyboard events in example,i attempting highlight row , understand how done. this example http://jsfiddle.net/thiswolf/pheax/ this how got scrolling bars .tableholder{border:2px solid red; overflow-y:auto;height:300px} what making scrolling bars move along move or down rows?. checkout fiddle . uses following code in addition code mimic basic version of table control you're aiming var cntnr = $('.tableholder'); var cntnr_height = cntnr.height(); var cntnr_top = cntnr.offset().top; var cntnr_scrolltop = cntnr.scrolltop(); var all_rows = $('tr', cntnr) var row_height = $(all_rows.get(0)).height(); $('.table

relative path - Enforce trailing slash in Rails Routing -

adding trailing slash in links easy enough {:trailing_slash => true}, doesn't account if user types in non-slashed url. there way enforce trailing slashes via redirects in router? get "/:controller/:id" => redirect{|params| "/#{params[:controller]}/#{params[:id]}/" } the above leads circular loop. why? a relative link of "./subclass" on /parent/1 is different than /parent/1/ in config/application.rb file, add config.action_controller.default_url_options = { :trailing_slash => true } in application class

Cocos2d: UIImageView will not remove itself from glView -

in application pushing new scene has 2 uiimageviews on it. in init method of new scene, uiimageviews allocated , added view using: [[[ccdirector shareddirector] view] addsubview: _someuiimageview]; in dealloc method, removing layer delegate touchdispatcher , removing uiimageviews like: [_someuiimageview removefromsuperview]; _someuiimageview = nil; however when pop scene, return scene want, still able interact uiimageviews scene before. have tried replacing scene instead of popping it, still there. using cocos2d 2.0 if makes difference. thanks @kreiri alright, maybe dealloc method not called when remove de scene, review retains objects, maybe not released , cause dealloc method not called.

crystal reports - Subreport parameters not being used when 0 records -

i have subreport in crystal report there 0 records returned, subreport insists on pulling every order remark ever entered yet still displaying 0 remarks. it's odd, says "reading records 0 of 150000" , keeps increasing. the subreports selection critera company code, customer code , order number. passed "{?pm-..." thing going on. i opened blank subreport's preview , sql didn't make mention of selection criteria. query run indeed show every remark. any thoughts on how can happen? subreport formula: ({e_ord_h.comp_code} = {?pm-e_ord_h.comp_code}) , ({e_ord_h.cust_code} = {?pm-e_ord_h.cust_code}) , ({e_ord_h.ord_num} = {?pm-e_ord_h.ord_num}) when crystal report behaves means there logic cannot done on db server, must done locally. caused using cr function in record selection formula doesn't translate db's language. in case, believe when parameters null causing (for example, statement {e_ord_h.comp_code}=<null> does no

c++ - Strange comma operator behaviour -

this question has answer here: why these constructs (using ++) undefined behavior? 12 answers undefined behavior , sequence points 3 answers void foo() { int a[5], c = 2; (int = 0; < 5; i++) a[i] = 0; int res = (c--, a[c]++, c++) + (c++, a[c]--, c--); (int = 0; < 5; i++) cout << << ": " << a[i] << endl; } the code above print: 0 : 0 1 : 1 2 : -1 3 : 0 4 : 0 instead of: 0 : 0 1 : 1 2 : 0 3 : -1 4 : 0 this because operations order in generated code following: // first parentheses c--; a[c]++; // second parentheses c++; a[c]--; // , last operation res = c++ + c--; the question is: why operations not run expected (i.e. 3 operations in 1 parentheses , 3 operations in other)? order of operations no

c# - Attitude.RotationMatrix vs. Matrix.CreateFromYawPitchRoll() -

shouldn't rotationmatrix returned motion sensor equal matrix created using yaw, pitch , roll values same motion reading? having following code: motionreading mr = motion.currentvalue; matrix m1 = mr.attitude.rotationmatrix; var yaw = mr.attitude.yaw; var pitch = mr.attitude.pitch; var roll = mr.attitude.roll; matrix m2 = matrix.createfromyawpitchroll(yaw, pitch, roll); shouldn't m1 , m2 equal? missing there? how rotationmatrix calculated? if rotating model on more 1 axis, can occur problem first rotation rotates other 2 axis, , maybe that's why createfromyawpitchroll gives matrix different rotationmatrix . suggest use createformyawpitchroll , or can try using quaternions .

python - How to build groups with read_csv()? -

i have csv files following layout : finances , enterprises mortgages mortgages constituted unidades:capital loaned (millions euros) ,total,,rustic,,urban,,-urban. dwellings,,-urban. lots,,-urban. others,,rustic,,-rustic bank loans,,-rustic savings banks loans,,-rustic loans @ other institutions,,urban,,-urban bank loans,,-urban savings banks loans,,-urban loans @ other institutions,, ,number,capital loaned,number,capital loaned,number,capital loaned,number,capitalloaned,number,capital loaned,number,capital loaned,number,capital loaned,number,capital loaned,number,capital loaned,number,capital loaned,number,capital loaned,number,capital loaned,number,capital loaned,number,capital loaned, 2003m01,"118040.0","11135.75","3469.0","444.5","114571.0","10691.25","89642.0","7937.54","3496.0","1134.3","21434.0","1619.4","3469.0","444.5","1069.

restkit - How do I implement dynamic mapping (RKDynamicMapping) with this JSON? -

my backend returns kind of json files: { "response": { "message": "test" }, "responsecode": 205 } depending on responsecode value, inside response different. know have use rkdynamicmapping, not sure how. problem see in sample code , manual, attribute differentiate among mappings inside, in case outside. tried doesn't work: [dynamicmapping setobjectmappingforrepresentationblock:^rkobjectmapping *(id representation) { nsnumber* responsecode=(nsnumber*)representation[@"responsecode"]; if (responsecode.integervalue==204) { return searchbylocatorresponsecontent204mapping; } else if (responsecode.integervalue==205) { return searchbylocatorresponsecontent205mapping; } return nil; }]; rkresponsedescriptor *searchbylocatorresponsecontentresponsedescriptor = [rkresponsedescriptor responsedescriptorwithmapping:dynamicmapping pathpattern:kc