Posts

Showing posts from September, 2012

html - Random Div Order on Page Load -

this question has answer here: randomize sequence of div elements jquery 3 answers i have bunch of divs id "gallerycard". need them load in random order every time user visits page. <div id="gallerycard"> <div id="girlname">akulina</div> <div id="girlinfo">n/a</div> </div> <div id="gallerycard"> <div id="girlname">martina</div> <div id="girlinfo">n/a</div> </div> <div id="gallerycard"> <div id="girlname">samantha</div> <div id="girlinfo">n/a</div> </div> <div id="gallerycard"> <div id="girlname">karen</div> <div id="girlinfo">n/a</div> </div> <div id=...

java - Avro- IDL protocol to programmatic API schema -

i want declare client-server (at moment there 2 ways mentions on avro site nettyserver or httpserver ) app using avro. want define protocol using idl files. thing type in file idl protocol avdl. 1. how read avdl programmatic model? i found idlprotocolmojo methods protected no access. know can use schemabuilder bu defining schema in code , want schema object read avdl definition written in hand. i not want use avro tools because want program in code no outer commands. 2. can simmilar thing done protocol definition displayd in json in avpr instead of idl in avdl?

php - Yii selenium functional testing issue -

when run functional test phpunit functional/logintest.php it starts page in browser $this->open('http://mysite.com/'); but uses index.php instead of index-test.php , have no idea why. in webtestcase class there constant define('test_base_url','http://mysite.com/index-test.php/'); and setup method of webtestcase protected function setup() { parent::setup(); $this->setbrowser('*googlechrome'); $this->setbrowserurl(test_base_url); } please, tell me why keep calling index.php instead of index-test.php ? because $this->open('http://mysite.com/'); absolute url . if use it, must so: $this->open('http://mysite.com/index-test.php'); if use relative url , must so: $this->open(''); - open test_base_url and once again reread http://www.yiiframework.com/doc/guide/1.1/en/test.functional

c# - ManagementException: Generic failure accessing Win32_Printer (resulting in RPC server is unavailable) -

this exception started occurring had on server2003 , 2008r2: managementexception: generic failure stack: @ system.management.managementexception.throwwithextendedinfo(managementstatus errorcode) @ system.management.managementobjectcollection.managementobjectenumerator.movenext() after receiving error i've seen exception occuring (spooler stopped?): the rpc server unavailable win32exception: rpc server unavailable stack: @ system.drawing.printing.printersettings.get_installedprinters() the code generates wmi query listed here: // printername: \\server\printer or mylocalprinter printerattributes attribs = printerattributes.hidden; managementobjectsearcher searchprinter = null; managementobjectcollection prntcol = null; try { // "select attributes, name win32_printer" string qry = string.format("select attributes, name win32_printer name = \'{0}\'", printername); searchprinter = new managementobjectsearcher(qry); ...

javascript - js plugin to draw html dom tree from str and calculate xpath -

i want make code take html str $str = '<!doctype html> <html> <head> </head> <body> <div> <div> <strong></strong> </div> </div> </body> </html>'; and assign needed function <script type="text/javascript"> draw_dome_with_xpath_cal(<?php echo $str; ?>) </script> from php, ok? , js make dom clickbale, , when click on element calcaulate firfox xpath function example <script type="text/javascript"> /** * gets xpath element describes hierarchical location. */ var getelementxpath = function(element) { if (element && element.id) return '//*[@id="' + element.id + '"]'; else return getelementtreexpath(element); }; var getelementtreexpath = function(element) { var paths = []; // use nodename (instead of localname) namespace prefix include...

signal processing - Cepstrum analysis: how to find quefrency step? -

i'm newbie in cepstrum analysis. that's question. i have signal length 4096 , sample rate 8000 hz. make fft , array length 4096*2 (2*i position cosinus coeff, 2*i+1 position sinus coeff). frequency step (samplerate/signallength == 8000/4096). so, can calculate frequency @ position way: i*samplerate/signallength. then, make cepstrum transformation. can't understand how find quefrency step , how find frequency given quefrency. the bin number of fft result inversely proportional length of period of sinusoidal component in time domain. bin number of quefrency result inversely proportional distance between partials in series of overtones in frequency domain (this distance same root or fundamental pitch). quefrency bin number proportional period or repeat lag (autocorrelation peak) of harmonically rich periodic signal in time domain.

c++ - UNIX: What should be Stack Size (ulimit -s) in UNIX? -

how can calculate minimum stack size required program in unix, program never crashed. suppose program int main() { int number; number++; return 0; } 1) can stack size requried run program? how calculated ? 2) unix system gives ulimit -s 512000 . value 512mb required small program? 3) , if have big program having multithreads, 500 functions, including libraries, macros, dynamically allocated memory etc. how stack size required ? most people rely on stack being “large” , programs not using of it, because size has been set large programs fail because run out of stack space unless use large arrays automatic storage duration. this engineering failure, in sense not engineering: known , largely preventable source of complete failure uncontrolled. in general, can difficult compute actual stack needs of program. when there recursion, compiler cannot predict how many times routine called recursively, cannot know how many times routine need s...

