Posts

Showing posts from 2013

php - Concat multiple row and column in single row mysql -

i have table containing data in following format id | name | age ---------------------------- 1 | john | 24 2 | sam | null 3 | ron | 32 4 | harry | 44 now want fetch 1 row 1:john:24,2:sam,3:ron:32,4:harry:44 i have tried group_concat gives me 1 columns values separated comma, possible in mysql ? use group_concat , concat together: select group_concat(concat(id, ':', name, ':', ifnull(age,''))) table1 you can ":" moved over select group_concat(concat(id, ':', name, ifnull(concat(':',age),''))) table1 and here's updated sqlfiddle hims056 created.

ruby on rails - While launching browser how to handle authentication pop up in Rspec -

the website testing requires user login, , handled webserver not html form, generates authentication popup in browser. i've tried doing following before(:each) $browser = watir::browser.new :firefox $browser.driver.manage.window.maximize $browser.goto('http://qa.outbidhq.com') popup = rautomation::window.new(:title => /authentication/i) popup.send_keys('xxxxxx') # user id popup.send_keys :tab popup.send_keys('yyyyyyyyy') # password popup.send_keys :tab popup.send_keys :enter sleep(15) end but code not working........ while launching browser need handle window pop user name , password.....any suggestion?????? new rspec ...using ruby rautomation library provides ui automation using api similar watir. understands concepts of things text fields, buttons etc. can @ rdoc , or thing find helpful when learning new code library @ tests since ui bit interacting simple, can refere...

swing - Can't get String from GUI thread to 'logic' thread in java -

i've been writing program searches through list of numbers find ones add other number. no problems there, algorhythm is, while not efficient, functional. right list of numbers has taken text file, i've been trying make user can copy-paste list textarea, hit enter, , have program send string normal (non-gui) thread. to followed this example (the top answer). i'm using key event instead of button press, , string instead of linked list, other that, pretty similar. code create , run textdemo (yes, adapted tutorial program): /*copy paste text in window */ public static string copypaste() throws exception{ string text = ""; final textdemo demo = new textdemo(); javax.swing.swingutilities.invokelater(new runnable() { public void run() { demo.createandshowgui(); } }); synchronized(demo.text){ while(demo.text.equals("")){ //if window unused demo.text.wait(); } text = demo.text; ...

ios - How to reloadCells correctly -

i have navigation menu in uitableview. my cells loaded following: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = (uitableviewcell *)[tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; uiview *topsplitterbar = [[uiview alloc] initwithframe:cgrectmake(0, 0, cell.bounds.size.width, 1)]; topsplitterbar.backgroundcolor = [uicolor colorwithred:62.0/255.0 green:69.0/255.0 blue:85.0/255.0 alpha:1]; [cell.contentview addsubview:topsplitterbar]; } // set boolean determine if item in menu displayed vc on main stack bool currentdisplayed = no; cell.textlabel.backgroundcolor = [uicolor clearcolor]; cell.textlabel.textcolor = [uicolor colorwithred:196.0/255....

Passing variable to a form for display in django -

views.py def when(request): user = request.user report = report.objects.get(user=request.user) reportform = reportform(instance=report) settings = settings.objects.get(user=request.user) settingsform = settingsform(instance=settings) # settings=settings.objects.get(user=2) if settings.date_format == '0': date = report.manual_date.strftime('%d/%m/%y') else: date = report.manual_date.strftime('%m/%d/%y') if settings.time_format == '0': time = report.manual_time.strftime('%i:%m%p') else: time = report.manual_time.strftime('%h:%m') if request.method == 'post': reportform = reportform(instance=report,data=request.post,initial={'manual_date': date,'manual_time': time}) if reportform.is_valid(): report = reportform.save(commit=false) report.user = request.user report.save() ...

How to correctly write .htaccess for maintenance mode? -

i know basics writing .htaccess handle maintenance mode page. i don't want use plugin, need replace whole wp site while in maintenance mode. i've tried add additional rules allows access wp back-end, specific ips. i've tried several attempts , got close need. however, want white-listed ip(s) able see front-end site, without being redirected maintenance page, i'm stuck there. here's current .htaccess: rewriteengine on rewritecond %{request_uri} ^/images [or] rewritecond %{request_uri} ^/wp-admin/.* [or] rewritecond %{request_uri} ^/wp-content/.* [or] rewriterule .+ - [l] rewritecond %{remote_addr} !^93\.62\.93\.79 rewritecond %{request_uri} !^/maintenance-mode\.html$ [nc] rewritecond %{request_uri} !\.(jpe?g?|png|gif) [nc] rewriterule .* /maintenance-mode.html [r=302,l] what i'm supposed add/change? did found solution? don't tested wp worked me cms. options +followsymlinks rewriteengine on # exclude file (otherwise infinity lo...

