Posts

Showing posts from January, 2015

sql - SELECT inner joined columns where only one column can not have duplicate record -

i want select inner joined tables, , if there duplicate record in 'column d', not display entire inner joined row. table 1 a b 1 car 1 boat 1 man table 2 c d 1 dog *dog duplicate, display once. 1 dog 1 cat here inner joined sql select statement far: select distinct b c d table1 inner join table2 on table1.a = table2.c <duplicate> not in result result should be: 1 car 1 dog *1 boat 1 dog* <--dog duplicate should not displayed 1 man 1 cat it sounds want arbitrary pairs drawn 2 tables, long second column not have repeated values. whether car/dog or boat/dog unspecified, don't want both. declare @table1 table ( id1 int, value1 varchar(8) ) insert @table1 ( id1, value1 ) values ( 1, 'car' ) insert @table1 ( id1, value1 ) values ( 1, 'boat' ) insert @table1 ( id1, value1 ) values ( 1, 'man' ) declare @table2 table ( id2 int, value2 varchar(8) ) insert @table2 ( id2, value2 ) values ( 1, 'dog' ) in

Removing duplicates in xml with xslt -

i need remove duplicates in following xml: <listofrowidwithlistofbooks xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"> <rowidwithlistofbooks> <row_id>adoa-xssk</row_id> <listofbookinfo> <book> <booktype>brand</booktype> <bookname>jon</bookname> </book> <book> <booktype>brand</booktype> <bookname>jon</bookname> </book> </listofbookinfo> </rowidwithlistofbooks> </listofrowidwithlistofbooks> can help? this task can achieved using standard grouping solutions. not use single select statements known cause performance problems. note reference identity.xsl include stylesheet known identity transformation template. [xslt 1.0] <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:k

c# - Time difference between 2 timespans fails to return expected data -

i have created 2 timespans below: timespan currentts = timespan.fromseconds(43995); //12:13:15 timespan towtime = timespan.fromseconds(303072); //12:11:12 i'm trying find difference in minutes (by seconds i'm passing it, looks on different days). hoping around 2 minutes difference, in reality, i'm getting -57 minutes. int timedifference = (int)currentts.subtract(towtime).minutes; can explain doing wrong? if looking difference between minutes (not including days, hours or seconds), can use double timedifference = currentts.minutes - towtime.minutes; // 2 this difference of minutes component though. other people have said, these times separated 3 days, timespan possibly isn't ideal. or, if want seconds included well, can use timespan minutes1 = new timespan (0, currentts.minutes, currentts.seconds); timespan minutes2 = new timespan (0, towtime.minutes, towtime.seconds); double timedifference = minutes1.totalminutes - minutes2.totalminutes /

windows phone 7 - Pickerboxdialog Customizing -

so, i'm attempting use this: http://blogs.msdn.com/b/priozersk/archive/2010/09/17/customizing-picker-box-dialog.aspx however, want normal pickerboxdialog (just text) i'd attach id it, can reference selection user picked. however, after building own class pass in, still cannot text display (ie @ all) within pickerbox. does have experience? copied code , still no luck... if want normal picker box shouldn't have worry customizing template (unless want display id too). the way reference object selected user in closed event handler: void dialog_closed(object sender, eventargs e) { var picker = (pickerboxdialog)sender; var selected = (yourcustomobject)picker.selecteditem; } in other words shouldn't need id of selected object because can reference select object directly.

Get the full URL in PHP -

i use code full url: $actual_link = 'http://'.$_server['http_host'].$_server['php_self']; the problem use masks in .htaccess , see in url not real path of file. what need url, written in url, nothing more , nothing less—the full url. i need how appears in navigation bar in web browser, , not real path of file on server. have @ $_server['request_uri'] , i.e. $actual_link = "http://$_server[http_host]$_server[request_uri]"; (note double quoted string syntax perfectly correct ) if want support both http , https, can use $actual_link = (isset($_server['https']) ? "https" : "http") . "://$_server[http_host]$_server[request_uri]"; editor's note: using code has security implications . client can set http_host , request_uri arbitrary value wants.

Extract HTML Table ( span ) tags using Jsoup in Java -

i trying extract td name , span class. in sample code, want extract href in first td "accessory" , span tag in second td. i want print mouse, is-present, yes keyboard, no dual-monitor, is-present, yes when use below java code, get, mouse yes keyboard no dual-monitor yes. how span class name? html code <tr> <td class="" width="1%" style="padding:0px;"> </td> <td class=""> <a href="/accessory">mouse</a> </td> <td class="tright "> <span class='is_present'>yes</span><br/> </td> <td class="tright "> &nbsp;<br/> </td> <tr> <td class="" width="1%" style="padding:0px;"> </td> <td class=""> <a href="/accessory"> keyboard</a> </td>

vectorization - Avoiding for-loops in this Matlab matrix operation -

i have large 4 dimensional matrix, , wish 1) find minimum of 2 of dimensions (i.e. 4000x4000 result) , 2) count number of elements in last 2 dimensions less (lets say) 5 times minimum (i.e giving result of 4000x4000). i'm bit stumped how without reverting loops some code might aid description: a = rand([4000,4000,7,7]); b(:,:) = min(a(:,:,1:7;1:7)); % isn't quite right? c = size( < 5*b ) % totally wrong any pointers great - many thanks! if understood correctly, following should job: mn = min(min(a,[],3),[],4); num = sum(sum(bsxfun(@lt, a, 5*mn),3),4)

c# - ToolStripButton "Reset Appearance" / "Fire Leave Event" -