css3 - How to get user-modify:read-write-plaintext-only behaviour in Firefox and IE -

chrome/safari support css: -webkit-user-modify:read-write-plaintext-only , can disable user paste rich text contenteditable div. i not know how in firefox , ie. i believe can use -moz prefix firefox -moz-user-modify: read-write-plaintext-only; and ie (10+) can use -ms prefix -ms-user-modify: read-write-plaintext-only; it proper add without prefix future proofing ;) user-modify: read-write-plaintext-only;

multithreading - PyQT classes e threads -

hy, i'm tryng write simple app pyqt display map thread class write text in "console" textbox, on main gui. when execute code i've following error: type object 'googlemapsexec' has no attribute 'console' this code: class modem(threading.thread): def __init__(self, parent = none): threading.thread.__init__(self, parent) def run(self): = "this thread" googlemapsexe.console.settext(a) class googlemapsexec(qdialog, ui_dialoggooglemaps): def __init__(self, parent = none): qdialog.__init__(self, parent) self.setupui(self) self.mapview.seturl(qtcore.qurl("map.com")) #self.console.settext("line 1") @pyqtsignature("") def on_button_clicked(self): t = modem() t.start() ##d = threading.thread(name='daemon', target=daemon) ##d.setdaemon(true) if __name__ == "__main__": import sys app = qtgui.qa...

activex - Teechart ZoomIn and ZoomOut Button -

i using zooming of tchart. in our application have next , prev button using user can zoom , undozoom. can let me know how can fire zoom , undozoom event on click on 2 buttons you can either call methods directly (see code below) or use calls fire events (see commented code below). private sub command1_click() tchart1_onzoom 'tchart1.zoom.zoomrect 0, 0, 100, 100 end sub private sub command2_click() tchart1_onundozoom 'tchart1.zoom.undo end sub private sub tchart1_onundozoom() tchart1.header.text.clear tchart1.header.text.add "unzoom!" end sub private sub tchart1_onzoom() tchart1.header.text.clear tchart1.header.text.add "zoom!" end sub

html5 - How to use WYSIWYG editor in Phpfox? -

i using phpfox cms , have default tiny_mce editor want user wysiwyg editor, please tell me how can apply wysiwyg editor in code? i use code in controller $this->template()->seteditor(); i use code in html {editor id='message'} thanks go http://yoursite.com/index.php?do=/admincp/setting/edit/group-id_formatting/ and change wysiwyg editor default tiny_mce

c# - RavenDB indices chains -

