Posts

Showing posts from January, 2010

normalize - Properly normalizing a dual quaternion -

i'm having trouble dual quaternions, , believe it's because they're not normalized. a, b , a' dual quaternions latter conjugated. when doing this: q = * b * a' should theoretically end q = b if , b normalized. in cases, don't, , it's messing whole skeletal hierarchy. many pages show norm of dual quaternion ||q|| = sqrt(qq'), means taking square root of dual number, , have no idea how that. right i'm dividing whole thing length of real part. i've been searching around days, still have yet find code example on how use dual quaternions. feel know theory pretty well, still can't work. not difficult. of interest computer graphics unit dual quaternions, i.e. ||q|| = 1. leads to: qq' = (r, d)(r*, d*) = (rr*, rd* + dr*) = (1, 0) q = dual quaternion. r = real part, d = dual part. see, unit dual quaternions dual part vanishes. need calculate magnitude real part. problem reduced calculating magnitude of simple quaternion. , calc

optimization - Assembly uses CALL ESI 3 times on GetTickCount why? -

can explain why gettickcount called 3 times in row when 1 result used? this isn't whole function of assembly part has gettickcount many times. don't think it's human error in programming that? sort of optimization trick or compiler screw up? the output below ollydbg 00412eb0 /$ 81ec f4010000 sub esp,1f4 00412eb6 |. 53 push ebx 00412eb7 |. 55 push ebp 00412eb8 |. 56 push esi 00412eb9 |. 8b35 14b24d00 mov esi,dword ptr ds:[<&kernel32.gettick>; kernel32.gettickcount 00412ebf |. 57 push edi 00412ec0 |. ffd6 call esi ; [gettickcount 00412ec2 |. ffd6 call esi ; [gettickcount 00412ec4 |. ffd6 call esi ; [gettickcount 00412ec6 |. 8bc8 mov ecx,eax 00412ec8 |. b8 cdcccccc mov eax,cccccccd 00412ecd |. f7e1 mul ecx 00412ecf |. c1ea 03 shr edx,3 0041

html - jQuery .css does not add display:block; for all divs -

hi jquery script not add display block same mane divs, first one. js $("#sidecontrol_container").mouseenter(function(){ settimeout( function(){ $('#packet_name').css('display','block'); },310); $( "#sidecontrol_container" ).animate({ width:"230px" }, 300 ); }); $("#sidecontrol_container").mouseleave(function(){ $('#packet_name').css('display','none'); $( "#sidecontrol_container" ).animate({ width:"40px" }, 300 ); }); html <div id="sc_wraper"> <div id="packet_name">1</div> </div> <div id="sc_wraper"> <div id="packet_name">1</div> </div> css #packet_name{ height:40px; width:190px; float:right; display:none; } it adds first div name packet_name <div id="packet_name" style="display

recursion - Cascading reveal in Python Minesweeper -

i working on recursive function reveal contents of spaces around zero. getting type error "typeerror: unsupported operand type(s) -: 'list' , 'int'" code. want code (when given location) reveal spaces around not mines until there number. import sys game import * gameio import * import random rows = int(sys.argv[1]) cols = int(sys.argv[2]) mines = int(sys.argv[3]) def main(): mat = buildmatrix(rows,cols) status = buildmatrix(rows,cols) minematrix = placemines(mat) smatrix = processmatrix(minematrix) print("here minefield: ") displayboard(smatrix,status) array = [int(i) in input("enter row , column: ").split()] first = uncover(status,smatrix,array) displayboard(smatrix,status) return main() def minecascade(m,mat,r,c): if (mat[r][c] == '&'): if (m[r][c] == '*'): return elif (m[r][c] == 0): if (r > 0) , (c > 0):

jsf 2 - Primefaces....Getting Rowindex from Datatable in bean class -

sir, how can selected rowindex of primefaces datatable in bean class.? customer details

HTML: need help reducing white spaces between image table rows -

