Posts

Showing posts from June, 2014

String algorithm suggestion to find all the common prefixes of a list of strings -

String algorithm suggestion to find all the common prefixes of a list of strings - what algorithm suggest find out longest mutual prefixes of list of strings? i might have strings such as: call mike , schedule meeting. phone call lisa phone call adam , inquire quote. implement new class iphone project implement new class rails controller purchase groceries i want find out next prefixes: "call " "implement new class " i'll using objective c, ready made cocoa solution plus (though not must). edit: clarified question: sort strings find longest mutual prefix of each adjacent pair sort , dedupe mutual prefixes, remove that's strict prefix of another. actually, step (3) requires remove that's dupe/prefix of another, trie or whatever instead of sorting. in fact may whole thing can done faster suitably annotated trie - if include "count" @ each node you're looking exactly nodes count of 2+, have no children c...

ant - Concatenating CSS files in a specific order -

ant - Concatenating CSS files in a specific order - i have series of css files concatenating , minfying (using yui compressor) ant build script. css files are: reset.css formalize.css typography.css site.css there other css files ie.css , editor.css don't want include in minification. have build script working next code, problem files need concatenated in order posted above. <target name="minifycss"> <!-- combine css files except ones specified ie or content editor --> <concat destfile="css/e123-1.css"> <fileset dir="css" includes="*.css" excludes="ie.css editor.css print.css" /> </concat> <!-- minify css --> <java fork="true" jar="${yuicompressor.lib}" dir="css" output="css/e123-1.min.css"> <arg value="e123-1.css" /> </java> </target> i assume files added alphabeti...

Boost serialization end of file -

Boost serialization end of file - i serialize multiple objects binary archive boost. when reading objects binary_iarchive , there way know how many objects in archive or way observe end of archive ? the way found utilize try-catch observe stream exception. in advance. i can think of number of approaches: serialize stl containers to/from archive (see documentation). archive automatically maintain track of how many objects there in containers. serialize count variable before serializing objects. when reading objects, you'll know beforehand how many objects expect read back. i find approach kinda gross, i'm listing anyway sake of completeness. :-p have lastly object deed kind of sentinel indicates end of list of objects. perhaps add together islast fellow member variable object. this not pretty, have separate "index file" alongside archive stores number of objects in archive. use tellp position of underlying stream object observe if you...

wcf configuration - WCF Test Client - Any way to save the services/settings to a file to reload easily later? -

wcf configuration - WCF Test Client - Any way to save the services/settings to a file to reload easily later? - the wcf test client powerful tool. can avoid creating new console app test services. however, annoying can't seem save services/config add together client. if close , open 1 time again starts fresh. any way save "instance" of wcf test client... kind of how fxcop let's scan binaries , save setting fxcop file? the default behaviour of test client remember lastly few urls you've used. not enough? wcf wcf-configuration wcftestclient

android - Return to application from settings intent -