i have toolstripbutton performs action. user clicks button , button disabled prevent action being performed twice. after action complete button re-enabled. works perfectly...except: because button disabled not fire "mouseleave" event , result appearance of button not updated. absolutely clear, when mouse enters toolstripbutton button highlighted in orange (by default) black box around it. highlight not being removed when re-enable button. mouse cursor is, time, long gone control. mousing on button naturally fixes button redrawing it. what method on toolstripbutton "resets" appearance. such method may exist on toolstrip, despite searching have been unable find this. as alternative fire "mouse leave" event on button directly. far know there no way in c# .net. any advice @ point in time appreciated, naturally don't want tear application , replace tool strip. update: reproduced problem, trying figuring out! i didn't better way o

scala quirky in this while loop code -

yesterday, piece of code caused me headache. fixed reading file line line. ideas ? the while loop never seems executed though no of lines in file greater 1. val lines = source.fromfile( new file("file.txt") ).getlines; println( "total lines:"+lines.size ); var starti = 1; while( starti < lines.size ){ val nexti = math.min( starti + 10, lines.size ); println( "batch ("+starti+", "+nexti+") total:" + lines.size ) val linessub = lines.slice(starti, nexti) //do linessub starti = nexti } this indeed tricky, , it's bug in iterator . getlines returns iterator proceeds lazily. seems happen if ask lines.size iterator goes through whole file count lines. afterwards, it's "exhausted": scala> val lines = io.source.fromfile(new java.io.file("....txt")).getlines lines: iterator[string] = non-empty iterator scala> lines.size res4: int = 15 scala> lines.size res5: i

php - displaying my count results -

i have made query find how many people have voted entry , goes this: $query = "select itemid, count(*) totalcount jos_sobi2_plugin_reviews group itemid having count(*) > 1 order count(*) desc "; the sql works , produces following table. entry id totalcount -------- ---------- 202 5 203 20 204 15 ... i want display column totalcount , dont succeed. maybe knows query should right on php? thanks, ronen! $query = "select count(1) totalcount jos_sobi2_plugin_reviews group itemid having count(1) > 1 order count(1) desc "; this work fine

javascript - MooTools class binding with CoffeeScript -

how can write following in coffeescript? showmessage: function() { $('myelement').addevent('click', function() { alert(this.options.message); }.bind(this)); }, i believe following should work: someclass = new class showmessage: -> $('myelement').addevent 'click', => alert @options.message coffescript bit weird, , outputs return everywhere, can cause problems, of time doesn't.

Rails ERB: radio_button_tag not generated -

i have erb contains line: hello <% radio_button_tag "a", "b" %> world problem: output hello world . no radio button generated. what problem? you forget equal sign: hello <%= radio_button_tag "a", "b" %> world

asp.net - iTextSharp error: 'HtmlParser' is not declared -

i had import following namespace in asp.net page imports itextsharp imports itextsharp.text imports itextsharp.text.pdf imports itextsharp.text.html but still got error 'htmlparser' not declared when compile, what's problem ? thanks protected sub btn_print_click(byval sender object, byval e system.eventargs) handles btn_print.click 'get html gridview1 dim sw new io.stringwriter() dim htw new htmltextwriter(sw) gridview1.rendercontrol(htw) dim html string = "<html><body>" + sw.tostring() + "</body></html>" dim filename string = "temp" httpcontext.current.response.addheader("content-disposition", "attachment;filename=" + filename + ".pdf") 'set response response.clear() response.contenttype = "application/pdf" 'create pdf document dim document new itextsharp.text.document(pagesize.a4, 80, 50, 30, 65)

c# - Visual Studio throws error when I make a using directive for a project I referenced in my solution -

my solution (this vs2010 express) contains 3 projects. 1 main project uses xna, second called myextendedcontentprocessor, , third blank class file identical when add new project (even called classlibrary1). main project can reference classlibrary1 if add reference, if add reference myextendedcontentprocessor, can add using directive, when build error 1 type or namespace name 'triangleprocessorextension' not found (are missing using directive or assembly reference?) and after intellisense no longer see namespace inside myextendedcontentprocessor. i'm not sure why acting way. way, if comment out of myextendedcontentprocessor, still not let me add reference it. any appreciated. edit: (taken comment) also, not sure if related or not, i'm unable change output path. can change it, doesn't change files being copied to, , if restart visual studio, build path same before changed (even though pressed save)

pagination - grails paginated list not working correctly -

iam implementing search functionality pagination in projext using grails. following code can see first resultset max=5, when click "next" returns no data. below code snippet: controller code: list <searchcommand> empdetailslist = searchservice.searchemployee(searchcommand) service code: def userlist = criteria.list(max:searchcommand.max, offset:searchcommand.offset){ userprofiles { ('firstname', "${searchcommand.firstname}%") ('lastname', "${searchcommand.lastname}%") } employees { ('employeenum', "${searchcommand.employeenum}%") ('payenum', "${searchcommand.payenum}%") } } list <searchcommand> searchcommandlist = new arraylist<searchcommand>() for(userobject in userlist) { searchcommand searchcommandobj = new searchcommand() def user = userobject schemeuser

blackberry - Calling a customFields paint method -

i working on application displays chart on screen. made custom field paint function renders chart. want know how can call function chart shown. have attatched sample code here see blank white screen. public class graph extends mainscreen { class myfield extends field { protected void layout(int w,int h) { setextent(getwidth(),getheight()); } protected void paint(graphics g) { //my graph drawn here } public myfield() { paint(getgraphics()); } } public graph() { verticalfieldmanager vfm=new verticalfieldmanager(); vfm.add(new myfield()); add(vfm); } } one thing notice getwidth() , getheight() calls being used set extent. until you've finished calling setextent() , getwidth() , getheight() return 0. should doing own calculations determ

wpf - how to add DragDockPanel Dynamically, using ItemsControl? -

Image
<grid> <blacklight_controls:dragdockpanelhost > <itemscontrol itemssource="{binding path=dashboarditemlist}"> <itemscontrol.itemtemplate> <datatemplate> <blacklight_controls:dragdockpanel header="titel"/> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </blacklight_controls:dragdockpanelhost> </grid> this appear this.. the newly generated dragdockpanels itemscontrol, added inside dragdockpanel. not dragdockpanelhost. because dragdockpanels cannot move. need , generated dragdockpanes must directly add dragdockpanelhost, no inside dragdockpanel. i had same problem. removing itemtemplate produced effect wanted. <blacklight:dragdockpanelhost x:name="fields" >

how to update or change images of imageview dynamically in android? -

is possible update imageview diffrent images within specific time using timer or thread ? imageview image = (imageview) findviewbyid(r.id.test_image); image.setimageresource(r.drawable.xxx); use above code set image image view , use thread can change contents in ui bascially thing this public void onclick(view v) { new thread(new runnable() { public void run() { imageview image = (imageview) findviewbyid(r.id.test_image); image.setimageresource(r.drawable.xxx); } }).start(); }

php - Using the jQuery validate plugin with the "remote" option -

i using jquery validate plugin , remote option checking existence of username input field. use code: remote : { url :'ajax_php/admin/checking.php', type :'post', data : { type:'username' }} i've noticed request url has callback parameter appended, though set type request post : http://localhost/lopoli2/ajax_php/admin/checking.php?callback=jquery15104128487491980195_1311232389069 my php script works fine , returns true valid username , string invalid usernames. no error message appears! php file in short looks this: $check = mysql_query("select `username` `user_tbl` `username`='".$_post['username']."' ",$conn) or die('error in db !'); if (mysql_num_rows($check)>0){ echo("username exists"); }else{ echo("true"); } here's want know: what callback parameter for? how solve "display error message" problem? try cha

.net - Saving selected listbox(binded) items to an array in c# -

string[] chkitems = new string[4]; string[] str = new string[4]; str[0] = txtid.text; str[1] = txtname.text; str[2] = txtemail.text; itemcount = ltbxinterests.selecteditems.count; (int = 0; <= itemcount; i++) { ltbxinterests.selecteditems.copyto(chkitems, 0); // here returning exception //"object cannot stored in array of type." } please me how out exception couple issues here, chkitems defined length 4 exception if try , put more 4 items in. source array selecteditems of type object need cast result. assuming putting strings listbox use (remember reference system.linq) string[] str = new string[4]; str[0] = txtid.text; str[1] = txtname.text; str[2] = txtemail.text; string[] chkitems = ltbxinterests.selecteditems.oftype<string>().toarray(); if wanting limit first 4 items, replace last line to string[] chkitems = ltbxinterests.selecteditems.oftype<string>().take(4).toarray(); also shorten code use array initializer (but wil

c# - How to get value of text box from 1 aspx page to another -

i doing project on c#.net using sql server 2005. i have login.aspx , homepage.aspx. want save value of textbox "username" login.aspx , want displayed on homepage.aspx using label control. also, using .net's inbuilt login control , dont know how access database/table created automatically .net. tell me that? please me. thanks in advance, nikhil if using asp.net login system can use <asp:loginname /> control: http://www.google.co.uk/search?q=asp.net+loginname if want access information via code can use: string username = httpcontext.current.user.identity.name;

python - Function doesn't work the second time its called in a thread (Pyttsx module) -

edit: drastically reduced code. on python 2.7 , windows xp here small program, uses pyttsx module text speech. working: speaks particular string of text.a new thread ( runnewthread() ) created handles speaking part. in order stop speaking , used queue communicate new thread , hence stop pyttsx engine. this works expected. after stopping talking thread , creating new thread, reason engine doesn't speak @ all(inside 2nd new thread). thread function called, variable type of engine = pyttsx.init() correct, other statements executed correctly , engine.runandwait() doesn't work. why? edit: throws exception exception in thread sayitthread (most raised during interpreter shutdown): import pyttsx import threading threading import * import datetime import os import sys import time queue import queue queue = queue() pauselocation = 0 wordstosay = '' play = 0 #created new thread def runnewthread(wordstosay): e = (queue, wordstosay) t = threa

Android Location Wifi doesnt work after rebooting -

i using code location provider , location. mlocationmanager = (locationmanager) getsystemservice(location_service); criteria criteria = new criteria(); mbestprovider = mlocationmanager.getbestprovider(criteria, false); mlocation = mlocationmanager.getlastknownlocation(mbestprovider); if turn off gps, location network, if reboot phone(so loss last position known) , 3g data connections off. using wifi, cant provider therefore location. google places app can locate me. think might getting lastknownlocation.but in case others applications should able location. idea whats happening? the way calling return providers enabled or not because passing false intention have checked return string? mbestprovider = mlocationmanager.getbestprovider(criteria, false); you might getting gps provider, or might getting network provider, have learned not trust criteria mechanism because seems work differently per carrier , device (i have had weird bugs rep

difficulties Mapping maps with hibernate using JPA annotations -

there possibly fundamental don't understand semantics of jpa @mapkey element. trying save map has entity keys , entity values. schema auto generated hibernate. generates join table maps values entities containing entity (that has map property) , ignores keys. treats collection of values , ignores keys, far can tell. missing here ? thank you @entity public class practicemap { @javax.persistence.onetomany(cascade = cascadetype.all) @javax.persistence.mapkey public map<keysample, valuesample> getmap1() { return map1; } //more unrelated/standard bits here } look @ javadoc of @mapkey - it's used when need treat particular fields of value entity keys. if key , value should different entities, need use @mapkeyjoincolumn (introduced in jpa 2.0).

c++ - Thread execution "stops" when main form button is clicked -

i use borland c++builder 6. have app, form. app/main form kicks off thread. ( tthread ) thread creates new instance of server socket, , listens data. when data comes in, thread displays info on main form using synchronize method. problem is, while thread sends info, if menu option on main form clicked, thread execution temporary halted. if comment out form1->memo1->lines->add(mstr) in synchronize method, i.e. thread not sending info main form, thread continues executing without problem. data received , responded correctly. as restore line, , write data main form, , menu option selected on main form, thread temporary halted. there way stop behaviour thread never "blocked", still can report main form? after reading martin's response, here did: in main.h: #define wm_addlog (wm_user+0x0500) class tform1: public tform { ... private: void __fastcall virtual handleaddlog(tmessage &msg); ... public: hwnd hwnd; tstringlist *fstringbuf; __property tstri

.net - How do I configure a property of a static class in Spring.NET? -

how configure static class via spring .net? consider following class: static class abc { public interface xyz { get; set; } public void show() { xyz.show(); } } maybe workaround can help.. not static class works one namespace nyan { public class util{ protected util(){} //to avoid accidental instatiation public static string datetimeformat = "hh:mm:ss"; public static datetime parsedate(string sdate) { return datetime.parseexact(sdate, datetimeformat, cultureinfo.invariantculture); } } } <object id="util" type="nyan.util, nyan" singleton="true"> <property name="datetimeformat" value="hh-mm-ss" /> </object and used other static class: protected void page_load(object sender, eventargs e) { datetime sdate = nyan.util.parsedate("15-15-15"); //parsed injected format }

spam - email that my application sends is getting spammed: what's wrong with my headers? -

i'm sending out emails via php application. however, they're getting marked spam gmail. here's how i'm sending email (php): $headers = "from: test@bookmytakeout.com\r\nreply-to: test@bookmytakeout.com"; $mail_sent = mail( 'munged@gmail.com', 'test mail', $message, $headers, '-ftest@bookmytakeout.com' ); gmail spams message. went , clicked handy "show original message" option. here's get: delivered-to: munged@gmail.com received: 10.68.71.200 smtp id x8cs325812pbu; thu, 21 jul 2011 01:34:52 -0700 (pdt) received: 10.236.114.234 smtp id c70mr12483739yhh.163.1311237292052; thu, 21 jul 2011 01:34:52 -0700 (pdt) return-path: <test@bookmytakeout.com> received: vps.bookmytakeout.com ([8.22.200.47]) mx.google.com esmtps id u61si3662037yhm.119.2011.07.21.01.34.50 (version=tlsv1/sslv3 cipher=other); thu, 21 jul 2011 01:34:51 -0700 (pdt) received-spf: neutral (google.com: 8.22.200

Ruby On Rails: Error Message When Trying To Start WEBrick -

i'm total newbie trying learn rails lynda.com ruby on rails tutorial. i've got rails 3.0 installed , ruby germs 1.8. point in tutorial, have created rails project , access it. tutor says should able type rails server in terminal on mac boot webrick comes installed rails. however, when it, got error message below (which can't make sense of). **do know can webrick working? note: have mysql installed locally (/usr/local/mysql/bin/mysql) , running. have mamp installed not running (i use php applications). use mysql , webrick can work along tutorial, if there's alternative solution can think of please let me know... /library/ruby/gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle: dlopen(/library/ruby/gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9): library not loaded: libmysqlclient.18.dylib (loaderror) referenced from: /library/ruby/gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle reason: image not found - /library/ruby/gems/1.8/gems/mysql

How to start a background process with PHP exec (linux)? -

i know there's lot of posts on topic, solutions mentioned there don't seem work me. i'm building chat client , want keep process running in background, listen incoming messages on account. here's code: $command = "cd classes/chat/inc/ && /usr/bin/php5 client.php --mysql_server=localhost --mysql_username=root --mysql_password= --mysql_database=covide --gtalk_user=xxx --gtalk_password=xxx --user_id=".$_session['user_id']." &> /dev/null &"; exec($command); i've tried lot of options instead of this: &> /dev/null & like > /dev/null 2>/dev/null & or > testoutput.php 2>&1 & echo $! (from various posts on forum), no success. have idea on how should fixed? i have working version of this. instead of using exec(); use curl post run our background process. problem timing out limitations. can have background process run through "listen incoming messages" task, @

c# - How can I navigate from an "external" .cs file in Silverlight -

i know title isn't clear, i'll try explain myself better. i've got in mainpage.xaml listbox want populate in way. on purpose, have home.cs file no xaml attached, constructor this: public home(string sid, listbox lb){...} in constructor several post requests webclient and, in uploadstringcompleted method, create several elements, stackpanels, textblocks , hyperlinkbutton. stackpanel bigpanel = new stackpanel(); bigpanel.width = 456; hyperlinkbutton hyperlink = new hyperlinkbutton(); hyperlink.content = friend.name + " " + person.surname; hyperlink.click += new routedeventhandler(hyperlink_click); bigpanel.children.add(hyperlink); lb.items.add(bigpanel); and here comes problem. want hyperlink navigate page (friendpage.xaml), can't achieve it, because if try add navigationservice.navigate(new uri("/friendpage.xaml", urikind.relative)) fails, says "an object reference required non-static method navigate". as far know, code lin

python - How to read Unsigned integer from binary file? -

how read "unsigned 8/16/24/32/64-bit integer" binary file ? ( big-endian byte order ) unpack ? examples ? use struct module. covers 8,16,32 , 64 bits. 24 bits need fiddling yourself examples here

google maps - Implementing Location Checkin Rails -

i trying implement location "checkins" in rails 3 application. for example: user searches place , can find latitude , longitude of place , allow user "check in" there. is there gem can achieve that? thanks in advance! the gem you're looking 'geocoder' , there great screencast @ http://railscasts.com/episodes/273-geocoder?autoplay=true

java me - How to highlight button when get focus on it in blackberry? -

i want make blackberry button images, 1 image should shown when focused , when unfocused. or can blue color when focus off(by default) , red color when focus on, how can achieve such thing ? see custom class import net.rim.device.api.system.bitmap; import net.rim.device.api.ui.color; import net.rim.device.api.ui.field; import net.rim.device.api.ui.font; import net.rim.device.api.ui.fontfamily; import net.rim.device.api.ui.graphics; public class mybuttonfield extends field { // private int backgroundcolour = 0xffffff; private bitmap button; private bitmap on; //= bitmap.getbitmapresource("img/pink_scribble.bmp"); private bitmap off; // = bitmap.getbitmapresource("img/blue_scribble.bmp"); private int fieldwidth; private int fieldheight; // private int buffer = (display.getheight() - 105) / 2; private string text; private font fieldfont; private boolean btn_text = true; priva

How to call JavaScript/jQuery function from .cs file (C#) -

i'm working on asp.net (c#) project include page files (aspx, aspx.cs) , (.cs) file. i'm able access javascript/jquery functions page files (aspx, aspx.cs) using scriptregister , question how access javascript/jquery function alone (.cs) file. i'm generating html tags in (.cs) file therefore in need of call javascript/jquery functions (.cs) class. the file have are, example, default.aspx , default.aspx.cs , web.cs (my concern call javascript/jquery functions web.cs) actually, i'm trying generate html code in web.cs (business object) , while generating html code in web.cs need other dynamic html code generated jquery function output concern: var output ="my html code generated jquery function" now need above jquery output merger web.cs html code generating. kindly let me know how can possible call jquery functions web.cs , result jquery web.cs in order merge? thanks you can try write response stream directly , output response.write

c++ - Is text in code char or const char? -

possible duplicate: string literals vs const char* in c why can this? void foo(char * cstr) { ... } and in code foo("some text"); shouldnt "some text" of type const char * ? if char *, means can modify it? yes, should const . in c++03, allowed omit const backward compatibility c, 2 caveats: you still not allowed modify data. yes, highly confusing. that's why leaving out const deprecated . ideally plain disallowed (and, in c++11 onwards, is). if have compiler's warning level set properly, warned when trying this. if have compiler's error level set strictly treated error .

css - Resize XHTML with window -

i've done in past, forgot how it. how can set "master" container in css/xhtml , have website resize browser window when resized? for example, if have "master" container div of 500px 500px , user resizes browser window, how can container resize it? thanks. simply use max-height , max-width instead of height , width .

nosql - Store enum as integer in RavenDB -

i store enums integer-values inside ravendb-document instead of there full-name. doing so, ensure, changing name of enum-value, not break persistence. with fluentnhibernate, can create custom convention, didn't find matching ravendb. you can do: store.conventions.saveenumsasintegers = true;

asp.net - how to hack the validationsummary control -

i have validationsummary control on page client wants error message show in colorbox type dialog box. can't find way error message of summary can show in colorbox. also, if knows how error message, how hook it's change or update method know when display colorbox? thanks.

java - Can not understand the result of request JPA -

i have function return arraylist< string > ,the list contain elements retrieved database using jpa ,my problem can't understand format of output! the function is: public arraylist<string> getmylistenvironment() { arraylist<string> env=new arraylist<string>(); try{ entitytransaction entr=em.gettransaction(); entr.begin(); javax.persistence.query multipleselect= em.createquery("select h.henv hpe h h.hpepk.peplatform = :w ").setparameter("w", "platf1"); list s = new linkedlist(); s= multipleselect.getresultlist(); env = new arraylist(s); entr.commit(); return env; } catch (exception e ) { system.out.println(e.getmessage()); system.out.println("error"); } { em.close(); } return env; } the output(result): [dtomonito.henv[ envurl=http://10.55.99.5:1055 ], dtomonito.henv[ envurl=http://10.55.99.

php - Regex search for Smarty template -

i have fields names such as: home_phone company_phone mobile_phone other_phone_c personal_phone_c and have smarty variable populate input values field values: value="{$fields.{{$prefix}}_phone}" but ones suffix _c not outputting, since don't match pattern. is there way append kind of regex values either end after phone or _c , like: {$fields.{{$prefix}}_phone{regex | ($|_c$)}}" use this: .*_(?:phone|phone_c)$ it match desired strings, ends _phone or phone_c .

c# 3.0 - What is difference between ArrayList and Hashtable in C#? -

i want store collection of data in arraylist or hastable data retrival should efficient , fast. want know data structure hides between arraylist , hastable (i.e linked list,double linked list) an arraylist dynamic array grows new items added go beyond current capacity of list. items in arraylist accessed index, array. the hashtable hashtable behind scenes. underlying data structure typically array instead of accessing via index, access via key field maps location in hashtable calling key object's gethashcode() method. in general, arraylist , hashtable discouraged in .net 2.0 , above in favor of list<t> , dictionary<tkey, tvalue> better generic versions perform better , don't have boxing costs value types. i've got blog post compares various benefits of each of generic containers here may useful: http://geekswithblogs.net/blackrabbitcoder/archive/2011/06/16/c.net-fundamentals-choosing-the-right-collection-class.aspx while talks ge

generics - What does Map<?, ?> mean in Java? -

what map<?, ?> mean in java? i've looked online can't seem find articles on it. edit : found on mp3 duration java ? indicates placeholder in value not interested in (a wildcard): hashmap<?, ?> foo = new hashmap<integer, string>(); and since ? wildcard, can skip , still same result: hashmap foo = new hashmap<integer, string>(); but can used specify or subset generics used. in example, first generic must implement serializable interface. // fail because httpservletrequest not implement serializable hashmap<? extends serializable, ?> foo = new hashmap<httpservletrequest, string>(); but it's better use concrete classes instead of these wildcards. should use ? if know doing :)

How to traverse/rebuild UIComponent tree structure in Flex -

i have kind of uicomponent grouping may classes "group" , "element". groups can have children , children may elements or groups again, similar file system or str+g group function in several graphics programs. simplest form of group group children low level groups in tree. edit: display hierarchy existant, try persist xml. group - element - group - element - group -element -element - element - element i want rebuild structure in xml-document persistence. know how build xml document in flex not how (recursively) traverse n-tree correctly. update: for getting child nodes 1 make use of following algorithm (pseudo code). somehow don't understand how create xml this. walktree(group) { children = node.getchildren if(children != null) { for(int i=0; i<children.length; i++) { if(children[i].isgroup()) { walktree(group[i]); } else

image - Face Detection with JAVA -

i planning develop web app detect faces in jpeg image. use tomcat deployment. want on how proceed. i dont want code. flowchart of steps do. want avoid use of third party libraries face detection. please list options. any information, algorithm, resource helpful. thank you.. i recommend using 3rd party lib such opencv. you'll want @ haar feature detector. there's info here http://opencv.willowgarage.com/wiki/facedetection , plenty more on opencv mailing list. there java bindings opencv http://code.google.com/p/javacv/ . might easiest produce separate command line util shell out in tomcat.

Showing a CheckBox in a Cell of a ListView row isntead of a Boolean value in WPF -

i have listview in wpf application use dynamic binding . wish insert in cell of row checkbox instead showing boolean value specific row. should apply rows , should offcourse enable me unset , set (it update object in code) can last part myself. need figure out how put checkbox there. it possible ? ideas ? here xaml: <listview margin="385,91,12,120" name="lsttransactions"> <listview.view> <gridview> <gridviewcolumn displaymemberbinding="{binding description}" width="220">description</gridviewcolumn> <gridviewcolumn displaymemberbinding="{binding path=montantestimation, stringformat='{}{0:c}'}" width="100">estimation</gridviewcolumn> <gridviewcolumn displaymemberbinding="{binding path=mo

c# - Custom cursor in XNA 4.0 -

so i've been following answer: adding custom cursor in xna/c#? ... custom mouse cursor working on xna. i've done solution, no error, still no custom cursor (it still shows windows default one). i'm unsure on really... i created getcursorpos method @ bottom of game1.cs file, included following declarations @ begining of game1 class: private mousestate mousestate; private int cursorx; private int cursory; the code in loadcontent giving me error: cursortex = content.load<texture2d>("cursor.png"); so replaced with: cursortex = content.load<texture2d>("cursor"); ("cursor" png) what doing wrong?... said, no error :( i suspect need update mouse's position, using mousestate = mouse.getstate(); (put in game's update method, before update cursorpos variable).

ms access - SQL query to calculate the difference between current and previous day's value -

i have access .mdb database table looks similar to: +---------+------+--------+ | date | value | +---------+------+--------+ |2011-05-04 12:00 | 45.9 | |2011-05-05 12:00 | 21.2 | |2011-05-06 12:00 | 32.2 | |2011-05-07 12:00 | 30.4 | |2011-05-08 12:00 | 40.4 | |2011-05-09 12:00 | 19.8 | |2011-05-10 12:00 | 29.7 | +-------+---------+-------+ i create query return values derived subtracting 1 value previous day value. for example: query calculate (21.2-45.9) , return -24.7 (32.2-21.2) , return -11.0 (30.4-32.2) , return -1.8 etc how can accomplish in select statement? you can use query employs self-join on table in question: select t.datevalue , t.singlevalue - iif(isnull(tnext.singlevalue), 0, tnext.singlevalue) test t left join test tnext on t.datevalue = dateadd("d", -1, tnext.datevalue) t.datevalue = #2011-05-08 12:00#; outputs datevalue expr1001 ---------------------- ---------------- 05/08/2011 12:

javascript - What is the best way to have an array of 2 properties? -

i'd have array in javascript each item contains 2 properties instead of 1, how possible? the following adds 1 property item default: var headercellwidths = new array(); headercellwidths.push(100); this enables me access item using [0][normalcellwidth] but i'd able have e.g. [index][normalcellwidth][firsttemplatecellwidth] e.g. [0][100][25] e.g. headercellwidths.add(100, 25); one solution create own customarray maintains 2 separate array instances isn't there better way? thanks, you can add entries objects array. try this: headercellwidths.push({normalcellwidth:100, firsttemplatecellwidth:25); you access items using: headercellwidths[0].normalcellwidth , headercellwidths[0].firsttemplatecellwidth

php - specify key values for return $query->fetchArray()? -

using doctrine, i'm doing query kinda this: $query = doctrine_query::create()->select('id,name')->from('people'); return $query->fetcharray(); it returns object similar following array of arrays: array(3) { [0]=> array(4) { ["id"]=> string(1) "34" ["name"]=> string(7) "john" } [1]=> array(4) { ["id"]=> string(1) "156" ["name"]=> string(6) "bob" } [2]=> array(4) { ["id"]=> string(1) "27" ["name"]=> string(7) "alex" } } notice how array's keys count 0, 1, 2, etc? question: possible specify want key values come from? example, key values in above case 34, 156 , 27. i noticed in doctrine doc's both fetcharray() has parameters can feed them, doesn't parameters are... public array fetcharray(string params) http://www.doctrin

plot a multiple rule function in mathematica -

Image
how can write code function (complex contour) similar in mathematica: the direct way use graphics primatives (although think prefer felix's polarplot solution) with[{q = pi/6}, graphics[{circle[{0, 0}, 1, {q, 2 pi - q}], arrowheads[{{.05, .8}}], arrow[{{cos[q] + 2, sin[q]}, {cos[q], sin[q]}}], arrow[{{cos[q], sin[-q]}, {cos[q] + 2, sin[-q]}}], fontsize -> medium, text["\[scriptcapitalc]", {2, sin[q]}, {0, -2}]}, axes -> true, plotrange -> {{-4, 6}, {-4, 4}}]] i guess if want actual function contour, maybe like contour[t_, t0_: (5 pi/6)] := piecewise[{ {exp[i (t + pi)], -t0 < t < t0}, {t - t0 + exp[i (t0 + pi)], t >= t0}, {-t - t0 + exp[-i (t0 + pi)], t <= -t0}}] parametricplot[through[{re, im}[contour[t]]], {t, -8, 8}, plotpoints -> 30] and add arrows plot, guess you'd have add them in manually (using epilog or drawing tools) or use 1 of packages modifies built-in plots.

jquery - Some browsers don't retain appended AJAX content when page returned to -

i have developed ajax search component query google search appliance. makes ajax call php script grabs xml gsa , encodes json , sends browser. there, jquery template plugin rest. process works should. however, when navigate away search page (e.g., click on result link) , later wish return search results, ie , chrome not retain search results , position on page, while ff, opera, , safari retain the ajax content appended dom , position on pae. in ie , chrome, hitting , seeing blank page w/ no results. is there reason why browsers behave differently? (some browsers show appended content when go page, don't) is there way easy way fix without type of session or state or storage? thanks how when hit search change location of page without redirecting ( ex: http://myurl.com/search.html#mysearchtext(url encoded)) then search. on onload event of page check #xxxxx in url, , if 1 exists make search. it serves 2 purpose : - way action work :p - way can link search

regex - ASP.Net Regular Expression Validator no spaces -

i'm trying set validation expression asp.net regular expression validator control. validating creation of user name, want limit number of characters, , want prevent them using spaces. here's i've got far: ^.*(?=.{5,20})(?=.*\w{5,255}).*$ the \w{5,255} part prevents spaces , special characters (except underscores, apparently). have no idea how "5,255" makes work, does; copied somewhere else. the main problem i'm having if first or last character space (or special character), passes validation, not acceptable. can me? i'm sure simple, know next nothing regular expressions. you can use simpler this: ^[a-za-z0-9_]{5,255}$ this allow alphanumeric usernames between 5-255 characters in length.

Should JSON representation of REST resources use URIs for related resources? -

is best practice of using uris in json (or xml) representation of rest resources, example for example resource has list of attachments, every attachment has id can used retrieve using url http://myserver.com/resources/attachments/ : { filename: "screenshot.png" contenttype: "application/octet-stream" id: 52004 } should add uri element like { filename: "screenshot.png" contenttype: "application/octet-stream" id: 52004 uri: /resources/attachments/52004 } yes, think should include link each item in collection. api not restful (and more importantly, not useful) without links. if think human client rather have link instructions on how request item id, same applies non-human client. should give client idea of how item relates current resource providing link relationship: link : { uri: "/resources/attachments/52004", rel: "/rels/file-attachment" } john

excel vba - Macro to show/hide a worksheet based on date value -

i have excel workbook created executable data days of month on separate worksheets. 'sheet 1' of executable has days of month listed. write macro show/hide worksheets based on date in 'sheet 1'. for instance, if data month of jan has days 1,2,3,4,5,11,12 displayed macro should show corresponding worksheets day1, day2, day3, day4,day5 , hide day6 through day10 , show day11 , day12. pointers appreciated. thank you. public sub setsheetvisiblity() 'load data sheet 1 collection 'i'm making assumption have days listed horizontally '1a 1* dim currentcolumn integer dim activedaycollection collection currentcolumn = 1 set activedaycollection = new collection while cells(currentcolumn, 1).value <> "" activedaycollection.add cells(currentcolumn, 1).value currentcolumn = currentcolumn + 1 wend 'make every sheet invisible/visible each currentworksheet worksheet in worksheets if currentwo

c# - Enumerable OrderBy - are null values always treated high or low and can this be considered stable behaviour? -

i sorting ienumerable of objects: var sortedobjects = objects.orderby(obj => obj.member) where member of icomparable type. sort seems put objects obj.member == null @ top. behaviour want, can consider stable respect future .net frameworks? there way can make 'nulls low' behaviour more explicit? to make behavior more explicit: var sorted = objects.orderby(o => o.member == null).thenby(o => o.member);

javascript - Google Map-like image zoom with loading slices of image on web? -

i looking relative-simple approach one-level image zoom in, slices of images loaded , appear viewed in area (like google maps). have lot of images, manual-slicing maybe out of question. preferably no flash/silverlight. i had @ of jquery solutions none quite fits looking for. similar implementation can seen on uk national gallery site ( http://www.nationalgallery.org.uk/paintings/georges-seurat-bathers-at-asnieres ), or google+ intro site ( http://www.google.com/+/demo/ ) thank you. check out jquery overscroll plugin , this question . should trivial make script slices images using php's gd .

Android: (simple) missing import or...? -

Image
i following book learn android , getting error, code i using image above can see error (compoundbutton). did type wrong or did book not write of imports needed? thanks! edited full code: package newbook.appress; import android.app.activity; import android.os.bundle; import android.widget.checkbox; import android.widget.compoundbutton; public class checkboxdemo extends activity implements compoundbutton.oncheckchangedlistener{ checkbox cb; @override public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.main); cb=(checkbox)findviewbyid(r.id.chkbox1); cb.setoncheckedchangelistener(this); } public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { if (ischecked) { cb.settext("this checkbox is: checked"); } else { cb.settext("this checkbox is: unchecked"); } } }

php - Executing a script -

i need execute script within php, tried everything.. http://bulksms.mysmsmantra.com:8080/websms/smsapi.jsp?username=user&password=******&sendername=vfup&mobileno= '.$f.' &message='.$message1.'' i tried java script, $f , $message1 variables, cant use echo twice is there function in php, automatically opens above link in new window , need remaining part of php code execute without being affected. provide more details if required.. regards, php executes on server, not capable of opening windows. if want happen on client side have echo out javascript browser can execute.

How to overcome max upload size limit in Wordpress 3.1 running on Windows 2003 IIS6 -

i trying increase max upload size in wordpress 3.1 multisite-installation running on windows 2003 iis6, methods try (from editing php.ini, putting in wp-admin in root, editing htaccess, editing metabase.xml, restarting server) give nothing, still same error saying file exceeds allowed 2mb....that's frustrating... workaround , please, step step...thanks! i have pretty urls isapi, - frustrates me since can't upload audio mp3 file, problem? php has these 2 settings govern uploading files: * upload_max_filesize * post_max_size have modified both of those? additionally, iis has aspmaxrequestentityallowed metabase property defaults 2mb. can modify iis manager application.

android - If there is no space horizontally on the screen go to the next vertically available space? -

hello android experts, i have following layout: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal"> <imagebutton android:id="@+id/imagebutton01" android:layout_width="80px" android:layout_height="80px" android:background="@drawable/projects_badge" android:layout_margin="10px"/> <imagebutton android:id="@+id/imagebutton02" android:layout_width="80px" android:layout_height="80px" android:background="@drawable/projects_badge" android:layout_margin="10px"/> <imagebutton android:id="@+id/imagebutton01" android:layout_width="80px" android:layout_height="80px" android:background="@drawable/projects_badge" android:layout_margin="10px"/> <imag

Cyclic relationships in Hibernate -

i want map tree in hibernate, persisting results in exception because of cyclic reference (the relationships not bidirectional). class node { @manytoone node parent; @onetoone node leftchild; @onetoone node rightchild; } node n references left child l in turn references n again parent. also, node n references right child r in turn again references n again parent. however, cannot make relationships bidirectional, because parent inverse of both leftchild , rightchild. best way make model persistable? regards, jochen i don't see problem: @entity class node { @id @generatedvalue private int id; private string name; @manytoone(cascade = cascadetype.all) node parent; @onetoone(cascade = cascadetype.all) node leftchild; @onetoone(cascade = cascadetype.all) node rightchild; node() {} public node(string name) { this.name = name; } // omitted getters , setters brevity } public sta

jquery menu slide down -

i have vertical menu sub categories. when main category clicked sub-menu slides down , opened sub-menu slides up. if user clicks on same main-menu item second time slides associated sub-menu. code opens , closes simultaneously when same main menu item clicked second time. $(".main-cat").click(function() { $(".active-sub").hide('slow'); $(".sub" , $(this).parent()).toggle('slow'); $(".sub" , $(this).parent()).addclass('active-sub'); }); <div id="sidebar"> <ul> <li class="main"> <div class="main-cat 1">real estate</div> <ul class="sub" id="sub_real_estate"> <li><div class="sub-cat 2">consulting services</div></li> <li><div class="sub-cat 3">investment</div></li> <li><div class="s

Decrypt or decode Facebook access token from Facebook Graph iOS SDK -

the facebook ios sdk granting encrypted or encoded access tokens in format: v9ylvkttpnufwux4kvdjdpb0srxkukx7z281rqjhug0.eyjpdii6imewwxbdaetncwpdtu5ibunuqwdrowcifq.y-dwxry2zafzip7evur-hksxqmgw9lxp6umgrfz2xnjslm0a508u7_jxq0_kz5a2s8auuulzuvirvxts51_i6vfsbyocbfbikobe0-n-pa8nc29wbuvmgjlvq4w-ezhv0dza3diiciqcybt9eldxoa using oauth on web, facebook provides unencrypted / unencoded access tokens in format (this 1 not real): 213455681425|1.bggrgnfwrdpg_x18.3600.1213252135.2-1334679|dhcdbxgbeyblg3srgw12fdf4gd60 how can decrypt/decode ios access token can read expiration unix time value , user id can unencoded tokens? reason need expiration date determine when expires, , need user id publish appid|appsecret style access token in event access token expired yet user hasn't revoked publish_stream access. that access token never expires since has offline_access permission. see here . in case looks user expired access token de-authorizing app or changing his/her password. m

formatting - SSAS Date Measure Max StringFormat when Null -

i have cube measure of type date, performing max aggregation, of data points have null value date. in these cases, max value becomes 12/30/1899 believe earliest expression of date. is there way have these appear in results blank rather bogus date? i tried use measure's stringformat property no luck. change nullprocessing property measure preserve . can in bids. open project, cube, on cube structure tab expand measure group , select measure. in properties pane select source, expand , should see property there. after process , measure null instead of default 0 gets assigned nulls. 0 gets cast date , becomes 00/01/1900 in excel.

python - Why does Idle keep crashing? (Mac) -

i installed python 2.6 on mac os x (snow leopard) , when start idle keeps quitting! i removed installations of python by: rm -rf /library/frameworks/python.framework and re-installed , still same problem :( any ideas might be? thanks you undoubtedly using version of python dynamically linking apple-supplied tcl/tk 8.5 in os x 10.6. version of tcl/tk flawed. there several easy ways avoid problem, simplest being install current python 2.7 (or out-of-date 2.6) installer python.org and, 64-bit/32-bit installers, install up-to-date activetcl 8.5 . there more information here . i should add that, while far common problem idle on os x 10.6, possible there cause. take @ system.log (with console.app ) launching idle.app or start idle shell , see error messages being reported.