i managed reduce white space between images on same row of table blogger.com, can't life of me figure out how reduce white space between rows of images. below html have. suggestions? <table border="0" cellpadding="0" cellspacing="5" style="width: 900px;"> <tbody> <tr><td valign="top" width="209"> <img src="url" height="130" style="background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px width="200"/> ... <img src="url" height="130" style="background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px width="200"/> </tbody></table> you missing " before width=&quo

vb.net - how to make a loop until an event in visual studio? -

how make loop until event in visual studio ? i want value of label datagrid cell, until user clicks on button1. can me code ? logic: do .. ... textbox1.text = datagridview1.selectedrows(0).cells(0).value.tostring until button1.click why want loop @ first place? label value once set doesn't change. if want label value empty can try setting empty once button1.click event triggers.

html - How can I vertically align text in my div -

Image
this doing head in. can't text align vertically in footer. basic text want in middle links log in end @ top of footer. when log in , have other options display text on right of footer doesn't display. please help. footer code: <?php include ("includes/closedb.php"); ?> <footer> <div class="footer-wrapper"></div> <div class="footer-wrapper"> <div class="float-left"><p id="social">site map</p></div> <div id="login"> <?php if (logged_on()) { echo '<li><a href="/logoff.php">sign out</a></li>' . "\n"; echo '<li><a href="/addpage.php">add</a></li>'

html - how to split a container into multiple rows where each rows have different columns -

i want split container 3 rows. first rows have 2 columns (display 2 elements side side). second row have 3 columns third column again split 2 columns 23a , 23b. 23b again have 2 rows. third row have 2 columns (similar first row.) this parent container: .container { position:fixed; margin-top:-325px; width:75%; height:75px; background-color:#300000; } i tried multiple combinations. didn't got success achieve want. can 1 please me. thanks here fiddle of described: http://jsfiddle.net/fvgmb/ you need have rows set width , can have columns go in rows percentages describe width you'd them be. columns need floated. css .col { float: left; } .row { width: 100%; } .half { width: 50%; } .third { width: 33.33%; } html <div class="row"> <div class="col half"> </div> <div class="col half"> </div> </div> <div class="row"> <div class=&q

for loop - R 3.1.0 number of items to replace is not a multiple of replacement length error -

i have written following r code: csv_data<-temp[1:3] req_data<-null for(j in 1:length(1:3)){ req_data[j]<-read.table(csv_data,sep=",") } csv_data contains 3 files "001.csv", "002.csv" , "003.csv" each file has 4 columns after loop expect req_data contain 3 files as: req_data[1] - contains "001.csv" (all 4 columns) req_data[2] - contains "002.csv" (all 4 columns) req_data[3] - contains "003.csv" (all 4 columns) but req_data contains: req_data[1] - contains "001.csv" (only 1st column) req_data[2] - contains "002.csv" (only 1st column) req_data[3] - contains "003.csv" (only 1st column) how can expected result? i doubt program works without giving 3 warnings. since read.table returns data.frame, can make self-contained example als follows. req_data<-null for(j in 1:length(1:3)){ req_data[j]<- iris[sample(nrow(iris),10),] } giving: warni

javascript - Replace content from a Span by "..." after 70% of parent's width -

Image
update: actual problem : why "(ciclo)" go line bit lower rest? : http://jsfiddle.net/mv8q5/2/ example: http://jsfiddle.net/vahcs/ i have structure: <div> <span class="limitcharacters">content limit</span><span>(ciclo)</span> </div> what want that, if limitcharacters span content occupies more 70% of it's parent's div width, jquery must remove rest of span replacing "...". shows in single line remained content of span, plus "...", plus inline span goes right after limitcharacters class span (in above code, "(ciclo)"). i solved calculating limitcharacters' % width based on it's parent (calculates correctly), , in case result 70 or more, adjust span's width 60%. problem must avoid line break, , can done white-space: nowrap css method, result 60% not apply. what need this: what have (see jsfiddle): if avoid using nowrap method, breaks line. if use overfl

javascript - On toggle Hide/show -

i have code. if user press on lets burger , add session basket. reload of page doesn't open current window view(toggle) how can make open current again on reload... <script type="text/javascript"> function unhide(divid) { var item = document.getelementbyid(divid); if (item) { item.classname=(item.classname=='hidden')?'unhidden':'hidden'; } } </script> this how show/hide text. <a href="javascript:unhide('sandwich');"></a> <div id="sandwich" class="hidden"> here go 1 </div> <a href="javascript:unhide('burger');"></a> <div id="burger" class="hidden"> here go 2 </div> things not persistent across page reload / refresh. there 2 basic approaches it: session cookie , session on server, communication via ajax store in cookie both require work, it's unavoidable. for

android - Error when getting a dimension in theme for margins -

background i'm trying set custom margin value on listview items based on selected theme. the app has multiple themes, , user can choose theme use , set calling "settheme()" . the problem whatever try, error: java.lang.unsupportedoperationexception: can't convert dimension: type=0x2 note occurs margin attribute, , far no other attribute has caused this. what i've tried first, here's xml snippets i've used attrs.xml <attr name="listview_item__horizontal_spacing" format="dimension" /> styles.xml <style name="apptheme_holodark" parent="@style/theme.sherlock"> <item name="listview_item__horizontal_spacing">4dp</item> .... the layout of listview item: <relativelayout ... android:layout_marginleft="?attr/listview_item__horizontal_spacing" > i've tried using "reference" attribute type, , reference "dimen" resou

Overload event handler in javascript -

i've got event handler in javascript i'd overload : function overloadedhandler(event, myobject){ if(event){ var elem = event.currenttarget; } else { var elem = myobject.x; } //function logic } $('.mydiv').on('click', overloadedhandler); if want call overloadedhandler function (not event handler), what's right way ? 1. overloadedhandler(null, obj); 2. overloadedhandler(undefined, obj); 3. overloadedhandler(false, obj); p.s. understand put //function logic part in function & call when needed outside of event handler, know if there's wrong above approach? well indeed seems bit odd @ first sight, there nothing wrong. equivalent having argument optional, except event handling mechanism forces define event first argument cannot make optional. to make close possible optional argument, set event undefined when calling not event handler, since value if optional argument. null ok guess, think false s

ruby on rails - How do you get to have multiple root? -

so making application in rails, , require more 1 roots seen below root "post#index" root "gaming#index" but allows me have 1 root. have solution? if understand correctly want have different #root different cases, in case use constraints , or namespace #root try out, can useful in case. http://guides.rubyonrails.org/routing.html#advanced-constraints

string - php remove "questionmarks" � from fail-encoded text -

i´m extracting text weblink file_get_contents, have no influence on text, bits talk malformed in sourcecode of weblink got contents , , sth. : /$%§&fdsgfkgfd � fdsfdsfs � � --> <h1>m�lll</h1> <h1>m�lll</h1> <h1>m�lll</h1> <h1>m�lll</h1> <h1>m�lll</h1> <h1>m�lll</h1> or <<<!-- � födns my php file not meant "be" html file string im dealing with, i searched internet difficult icon, i want remove them because not necessary, how can remove them ? ps: i´m not looking through browser, var_dump text in console solution: i use tthis function first cast string utf-8 string function convtoutf8($str) { if( mb_detect_encoding($str,"utf-8, iso-8859-1, gbk")!="utf-8" ) { return iconv("gbk","utf-8",$str); } else { return $str; } } you can discard characters not supported encoding, iconv() : $converted = i

java - allocateIds DatastoreService real-world usage -

can ask real world usages of datastoreservice - allocateidrange(keyrange range) - allocateids(key parent, java.lang.string kind, long num) - allocateids(java.lang.string kind, long num) uses of allocateids(): you want write several mutually referential entities in transaction, using integer ids. wouldn't know "auto ids" (i.e., if leave id/name of key unset) until after commit, couldn't make entities "point each other" (e.g. using reference properties) part of txn. if allocate ids first, can manually set key ids allocated, write mutually referential entities in transaction, , without risk of collision other auto ids. you want user-facing ids human readable, e.g. case numbers. default auto ids large numbers (~16 decimal digit), allocateids() gives "old-style" sequential ids smaller (6 or 7 digits). if entity wish allocate ids has ancestor, use function takes parent key arg. else, use other allocateids specify kind. as alloc

java - UDP Client Server File Transfer PDF -

i doing project on udp client server file transfer in client reads file , transfers server. works long file .txt suggestions on how make work .pdf files also. in advance :) i implemented tcp , works fine. figured out converting byte array string , writing file , error occuring fixed directly writing byte array file rather first converting string. help. :)

jquery - How to wrap a td with anchor tag on datatables plugin -

i have using jquery-datatable serverside. working fine, want add anchor tag on 1 coloumn doing this: $('td:eq(1)', nrow).wrap('<a href="/hello/"/>'); which resulting in following error: scurrentclass = ntds[i].classname; i want anchor tag value of specific row like: <a href="ok">ok</a> <a href="hello">hello</a> --> hello , ok values how this. thank you you should use .append() instead of .wrap() $('td:eq(1)', nrow).append('<a href="hello">hello</a>');

object - Merging NSManagedObjectContexts - Get Reference to NSManagedObjects in the merged context? -

i have main context create nsmanagedobject's on if said object doesn't have required fields. however, if want create nsmanagedobject subclass have required fields, copy main managed object context , create object (that has required fields) on new context. once required fields object have been populated, merge duplicate context main context. issue references had objects required fields still on old context after merge? there option somewhere "after merge switch object references newly-created counterpart in merged context"? reason after merge contexts, want start setting them related objects each other, error saying can't objects in separate contexts. error makes sense, confused how may switch nsmanagedobject subclass's reference new 1 in main (merged) context.

vb.net - How to change Required in an input tag to false -

i have html code , want press button without input data required can redirected previous page, needs in vb.net. <form runat="server"> <table> <tr><td>first name:</td><td><input type="text" id="first" runat="server" required/></td> <td>surname:</td><td><input type="text" id="last" runat="server" required/></td></tr> <tr><td>date of birth:</td><td><input type="date" id="birth" runat="server" required/></td> <td>gender:</td><td><select id="gender" runat="server" required><option>male</option><option>female</option></select></td></tr> <tr><td>known illnesses:</td><td><input type="text" id="illnesses

css - Changing width and height in html -

the width , hight of following code change, on change of resolution of different devices. <div style="background-color:orange;height:125px;width:75px;"> div has height , width applied. </div> is there way prevent change of width , height , make retain same width , height resolution. note: have tried zooming ( in , out ) html page changes width , height of div. you need add viewport meta between head tags: <meta name="viewport" content="initial-scale=1"> http://webdesign.tutsplus.com/articles/quick-tip-dont-forget-the-viewport-meta-tag--webdesign-5972

python - How to bring selenium browser to the front? -

if browser window in bg, line doesn't work. from selenium import webdriver selenium.webdriver.common.keys import keys selenium.webdriver.common.by import # available since 2.4.0 selenium.webdriver.support.ui import webdriverwait # available since 2.26.0 selenium.webdriver.support import expected_conditions ec browser = webdriver.firefox() browser.get(somewebpage) element = webdriverwait(browser, 10).until( ec.element_to_be_clickable((by.xpath, '//button[contains(., "watch")]'))) elements = browser.find_elements_by_xpath('//button[contains(., "watch")]') if elements: print 'find watch button',elements elements[0].click() it errors out file "myscript.py", line 1469, in getsignedurl ec.element_to_be_clickable((by.xpath, '//button[contains(., "watch")]'))) file "c:\python27\lib\site-packages\selenium\webdriver\support\wait.py", line 71, in until raise timeoutexception

partitioning - Error with C++ array partition compilation -

i have problem when trying compile code: #include <iostream> #include <functional> using namespace std; template <typename t> size_t partition(t arr[], size_t size, function<bool(t)> lambda) { int index = 0; for(int = 0; < size; i++) { if(fun(arr[i]) == true) { //jeśli element spełnia predykat zamien go z arr[index] ustaw index na 'i' int tmp = arr[index]; arr[index] = arr[i]; arr[i] = tmp; index = i; } else { //na początku gdy index = 0, powiększ if(index == 0) index = i; } } return index; } template <typename t> void printtable(t arr[], size_t size) { cout << "[ &qu

Importing facebook birthday list to my android app -

i want import facebook birthdays of friends app. app capable of creating new birthday events. long procedure add each , every birthday, instead want code import facebook friends birthdays app. have used facebook session nothing till now facebook = new facebook(constants.fb_app_id); session session = new session(getapplicationcontext()); if (session.isopened()) { toast.maketext(getapplicationcontext(), session.getstate().tostring(), toast.length_long).show(); } else toast.maketext(getapplicationcontext(), session.getstate().tostring(), toast.length_long).show(); fbrunner = new asyncfacebookrunner(facebook); also have created request private void importbirthdayfromfb() { toast.maketext(getapplicationcontext(), "clicked on fb button", toast.length_long).show(); fbrunner.request("maxparera/friends", new requestlistener() { @suppresswarnings("unchecked")

ios - Better way to get BOOL from ColdFusion boolean return type in Objective-C? -

i have method in app sends request server check if user logged in. coldfusion function returns type boolean . when nslog data returned, get: <wddxpacket version='1.0'><header/><data><boolean value='true'/></data></wddxpacket> . currently, determine if returned true or false i'm searching substring 'true' in returned string. not seem solution. question is, there better way objective-c bool function? if it's better change coldfusion function, luckily can that. thanks! coldfusion function: <cffunction name="loggedin" returntype="boolean" output="false" access="remote"> <cfargument name="sessionid" type="uuid" required="true"> <cfquery name="q_session" datasource="#request.db_dsn#"> select ... </cfquery> <cfreturn q_session.recordcount gte 1> </cffunction> obj

java - Calculation of BigDecimal -

i'm having problem getting calculation down. can addition, subtract, etc... i'm trying ((a - b)/b) in jasper reports. here's i've tried far ${budget}.subtract($f{actual})/$f{budget} but when compile it. says have expression problem. i'm using jasper studio expression editor both $f{budget} , $f{actual} text fields , class java.math.bigdecimal here's stace trace net.sf.jasperreports.engine.jrexception: net.sf.jasperreports.engine.fill.jrexpressionevalexception: error evaluating expression : source text : $f{budgeted}.subtract($f{actual}.divide($f{budgeted})) @ com.jaspersoft.studio.editor.preview.view.control.reportcontroler.fillreport(reportcontroler.java:475) @ com.jaspersoft.studio.editor.preview.view.control.reportcontroler.access$18(reportcontroler.java:450) @ com.jaspersoft.studio.editor.preview.view.control.reportcontroler$4.run(reportcontroler.java:337) @ org.eclipse.core.internal.jobs.worker.run(worker.java:53) caused by: net.sf

Why does my app force close on moving from one fragment to another on a ImageView click in Android? -

i trying move mycontacts extends fragment tasks extends fragment on clicking imageview . imageview in listview generated using simpleadapter .the ids of layouts follows: r.id.tasky tasks fragment, r.id.mycontacts mycontacts fragment. codes , error logs follows. new fragments kindly explain me step step. mycontacts extends fragment purple.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub android.app.fragmenttransaction t = getactivity().getfragmentmanager().begintransaction(); fragment fragment = new tasks(); fragmentmanager fragmentmanager = getactivity().getsupportfragmentmanager(); fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction(); fragmenttransaction.replace(r.id.tasky, fragment); fragmenttransaction.addtobackstack(null); fragmenttransaction.commit(); } }); error logs: 04-22 04:41:52.486: e/fragmentmanager(3250):

Creating two separate websocket connections for send and receive on localhost -

i new websockets. it expected send data(any data) on send websocket connection using port(ex:8000) , localhost should echo same data browser using different websocket connection through different port(ex:9000). i understand websocket supports full duplex communication on single connection,but above design implement. question 1) above design possible? question 2) if yes,how create 2 websocket connections(one send , 1 receive) single localhost websocket server? 1) yes. 2) creating 2 separated websockets. different objects though. you blend both objects in composite object this: var compositewebsocket = function(urlsend, urlreceive){ var me = {}; var wssend = new websocket(urlsend); var wsreceive = new websocket(urlreceive); var open = 0; wssend.onopen = opening; wsreceive.onopen = opening; var opening = function(){ if(open == 2){ if(me.onopen) me.onopen(); } else open++;

Qt License in next versions -

can lgpl license in newest version of qt changed? ofcourse new versions can have diffrent license, , can released without lgpl license. how released qt? can license changed? i'm not talking qt, generally. of course license can changed @ time, doesn't affect code have, unless license had under explicitly time-limited allow such changes. suppose i'm author of bobulator project. i've released version 1.0 under bsd license. you've downloaded , using in own project. sometime later decide not offer project under open source license. take source down website , that's last hears it. except have downloaded , have it, , can use subject terms of license code released under. include, example, internet archive :) case in point: vivacore library now , then . it's based on prof. chiba's opencxx . oops. internet remembers :) of course library's provenance wasn't meant secret . i'm not lawyer.