c++ - Byte representation - Network raw data -

i'm little confused on following network analogy: consider i'm serializing structure (with integers) passing pointer winsock send() function. these 4byte integers on intel machine may represented in different way on big endian machine , misinterpreted when structure recreated on other side. that's understandable, problem - wondering - if both programs run on both machines compiled 32bit? wouldn't automatic conversion occur intel <-> amd instruction set happens binary files? if there's no way avoid - how work sending raw data structures on network without having problem? you should choose network format data , specify every byte in format (e.g. may use big-endian 4 bytes representation integers), , write converters to/from format each kind of platform program runs at. the 32/64-bits, instruction sets, intel/amd differences have nothing this.

javascript - Find all words that start with @ sign -

i have following javascript function finds matches of set of words inside contenteditable div: var words = ['oele', 'geel', 'politie', 'foo bar']; function markwords() { var html = div.html().replace(/<\/?strong>/gi, ''), text = html.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' '), exp; $.each(words, function(i, word) { exp = new regexp('\\b(' + word + ')\\b', 'gi'); html = html.replace(exp, function(m) { console.log('word match:', m); return '<strong>' + m + '</strong>'; }); }); //html = html.replace('&nbsp;', ' ').replace(/\s+/g, ' '); div.html(html); } how can modify marks words, in cases start @ sign @ ? example, should match @foo bar , etc. live fiddle if change exp = new regexp('\\b(' + word + ')\\b', 'gi'); ...

ios - Show view from xib in ScrollView -