android - Return to application from settings intent - in applicattion need go de settings activity of phone whith next code: `intent myintent = new intent(settings.action_location_source_settings); startactivity(myintent);´ then in settings activity, when user press key, want homecoming applicattion ¿it's possible? thanks it should automatically go previous activity when key pressed. utilize location settings activity in 1 of apps , when user presses returns them app. time might not happen if app closed free memory app/service, unlikely if opening location settings . android android-intent settings return

r - Data frame of tables from a list -

r - Data frame of tables from a list - suppose have list observations: foo <- list(c("c", "e", "a", "f"), c("b", "d", "b", "a", "c"), c("b", "c", "c", "f", "a", "f"), c("d", "a", "a", "d", "d", "f", "b" )) > foo [[1]] [1] "c" "e" "a" "f" [[2]] [1] "b" "d" "b" "a" "c" [[3]] [1] "b" "c" "c" "f" "a" "f" [[4]] [1] "d" "a" "a" "d" "d" "f" "b" and vector each unique element: vec <- letters[1:6] > vec [1] "a" "b" "c" "d" "e" "f" i want obtain info frame counts of ea...

unit testing - googletest printing COleDateTime values -

unit testing - googletest printing COleDateTime values - i have integrated googletest our mfc application. while writing tests involving coledatetime objects came across next warning: 1>gtest/gtest-printers.h(169) : warning c4244: 'initializing' : conversion 'date' 'const testing::internal::biggestint', possible loss of info 1>gtest/gtest-printers.h(168) : while compiling class template fellow member function 'void testing::internal2::typewithoutformatter<t,ktypekind>::printvalue(const t &,std::ostream *)' the test following: test(functiontest, sumdays) { coledatetime res = sumdays(coledatetime(2010,10,31,0,0,0), 1); expect_eq(coledatetime(2010,11,01,0,0,0), res); } the problem cannot add together << operator or printto method documentation announces. allot more tests going involve date values want avoid inline solution documentation refers to. is there solution command print string coledatetime val...

java - How do I pre-fill text fields in a form with info from a database in a .jsp? -

java - How do I pre-fill text fields in a form with info from a database in a .jsp? - i'm trying create form updates entry in mysql database. table users table contains various fields related user. need page work update form takes username passed via previous page , pre-fills text fields existing data. it's model 1 application uses presentation, transport, , info layer. transport layer user.java , info layer (that interacts database) userdb.java. here's code, functional except pre-filling. update: i've edited reflect changes answers below, want note "userdb.getusers()" returns arraylist. <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1" import="java.util.arraylist,beans.*,data.*"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <% //get parameters request string username ...

perl - How's DynaLoader's c library loaded? -

perl - How's DynaLoader's c library loaded? - we know module's function dynamically load c libraries perl code . but how's own c library loaded perl in first place? i justice should have own c library because don't find function dl_load_file right within dynaloader.pm ,so must in c library... dynaloader statically linked perl (managed configure), available. wouldn't work if had available load itself. the source dynloader @ /ext/dynaloader/ in perl distribution, contains number of different implementations of dl_load_file various architectures on perl might run. so yes, dl_load_file in library, ends within perl when perl gets built. perl

asp.net - SQLServer INSERT getdate() function using parameters -

asp.net - SQLServer INSERT getdate() function using parameters - what preferred method of adding current date/time sql server table insert command , executenonquery? i'm expecting ... cmd.parameters.add("@thedate", sqldbtype.varchar, 20) cmd.parameters("@thedate").value = "getdate()" how about... cmd.parameters.add("@thedate", sqldbtype.datetime) cmd.parameters("@thedate").value = datetime.now asp.net sql-server vb.net sqlparameters executenonquery

visual c++ - what is the problem with my path inside CString? -

visual c++ - what is the problem with my path inside CString? - why code not work? :( cstring parametera = _t("c:\program files\test\identify.exe"); cstring parameterb = _t(" -format \"%w\" ") + picturename; if (createprocess(parametera.getbuffer(), parameterb.getbuffer(),0,0,true, normal_priority_class|create_no_window,0,0,&sinfo,&pinfo)) { waitforsingleobject (pinfo.hprocess, infinite); } but, when alter the.... cstring parametera = _t("c:\program files\test\identify.exe"); to.. cstring parametera = _t("identify.exe"); it works. help me.. it's slashes. cstring parametera = _t("c:\program files\test\identify.exe"); note have escape sequences \p , \t , \i , 1 of means ( \t tab character, , not want!). instead, escape slashes interpreted slashes: cstring parametera = _t("c:\\program files\\test\\identify.exe...

android - How to act on attributes for custom XML Views -

android - How to act on attributes for custom XML Views - i have created view called roundedimageview, corners rounded. want attribute called cornerradius lets me (from xml) specify radius. how in java code have public class roundedimageview extends imageview can attribute "cornerradius" specified in xml? here's link example. link search "custom attributes android" more examples. also follow thread how retrieve xml attribute custom control android android-layout android-custom-view

timeout - jQuery hover - perform next transition only after current is over -

timeout - jQuery hover - perform next transition only after current is over - how time transitions out, next 1 start when current one's finished? way jumps next transition while in middle of current, , looks jumpy, when hover on bunch of links quickly. here's link how looks http://dynamo.kco.ie/about-us/clients , , code is: function slideshow() { $("#list .client").unbind('mouseover'); var imgsrc = $(this).attr('rel'); var image1 = $("#clientimage1"); var image2 = $("#clientimage2"); if(image1.is(":visible")){ image2.attr('src', imgsrc); image2.stop(true, true).show("slide", { direction: "down" }, 400, function() { $("#list .client").mouseover(slideshow); }); image1.stop(true, true).hide("slide", { direction: "up" }, 400); //image1.hide(); } else{ image1.att...

What does each column of objdump's Symbol table mean? -

What does each column of objdump's Symbol table mean? - symbol table: 0000000000000000 w *und* 0000000000000000 __gmon_start__ i've man objdump there's no such info. anyone know 5 columns mean? column one: symbol's value column two: set of characters , spaces indicating flag bits set on symbol. there 7 groupings listed below: group one: (l,g,,!) local, global, neither, both. group two: (w,) weak or strong symbol. group three: (c,) symbol denotes constructor or ordinary symbol. group four: (w,) symbol warning or normal symbol. group five: (i,) indirect reference symbol or normal symbol. group six: (d,d,) debugging symbol, dynamic symbol or normal symbol. group seven: (f,f,o,) symbol name of function, file, object or normal symbol. column three: section in symbol lives, abs means not associated section column four: symbol's size or alignment. column five: symbol's name. if want additional info seek m...

How to iterate through html elements and get combined time with javascript/jQuery? -

How to iterate through html elements and get combined time with javascript/jQuery? - here jsfiddle. i'm trying iterate through multiple plans, , calculate combined clip lengths minutes:seconds per plan. i'm missing obvious here probably... here html: <div id="right" class="active"> <div class="plan"> <span id="pl-title" contenteditable="true">plan 1</span> <ul id="pl" class="sort"> <li class="note yellow"> <span id="note-title">first clip</span> <span id="note-time">4:00</span> </li> <li class="note pink"> <span id="note-title">second clip</span> <span id="note-time">0:45</span> </li> </ul> ...

datetime - Substract 15 Minutes from time using Perl -

datetime - Substract 15 Minutes from time using Perl - i thought going simple out of options now. want substract 15 minutes given time. example time 15:04 want substract 15 minutes 14:49. have searched solutions on net there no perl module can help me out. you can utilize datetime : my $dt = datetime->new( year => 1, month => 1, day => 1, hr => 15, min => 4, ); $dt->subtract(minutes => 15); printf "%d:%d\n", $dt->hour, $dt->minute; # prints 14:49 perl datetime

Single App or Separate Apps for Development/Production in Rails -

Single App or Separate Apps for Development/Production in Rails - i'm using bluehost , i'm relatively new rails (and ruby). here's current setup: one app on local hd two apps on cpanel /rails_apps/myappdev on "dev.myapp.com" /rails_apps/myapppro on "myapp.com" do have maintain ftping same local file(s) both dev , production apps or there rails environments i'm not understanding? if utilize passenger, can have 1 application available in 2 different environments (here discussion might find useful). not claiming way - 1 aware of. other that, check configuration file ( config/environment.rb , if not mistaken) (see this question) - although afraid require restart app server every time create alter , create app available in 1 environment @ time. aside that, think thought test app in development mode before switching production. i have no thought bluehost (i self-hosting), think should help little before knows service ...

c++ - return reference to local variable -

c++ - return reference to local variable - possible duplicate: can local variable's memory accessed outside scope?! here code: #include <iostream> using namespace std; double &getsomedata() { double h = 46.50; double &href = h; homecoming href; } int main() { double nonref = getsomedata(); double &ref = getsomedata(); cout << "nonref: " << nonref << endl; cout << "ref: " << ref << endl; homecoming 0; } the nonref printed ok 46.5 ref not ok. is first output behavior right or got lucky? thanks yes got lucky. returning reference local variable undefined behavior. undefined behavior means can happen , behavior cannot defined. regarding undefined behavior, c++ standard section 1.3.24 states: permissible undefined behavior ranges ignoring situation unpredictable results, behaving during translation or programme execution in documented manner characteristic of en...

android - Getting the altitude -

android - Getting the altitude - in class derived mapactivity class, want height of point clicked user. far, know how retrieve latitude, longitude not altitude. is possible , how? thanks in advance time spend trying help me. find web service can study height given latitude , longitude. there nil built android this. android android-mapview mapactivity

Django-nonrel on Google App Engine, getting error i'm using Django 0.96 -

Django-nonrel on Google App Engine, getting error i'm using Django 0.96 - i'm using django appengine http://www.allbuttonspressed.com/projects/djangoappengine can utilize django 1.3 , seems work fine. however, when opening pages pydev console (os 10.6, aptana studio 2.0, python 2.5) puts out message: warning:root:you using default django version (0.96). default django version alter in app engine release in near future. please phone call use_library() explicitly select django version. more info see http://code.google.com/appengine/docs/python/tools/libraries.html#django the link error provides seems talk using: from google.appengine.dist import use_library use_library('django', '1.1') if using gae's django understand i'd need this. however, i'm using django-nonrel, why warn me i'm using 0.96 when should using 1.3? could please check project's pythonpath setting (right-click project, click on prefer...

mysqli - Can you define class variables from within a class method in PHP? -

mysqli - Can you define class variables from within a class method in PHP? - i want pull info file files table, table's construction might change. so, i'd pull field names table , utilize them generate class variables contain information, store selected info them. is possible? sample <?php class testclass { public $property1; public function method1() { $this->property1 = '1'; $this->property2 = '2'; } } $t = new testclass(); $t->method1(); print( '<pre>' ); print_r( $t ); print( '</pre>' ); ?> output testclass object ( [property1] => 1 [property2] => 2 ) as can see, property wasn't defined created assigning using reference $this . yes, can define class variable within class method. php mysqli

How record insert time in mysql database -

How record insert time in mysql database - i want remove table row table new_data 1 time row 45 mins old , input in table called old_data. the way can think work, query database lets every min , remove row thats (current_time - time inserted) > 45 mins. is there other way of doing this? if not how set table record inserted_time? edit added how write statement retrieve right info old_data table select * new_spots (now()-created_at)>45mins and insert above old_data table you can specify value of time column upon insertion: insert x (created_at) values (now()); additionally can setup view show recent entries. mysql database timestamp

c# - Assembly problem when using a .ashx file in my layouts folder -

c# - Assembly problem when using a .ashx file in my layouts folder - i have *.ashx file in "layouts" folder sharepoint , doesnt seem can access of custom made classes outside of layouts folder. there problem assembly? maintain getting error: the type or namespace name 'propertieshelper' not exist in namespace 'company.sharepoint.test' (are missing assembly reference?) i have tried set using statement import class seems isnt able find it. tried writing out total path of function like: company.sharepoint.test.propertieshelper.somemethod usually when happens me, it's because forgot deploy assembly gac (or locally depending on how you're doing it). either way, can't find assembly because it's not in right location or not trusted. c# asp.net sharepoint

android - How to make shape's child TextView white when state_pressed="true" -

android - How to make shape's child TextView white when state_pressed="true" - this shape backround of linearlayout, how can create textviews within linearlayout alter text color white during statepressed =true of parent selector? see previous question see more of code: shape not show <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#ffffff" /> <stroke android:width="1dp" android:color="#aa000000" /> <corners android:topleftradius="10dp" android:toprightradius="10dp" /> <gradient android:startcolor="#6633cc" android:endcolor="#00ccff" android:angle="270" /> </shape> pressed state propagated kid ...

c# - How to get receiver email from a sent email in EWS? -

c# - How to get receiver email from a sent email in EWS? - i'm looping sent item in ews, , seek show details of each sent emails, receiver, subject, body etc. however, found receiver in sent email message null. how receiver email address? code: itemid id = (itemid)request["id"]; // id item id of wellknownfoldername.**sentitems** emailmessage current = emailmessage.bind(service, id); la_subject.text = current.subject; la_from.text = current.sender.tostring(); la_sent.text = current.datetimereceived.tostring(); la_to.text = current.receivedby.tostring(); // line error occurs any idea? to recipients of mail, utilize displayto , displaycc properties of mail service message. or iterate through torecipients collection , build string yourself: var torecipients = string.join(", ", mail.torecipients.select( address => string.format("\"{0}\" <{1}", address.name, address...

CakePHP: Run shell job from controller -

CakePHP: Run shell job from controller - is possible utilize dispatchshell controller? my mission start shell job when user has signed up. i'm using cakephp 2.0 if can't mitigate need dogmatic suggests then, read on. so have (potentially) long-running job want perform , don't want user wait. as php code user executing happens during request has been started apache, code executed stall request until completion (unless nail apache's request timeout). if above isn't acceptable application need trigger php outwith apache request (ie. command line). usability-wise, @ point create sense notify user processing info in background. message telling them can check later spinning progress bar polls application on ajax observe job completion. the simplest approach have cronjob executes php script (ie. cakephp shell) on interval (at minimum, 1 time per minute). here can perform such tasks in background. some issues arise background jobs however...

c - stat() does not work for .so files -

c - stat() does not work for .so files - i facing issue stat() . stat() not seem working .so files. gives error no such file or directory . why happening? as requested paste portion of code: int main() { char str[300]; struct stat str_buf; strcpy(str,"path/to/my/library/libfuncs.so"); if(stat(str,$str_buf)==-1) perror("stat"); .... } thus error comes stat no such file or directory but same code works fine other files , directories. libfuncs.so generated shared library. many ".so" files in fact symbolic links due versioning issues. might want utilize lstat() in cases, stat actual link. the error you're getting ("no such file or directory") seems imply symbolic link pointing @ doesn't exist. in these cases stat:ing link helps, of course of study might not want do. check link's target. if path in link relative, perhaps you're executing code different directory? c ...

php - CakePHP Send query with link -

php - CakePHP Send query with link - i have created link on app allow users create appointments, need pass info across app knows client book appointment to. how this? e.g. <li><?php echo $this->html->link('book appointment', array('admin' => true, 'controller' => 'appointments', 'action' => 'add')); ?></li> so url like: /admin/appointments/add?clientid=2 note: if thinks bad way please comment alternate solutions etc. thanks i found in documentation: http://book.cakephp.org/view/1442/link you can following: <li><?php echo $this->html->link('book appointment', array( 'admin' => true, 'controller' => 'appointments', 'action' => 'add', '?' => array('clientid' => $clientid)) ); ?></li> the code untested since don't have cakephp installed , there long time since u...

mvvm - WPF DataGrid binding -

mvvm - WPF DataGrid binding - i came across issue when ilist bound datagrid. the class construction is, public class client { public virtual int customerid { get; set; } public virtual string name { get; set; } public virtual string addressline1 { get; set; } public virtual string addressline2 { get; set; } public virtual string addressline3 { get; set; } public virtual bool isactive { get; set; } public virtual salesline salesline { get; set; } public virtual int precedence { get; set; } } public class salesline { public virtual int saleslineid { get; set; } public virtual string name { get; set; } public virtual salesperson salesperson { get; set; } public virtual ilist<customer> customers { get; set; } } i create new ilist of client class. ilist<customer> customerlist = new ilist<customer>(); then "customerlist" populated. since client has salesline "saleslines" ilist popula...

css - Is it possible to put a list inside a span tag? -

css - Is it possible to put a list inside a span tag? - i'm aware <span> tag inline element while <li> block element. however, have tooltip uses <span> tag , we'd create text within tooltip list. however, putting <ul><li> within span doesn't work in browsers (and it's invalid). this html code: <a class='tooltip'>text<span>text want become list</span></a> is there possible work around? try this. chances if want set block element within inline element, want them both block elements: <a class='tooltip' style="display: block;">text <div> <ul> <li>item 1</li> <li>item 2</li> </ul> </div> </a> or tooltips: a.tooltip{ display: block; } css list tooltip

c# - Where has BigInt gone? -

c# - Where has BigInt gone? - this question has reply here: where system.numerics namespace? 1 reply i have started on project euler problems. on problem 13 requires provide first 10 digits of sum of 100, 50 digit numbers. i decided seek solve big int class in c#. looked around on net , there tons of illustration code them. however, can't seem find bigint in visual studio 2010. in .net framework 4.0 it's found in system.numerics.dll. add together reference assembly gain access system.numerics.biginteger. c# biginteger

django - TextMate Python bundle non-blocking -

django - TextMate Python bundle non-blocking - i created bundle in textmate restarting current django project's associated supervisor process. running code in python interpreter restarts process without blocking, when utilize textmate bundle (set run every time save .py file) blocks gui ~3 seconds. there way can avoid this? here's code looks like: class="lang-py prettyprint-override"> #!/usr/bin/env python import os import subprocess import threading projname = os.environ.get('tm_project_directory', '').rpartition('/')[2] def restart_proj(projname=none): """ restart supervisor instance. assumes name of supervisor instance basename tm_project_directory. """ if projname: subprocess.popen('$home/.virtualenvs/supervisor/bin/' \ 'supervisorctl restart {0}'.format(projname), shell=true, stdout=open('/dev/nu...

iphone - How to round of CGFloat value -

iphone - How to round of CGFloat value - possible duplicate: nsnumberformatter rounding float values currently, calculate scaling factor using : cgfloat scale = cgcontextgetctm(context).a; nslog(@"scale : %f", scale); i receive floating point value : 0.124979, 0.249958, 0.499917. how can utilize roundf convert 0.125, 0.250, 0.500 respectively. try this........ nslog(@"scale : %.3f", scale); nsstring *value = [nsstring stringwithformat:@"%.3f", thefloat]; stolen previous answer iphone objective-c rounding cgcontext cgfloat

xcode - Is there a way to save a "." file using NSSavePanel without MacOS warning me? -

xcode - Is there a way to save a "." file using NSSavePanel without MacOS warning me? - i'm working on cocoa project. project uses preferences menu, , includes alternative save set of preferences "." file (hidden files .rvmrc or .vimrc). problem after bringing nssavepanel , clicking save scheme pops , reminds me "." reserved system, isn't cool. is there way prevent os firing prompt? thanks! you can subclass or create category of nssavepanel , override -[nssavepanel _legalnamecheck:] afaik, checking dot name routine does. xcode cocoa

c# - Convert from to string in database to boolean property Entity Framework 4.1 -

c# - Convert from to string in database to boolean property Entity Framework 4.1 - i working on legacy oracle database uses character literals t , f in database boolean values entity property reflect proper boolen value there wy convert value when model binding read database inserts not of import i suggest wrapping or extending generating type add together sort of functionality ... entity framework generate objects match info in database tables looks if have table called "contacts" you'll object called "contacts", think (although wrong) classes defined partial generates ... public partial class contact { string boolreally { get; set; }; } you add together new property ... public partial class contact { bool mybool { homecoming (legacyvalue == "t") ? true : false; } } now when declare contact instance fish value "mybool" instead. ... that's extending, wrapping ... public class m...

math - Is there a trunc function in C++? -

math - Is there a trunc function in C++? - i searched around , couldn't find trunc function c++. know can this: int main() { double = 12.566789; cout << setprecision(2) << fixed << (int)(a * 100) / 100.0 << endl; homecoming 0; } but i'm not sure it's best way this. give thanks you. trunc there, in <cmath> : #include <iostream> #include <cmath> int main() { std::cout << trunc(3.141516) << std::endl; } i suppose you're looking else? c++ math

css - Pixel size for different browsers -

css - Pixel size for different browsers - is pixel size different different browsers? for illustration <input type='button' class='button2' value='...' /> /*****css*****/ .button2{ width:120px; } overflows button value in chrome doesn't in safari , firefox. doing wrong? pixels should same. if investigate, may find different browsers have different default values things margins, padding, text size, font face, etc. that's what's tripping (though note popping code own browsers not produce overflow.) css browser pixel

model view controller - MVC in qt and problem with interfaces -

model view controller - MVC in qt and problem with interfaces - i want create view , pass controller via constructor. so, i've created interface: #include <qstring> class imainview { public: virtual ~imainview() {} virtual void setwindowtitle1(qstring &title) = 0; }; q_declare_interface(imainview, "imainview/1.0"); then created view: class mainwindow : public qmainwindow, imainview { q_object q_interfaces(imainview) public: explicit mainwindow(qwidget *parent = 0); ~mainwindow(); void setwindowtitle1(qstring &title); private: ui::mainwindow *ui; }; mainwindow imainview. have pass instance of imainview controller, because each controller register view: #include "maincontroller.h" maincontroller::maincontroller(imainview *v) { qstring title = "my application"; v->setwindowtitle1(title); } maincontroller::maincontroller() { } and got error: e:\pm\pm\mainapplication\im...

winapi - Enable/Disable multiple monitors via Win32 API or NVidia API? -

winapi - Enable/Disable multiple monitors via Win32 API or NVidia API? - i'm trying write little utility enable/disable monitors under windows 7 nvidia graphics card. (ie. "extend desktop onto monitor", etc) the reason nvidia geforce gtx 480 has 3 outputs (2x dvi, 1x mini-hdmi) allows 2 active @ given time need enable/disable monitors when want switch tv (hdmi) display. the win32 api function enumdisplaydevices isn't working because doesn't show disabled monitors. nvidia provides api (nvapi) , has functions enumerate monitors (even disabled ones) , can enable monitor can't disable monitor. (i'm referring nvapi_createdisplayfromunattacheddisplay) ultramon seems have figured out how perform can't find information. i think if 2 out of 3 displays connected, 3rd 1 not detected. card stop listening new hardware. have manually take out cable , , insert new 1 in different port. unless there way "eject" connection, similar usb s...

jquery UI elements appear big -

jquery UI elements appear big - i using jquery ui within application , elements of jquery ui when used within page appearing quiet big. appear bigger rest of page. normal elements set within jquery ui element growing in size. for illustration have couple of textboxes , text labels within accordion become bigger original size insdide ui element. i not sure causing this. try setting font-size of body element of page container of widget smaller value in pixels. usually jquery ui plugins , stuff have relative sizes (in em ), become relative font-size inherited parent nodes. you add together css: .ui-widget{ font-size: 10px; } thanks @haochi improve idea, i've missed originally. jquery jquery-ui

Splitting up a large mySql table into smaller ones - is it worth it? -

Splitting up a large mySql table into smaller ones - is it worth it? - i have 28 1000000 records import mysql database. record contains personal info members in , searchable states. my question is, more efficient break table smaller tables opposed keeping in 1 big table? had in mind split them 50 seperate tables representing 50 states this: members_ca, members_az, members_tx, etc; this way query this: 'select * members_' . $_post['state'] . ' members_name "john doe" '; this way have deal info given state @ once. intuitively makes lot of sense curious hear other opinions. thanks in advance. i posted comment i'll post reply now. never, ever think of creating x tables based on difference in attribute. that's not how things done. if table have 28 1000000 rows, think of partitioning split smaller logical sets. you can read partitioning @ mysql documentation. the other thing choosing right db design , choosing inde...

Replace random instance of substring inside a string (ruby) -

Replace random instance of substring inside a string (ruby) - i want instances of given substring within string, , replace randomly: not in every instance of it, esporadically. thinking of using .each method each instance of substring, , within code block using rand replace or not depending on result. bit stuck how implement .each method in situation. can help? (i using ruby 1.9) you can utilize block-variant of string#gsub : s = 'foo bar foo bar foo bar foo bar' # , want alter random instances of "foo" "baz": s.gsub(/foo/){|m| rand(2) == 0 ? 'baz' : m} #=> "baz bar foo bar baz bar foo bar" ruby

Saving png stream to bitmap in asp.net -

Saving png stream to bitmap in asp.net - i have memory stream in png format , want save bitmap object can extract pixels. using .net 2.0 , cannot utilize higher version due restrictions. can please help me out ??? have looked @ system.drawing.bitmap object? it has constructor of public bitmap(stream stream) you can bitmap before calling save asp.net bitmap

Get id of last created album in Picasa (gdata) PHP -

Get id of last created album in Picasa (gdata) PHP - im trying insert photo on newly created album. couldnt find way on how lastly generated album id. $entry = new zend_gdata_photos_albumentry(); $entry->settitle($gp->newtitle("test album")); $entry->setsummary($gp->newsummary("this album.")); $createdentry = $gp->insertalbumentry($entry); from illustration on gdata: $username = "default"; $filename = "c:/xampp/htdocs/test.jpg"; $photoname = "my test photo"; $albumid = "5626728515640093041"; : : // utilize albumquery class generate url album $albumquery = $gp->newalbumquery(); $albumquery->setuser($username); $albumquery->setalbumid($albumid); $insertedentry = $gp->insertphotoentry($photoentry, $albumquery->getqueryurl()); how can know lastly inserted album without typing manually? thanks much! have on http://code.google.com/intl/zh-tw/apis/picasaweb/docs/2.0/dev...

asp.net mvc 3 - Common LINQ method using EF -

asp.net mvc 3 - Common LINQ method using EF - so stupid question, still not sure how entity frameworks objects work. using ef4 in mvc3 app, , have 2 controllers need utilize same linq query against it. best utilize static method takes db entity ref, or should method utilize "using" block own entity (as seen in this question)? i think using block add together additional overhead, didn't find examples of other method. there proper way create "library" methods ef access? in mvc application objectcontext should scoped request. di containers can automatically. prefer not using using block within method. instead inject context via constructor or pass method argument. asp.net-mvc-3 entity-framework-4 linq-to-entities

ruby on rails 3 - cancan Abilty, Devise and Rspec testing -

ruby on rails 3 - cancan Abilty, Devise and Rspec testing - people, i'm new @ ror enviroment, , i'm trying apparently simple, getting complicated. i not have roles in application, , want add together features logged in users, starting rspec tests, cannot find way test if user signed in... i'm using cancan devise. i tried code below, didn't work, says there no method called sign_in, i've tried current_user, , user_signed_in? before(:each) @user = user.new sign_in @user end what missing? gemfile: source 'http://rubygems.org' gem 'rails', '~> 3.0.7' # authentication gem 'devise', '~> 1.3.4' #authorization gem "cancan" # mongodb database gem 'mongoid', '~> 2.0' gem 'bson_ext', '~> 1.3' gem "high_voltage" gem 'translate_routes' gem 'factory_girl_rails', "~> 1.1.rc1" grouping :development, :test gem ...

IP address in TCP sockets -

IP address in TCP sockets - i have root node(server) connected many other nodes(clients) through tcp sockets. want send info server client, info different each node , depends on ip address of node. thus should have ip address of each node connected server. how can have information? as long have access list of file descriptors connected tcp sockets, easy retrieve addresses of remote hosts. key getpeername() scheme call, allows find out address of remote end of socket. sample c code: class="lang-c prettyprint-override"> // ugly, simpler alternative union { struct sockaddr sa; struct sockaddr_in sa4; struct sockaddr_storage sas; } address; socklen_t size = sizeof(address); // assume file descriptor in var 'fd': if (getpeername(fd, &address.sa, &size) < 0) { // deal error here... } if (address.sa.family == af_inet) { // ip address in address.sa4.sin_addr, port in address.sa4.sin_port } else { // other kind of...

javascript string.replace question -

javascript string.replace question - i know can this: var str = "microsoft has largest capital reserves of tech company. microsoft located in california."; str = str.replace(/microsoft/gi, "apple"); and you'd following: apple has largest capital reserves of tech company. apple located in california. how can utilize global case insensitive alter string 07/08/2011 07082011? i tried variations of str.replace(///gi, "") no luck. try this: var input = "07/08/2011"; var output = input.replace(/\//g,""); //output 07082011 javascript replace global

html - bottom border of dropdown menu not showing in IE -

html - bottom border of dropdown menu not showing in IE - i have site i'm working on , navigation menu dropdown one, , issue ie specific. have set right, left, , bottom bluish borders dropdown menu, works in browsers not ie (not surprisingly). think improve check demo of problem , live code , figure out hack. "i using ie9 way." thanks. html css

javascript - Best way to get spidermonkey js on Ubuntu? -

javascript - Best way to get spidermonkey js on Ubuntu? - i need install spidermonkey js engine on work machine. project i'm working on has jslint script requires spidermonkey or similar js binary. i've tried compiling spidermonkey source , gotten stuck in dependency hell. tried installing rhino bundle ubuntu repositories, , turned out slow , broken. morning, compiled google's v8 engine , built v8jslint next instructions here: http://blog.stevenreid.co.uk/2011/06/27/jslint-command-line-tool-powered-by-v8/ v8jslint works, lint 1 file @ time. instance, $ v8jslint foo/*.js if have a.js, b.js , c.js under foo, v8jslint lint a.js. easy fix: write bash script this. bigger problem v8jslint not compatible spidermonkey jslint on our build server. has had success building spidermonkey on recent version of ubuntu, or know workaround? fixed it. need 'autoconf2.13' package. install apt-get. go spidermonkey source code page on mozilla. find hg repository (...

.net - Settings for multiple instances in VB -

.net - Settings for multiple instances in VB - which best way store application , user settings of application running multiple instances? my problem using vb's "application settings" 1 instance overwrite other one. i want identify each instance number passed via command line argument. utilize number identify appropriate settings of running instance, see in local ini o xml file improve way handle that. is there alternative, maybe native in .net? thank you. the best thought scenario utilize database. concurrent access databases designed for. simpler develop , maintain custom cross-process info storage solutions. maybe sql server (since well-integrated vs), or sql server express. you seek db bit more embedded, , simpler install/distribute, sqlite. here couple quick tutorials on how started sqlite: http://web.archive.org/web/20100208133236/http://www.mikeduncan.com/sqlite-on-dotnet-in-3-mins/ (mostly goes on installation, , classes you...

delphi - Using "for in" sentence and compiler error E2064 -

delphi - Using "for in" sentence and compiler error E2064 - i want utilize for in sentence in test case under d2010. if want write in param.value variable compiler reports error 2064, allows write in param.edit.text same record, why? test case: type // tparamset = (param_a, param_b, param_c, param_d, param_e, param_f); tparam = record edit :tedit; value :integer; end; var dtcp :array [tparamset] of tparam; procedure resetparams; var param :tparam; :integer; begin param in dtcp begin param.edit.text:= 'test'; //no problem := param.value; //no problem param.value := 0; //error: e2064 left side cannot assigned to; end; end; records value types. for in loop returning re-create of each record in array , compiler error telling modifying futile. you'll need utilize old fashioned loop: f...

user interface - Circular rotary/dial UIView for iOS? -

user interface - Circular rotary/dial UIView for iOS? - i have need create circular dial/rotary style component utilize in ios application. it's circular menu allows users select items ringed around it, , can click button in center activate selected item. however, i've never created custom uiview of type, , don't know begin. can give me pointers how draw view , rotate user drags finger? know how intercept touch events, etc. i'm not sure how go manipulating ui appropriately. tips or pointers great! or, if know of similar component open-sourced great, too! i needed similar thought app company working on, however, project turned different direction , decided open-source our code. here's code illustration usage of library: @implementation wsqviewcontroller - (void)viewdidload { [super viewdidload]; uicolor *backgroundcolor = [uicolor colorwithhue:1.0 saturation:0.33 brightness:0.75 alpha:1]; uicolor *selectedcolor = [uicolor color...

how to get rss feed in an android app page from a live website? -

how to get rss feed in an android app page from a live website? - i have asp.net website , want develop simple android application 1 page in want live info rss feed of website. the link of website rss feed like: http://www.mydomain.com/latestnewsrss.aspx?languageid=7 in android application want display news coming rss feed of website in list. i next tutorial not running (i don't know why): http://nscraps.com/java/523-rss-feed-reader-example-java.htm when seek run code on phone, error saying "force app stop/close" ------------log cat------------- 07-18 19:24:27.657: error/zygote(33): setreuid() failed. errno: 2 07-18 19:24:27.657: error/zygote(33): setreuid() failed. errno: 17 07-18 19:24:27.657: error/batteryservice(55): usbonlinepath not found 07-18 19:24:27.657: error/batteryservice(55): batteryvoltagepath not found 07-18 19:24:27.657: error/batteryservice(55): batterytemperaturepath not found 07-18 19:24:27.657: error/surfaceflinger(55): couldn...

javascript - Why will Webkit not repaint my webpage properly? -

javascript - Why will Webkit not repaint my webpage properly? - i have somewaht of unusual problem. not sure if screwing or if maybe bug in webkit. what doing using more or less complex css tricks (:after , content, sibling selector, etc) , custom data-attributes indicate if input fields of form valid or not. have info attribute "data-valid" on each input field attribute "data-validate", contains regular expression. on keyup run regular look against value of input , set data-valid accordingly. have little div next input, styled using data-valid sensitive attribute selector. background show ok symbol if sibling's input data-valid attribute true , show fail symbol if set false. because might hard understand, stitched jsfiddle, can @ yourself. all works fine in firefox 6 , ie9. however, in both webkit based browsers (chrome + safari) not work 100% correctly. allthough data-valid attribute changes correctly, styled div not alter it's appearanc...

Write notepad++ plugins in a different language -

Write notepad++ plugins in a different language - is possible write plugin notepad++ using language other c++ ? example, ruby or haskell. there's c# template here nppplugin.net with pythonscript plugin, , help python script plugin wrapper, can write plugins in python. believe due startup issue, wrapper dll must named such alphabetically comes after pythonscript.dll, otherwise works. you can write plugin in language can export c style functions in dll, e.g. delphi. plugins notepad++

xml - JSON iphone help desperately needed -

xml - JSON iphone help desperately needed - hi desperate newbie in need of direction! newbie, have built myself app set out achieve, tableview display story titles website, when touched using navigation controller slides story/article. only problem have test info embedded views array (which no me). need info come website, www.theknowledgeoflondon.com. want take title display in tableview , when touch slide actual article. been reading , believe json reply or xml? not have clue on subject , if thought learning object c , coco touch hard json or xml thing seems new world of pain me!!! , there doesn’t seem way of tutorials out there has not clue on subject. info drawn simple mysql table php script , hoping there easy way feed table view? would greatful info on way forward. have downloaded sbjson, read jsontouch alternative use. or should using straight xml. help , tutorials much appriciated. thanks in advance. steve i made app lastly week uses xml , ...

spring - Cannot load data from database to chart using extjs -

spring - Cannot load data from database to chart using extjs - i'm using spring , hibernate display extjs chart database. but, when i'm pointing out url controller, not caling . check reference in dispatcher servlet <bean id="urlmapping" class="org.springframework.web.servlet.handler.simpleurlhandlermapping"> <property name="mappings"> <props> <prop key="index.htm">indexcontroller</prop> <prop key="loadchart.htm">empcntrl</prop> </props> </property> </bean> <bean name="empcntrl" class="com.hclt.controllerr.contrler" /> script code follows: function loadchart(){ ext.chart.chart.chart_url = 'images/charts.swf'; var store = new ext.data.jsonstore({ fields: ['depname', 'count'], url: 'loadchart.htm...

bits - Large number arithmetic -

bits - Large number arithmetic - i have read somewhere handle big number arithmetic (really large) should store number in big base of operations @ max squareroot(maxnumber). because representing number in larger base of operations needs little number of digits e.g. 120 in decimal = 1111000 in binary system. if @ store big numbers in big bases, reduces number of bits @ lowest level? don't think because number in hexadecimal number scheme certainly takes little number of digits on paper not on hardware. i think missing here. help me understand how can store big base of operations number @ bit level in less number of bits? depends on encoding want utilize .. can binary coded decimals in can code each individual binary digit 4 binary bits ,, or can utilize extended binary representations numbers e.g 128 bit numbers etc.. should able find libraries allow both of above solutions online. p.s bcd take smaller space little numbers huge amount of bits big number...

internet explorer - Javascript modification on page not being reflected in IE -

internet explorer - Javascript modification on page not being reflected in IE - i used javascript modify style on page , alert modified style. in ie v7, though alerted message shows alter has been made, visual rendering of page shows no difference. same code works fine in ff. reason be? thing noted when used developer toolbar's script console able expected results not when set js in script tag. sample code - function change() { var text=document.getelementsbytagname("h2"); var i=0; var p=text[0]; while(p) { alert(p.style.csstext); p.style.csstext="color:#565656;"; p.innerhtml="changed"; alert(p.parentnode.innerhtml); i++; p=text[i]; } } this set in script tag , set within body test. alter made innerhtml or style not reflected in ie browser window though later javascript alert shows change. instead of changing style way, straight set "colo...

.net - Set Z-Index of Window comparatively to other windows -

.net - Set Z-Index of Window comparatively to other windows - how can i, in vb.net, set window's z-index comparatively other windows? my programme runs in background of other programs, , when specific event happens, custom class pops up. however, sometimes, window in background of other apps. how can create such window comes front? realize there questions mine, cannot find in visual basic. i appreciate code in vb.net, not c#. thanks, odinulf set topmost property true . .net vb.net vb.net-2010

regex - Ruby Format Validations [ No Whitespace ] -

regex - Ruby Format Validations [ No Whitespace ] - i'm trying create format validation text field reject whitespace. can help me out regex syntax? i've tried: no_whitespace = /\a[\s]\z/i validates :customurl, :format => { :with => no_whitespace } i'm new programming , clueless regex. help appreciated. thanks! try this: no_whitespace = /^[\s]+$/ that should specify no whitespace characters origin (^) the end ($) of string, , @ to the lowest degree 1 character. ruby-on-rails regex validation models

Android ServiceTestCase for IntentService -

Android ServiceTestCase for IntentService - i'm writing unit tests android application , stumbled next issue: i utilize servicetestcase test intentservice this: @override public void setup() throws exception { super.setup(); } public void testservice() { intent intent = new intent(getsystemcontext(), myintentservice.class); super.startservice(intent); assertnotnull(getservice()); } however noticed intentservice created (means oncreate called) never receive phone call onhandleintent(intent intent) has tested intentservice servicetestcase class? thanks! i got started testing own intentservice , it's proving bit of headache. still trying work things out scenario seems not receive phone call method onhandleintent() , (i'm not technicalities behind junit forgive utilize of terminology) should because test framework, based on code, tears downwards or end test method 1 time phone call startservice retu...

objective c - MpMoviePlayerController streaming video problem in simulator -

objective c - MpMoviePlayerController streaming video problem in simulator - i working on mpmovieplayercontroller, playing video in url @"http://www... xyz... not playing in simulator. i nsstring *url = @"hhttp://www... xyz... "; mpmovieplayercontroller *movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:[nsurl urlwithstring:url]]; nsstring *urlstr = [[nsbundle mainbundle] pathforresource:@"video.mp4" oftype:nil]; nsurl *url = [nsurl fileurlwithpath:urlstr]; movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:url]; [self.view addsubview:movieplayer.view]; movieplayer.view.frame = cgrectmake(50, 50, 200, 200); [movieplayer play]; objective-c ipad

javascript - Exception when using canvas (0x80040111 NS_ERROR_NOT_AVAILABLE) -

javascript - Exception when using canvas (0x80040111 NS_ERROR_NOT_AVAILABLE) - i'm having problem writing javascript paint tool. it's unit test , in future used component larger project i'm working on. runs in canvas when seek run it, error message: error: uncaught exception: [exception... "component returned failure code: 0x80040111 (ns_error_not_available) [nsidomcanvasrenderingcontext2d.drawimage]" nsresult: "0x80040111 (ns_error_not_available)" location: "js frame :: http://rasmvillage/canvasapp/js/lib.js :: <top_level> :: line 52" data: no] i'm using jquery library the html nil special. div#container canvas#imageid , canvas#boardid within of it. can help me figure out what's wrong? thanks. as indicated on canvas drawimage doesn't draw images first time, create sure don't operate on images until images onload has fired. more advice on image onload static images, including jquery plugin may...

objective c - iPhone : Unable to create Object of File -

objective c - iPhone : Unable to create Object of File - i trying phone call method of 1 file file. for this, creating files object , importing .h file. while importing file able see .h file other files can see files(.h,.m,.xib). #import "firstview.h" firstview *first = [firstview alloc] init]; but not allowing me create object of file , not showing error or warning. what should ? you missing bracket in code: #import "firstview.h" firstview *first = [[firstview alloc] init]; iphone objective-c cocoa-touch ios4

c - What happens if ntohl() is called with an integer that is already in host byte order? -

c - What happens if ntohl() is called with an integer that is already in host byte order? - if utilize ntohl() on integer in host byte order cause problems? if not, how ntohl() function know argument in host byte order? your question doesn't create sense. ntohl nil high-order or low-order. if endianness of scheme same network order, nothing otherwise swap stuff around c byte-order

ruby on rails - Creating (Dropping) Multiple Tables in One Migration -

ruby on rails - Creating (Dropping) Multiple Tables in One Migration - is possible create (self.up) multiple tables in 1 rails 3 migration. if possible, conventional wisdom on using such approach. tells me improve form maintain 1 table per migration, i'd thought check more seasoned ruby on railers. thanks. the overall thought of migrations have database schema in version control. think more of import have 1 migration per "feature". example, if have application pleople(name, prename) , want add together phone number, add together alter migration. if, phone number want implement remote lookup, might need caching table. still add together same migration. there 1 advantage of splitting table creations: can manually rewind migrations per table. ruby-on-rails rails-migrations

Rails Select in Form returns Index. I want to send the Text -

Rails Select in Form returns Index. I want to send the Text - <%= f.select :owner, options_for_select(names) %> here names array of names e.g. "harry", "barry", "joe". form element sets value of :owner index of selected alternative i.e. 0,1,2. want send value instead i.e. "harry", "barry", "joe". is there alternative select so? if not, how can accomplish this? map name in two element array of [text,value] pairs thus: <%= f.select :owner, options_for_select(names.map {|name| [name,name]}) %> ruby-on-rails forms select text indexing

asp.net - Weird Asynchronous Javascript & WebMethod Behavior -

asp.net - Weird Asynchronous Javascript & WebMethod Behavior - i'm calling pagemethod in javascript. this: function deletebatchjs2() {$find('mdlpassword').hide(); var pswd = $('#txtpassword').val(); var userinfo = get_cookie("userinfo"); pagemethods.authenticateanddelete( userinfo, pswd, onsuccess(), onerror1()); } function onsuccess(result) {alert(result);} function onerror1(result) {alert(result);} now here's unusual part: 1 think calling pagemethods give 1 (1) alert when running. either onsuccess function or onerror1 function. -- 2 alerts, both saying "undefined". as matter of fact, when set breakpoint in vb code-behind (like 3rd or 4th line of code in function), both alert boxes before can step code behind. 2 alerts, , code breaks. this makes no sense me. missing anything? thanks, jason. p.s. -- here's source webmethod function. please note ...

ajax - Access to restricted URI denied" code: "1012 -

ajax - Access to restricted URI denied" code: "1012 - on domain (localhost:8080) run code access unauthenticating rest serivce on domain b (localhost): req = new xmlhttprequest(); req.open('get', 'http://localhost/rest/service'); req.send(); this works fine , response across domains have apache on domain b set response header: header set access-control-allow-origin "http://localhost:8080" however if turn on authentication rest service , seek run same request: req.open('get', 'http://admin:admin@localhost/rest/service'); it produces error in firebug: access restricted uri denied" code: "1012 i'm confused able sucessfully create cross domain ajax calls authenticated service bypassing same origin policy, yet when authentication required on service firefox decides not allow ajax call? how can prepare without using jsonp etc, production server won't able provide php or servlet hosting. ...

html - Is it possible for a nested element's background to stretch to an absolute position inside that's in a fixed width/centered parent? [Image inside] -

html - Is it possible for a nested element's background to stretch to an absolute position inside that's in a fixed width/centered parent? [Image inside] - the header text live within wrapper[white] centered. header has background[green] positioned way left 0px position, need fluid when resizing. header text left aligned how wrapper text positioned. is possible? the negative margin work this! http://jsfiddle.net/6dbq8/1/ html css

cocoa touch - Updating UITableViewCell not refreshing the UI -

cocoa touch - Updating UITableViewCell not refreshing the UI - i have uitableview , on first time cellforrowatindexpath called, save uitableviewcell values return. can update contents when ever underlying info changes. however, when update contents of uitableviewcell, uitableview not show new entries until scroll , downwards on ui. how programatically forcefulness refresh? the uitableview has method „reloaddata.“ phone call it: [tbl reloaddata] cocoa-touch ios4 uitableview

MYSQL Query statment to replace PHP loops -

MYSQL Query statment to replace PHP loops - suppose have next tables : projects( project_id , project_name ) documents( document_id,document_name , project_id) which kind of top-down hierarchically , utilize select statement , loops generate nested array ex.: $result_array = array(); $projects = mysql_query(' select * projets') ; $i = 0 ; while( $row_proj = mysql_fetch_assoc($projects) ) { $result_array[$i] = $row_proj ; $documents = mysql_query('select * documents project_id='.$row['project_id']); $doc_res = array(); while( $row_doc = mysql_fetch_assoc($documents) { $doc_res[] = $row_doc; } $result_array[$i]['documents'] = $row_doc ; $i++; } .. , on the result nesteed array in view can print : foreach( $projects $project ) { echo $project['project_name']; foreach( $project['documents'] $document ) { echo .. } } how can generate using simple flat loop using sql st...

c# - Can we eliminate negative value in crystal report -

c# - Can we eliminate negative value in crystal report - i wrote programme in c#. in info there negative values. there problem showing negative value on graph. graph not updating according value. please help me regarding this. you can: fix data modify query, or utilize crystal function utilize abs() modify query negative values not included in result set. post in appropriate location. c# crystal-reports