c# - How to convert linq expression to dictionary<string,string> -

can me, how convert linq expression dictionary? following code throwing me argumentexception: item same key has been added. idictionary<string, string> listallcourseswithareaasdictionary = new dictionary<string, string>(); var dictionary = (from b in booklistrecord select new { b.coursecode, b.area }).distinct(); listallcourseswithareaasdictionary = dictionary.asenumerable().todictionary(x => x.coursecode, x => x.area); return listallcourseswithareaasdictionary; when try this: listallcourseswithareaasdictionary = dictionary.asenumerable().todictionary(x => x.coursecode); i error: cannot implicitly convert type 'system.collections.generic.dictionary' 'system.collections.generic.idictionary'. explicit conversion exists (are missing cast?) agreed aharon, you're looking grouping operator: var dictionary = booklistrecord .groupby(g => g.coursecode)

Laravel 4 pagination - Can't get past page 1 -

i have created of search feature, user can choose type, pool, date , time. can't seem make paginator work, when click on page 2 results disappear. i have tried append $query->links() function, none of tries have yet succeeded. the url looks this: http://localhost:8080/nih/public/bassengweb/data?time_maling=1&pool_id=1&fradato=14%2f04%2f2014&tildato=22%2f04%2f2014&fratid=00%3a01&tiltid=23%3a59 the code view file: @extends('default') @section('content') <h1>admin sØk</h1> {{ form::open(array('url' => 'bassengweb/data', 'method' => 'get')) }} <table> <tr> <td>{{ form::label('time_maling', 'timemåling') }}</td> <td>{{ form::checkbox('time_maling', 1) }}</td> <td>{{ form::label('3_time_maling', '3. timemåling') }}</td> <td>{{