is possible use output of 1 index input another? something like: public class chainedindex: abstractindexcreationtask<inputindex, inputindexoutputtype, reduceresult> { //blahblahblah } yes. can this. enable scripted index results bundle write first index, example - map/reduce index. write script writes result document. write new index against documents. as changes original documents indexed, resulting changes written new documents, indexed. repeat if desired, careful not create endless loop. this new feature ravendb 2.5. oren describes in this video @ 21:36.

xml - ANT | Trying to override old definition of task javac Error -

i trying build jar in ant.below code generating jar file.i dont know why error("trying override old definition of task javac") happens.sometimes not generating jar. <?xml version="1.0" ?> <project name="helloworld" default="compress"> <presetdef name="javac"> <javac includeantruntime="false" /> </presetdef> <target name="init"> <mkdir dir="build/classes" /> <mkdir dir="dist" /> </target> <target name="compile" depends="init"> <javac srcdir="src" destdir="build/classes"/> </target> <target name="compress" depends="compile"> <jar destfile="dist/sample.jar" basedir="build/classes" /> </target> <target name="execute" depends...

performance testing - Socket has timed out -

we trying access our web-app (through web server, ihs). when use http fine ; https protocol working submits requests, observe socket time out exception continuously after requests have been processed. thereafter request processing resumes again. have tested application quite large concurrent load using https earlier; in case not sure why getting error. oh boy, can due thousands of different things. suggest layer analysis approach starting off web server logs, need make sure requests reaching web server , happening ones dictating time out, facing network latency resource bounded host, contention or knows, depends on application's design. start off checking out network layer. maybe if provide more information can out. also check out http , https time out configurations on web server.

javascript - Launching the e-mail client from razor view -

i have asp.net mvc4 application in have view: @{ layout = "~/views/shared/template.cshtml"; } @section logout { <a href='@url.action("logout", "begin")' style="margin-left: 91.3%"><img src="~/content/images/images.jpg" style="width:37px; height:37px" /></a> } <html> <head> <script> function mailjob(code) { window.open('mailto:example@gmail.com'); } </script> </head> <body> <form action="/pages/index" method="post" style="margin-left:20%"> <div class ="centertitle"> <h1 style="color:rgb(73, 140, 212)">norm impact : registre des réclamations clients</h1> </div> <div class="noprint"> <input type="hidden" value ="1" name="pages"/> ...

jquery - Horizontal scrollbar control for child div outside parent div/ floating div control -

developed replica of question: http://jsfiddle.net/m8pdd/ if refer fiddle has 2 div's inside parent div, when parent div overflowed show vertical scrollbar right inner div's horizontal scrollbar goes inside overflowed vertically , horizontal scrollbar unavialable person use. how can achieve horizontal scrollbar of inner div accessed if data more; seems me floating or creating replica of scrollbar outside parent div?? any ideas?? code: <div class="parent"> <div id="left-order-panel"> <table id="edit-left"> <thead> <tr> <th>h1</th> <th>h2</th> <th>h3</th> <th>h4</th> <th>h5</th> </tr> </thead> <tbody> <tr> <td>h1</td> ...

wpf - Bar series plotting for status -

Image
i have requirement should plot bar chart shown below. in below image each color represents different status. have data structure 'machine off' status on time 1 till time 2. should plot bar series in status on. how can achieve using bar series in wpf toolkit. early appreciated. thanks, just in case looking solution . i have achieved using custom panel (gantt panel). referred this blog. did modification based on need.

Determine arguments where two numpy arrays intersect in Python -

i have 2 arrays, say: a, b = np.array([13., 14., 15., 32., 33.]), np.array([15., 16., 17., 33., 34., 47.]) i need find indices of elements in not present in b. in above example result be: [0, 1, 3] because a[0], a[1] , a[3] 13., 14. , 32., not present in b. notice don't care know actual values of 13., 14. , 32. (i have used set(a).difference(set(b)), in case). genuinely interested in indices only. if possible answer should "vectorized", i.e. not using loop. you use np.in1d : >>> np.arange(a.shape[0])[~np.in1d(a,b)].tolist() [0, 1, 3]

vb.net - System.Linq.Dynamic library - need Count() example -

i need elegant solution dynamic selecting/grouping/ordering via linq2entities (vb.net/vs2012). and i'm trying use system.linq.dynamic library ( http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx ) this construсtion works fine dim testquery= testdb.testtable.select("new(field1)").groupby("new(field1)", "it") but 1 (found example somewhere on blogs/so) generates error: dim testquery= testdb.testtable.select("new(field1, count())").groupby("new(field1, count())", "it") the error "no applicable method 'count' exists in type 'testtable'" i know library born dead, official ms solution dynamic queries expressions-trees kinda scary. :-) if aim retrieve count of rows in testtable each value of field1 , have thought want firstly groupby field1 , select afterwards. reverse order of select , groupby , remove count() ...

c# - DependencyProperty does not trigger LayoutProcess -

i writing own panel (wpf) draw model. have model-dependencyproperty , want changes model affect layoutprocess. modelproperty = dependencyproperty.register("model", typeof(model), typeof(modelpanel), new frameworkpropertymetadata(null, frameworkpropertymetadataoptions.affectsmeasure)); how should implement model-class changes affect layoutprocess? i've tried inotifypropertychanged. didn't work. sorry this, think might going wrong way. in wpf panel supposed define how things laid out. a stackpanel places things 1 after another, horizontally or vertically. a wrappanel lays things out in row/column wraps next. a canvas lets position things @ x,y points. since attempting use panel, assume have collection of things in model. can handle collection listbox can give correct panel type to. i.e. <listbox itemssource="{binding mythings}"> <listbox.itemspanel> <stackpanel orientation="vertical...

java - How to send parameter values to server using Socketchannel? -

i'm using socketchannel send file client server in android application. it's working without issues. need send file name server. possible set request parameter socketchannel httppost? i tried searching many forums no luck. if having in depth knowledge on socketchannel please share answer me. thanks in advance.

powerpoint - How to add a Add ins menu tab to Power Point 2007? -

i working power point 2007 there no add ins menu tab , can not find how add it. when ppt 2007 , onward runs code creates "legacy" command bars or menu modifications, automatically adds add-ins tab ribbon , puts command bars/menu changes there. here's simple example code. can run is, or save add-in. once add-in loaded, auto_open code run every time ppt starts up. sub auto_open() dim otoolbar commandbar dim obutton commandbarbutton dim mytoolbar string ' give toolbar name mytoolbar = "kewl tools" on error resume next ' doesn't stop on next line if toolbar's there ' create toolbar; powerpoint error if exists set otoolbar = commandbars.add(name:=mytoolbar, _ position:=msobarfloating, temporary:=true) if err.number <> 0 ' toolbar's there, have nothing exit sub end if on error goto errorhandler ' add button new toolbar s...

c++ - Building via MSBuild fails when run as System User -

we using visual studio 2012 build our c++ application if run commandline in source folder: c:\windows\microsoft.net\framework\v4.0.30319\msbuild.exe /p:configuration=release /p:platform=win32 myproject2012.sln it works fine. if it's run via buildscript of buildserver (atlassian bamboo) lot of errors. first 2 lines.. c:\program files (x86)\msbuild\microsoft.cpp\v4.0\v110\microsoft.cppcommon.targets(347,5): error msb4018: "cl" task failed unexpectedly. [c:\data\bamboo-home\xml-data\build-dir\xxx-imb-job1\xxx\common\common.vcxproj] c:\program files (x86)\msbuild\microsoft.cpp\v4.0\v110\microsoft.cppcommon.targets(347,5): error msb4018: system.typeinitializationexception: type initializer 'microsoft.build.utilities.filetracker' threw exception. ---> system.io.directorynotfoundexception: das system kann den angegebenen pfad nicht finden. (exception hresult: 0x80070003) [c:\data\bamboo-home\xml-data\build-dir\xxx-imb-job1\xxx\common\common.vcxproj] what...

c# - formatting the string to look like a table -

i have string have initialized empty , building string seen below have got preferred output like, whats best mathod of doing this sent email. tak account company names off different length. string being buit foreach(string s in array) { emailbody += s + " success" + environment.newline; } ouput of string companyname success companyname success companyname success companyname success companyname success companyname success companyname success would output below companyname | success companyname | success companyname | success companyname | success companyname | success companyname | success companyname | success output of solution given qxeawgentina success tweseqmechile success vidqwedal success qwebr ...

endianness - understanding the concept of little endian and big endian -

i new in linux , learning little endian , big endian .i little confused why require them , purpose , difference between them ? in general not related linux hardware. in earlier days big endian common, x86 hardware has little endian. for more info: http://en.wikipedia.org/wiki/endianness

c# 4.0 - wrong result possibly because MergeAs(AppendOnly) LINQ -

note this might dup of this . don't clear answer that. the problem i got wrong result linq. example id groupid status name ------------------------------------ guid1 guida reserved truck1 guid2 guida reserved truck2 guid3 guida reserved truck3 guid4 guida reserved truck4 *assume guids guids.. **id primary key (unique) case if put where groupid == guida result correct (4 rows) but, if put where groupid == guida && status == reserved result wrong (3 rows) explanation the query built expression tree. debug watch, query (that return wrong result) this query.expression: ----------------- convert(value(system.data.objects.objectset`1[myeftable])) .mergeas(appendonly) .where(m => ( m.groupid == value(myfilterclass).groupid)) .where(m => m.status.contains(value(myfilterclass).statusstr)) .select(m => new myviewclass() { id = m.id, groupid = m.groupid, status = m.status, name = m.name }) .orderby(o =...

javascript - Making divs visible and invisible with 1 button without JQUERYand an error if not correctly filled in textfields -

im working on little project. here fiddle: http://jsfiddle.net/gjf46/ i need invisible button make 3 divs invisible when clicked , visible again when clicked. tried doing this: var gone = document.getelementbyid("invisible"); var div1 = document.getelementbyid("one"); var div2 = document.getelementbyid("two"); var div3 = document.getelementbyid("three"); gone.addeventlistener("click", function () { if ( div1.style.visibility == "visible", div2.style.visibility == "visible", div3.style.visibility == "visible") { div1.style.visibility == "hidden"; div2.style.visibility == "hidden"; div3.style.visibility == "hidden"; } else { div1.style.visibility == "visible"; div2.style.visibility == "visible"; div3.style.visibility == "visible"; } }); also need alert box when textfi...

java - Injecting BeanFactory into a Bean -

i want inject spring beanfactory bean created same beanfactory way so? by way, i'm developing web application. if not know can beanfactory having requestcontext bean want inject beanfactory not in requestcontext still in application context. can that? your bean can implement beanfactoryaware . implementing interface, bean receive beanfactory through call method: void setbeanfactory(beanfactory beanfactory) throws beansexception by way, there similar interface ( applicationcontextaware ) in order retrieve applicationcontext if need to.

Replace string from PHP include file -

let's have include file, foo.php, , contains text "this file foo". so, when load include using <?php include 'foo.php'; ?> , want able replace string include before displaying text contains. so let's want replace "foo" include "cool". make sense? you can use this: <?php function callback($buffer) { return (str_replace("foo", "cool", $buffer)); } ob_start("callback"); include 'foo.php'; ob_end_flush(); ?>

java - Check if a string lies within a range -

i have 1 string has between specific range. the range of values are: "620/75r38" - "1050/50r38" guys can see, should fit within range. yet don't know how put in java code can me? tried string.compareto() function somehow doesn't give right answeres. edit here i've tried. private submaat = ""; private maat = "650/65r38"; if(maat.contains("r")){ submaat = maat.substring(0, maat.lastindexof("r")); } else if (maat.contains("-")){ submaat = maat.substring(0, maat.lastindexof("-")); } if(submaat.compareto("620/75") >= 0 && submaat.compareto("1050/50") <= 0){ //do } try this string lower="620/75r38"; string upper= "1050/50r38"; string str="50/65r38"; if(str.compareto(lower)>0 && upper.compareto(str)<0){ system.out.println("inside range"); } ...

c# - how to use interface with singleton class -

as go through differences between singleton vs static class, came across 1 point can inherit interface in singleton class , can call singleton through interface multiple implementation. i code demonstration example, how object orientation can achieve through singleton , not through static. thanks, although it's hard tell referring to, 1 pattern might referring multiton pattern , manage map of named instances key-value pairs. that's factory, each instance created once: i've modified wikipedia example bit show can derive singleton class, long concrete implementations private , within original class: class foomultiton { private static readonly dictionary<object, foomultiton> _instances = new dictionary<object, foomultiton>(); // classic old singleton trick (prevent direct instantiation) private foomultiton() { } // can have private concrete implementations, // invisible outside world private class conc...

format - Makefile Grammar -

is there anywhere precise makefile grammar definition? or @ least common subset since guess there flavors. such grammar used writing parser. gnu make manual doesn't seem precise. require guessing , trial-and-error write parser makefile based on document. i found similar question on antlr mail list . remained unanswered kind of suggests answer... it seems there no official grammar gnu make, , ... it tricky write grammar make, since grammar extremely context-dependent. as said paul d. smith in a message in gnu make mailing list . paul d. smith official maintainer of gnu make.

What is the ideal bulk size formula in ElasticSearch? -

i believe there should formula calculate bulk indexing size in elasticsearch. followings variables of such formula. number of nodes number of shards/index document size ram disk write speed lan speed i wonder if know or use mathematical formula. if not, how people decide bulk size? trial , error? there no golden rule this. extracted doc: there no “correct” number of actions perform in single bulk call. should experiment different settings find optimum size particular workload.

authentication - How to achieve triggered redirect after log in so that administration interface will be available on the redirected url? Drupal 7 -

i ask advice. recently, developing conference site drupal 7. site hosted @ domain1.com. however, conference covered organization , require conference page accessible own domain like.: organization.com/conference2014 fortunately, drupal has base_url parameter , site accessible organization.com/conference2014 domain. but, problem when want access administration interface of drupal through organization.com/conference2014?q=user/login redirected organization.com site administrated organization admin. moreover, when access again organization.com/conference2014 - still asks me password. i got adviced introduce trigger after user logs in site organization.com/conference2014. redirect me administration interface/overlays not there. ideas how tackle problem? martin your session cookie associated domain logged in at, if login @ domain1.com not logged in @ organization.com. i'm assuming organization.com has rewriterule configured conference2014 points domain? if so, can confi...

.net - How to debug System.ExecutionEngineException in a framework code of a managed application -

i have application running service. application crashes time time. application written in vb.net , runs tasks @ new thread (one @ time). have collected crash dumps , started analyzing. analyze of log file created application (analysis of dump supports it) seems crash occurs when no task running , application waiting next system.timers.timer event. first loaded .dmp file vs2010: process architecture: x86 exception code: 0xc0000005 exception information: thread tried read or write virtual address not have appropriate access. heap information: present when started 'debug mixed' have got an unhandled exception of type 'system.executionengineexception' occurred in unknown module. when searching web more information found cdb.exe can give more information. here (shortened not much) result of !analyze -v : faulting_ip: clr!gcpreempnodtor::enter+23 73532ac0 c7410800000000 mov dword ptr [ecx+8],0 exception_record: ffffffff -- (.exr 0xffffffffffff...

javascript - how to view pdf in new window? -

in crome works fine not in ie , safari. newwin('data:application/pdf;base64,' + base64variable,600,600); function newwin(url,w,h) { var win = window.open("","temp","width="+w+",height="+h+",menubar=yes,toolbar=yes,location=yes,status=yes,scrollbars=auto,resizable=yes"); win.location.href = url; win.focus(); } in both of browser windows open no content shown. in safari attempts download file. real ball buster , dont know do. older versions of ie not support data: protocol - reference . more information ie can found here not sure safari

jsf 2 - JSF2 updating composite elements using ajax -

there's input element , want update once user enters in there. input element: <h:form id="form"> <h:inputtext value="#{message.message}"> <f:ajax event="keyup" render="form:compelem"/> </h:inputtext> <compositeoutputcomponents:test2 id="compelem" message="#{message.message}"/> </h:form> and how composite element looks like: <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite"> <h:head> </h:head> <...

Cannot delete record after using Rails default scope with associations -

i have tables emails , users . emails table has 2 fields: user_id , publish_id . i have used default scope this: default_scope joins('left outer join users on users.id = emails.publish_id').where("users.status in (?)", ["approve", "spam"])` as users table holds publishers , subscribers , have used users_id associate subscribers , publish_id associate publishers . i fetching record using: email = email.unscoped.find(:id) email.delete but, following error: can tell me how can remove or how can force remove delete email? complete error message :- em=email.unscoped.last email load (0.5ms) select `emails`.* `emails` order `emails`.`id` desc limit 1 => #<email id: 4, user_id: 2, body: "asdasd", complete_email: {}, created_at: "2013-08-28 15:29:10", updated_at: "2013-08-28 15:29:10", snapshot_status: nil, thumbnail: nil, deleted_at: nil, read: nil, publish_id: 1, email_type: nil, snaps...

How to use multiple sub-query left join in rails -

i having 4 table need join 4 table in rails model how can it my join sample schema is select * ( select id,name table1 )a left join ( select * table2 )b on a.id=b.user_id left join ( select * table3 )c on a.id=b.ord_id left join ( select * table4 )d on a.id=d.other_id one of best features of rails don't have worry writing these types of database setups. think served going through intro activerecord: http://guides.rubyonrails.org/active_record_basics.html activerecord abstracts sql 1 layer, you're (in theory) not writing database-specific code. allows conceptualize database schema @ higher level, rather doing left join, inner join, etc. see here more info on various associations: http://guides.rubyonrails.org/association_basics.html

Whats the difference between Methods and Members in C++? -

this beginner question. i'm pretty sure many people had doubt still didn't find clearfy mind, maybe i'm looking in wrong direction or conception. thing is, can work both codes: sf::clock clock; clock.getelapsedtime(); sf::clock getelapsedtime(); both accepted through ide can't understand difference. programm other languages know clock.getelapsedtime(); return time during app open, sf::clock getelapsedtime(); exactly? thanks in advance first calls member function getelapsedtime through object named clock while, second declares non-member (free) function name getelapsedtime returns object of type sf::clock , takes no arguments. good read: what function declaration?

design - Custom Styling Qt Quick Controls -

Image
i have custom design qt quick controls. example, change background colour of tool bar, since hate default design. how can that? in qt quick controls, there limited styling available via qt quick control styles items, buttonstyle , checkboxstyle , etc. at moment, other styles require delving qt sources , messing internal details. here complete example of how 1 might modify toolbar's style. main.qml import qtquick 2.1 import qtquick.layouts 1.0 import qtquick.controls 1.0 applicationwindow { toolbar: toolbar { id: toolbar component.oncompleted: toolbar.data[0].item.children = [newrectangle]; property item _newrectangle: rectangle { // rectangle within toolbarstyle's panel // gleaned from: // http://qt.gitorious.org/qt/qtquickcontrols/source/ // c304d741a27b5822a35d1fb83f8f5e65719907ce:src/styles/base/toolbarstyle.qml id: newrectangle anchors.fill: parent...

Do I have to rescue exceptions inside my loop using Ruby? -

i learning more , more ruby , have written script times out on occassion (making several api calls). i know need rescue exception this: rescue timeout::error => e # log #{e} later, maybe end my question should place rescue block. since making several api calls within multiple loops, need put block within each api loop? prefer write rescue block once, @ end of script example, , have work inside each loop in script. using ruby 1.9.3. it depends of try errors. for example, if want errors not abort loop run, catch exception inside loop, can log error , continue next iteration. if error kind of "fatal" , cannot (or don't want to) continue loop, catch outside.

javascript - Why can't I use a variable as a ID selector? -

sorry being jquery noob i'm not understanding why can't place variable selector name? if alert works fine, not when try modify contents of id: 'success': function () { var varpk = $(this).editable().data('pk'); //alert('#test' + varpk); var spanid = '#test' + varpk; //alert(spanid); $(spanid).html(varpk); } if sure id exists, should work form code there. see working example here : settimeout(function() { var id = '#' + 'asdf'; $(id).html('fdsa'); }, 2000); ps: believe $(this) not returning think should, unless want target context of callback.

sql - IBM Netezza, How to convert a varchar to a numeric with TO_NUMBER(..., ...) -

i have table called dart_stg1 in netezza database. table has varchar column. trying use below sql convert varchar number, throws error. code select distinct to_number(m12,'99g99') dart_stg1 m12 not null; throws error: error [hy000] error: bad numeric input format what error mean? the error: error [hy000] error: bad numeric input format is caused because feeding letters to_number . feeding 99g99 not number. the program tries tell it's not number telling numeric input format bad, error says.

javascript - replace the submit button -

i tried implement file upload process in grid. chose use jquery.iframe-post-form plugin. solutions post data of form , after upload file. in order post data of form @ once (lastname, ...) + photo, replaced submit button of form (sdata) mine. $(formid).removeattr('onsubmit'); $(formid).iframepostform({ ... }); i attached code new button (click event). changed submit button id , jqgrid not attach click event . $('#sdata').attr('id', 'mysubmit') .click(function(e) { ... $(formid).submit(); }) therefore changed behaviour of jqgrid: no beforesubmit event, no aftersubmit event, no aftercomplete event ! how fire after aftersubmit event getting errors ? how overriding default behavior of button? custom stuff submit form? $(document).ready(function () { $(":button").click(function (event) { event.preventdefault(); ...

html5 - Are there good alternatives to Flash on both mobile and desktop? -

i have html website flash-based interactive online course. @ moment course works fine on desktop browsers, not on mobile. my question is, best alternative? how can make course mobile compatible? html5 solution? if so, html5 compatible desktop browsers? thanks. html vs flash, lol html 5 supported depends on want exactly... animations limited in browsers example windows explorer: visit site chrome , windows explorer notice difference of interactivity www.myobject.net the upside flash 95% of desktops have flash installed if memory serves me correctly whilst html features supported 30% of desktops @ current.. mobile phones(smart phones don't support flash content @ current time.adobe air can installed on portable devices show flash content big ask such things.. if provide me link website want have on mobiles idea more of want do, , if html5 solution you. " site 3d, or 2d has elements on it... heaps answered :)

Stored procedures in SQL Server Errors Unsolved -

create function chi_x2 ( @a1 int, @b1 int, @a2 int, @b2 int ) returns int begin -- declare return variable here declare @result int declare @tr1 int; declare @tr2 int; declare @tc1 int; declare @tc2 int; declare @ca1 int; declare @ca2 int; declare @cb1 int; declare @cb2 int; declare @xi int; declare @nt int; create procedure [dbo].[pro1] begin set @tr1 = @a1+@b1 set @tr2 = @a2+@b2 set @tc1 = @a1+@a2 set @tc2 = @b1+@b2 set @nt = @tr1+@tr2 set @ca1 =(@tc1/@nt*@tr1) set @ca2 =(@tc1/@nt*@tr2) set @cb1 =(@tc2/@nt*@tr1) set @cb2 =(@tc2/@nt*@tr2) set @xi =((power((@a1 -@ca1),2)/@ca1)+(power((@a2 -@ca2),2)/@ca2)+(power((@b1-@cb1),2)/@cb1)+(power((@b2 -@cb2),2)/@cb2)) -- add t-sql statements compute return value here select @result = @xi -- return result of function return @result --end chi_x2 create procedure [dbo].[pro2] begin declare @max_chi int dec...

android - Can't get AutoBahn Websocket to Connect -

i trying of websocket client libraries developed android usage. fiddling autobahn library , can't seem "example" client connect server. using following code: try { mconnection.connect(wsuri, new websockethandler() { @override public void onopen() { log.d(tag, "status: connected " + wsuri); mconnection.sendtextmessage("info"); } @override public void ontextmessage(string payload) { log.d(tag, "got echo: " + payload); } @override public void onclose(int code, string reason) { log.d(tag, "connection lost."); } }); } catch (websocketexception e) { log.d(tag, e.tostring()); } i sniff using wireshark , can see tcp connection established, can see http go out. but, server isn't responding upgrade message. notice ...

java - Populate a tableview using database in JavaFX -

i'm starting learn javafx , need populate table data database. i've read lot of code online, haven't found looking for. read this don't know how implement last function. read other code , far of code: @fxml private tableview<user> table; @fxml private tablecolumn<user, string> namecol; @fxml private tablecolumn<user, string> emailcol; private observablelist<user> data; public void initialize(url location, resourcebundle resources) { namecol.setcellvaluefactory(new propertyvaluefactory(“name”)); emailcol.setcellvaluefactory(new propertyvaluefactory(“email”)); builddata(); } public void builddata() { connection connect = new connection(); statement st = connect.connect(); data = fxcollections.observablearraylist(); try { resultset rs = st.executequery("select * user"); while (rs.next()) { observablelist<user> row = fxcollections.observablear...

Can you connect 2 Facebook apps to one iOS app? -

we using few different apps on facebook different platforms marketing purposes - 1 our production site, 1 our iphone app , 1 our ipad app. would possible / work connect 2 facebook apps 1 ios app? way, have production site facebook app connected platforms (preferable implementing facebook login) still keep say, iphone facebook app connected marketing analysis. thanks much!! unfortunately, facebook doesn't allow this. sorry :( if have other questions, feel free ask.

php - Get Previous and Next records in MYSQL with non-numeric ID -

i trying develop small photo cataloging , storage system in php / mysql. database structured follows: create table `photos` ( `picid` varchar(36) not null, `uploaded` varchar(10) not null, `picdesc` text not null, `views` bigint(20) not null, `albumid` varchar(36) not null comment 'fkey albums', `uploadedby` varchar(50) not null comment 'fkey users', `exif` longtext not null, `album_protected` tinyint(1) not null default '0', primary key (`picid`) ) engine=myisam default charset=utf8; the picid field guid used primary key. i need creating sql query return record previous passed in picid , record next too. think need use 2 queries, perhaps can tell me otherwise. records ordered uploaded unix timestamp value. hope can help! please tell me if require more info! give auto_increment integer field primary key, , change picid unique. unique, indexed , can still used lookups. if want sequence in rows, need auto_increment ...