firstly want newbie @ ios development. have problem showing view xib file in scrollview. this myview green background 1 label. here code controller: @implementation myview - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { //init code } return self; } - (id) initwithcoder:(nscoder *)adecoder { if (self = [super initwithcoder:adecoder]) { [self setautoresizingmask:uiviewautoresizingflexibleheight]; } return self; } @end and here code main controller scrollview: - (void)viewdidload { [super viewdidload]; scroll = [[uiscrollview alloc] initwithframe:cgrectmake(0, 67, self.view.frame.size.width, self.view.frame.size.height)]; scroll.pagingenabled = yes; scroll.frame = cgrectmake(0, 20, 320, 350); scroll.contentsize = cgsizemake(320, 350); scroll.autoresizingmask = uiviewautoresizingflexibleheight | uiviewautoresizingflexiblewidth; scroll.bounces = ...

Open source - How to make sure user has bought a license/avoid pirate-versions? -

this not want myself, it's question/problem can't out of head. if distribute open source-program/classes/libraries, how can make sure user has purchased license? not easy programmers remove license-part of product , distribute or use pirate-version? take invision power board instance. written in php (i.e open , editable) , have buy license able use it. how can make limit? authenticate forum towards servers? if do, not easy remove function? another example have more problem understanding highcharts , js library draw graphs. offer free version name on each graph. if purchase product, label gone. how this? i know question bit wide , open, asking way prevent people editing out license/blockade? essence in this? there no license purchases true "open source" libraries or programs, because essence of open source code free , can build/deploy @ will. what you're talking commercial software might use codebase visible/editable. it's not marketed ...

html - How do you maintain CSS layout when adding content (ASP.NET) -

Image
i have page in asp.net follows. jsfiddle http://jsfiddle.net/nyrup/ html <div class="maincontainer"> <div> <div class="topleft"> <% =datetime.now.ticks.tostring()%> </div> <div class="topright"> foo </div> </div> <div> <div class="bottomleft"> foo </div> <div class="bottomright"> foo </div> </div> <div class="underneath"> foo </div> </div> css .maincontainer { } .topleft { width: 50%; float: left; background-color: red; } .topright { width: 50%; float: left; background-color: orange; } .bottomleft { width: 50%; float: left; background-color: yello...

image - PHP img alt attribute -

this question has answer here: codeigniter img tag 3 answers i want include image alt attribute using php. i have following code... <?php echo img(imagepath . 'logo.png'); ?> how go adding alt attribute - "my awesome alt" - image using php when go view source see image? <img src="http://examplesite.com/img/logo.png" alt="my awesome alt"/> i using codeigniter. <?php echo img(array('src'=>'image/picture.jpg', 'alt'=> 'alt information')); ?>

java - Javascript on (before and after) every Ajax-call -

since i'm working tinymce (please don't go "primefaces has editor" or similar) need execute small piece of javascript before , after every ajax -call. i'd prefer not edit every ajax -call since there lot (and doing bad practice future maintenance). what elegant solution execute javascript pre- , post- ajax -call on page? note: i'm using custom composite tinymce -textarea. events object suffice. though keep in mind actual ajax -trigger might invoked totally different object (though nevertheless rerender composite ). use jsf.ajax.addonevent handler. jsf.ajax.addonevent(function(data) { switch(data.status) { case "begin": // invoked right before ajax request sent. break; case "complete": // invoked right after ajax response returned. break; case "success": // invoked right after successful processing of ajax response , u...

text to speech - android- TextToSpeech in hebrew -

i try use int result2 = tts_hebrew.setlanguage(locale.iw); but iw not recognized locale.iw. in http://developer.android.com/reference/java/util/locale.html : "note java uses several deprecated two-letter codes. hebrew ("he") language code rewritten "iw", indonesian ("id") "in", , yiddish ("yi") "ji". rewriting happens if construct own locale object, not instances returned various lookup methods." how can use texttospecch in hebrew? edid2: use new locale("iw") now. compile no voice..(no english , not hebrew) . english work fine package com.example.freeenglish; import java.util.locale; import java.util.timer; import android.os.bundle; import android.os.handler; import android.app.activity; import android.speech.tts.texttospeech; import android.util.log; import android.view.menu; import android.widget.button; import android.widget.edittext; import com.example.freeenglish.const; public ...

how to check if input type date is empty or not using javascript or jquery -

i have following html form: <form id="chartsform"> <div id="dateoptions"> <p>until date: <input type="date" name="until_date" value="until date"></p> <p>since date: <input type="date" name="since_date" value="since date"></p> </div> <div class="insightsoptions"> <input id="newlikes" class="insightsbuttons" type="submit" name="submit" value="daily new likes"> <input id="unlikes" class="insightsbuttons" type="submit" name="submit" value="daily unlikes"> </div> </form> and following jquery script: $(function () { $("#newlikes").one('click', function () { $.ajax({type:'get', url: 'newlikes.php', data:$('#chartsform...

PHP MySQL connection (mountain lion) -

beginner on here. im trying connect mysql database php. im running mysql 5.6.11, php 5 , apache on mac osx (mountain lion). php code connection. when try opening .php file, nothing happens(blank page), same if y try query. <?php $pdo = new pdo('mysql:host=localhost;dbname=database1', 'user', 'password'); ?> i thought mysql wasn't configured. current socket unix socket /tmp/mysql.sock currently running mysql through pref pane. cheers

Can I upload an arduino code on Atmega8? -

i have arduino duemilanove , atmega8 chip. arduino board having atmega328 on it. have written code works fine on arduino. want transfer code arduino atmega8 chip. can use arduino bootloader that? thanks in advance. you can use old files arduino sure , (probably newer builds) keep in mind have ~7kb(after 1k bootloader) you need compile code "arduino ng or older w/ atmega8" you can find instructions on how burn boot loader here http://arduino.cc/en/hacking/bootloader and reference schematics here http://arduino.cc/en/uploads/main/arduino_ng_schematic.png

telerik - Bind a GridView to a single object -

i'm trying bind single row telerik radgridview, think question might apply gridview control. since list ever contains 1 item, seems inefficient bind "list", though know list has 1 item. however, when try bind single item in list, nothing happens. nothing shows on grid, don't error in debugger. this works. getobjects dal method returns list. list<myobject> myobjects = mydal.getobjects(myid); this.mygridview.datasource = myobjects; the following code not work. getobject dal method returns first element list. myobject myobject = mydal.getobject(myid); this.mygridview.datasource = myobject; i tried code bound object called class1 , works fine using method: list<myobject> _list1=new list<myobject>(); _list1.add(mydal.getobject(myid)); radgrid1.datasource=_list1; radgrid1.databind(); the reason grid should bound ilistsource, ienumerable, or idatasource. regards

.net - The type was not found -

visual studio writes me the type not found. verify not missing assembly reference , referenced assemblies have been errors in wpf project user control. when press build message dissapear , ok. after few seconds message comes , disturbs me. why vs write , how can fix it? thank in anticipantion <usercontrol x:class="tandocare.desktop.views.login" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:loc="clr-namespace:tandocare.desktop.infrastructure.localization" mc:ignorable="d"> <label width="120px" content="{loc:translate user...

datagridview - vb.net The method or operation is not implemented -

i have data grid view when click on viewdtails button in grid, populates exception details grid right below it. works fine, have second query populating history grid user see when uncomment out , run error "the method or operation not implemented." , first query doesnt return results @ all. how can rewrite run both queries , populate both grids? protected sub countalerts_rowcommand(byval sender object, byval e system.web.ui.webcontrols.gridviewcommandeventargs) handles countalerts.rowcommand if (e.commandname = "viewdtails") dim index integer = convert.toint32(e.commandargument) dim abc, unit, cell, dttm, prod, query string 'dim qry2 string dim ds dataset 'dim ds2 dataset abc = countalerts.datakeys(index).values("abc") cell = countalerts.datakeys(index).values("cell") unit = countalerts.datakeys(index).values("unit") dttm = countalerts.datakey...

batch file - variable was unexpected at this time -

i'm not familiar bat files have file runs sqlplus query, returns row count, , if greater 0, run bat file. feel i'm there keep getting error: %%a unexpected @ time @echo off /f "delims=" %%a in ( 'sqlplus user/pass@omp1 @voiceblocktrig.sql' ) set rowcount=%%a if %rowcount% gtr 0 ( c:\sqltriggers\voiceblkautoationbat.bat ) when run above, reponse: @echo off /f "delims=" %%a in ( %%a unexpected @ time 'sqlplus user/pass@omp1 @voiceblocktrig.sql' ''sqlplus' not recognized internal or external command, operable program or batch file ) set rowcount=%%a if %rowcount% gtr 0 ( more? c:\sqltriggers\voiceblkautoationbat.bat more? when run this: sqlplus user/pass@p1 @voiceblocktrig.sql i integer value too why there such gap between set , rowcount? in itself, it's of no matter - suspect have them on separate lines. the set rowcount=%%a must on same physical line do - , do must on same physical line ...

c# - how to propagate some data to main process from TPL tasks while tasks are running -

i have situation create list of long running tasks monitors system/network resources , sends email , logs txt file , , calls web service when conditions met. begins monitoring again. these tasks created in windows service , hence running time. i want them raise events or notify parent class (which created them) , performs 3 operations mentioned above instead of each object in tasks doing itself. and how can controlled single task uses parent class's method @ single time. email , web service call involved, 2 concurrent requests may beak code. update these watchers of 3 types, each implements following interface. public interface iwatcher { void beginwatch(); } classes implement //this watcher responsible watching on sql query result public class dbwatcher : iwatcher { .... void beginwatch() { //here timer created contiously checks sql query result. //and call service, send email , log file timer watchiterator = new ...

php - In template page_list get image attribute Concrete5 -

my following code based on 1.get current url 2.go through array , check if in url value = value in array this: $on_this_link = "http://$_server[http_host]$_server[request_uri]"; foreach ($city_array $sandwich) { if (strpos($on_this_link, $sandwich) == true) { $sandwich = trim($sandwich, '/'); $city = $sandwich; if ($city == 'newyork') { foreach ($category_array $double_sandwich) { if (strpos($on_this_link, $double_sandwich) == true) { $double_sandwich = trim($double_sandwich, '/'); $category_is = $double_sandwich; loader::model('page_list'); $nh = loader::helper('navigation'); $pl = new pagelist(); $pl->filterbyattribute('city', '%' . $city . '%', 'like'); $pl->filterbyattribute...

ember.js - in Ember Data how do you manually load a Record with a hasMany association for unit testing? -

i'm unit testing computed properties on ds.model . // trivial example i'm not testing app.modela = ds.model.extend({ sub_models : ds.hasmany('app.modelb'), lengthofbees : function() { return this.sub_models.length; }.property('sub_models.length') }) how manually create record has association? providing json record no associations easy.. app.modelx = app.modelx.createrecord({ attriba : 'valuea'}); but don't know syntax createrecord when want supply hasmany associations. how do that? assuming using ember-data rev 12 should work test("findmany qunit test example", function() { store.load(person, {id: 9, name: "toran billups"}); person = store.find(person, 9); store.loadhasmany(person, 'tasks', [ 1, 2 ]); var tasks = get(person, 'tasks'); //to fire http request equal(get(tasks, 'length'), 2, ""); }); and if loadhasmany doesn...

CSS ul > li selector selecting nested lists -

i've been reading everywhere, , i've read select list without selecting nested list. need have this .myclass > ul > li //or ul > li i've been trying work unsuccessfully. selector selecting everything, including nested list. missing? please see code on js bin: http://jsbin.com/asipap/4/edit some css styles inherited parent elements unless style explicitly overrides it, you've set color list items, haven't overridden other matched selector. adding li { color: black } should solve issue.

Can I have more than one {app} variable in Inno Setup? -

i making inno setup script. setup needs user choose 2 customized install locations. but there 1 {app} variable in inno. our software audio plugin software, common way in field choose 1 location program , other location audio sample/data (which large users want install @ dedicated place storage , performance purpose). is there way around condition? thanks lot! there many other variables (directory constants) can use, common ones: {app} - application directory (user chooses derectory in wizard dialog) can create subdirectories {app}\data {win} system's windows directory. {sys} system's system32 directory. {pf} program files. {cf} common files. and many, many others. the modern installers store application in 1 directory - {app} , user's files in every user's custom directory - e.g. {localappdata} . and if still not enough can create own dialog (wizard page) contains edit boxes , browse buttons selecting directories. use function...

width - CSS 100% will not resize below 1000px -

i'm working on custom stylesheet override site. https://adminluonline.blackboard.com/ . want page elements load 100%. seem assume 1000px min-width reason. they'll stretch out past far want won't go smaller. i'm using stylish firefox plugin , using !important override. i've gone far telling 1 div not display. 1 div , no padding , no margins, won't cooperate. have suggestions o next steps? #loginpane has fixed width of 800px . that's what's causing page stop shrinking. either use media queries or change , child elements have static width of 600px line 3 of theme1.css: body{ min-width: 1000px; } probably problem.

javascript - How to detect Ctrl + Mouse dblckick using jquery -

i want detect event ctrl + dblclick using jquery. dblclick have dblclick event. possible recognize event without setting flag on keypress event? look @ passed jquery event object. there boolean property called ctrlkey . $(window).on("dblclick", function(e) { console.log(e.ctrlkey); }); here's simple example: http://jsbin.com/ugocaf/2/edit

apache - Echo output from a custom task -

i have black-box ant task creates output consume in task. need write output of create-uuids file. neither of ideas working, because redirector , echo tasks not accept adhoc tasks input. here code: <redirector output="atest.txt"> <createuuids numberofuuidstoprint="1"/> </redirector> also tried <echo file="atest.txt"> <createuuids numberofuuidstoprint="1"/> </echo> i solved using recorder : <record name="atest.txt" action="start" emacsmode="true"/> <createuuids numberofuuidstoprint="1"/> <record name="atest.txt" action="stop"/>

Kprobe on Linux Scheduler and finding linux scheduler -

i have 2 question: 1 - in fedora source code, can find scheduler code? 2 - can put kprobe in fedora scheduler? (or can use register_kprobe() in fedora scheduler?) thanks. scheduler code found under kernel/sched/ directory on latest source code (this core file: http://lxr.linux.no/linux+ */kernel/sched/core.c). you can insert kprobe hooks anywhere in kernel source not everywhere list found under list /sys/kernel/debug/kprobes/list (assuming you've kprobe enabled kernel, , mounted).

asp.net mvc 3 - "Does not contain definition for" error when using junction table created using .toTable() method in dbContext -

i'm not sure i'm doing wrong here. table "class1class2" not being recognised.(see code below). want able use junction table context public class context: dbcontext { protected override void onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.entity<class1>() .hasmany(c => c.listofclass2).withmany(i => i.listofclass1) .map(t => t.mapleftkey("class1id") .maprightkey("class2id") .totable("class1class2")); } } implementation: context db = new context(); var r= db.class1class2; class1class2 in implementation code not recognised yes not recognized because doesn't exist. when map many-to-many relation way there no class used junction table. handled transparently through navigation properties listofclass2 , listofclass1 . if want have access junction table (which useful if junction table contains additional data - not foreign keys) must create class , map 2 one-to-many rela...

c++ - Update remote File using Eclipse's RSE Plugin -

i've installed remote system explorer plugin eclipse , set ssh connection our development server using public key authentication , custom port (not sure if of these customisations relate problem). however browsing file system works great , can create folders , files. e.g. /tmp/foo/bar.txt can't figure out "push" changes i've did server. so problem open file, write text , save in eclipse. asterisk next file names vanishes (indicating it's save) , if close re-open file in eclipse changes present. they're not visible on server. e.g. doing changes .html file won't show changes in web browser or cat bar.txt (mentioned earlier) produces empty output. creating folders or files working intended updates file contents not shown on remote system though they're persist in eclipse. is there button i'm missing update "local" changes "remote server". can rid off caching? we're working in team it's crucial our files date...

ruby - Is there a way to a regex query on a json structure's keys? -

say have have list of json structure such { "s1" => "foo", "r2" => "bar", "s2" => "baz" } and want data "s*" keys, how in ruby? there way perform such task? thanks, use select pick out key/value pairs want: { "s1" => "foo", "r2" => "bar", "s2" => "baz" }.select{|k,v| k =~ /^s/} the result desired hash - if using ruby 1.9/2.0. however, in ruby 1.8 return array of arrays - can wrap hash[] turn hash: start = { "s1" => "foo", "r2" => "bar", "s2" => "baz" } hash[start.select{|k,v| k =~ /^s/}]

c++ - python sockets receive binary data -

i'm having trouble receiving binary data server (python). seems os (win7) sending big data in several packets without "permission", when im trying send client (c++) binary data, have manipulations combine data. tried several ways none of worked. here sending part (c++ - works fine sure): sendbuf = "2011@" + readthisfile("c:\\0x3z4.jpg") + "@"; // buffer should "2011@<image data>@" // readthisfile returns string binary data file vector<char> vect(sendbuf.begin(), sendbuf.end()); // vector image data iresult = send( connectsocket, &vect[0], vect.size(), 0 ); // sending image here receiving part (python - part of threaded function 'handler'): while true: buffer = sock.recv(self.buffersize) if buffer[0:4] == "2011": self.print(addr[0] + " > 2011 > capture screen response.") # save image path = datetime.now().strftime("information\\...

.net - creating hierarchichal XML structure dynamically -

i creating xml shown below code public class group { [xmlelement(typeof(manager))] public employee [] staff; [xmlelement (typeof(int)), xmlelement (typeof(string)), xmlelement (typeof(datetime))] public arraylist extrainfo; } public class employee { public string name; } public class manager:employee { public int level; } public class run { public static void main() { run test = new run(); test.serializeobject("typeex.xml"); } public void serializeobject(string filename) { // create xmlserializer instance. xmlserializer xser = new xmlserializer(typeof(group)); // create object , serialize it. group mygroup = new group(); manager e1 = new manager(); e1.name = "manager1"; manager m1 = new manager(); m1.name = "manager2"; m1.level = 4; employee[] emps = {e1, m1}; mygroup.staff = emps; mygroup.extrainfo = new arraylist(); mygroup.extrainfo.add(".net"); mygroup.extrainfo.add(42); mygroup.extrain...

jquery - On create view, check if an entry already exist in the database -

let me in context, mvc project creates reservations. reservation contains zones , equipements (you select zones , equipement want checking checkboxes). when create new reservation, can select date (it's datepicker). when select date, if in database there entry same date, want disable zones , equipements (checkboxes) taken. obviously, can't have 2 people take same spot on same day. i don't know if guys understand i'm trying hasn't been answered yet.

c# - Datagrid: User cannot edit or select a row -

i'm using datagrid in wpf display rows of users returned linq-sql expression in list: private void admin_tab_gotfocus(object sender, routedeventargs e) { if (dbmethods.checkdatabaseconnection()) { using (pubsdatacontext db = new pubsdatacontext()) { var allusers = new list<application_user>(from users in db.application_users select users); users_datagrid.datacontext = allusers; } } } the users load fine, row row information intact. however, when rows left clicked row not become selected , there appears no event being passed. added in mousedown event , can capture right-clicks, never left click. the xaml datagrid is: <datagrid autogeneratecolumns="true" margin="6,6,6,215" name="users_datagrid" canuseraddrows="true" itemssource="{binding}" height="286" width=...

Put a Javascript variable into a innerHTML code -

i'm creating table dynamic table javascript: var row = table.insertrow(-1); var cell1 = row.insertcell(0); var cell2 = row.insertcell(1); var cell3 = row.insertcell(2); var cell4 = row.insertcell(3); var cell5 = row.insertcell(4); i want fill cell5 innerhtml javascript variable inside var add = aux[i].split("#"); cell5.innerhtml = "<img src='matrixlogos/add[3]' width='100' height='25'/>"; but give add[3] in html instead of value inside add[3]. my question how escape variable inside innerhtml code, shows me value , not declaration. use "+". var add = aux[i].split("#"); cell5.innerhtml = "<img src='matrixlogos/"+add[3]+"' width='100' height='25'/>";

opencv - object detection using SURF and FLANN features -

i using opencv's surf feature extraction , flann matcher. have existing database of images, , webcam obtain data. want compare webcam images database images , find matches. however, having problems using matches obtained after computing descriptors , keypoints. my ultimate objective able use image database recognise object infront of camera (assuming in database).

mysql - Slow SQL query when grouping by two columns with self join -

i have table rating less 300k rows , sql query: select rt1.product_id id1, rt2.product_id id2, sum(1), sum(rt1.rate-rt2.rate) sum rating rt1 join rating rt2 on rt1.user_id = rt2.user_id , rt1.product_id != rt2.product_id group rt1.product_id, rt2.product_id limit 1 the problem is.. it's slow. takes 36 secs execute limit 1 , while need execute without limit. figured out, slowdown caused group by part. works fine while grouping 1 column no matter table rt1 or rt2. have tried indexes, have created indexes user_id, product_id, rate , (user_id, product_id). explain doesn't tell me too. id select_type table type possible_keys key key_len ref rows 1 simple rt1 primary,user_id,user_product null null null 289700 using temporary; using filesort 1 simple rt2 ref primary,user_id,user_product user_id 4 mgrshop.rt1.user_id 30 using i need execute once generate data, it's not important a...

r - Making knitr code blocks more cleanly cut-and-pastable -

i use knitr produce pdf documents example code can cleanly cut , pasted, don't seem able to. an example of problems run into: the knitr manual pdf includes code block (p.3): ## option tidy=true (k in 1:10) { j <- cos(sin(k) * kˆ2) + 3 print(j - 5) } when copied pdf , pasted r (or so, or etc.), yields: ## option tidy=true (k in 1:10) f j <- cos(sin(k) * kˆ2) + 3 print(j - 5) g see how first 2 code lines combined onto one, and, worse, { , } converted f , g ? my questions: first, guess, other folks experience? happen on windows, or elsewhere well? if it's not me, there easy workaround? using different font when compiling *.tex file produce *.pdf document easier copy-and-paste from? (fwiw, if instead use minted highlight r code, don't have of same problems, know it's possible right.) based on clues in this question , accepted answer , found using latex fontenc package set font encoding t1 fixes problems reported above. ( se...

Should I change the css style in my file or in the original file -

when want change example style of bootstrap button how should that: remove css class in bootstrap file , create class in css file settings leave original css file , create class in css file !important overwrite original file settings. there surely other ways... what best considering upgrading new bootstrap.css file? the best way to: leave bootstrap file untouched modify class in own stylesheet load own stylesheet after bootstrap css you have benefit of not having use !important , can still update bootstrap. note: although can update bootstrap-file, still have test page see whether update broke something, @ least assure you didn't lose work

Watir-webdriver rails integration with minitest -

looking equivalent of gem minitest-rails-capybara watir-webdriver, or in other words having tests automatically start , stop rails server. this purposes of continuous integration server, don't want muck manually starting , stopping rails server minitest:integration. there watir-rails project , ruby gem: https://github.com/watir/watir-rails

jquery - How can I get jqGrid to display the right record count when doing rowspan? -

i've been using jqgrid time , getting pretty @ using it, it's fantastic tool. i'm getting more advanced uses , have run problem can't seem figure out. i've built grid uses "rowspan" has been discussed in other stackoverflow questions. problem i'm having pager displays wrong record count , page counts based on number of records loaded. each , every row in grid spans 2 rows, page count , record count double size of number of displayed rows. there hook grid allow me provide number of records should displayed or change being displayed? i appreciate can provided.

clojure - Understanding core.logic != -

i expect following expression return number of results, each of consists of 2 cons cells, 2 cons cells not equivalent. however, returns 0 results. why getting no results? (run* [c1 c2] (fresh [lx ly x1 y1 x2 y2] (== lx [1 2]) (== ly [4 5]) (membero x1 lx) (membero x2 lx) (membero y1 ly) (membero y2 ly) (conso x1 y1 c1) (conso x2 y2 c2) (!= c1 c2))) examples of expected results: [(1 . 4) (2 . 5)] [(1 . 4) (1 . 5)] [(2 . 4) (2 . 5)] i not expect return result [(1 . 4) (1 . 4)] both spots in each cons equal. if remove (!= c1 c2) portion, 16 results, including both cons same. i results expect if replace (!= c1 c2) with: (conde ((!= x1 x2)) ((!= y1 y2))) which should same thing, explicitly checks 2 cells. this not valid core.logic program. cannot use conso tail not proper. minikanren in scheme let this, behavior undefined core.logic. i've amended docstring conso reflect this. working program: (run* [c1 ...

Eclipse Maven Error Plugin execution not covered by lifecycle configuration: -

i using eclipse juno maven 3.0.5 on windows 7. project on windows xp , have moved windows 7 64 bit machine. i have copied eclipse spring 3, hibernate 4 , jsf 2.0 project , when try compile getting following error plugin execution not covered lifecycle configuration: org.bsc.maven:maven-processor-plugin:2.0.6:process (execution: process, phase: generate-sources) i tried mentioned in this thread adding following in eclipse.ini file, didn't solve issue. -vm c:\program files\java\jdk1.7.0_21\jre\bin\server\jvm.dll tried building maven install , clean, problem still persists. how can resolve issue? highly appreciable. thanks maven snippet <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.6</source> <target...

ajax - Send data to absolute URL with jQuery -

i have html file url localhost/dir1/dir2/file.html . in file send data through jquery server. $('#element').live("change", function(){ $.ajax({ url: "localhost/dir1/dir3/file.php", type: "post", data: { esp: $(this).val() }, success: function(result){ $("#element2").html(result); } }) i error due jquery send data localhost/dir1/dir2/localhost/dir1/dir3/file.php need send data localhost/dir1/dir3/file.php . how can this? change url to: /dir1/dir3/file.php this avoids hardcoding protocol , server code.

java - How to read and sort data that's only separated by spaces? -

i have data set wanted read out , sort arrays, problem of data separated spaces only. i wanted use loops sort data big multi-dimensional array, since it's separated spaces i'm @ complete loss. the data sorted year followed 6 spaces, month followed three, 31 sets of data month, each of followed 3 spaces. so: 1974 1 0.00 0.01 i'd wanted this: while(year) //sort annual array while(month) //sort monthly array for(each individual data entry) //sort each data entry each month's array sorry if wording isn't here. many in advance. probably best create class data, write sort custom comparator. you should use scanner read in data data class, , store in list public class mydata{ date date; float data[]; } list<mydata> data = new arraylist<mydata>(); /// add data collections.sort(data, new comparator<mydata>(){ @override public int compare(mydata...

image - Java moving a BufferedImage on JFrame -

i'm new java, studying gui. i'm creating simple maze game. have maze 'layout' using string array converted 2d array , placing image walls , space using 'w' , 's' in in string array. the problem facing character image moving array keys, have created bufferedimage, painted form , have key listener , cant find im going wrong. here code; public class maze extends jframe implements keylistener { private container contain; private jpanel peast, pnorth, psouth, pcenter, pwest; private jbutton btnstart, btnreset, btnexit; private jlabel lbltitle, lblmazewall; private jtextarea txtarea; //private string s; //private fileinputstream in; //private int no; //private char ch; private imageicon mazewall; private bufferedimage player; private int xpos = 100, ypos = 100; private string [] mazelayout; private string [][] mazelayout2d; maze(){ loadimage(); mazelayout = new string[1...

Draw persistent grid in TabPage (.Net, C#) -

i need display persistent grid in tabpage. problems instantly solved if draw entire non-visible portion of tabpage , prevent graphics being erased when scrolling. the other solution can think of tracking scroll position in tab , basing grid drawn that. to draw in first place, had create eventhandler tabpage.paint. //code removed this method draws vertical , horizontal lines create grid within visible tab, continues draw whenever paint event occurs (i.e. scrolling), creates overlapping lines , aren't aligned size of current visible area of tab. maybe work you: public partial class form1 : form { public form1() { initializecomponent(); const int gridspacing = 20; const int linethickness = 1; bitmap bmp = new bitmap(gridspacing, gridspacing); using (system.drawing.pen pen = new system.drawing.pen(color.blue, linethickness)) { using (graphics g = graphics.fromimage(bmp)) { ...

C# equivalent to JavaScript "OR assignment" -

does c# have equivalent javascript's assignment syntax var x = y || z; ? in case don't know, result not true/false . if y defined, assigned x , otherwise z assigned x if undefined. note in javascript variable still has declared: var test; i think looking ?? operator. msdn reference

html - containing div with max-height having a contained div that do not overflow using css -

i have following html. the height of div b set using max-height. contains 2 divs, b1 , b2 have variable heights. when height of b1+b2 smaller height of b, want b1 , b2 have normal height (and height ob b smaller it's max-height). part working. when height of b1+b2 higher 1 of b, don't want b2 overflow div b (i want bottom of b2 match bottom of b, , content inside b2 overflow b2). how can achieve this? please see fiddle better understanding. <div id="container"> <div id="a"> <div id="b"> <div id="b1">d1</div> <div id="b2"> d2 - long content <br/>line <br/>line <br/>line <br/>line <br/>line <br/>line <br/>line <br/>line <br/>line <br/>line ...