jquery - Load Partial view in ajax call -

i new mvc . started creating 1 project , faced 1 big problem. pls me this. explanation: have view 1 actionlink , loading 1 partial view @model list<muthutag.models.loadpostmodel> @{ viewbag.title = "loadpost"; } @html.actionlink("add new post","post","home") <h2>loadpost</h2> <div> <table> @foreach (var item in model) { <tr> <td> @item.tagid </td> <td> @item.tagtitle </td> <td>@item.tagcontent</td> </tr> } </table> </div> in u can click add new post action link ill load view controller code public actionresult post() { return view(); } it ill load view @model muthutag.models.loadpostmodel @{ viewbag.title = "add new post"; } <script src="~/content/jqu

PHP Protected access to pages within set sessions -

<?php ob_start(); session_start(); include 'connection.php'; $username = $_session['user']; ?> <!doctype html> <html lang="en"> <head> <title>home page</title> <meta charset="utf-8" /> <link href="../css/my_design.css" media="screen" rel="stylesheet" type="text/css" /> <link href="../css/homepage.css" media="screen" rel="stylesheet" type="text/css"/> <link href="../css/bootstrap.css" media="screen" rel="stylesheet" type="text/css"/> </head> <div id="wrapper"> <body> <!-- header row --> <div class="grid10 first"> <?php include 'header.php'; ?> </div> <!-- 2 column row - content , navigation columns -->

FIPY axisymmetric 2D with GMSH -

i'll have approach problem involving plasma chemistry in reactor. useful describe problem in 2d axi-symmetric configuration. i'd use fipy, since solve electromagnetic fields getdp (which uses gmsh mesher), i'd know if fipy can handle 2dgmsh meshes , set 2d axi-symmetric domain, before it. i'm not able find information in user manual. thanks fipy's default no-flux boundary conditions represent mirror symmetry @ boundaries. if want rotational symmetry, require adaptation along lines of cylindricalgrid2d classes. wouldn't hard, need additional code adjust face areas , cell volumes. see http://matforge.org/fipy/browser/fipy/fipy/meshes/cylindricaluniformgrid2d.py , related modules.

ruby on rails 4 - RailsObservers - NameError - undefined local variable or method comment for CommentObserver -

rails 4.0.2 i using rails observer send mail when creates comment. observer- class commentobserver < activerecord::observer include users::adminshelper def after_create(comment) commenter = get_user(comment.user_id) receiver = get_receiver(commenter) notificationmailer.new_comment_email(receiver,commenter).deliver end def get_receiver(user) #user = get_user(comment.user_id) unless user.mentors.empty? user.mentors.first else user = get_user_by_update_id(comment.update_id) end end end now have 2 types of users mentors , mentee. when mentee creates comment, works fine when mentor creates comment error. this partial render both users- <div class="mentee-updates"> <h1>updates</h1> <% @previous_updates.each |update| %> <div class="post"> <div class="heading"> <div class="user"> <%= get_user(update.user_id).name %&g

Java 7 update 55 JacORB error when running via WebStart -

since updating java 7 update 55, i'm not able run webstart java application. this application worked fine under java 7 update 51 when launched via webstart. it works update 55 when launched outside of webstart. any suggestions further investigation points? org.omg.corba.initialize: can't instantiate default orb implementation org.jacorb.orb.orbsingleton vmcid: 0x0 minor code: 0 completed: no @ org.omg.corba.orb.create_impl_with_systemclassloader(unknown source) @ org.omg.corba.orb.init(unknown source) @ org.jacorb.orb.cdrinputstream.<init>(cdrinputstream.java:186) @ org.jacorb.orb.etf.profilebase.initfromprofiledata(profilebase.java:252) @ org.jacorb.orb.etf.profilebase.demarshal(profilebase.java:172) @ org.jacorb.orb.etf.factoriesbase.demarshal_profile(factoriesbase.java:124) @ org.jacorb.orb.parsedior.decode(parsedior.java:235) @ org.jacorb.orb.parsedior.parse_stringified_ior(parsedior.java:460) @ org.jacorb.orb.parsedi

r - for the length of each row in column Y duplicate row in column X -

(please feel free adjust title more fitting) i have data.frame 2 columns, x , y of class list below x <- list("a","b","c","d") y <- list("a",c("a", "b"),"c",c("a", "c", "d")) df <- as.data.frame(cbind(x,y)) when column y has 2 or more entries or here characters, length of each row in y (number of characters) correspond number of identical rows in column x . easier put, each character in y must individual row in x . # desired output x y a b b b c c d d c d d im not sure how go this, pointers appreciated, thanks! try do.call(rbind, map(expand.grid, x, y)) ## var1 var2 ## 1 ## 2 b ## 3 b b ## 4 c c ## 5 d ## 6 d c ## 7 d d