Posts

Showing posts from March, 2010

iphone - How do I change the background of a UINavigationBar? -

Image
i'd change background of uinavigationbar [uicolor colorwithimage:] , isn't working. missing? edit: once i've created subclass, set uinavigationcontroller use it? you can use tintcolor property change colour of uinavigationbar , set image background you'll have provide own uinavigationbar subclass , override drawrect: method, example: - (void)drawrect:(cgrect)rect { // drawing code uiimage *img = [uiimage imagenamed: @"background-image.png"]; [img drawinrect:cgrectmake(0, 0, self.frame.size.width, self.frame.size.height)]; } if use interface builder build ui use custom navigation bar, select uinavigationbar element in interface builder, open inspector , in identity tab specify uinavigationbar subclass in class field, so:

gridview - how to check if the cell value is nothing or not in vb.net? -

using grid view in vb.net. here code... if not datagridview1.selectedrows.count = 0 = datagridview1.selectedrows(0).index if datagridview1.rows(i).cells(0).value <> nothing namebox.text = trim(datagridview1.rows(i).cells(0).value) salarybox.text = datagridview1.rows(i).cells(1).value end if end if now if cell has nothing in show exception.... this... operator '<>' not defined type 'dbnull' , 'nothing'. this code called when selected cell changed. trying values of selected cell , put in in 1 text box. you don't want use <> operator, should value isnot nothing check if isnot nothing or inversely is nothing check if value is nothing . also reason there no comparer dbnull , nothing types if case need check see both. if value isnot nothing andalso value <> dbnull.value ''#do end if

Do KRL rules stop running when a Twilio call ends? -

if create toddler amusement line (see http://blog.tropo.com/2010/11/22/something-fun-and-quick-to-make-the-toddler-amusement-line/ ) using twilio , kynetx need set stop condition in ruleset or evaluations end when caller hangs up? // warning! not use ruleset! rule callstart { select when twilio callstart { raise explicit event loves_me } } rule loves_me { select when explicit loves_me twilio:say("she loves me.") { raise explicit event loves_me_not } } rule loves_me_not { select when explicit loves_me_not twilio:say("she loves me not.") { raise explicit event loves_me } } my guess: call starts ruleset running. caller rings off. small part of kns cries. actually, code here never return twilio @ all. twilio raises events @ call start , during call when instructed. happens twilio:gather_start() , twilio:redirect() among others. when raise explicit event, matching rules select , fire before response sent. because of loop here, respo

iphone - How to create a "return to app" status bar when app goes to the background? -

Image
when app moves background while either playing audio or recording audio, provide the green "in call" status bar appears when in call , swap out app, giving quick "return app" capability. i thought might private api, noticed griffin italk app when recording audio (see picture) - know can done, have not been able figure out api (the info.plist setting, avaudiosession , uiapplication/delegate or whatever) make magic happen. app working , recording audio in background , works fine, assume there bit somewhere i'm not setting behavior. can either point me right docs or sample code exhibits behavior? (i've scoured audio docs , haven't been able find it). thanks! there may private api this, if want app store, thing register voip app , gets in-call status bar, skype or (i imagine) italk.

java - JBPM to Drools Flow - Is there a documented migration path? -

i'm using old version of jbpm workflow processing part of larger project. i'm investigating possibility of moving drools flow library replacement jbpm. i've found lot of documentation migrating osworkflow drools, can't find migrating jbpm drools flow. there similar, automatic tools migration jbpm? , if not, there documentation describing steps involved in manual migration? there should 1 jbpm5 direct port of drools flow. jbpm5 uses drools maven artifacts internally , far know, jboss has been trying merge 2 projects time. of course can still use drools integration, drools expert jbpm5, , use eclipse drools editors modify it's bpmn 2.0 processes. digress. the migration tool not out yet bet ask author directly that: http://community.jboss.org/wiki/jbpm5migrationtoolproject

c - malloc problem when writing on a file -

a garbage data appears whenever write data in text file... why that? here's code... thanks int main(void) { unsigned int option = 0; int = 0; } getch(); while(option != 5){ option = display(); switch(option){ case 5: save(); break; } for(i = 0; < recordctr; i++){ free(array[i]);} } } save(){ file *stream = null; stream = fopen("student.txt", "wt"); printf("\nsaving student list directory. wait moment please..."); int =0; (i=0; i<3; i++){ fprintf(stream, "%5s %30s %5s\n", array[i]->studentid, array[i]->name, array[i]->course); } fclose(stream); } there bugs. recordctr incremented. if chose add 2 times fill array[0], array[1] , array[2]. when freeing memory, freeing recordctr value. in case happen free 6 student

inheritance - Delegating methods to subclasses in Java -

i have superclass shape, , classes triangle, square, etc. extend shape. have 2 current issues: my method triangle extends shape not compile. has return shape, not triangle. i want hide method. should callable shape superclass. public class shape { public static shape createshapefromxml(string xml) { string type = parse(xml); if (type.equals("triangle") { triangle.createshapefromxml(xml); } else if (...) { // ... } } } public class triangle extends shape { public static triangle createshapefromxml(string xml) { .... } } public static void main(string[] args) { string xml = ... shape s = shape.createshapefromxml(xml); } how can resolve these issues? why don't keep 1 static method in superclass, , have return appropriate shape subclass? signature stay same because triangles have is-a relationship shape. you make method on superclass private access restriction want... another approach use factory

javascript - jquery: the parent modal dialog textbox is not editable -

jquery ui.dialog after open modal dialog, if open modal dialog again , close it, textbox lock in parent dialog. can not resolve problem. if open non-modal dialog , works fine, parent dialog can closed ,how resolve , , waiting online html:(dotnet mvc2) <input id="btndlg" type="button" value="open dialog"/> <div id="dlg1"><%=html.textbox("txtname","can not edit") %><input id="btnshowdlg" type="button" value="dialog again" /></div> <div id="dlg2"><div>the second dialog</div><%=html.textbox("txtname2") %></div> jquery: //first modal dialog $("#dlg1").dialog({ autoopen: false, height: 350, width: 300, title: "the first dialog!", bgiframe: true, modal: true, resizable: false,

java - very very rougly sorting -

suppose have array ( int[] m ). i need sort it... result must be: all items in first half must less or equal items in second half. how it?... as karl mentioned in comment, task equal partinioning step in quicksort algorithm with exception have find sample median first , use pivot element. computing median can computed o(n) operations, partinioning step linear (o(n)), overall worst-case performance still better full sorting (o(n log(n)). the algorithm go (standard methods need implemented): public int[] roughsort(int[] input) { int pivot = findmedian(input); int[] result = partition(input, pivot); return result; }

C++ with Qt4 plugin development -

lately have been playing around plugin framework provided qt4 framework, , works perfectly. there 1 thing unsure of. in examples, interfaces implemented (the actual plugin), had source code available (the person implementing interface has access interface source). not problem, rather expose interface via shared library or similar. my aim give 3rd party developers shared library file, can "import" (excuse java terminology) in code create plugins application. similar giving .jar file in java developer can import. the reason behind not hide source code, open source project, simplicity sake. also, program dependant on interfaces staying way plugins different 3rd parties can talk each other. if mess actual interfaces, fall apart. i appreciate nudge in correct direction. thanks! c++ not allow introspection java, therefore cannot ship "the binaries" , infer interface that. in c++ need textual description of interface (the header files). someone wa

visual studio 2008 - to count the no of days present and absent -

i have stored employee's attendance following..... columns : employeecode day1 day2 day3 ................ day31 values : ec001 p p for purpose need present day count & absent day count every employee. how it? hi copy , paste code , work fine. check if change table name have in database. please don't forget vote if helps. thank you! declare @tablename varchar(100) declare @tablefieldid varchar(100) set @tablename = 'tbl_attendance' set @tablefieldid = 'employeecode' ------------- no need edit here ----------------------- declare @sql nvarchar(max) declare @present nvarchar(max) declare @absent nvarchar(max) set @sql = 'select ' + @tablefieldid + '' set @present = '' set @absent = '' select @present = @present + ' case when ' + syscolumns.[name] + ' = ''p'' 1 else 0 end + ' + char(10) + char(13), @absent = @absen

PHP and MySQL user filtering -

i have web application shows list of events taken mysql db , presented user. the user can filter results according several (8-10) 'types' my question is, how should approach this? need take user input filter (in $_get ) , find out types looking filter , according that, change sql query. how do in way not complex? thought of using many 'if' or 'case' statements, i'm not sure if that's best solution lot of coding simple thing.. can give me advice? thanks, example db: event_id event_name event_type 1 test regular 2 test2 vip 3 test4 testtype ... example $_get: $_get['regular'] = 'on' ... you should create array of types using checkboxes <input type="checkbox" name="types[]" value="regular" /> regular <input type="checkbox" name="types[]" value="vip" /> vip then have arr

mysql - PHP 2 people logging in at the same time from the same computer -

i have login script should check 2 people login in @ same time compares usernames , password in mysql server if user exists //player 1 login username , password $p1name = $_post['p1name']; $p1pass = $_post['p1pass']; //player 2 login username , password $p2name = $_post['p2name']; $p2pass = $_post['p2pass']; $connection = mysql_connect("db_host", "db_user", "db_pass"); mysql_select_db("db_name", $connection); get_user($p1name, $p1pass); get_user($p2name, $p2pass); $row = $result; $found = false; if(($row["username"] == $p1name && $row["password"] == sha1("$p1pass")) && ($row["username"] == $p2name && $row["password"] == sha1("$p2pass"))){ $found = true; break; } function get_user($username, $password) { $query = 'select * users'; $query .= ' username = &

sql - select the rows affected by an update -

if have table fields: int:id_account int:session string:password now login statement run sql update command: update tbl_name set session = session + 1 id_account = 17 , password = 'apple' then check if row affected, , if 1 indeed affected know password correct. next want retrieve info of affected row i'll have rest of fields info. can use simple select statement i'm sure i'm missing here, there must neater way gurus know, , going tell me (: besides bothered me since first login sql statement ever written. is there performance-wise way combine select update if update did update row? or better leaving simple 2 statements? atomicity isn't needed, might better stay away table locks example, no? there row_count() (do read details in docs). following sql ok , simple (which good), might unnecessary stress system.

How to add data to a spark list control dynamically -

i have spark list control(id="cclist") in 1 of custom components() , text input control. when value entered text input, want dynamically add same list control. tried doing following : protected function cc_selecthandler(event:customevent):void { var cctext:displayobject = event.data displayobject cclist.enabled = true; cclistbutton.enabled = true; cclist.addchild(cctext); } but error saying "addchild() not available in class. instead, use addelement() or modify skin". tried using addelement, apparently isnt available @ all. idea im doing wrong ? <s:list x="732" y="299" width="191" height="108" id="lstque"> <s:dataprovider> <mx:arraycollection> </mx:arraycollection> </s:dataprovider> needs dataprovider use additem method. quick , dirty way add blank dataprovider blank arraycollection enclosed. example of adding through click event. protected fun

JSFL - Flash CS4: replace textfields' font by an embedded font -

i have tried bunch of jsfl scripts change textfields' fonts of fla library. used scripts change textfields' fonts embedded font exist in library. scripts run fine through flash cs3 fail through flash cs4 let's give example: replacing "arial" font used textfields in fla scene "myembeddedarial*" embedded font (symbol). jsfl font replacement instruction following one: textelement.settextattr("face", "myembeddedarial*"); i can give lots of details issue observed , may know root cause ? thanks p.s: note find/replace "font" feature of flash cs4 ide works if textfields contain not emtpy strings and if symbol including textfield in scene and if search in "current document" (and not in "current scene"). i not sure if works maybe: http://blog.samueltoth.com/?p=142 good luck, rob

c# - EF4 Code-First causes InvalidOperationException -

i'm having issue when trying run project each time builds. seems initializer runs, when comes first query - dies following invalidoperationexception . this operation requires connection 'master' database. unable create connection 'master' database because original database connection has been opened , credentials have been removed connection string. supply unopened connection. for reference, i'm using ef code first ctp4, imported directly nuget. connecting sql server 2008 r2 what want happen re-create database if there model amendments , seed few values lookup table. both of these things seem supported* out of box. my setup so: global.asax protected void application_start() { database.setinitializer<coredb>(new coredbinitialiser()); // et al... } coredb.cs public class coredb : dbcontext { public dbset<user> users { get; set; } public dbset<login> logins { get; set; } public dbset<permission> per

jquery ui - Additional themes -

are there additional themes jquery ui anywhere (jqueryui.com exluded)? i've found following theme: http://taitems.tumblr.com/post/482577430/introducing-aristo-a-jquery-ui-theme there theme called 'absolution' written michaël vanderheeren, inspired jquery mobile: http://www.michaelvanderheeren.be/?p=382 and mike stone has link 'hot dog stand' theme blog: http://smellsblue.blogspot.com/2009/04/jquery-ui-theme-tribute.html

javascript - What's the correct way to write to the script console (console.log) in IE? -

i have substitute console.log defined in document.ready() : $(document).ready(function(){ console.log("doc ready"); if(typeof console === "undefined"){ console = { log: function() { } }; } } i thought ie supposed have function available but, when include call above console.log("doc ready"); the output appears in firefox console not in ie - in fact ie script execution breaks @ point. what's correct way write console in ie? the script-execution breaks because of wrong order of instructions, may better: $(document).ready(function(){ if(typeof console === "undefined"){ console = { log: function() { } }; } console.log("doc ready"); } if first access console before checking if exists(and creating if not), results error.

Diving into gsoap, Makefile.am of examples in ubuntu pkg, -

hi find quite hard gsoap running. need mention knowledge of c/c++ quite limited. in /usr/share/doc/gsoap/ see makefile.c_rules makefile.cpp_rules makefile.defines in /usr/share/doc/gsoap/examples : readme says make there makefile.am so did make -f makefile.am examples/ck$ make -f makefile.am /usr/bin/soapcpp2 -i/soapcpp2/import ck.h and source code created. and then?? application? for project need ws client, guess better create server can test it. hope question clear enough.. :-/ greets, florian the header file ck.h contains functions service. gsoap compiler soapcpp2 creates stubs , skeletons. create test-server can view documentation on how create standalone server . if compile standalone-server undefined references because have implement functions ck.h file. take @ example gsoap documentation. calc.h file represents ck.h file. there quick start guide developing client , server.

jquery - How can I use onblur() option with jeditable plugin? -

i working in mvc & using jeditable grid plugin. i want know how can use onblur() option manage submit? this how it.... $('#element_ud').editable('path/to/edit', { indicator : 'saving...', loadurl : '/load/url', type : 'select', submit : 'ok', onblur : 'submit', tooltip : 'click edit...' });

Vertical divider in android listview not working -

i have listview need show contact pictures , details. format : the vertical separator not showing @ al! here layout file listitem: [using relative layout here have more views added in list relatively] <imagebutton android:id="@+id/pic" android:layout_alignparenttop="true" android:layout_alignparentleft="true"/> <imageview android:id="@+id/vertical_separator" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@android:drawable/divider_vertical_bright" android:layout_torightof="@id/badge" android:layout_alignwithparentifmissing="true"/> <textview android:id="@+id/details" android:layout_torightof=&qu

Login window on a dll C# project -

i'm developing dll project make transactions database server, problem must idependent dll, , needs ask login screen if not found previous information. login screen needs written in c#, windows application. any ideas apreciatted. thanks in advance this isn't sort of thing typically put dll. login screen dependent on implementing ui. better of creating data access class implements interface has login credentials required implemented properties. allows consuming application (web, winforms, wpf, whatever) create login screen or pass direct credentials data class: public interface imydatainterface { string loginuser { get; set; } string loginpw { get; set; } } public class mydatalayer : imydatainterface { public mydatalayer(string login, string pw) { loginuser = login; loginpw = pw; } } using interface faithfully guarantees exposed datalayer has same implementation basics consuming applications. edit reflect more secure met

c# - Errors resulting in YSOD when I deploy the app -

i have app runs fine locally. when deploy app our staging environment, errors caught resulting in 'yellow screen of death', though errors surrounded try/catch blocks , being logged elmah. i have no idea why case. app deal error , keep working. can suggest causing this? i don't know useful info supply here, please ask , i'll fill in as can. possibly sounds configuration issue. i'd suggest looking in web.config in <system.web> <customerrors ... section.

python - Save a subplot in matplotlib -

Image
is possible save (to png) individual subplot in matplotlib figure? lets have import pylab p ax1 = subplot(121) ax2 = subplot(122) ax.plot([1,2,3],[4,5,6]) ax.plot([3,4,5],[7,8,9]) is possible save each of 2 subplots different files or @ least copy them separately new figure save them? i using version 1.0.0 of matplotlib on rhel 5. thanks, robert while @eli quite correct there isn't of need it, possible. savefig takes bbox_inches argument can used selectively save portion of figure image. here's quick example: import matplotlib.pyplot plt import matplotlib mpl import numpy np # make example plot 2 subplots... fig = plt.figure() ax1 = fig.add_subplot(2,1,1) ax1.plot(range(10), 'b-') ax2 = fig.add_subplot(2,1,2) ax2.plot(range(20), 'r^') # save full figure... fig.savefig('full_figure.png') # save portion _inside_ second axis's boundaries extent = ax2.get_window_extent().transformed(fig.dpi_scale_trans.inverted()) fig.sa

c# - How do I sort a custom array list by the dateTime elements -

i have arraylist instances of class (in case 'loan'). loan class contains variable 'date'. want sort arraylist these date variables in optimum way. the way have done date sorting before, use list<datetime> . in case want sort list/arraylist, keeping rest of information, information can used elsewhere what slaks said sort in place in arraylist need custom icomparer implementation, put sample below: public class loan { public datetime date { get; set; } } public class loancomparer : icomparer { public int compare(object x, object y) { loan loanx = x loan; loan loany = y loan; return loanx.date.compareto(loany.date); } } static void main(string[] args) { loan l1 = new loan() {date = datetime.now}; loan l2 = new loan() { date = datetime.now.adddays(-5) }; arraylist loans = new arraylist(); loans.add(l1); loans.add(l2); loans.sort(new loancomparer()); }

xml - Way to return True/False with rails api? -

i need create method, gets called local application 2 parameters. how can return true or false then? xml? method looks this: def check_license app_id = params[:id] app_sn = params[:sn] @license = license.find_by_id(app_id) respond_to |format| if @license.app_serial == app_sn # should return true here else # should return false here end end end thanks in advance! you first need decide format other internal application call application. popular (and sane) formats xml or json. then, in controller, need render response in each of formats: resp = @license.app_serial == app_sn respond_to |format| format.json { render :json => resp } format.xml if resp head :ok else render :xml => resp, :status => 403 # that's failed authentication response end end end

Ruby on Rails - Virtual Attributes -

i have following model: create_table "material_costs", :force => true |t| t.string "material" t.integer "height" t.integer "width" t.decimal "cost", :precision => 4, :scale => 2 t.datetime "created_at" t.datetime "updated_at" end how create virtual attribute in model give me cost per square inch of each material? also have model holds vat value: create_table "taxes", :force => true |t| t.string "name" t.decimal "rate", :precision => 10, :scale => 0 t.datetime "created_at" t.datetime "updated_at" end how use model give me total price per square inch each material item ie need add on vat rate? edit - store vat value in following model: create_table "app_options", :force => true |t| t.string "name" t.string "value" t.

External Log files from Ant -

i have configured log4j in project , invoked ant task. i want ant logs project logs written single file along timestamps. could let me know how take care of in ant? you can run ant in such way it's logging via log4j, there's example in ant listeners & loggers page: ant -listener org.apache.tools.ant.listener.log4jlistener but see ant documentation proper details, how ensure log4j.properties etc. found.

c# - Reflect specific framework version? -

using mono.cecil if (methoddefinition.returntype == assemblydefinition.mainmodule.import(typeof(string))) is failing because assembly reading .net 2 program .net 4. trying compare string v2 , string v4 never equal. how can string v2 without building program .net 2? your question similar this one in short, should able string type : assemblydefinition.mainmodule.typesystem.string

linux - How do I uniquely identify an USB-device? -

i wondering how unique id of usb storage device. know how fetch scsi serial id post : usb-drive serial number under linux c++ post mentions using device descriptor id. can post code determine device descriptor information under linux? ls -l /dev/disk/by-id

sql - copy part of string from one column into another -

i've got column string data somewhere has 't##' (## being 2 digit number) want copy column, how do that? something this: abc-t03-def -> 03 for microsoft sql server: update yourtable set newcolumn = substring(oldcolumn, patindex('%t[0-9][0-9]%', oldcolumn) + 1, 2) patindex('%t[0-9][0-9]%', oldcolumn) <> 0

Images in case of multi screen support in android -

i have confusion regarding multi screens support in android. have gone through article multi screen support @ android developer forum. question if app has 15-20 images need shown full screen on device screen. if want support screens should put in 3 drawable folders ldpi, mdpi & hdpi. here have done in ldpi - images of 240x320 resolution mdpi - images of 320x480 reolution hdpi - images of 720x800 resolution. (i using same densities 3 resolution) think not right approach. what should do? put images of different resolution in drawable-ldpi, drawable-mdpi & drawable-hdpi above or should use images of different densities 120 dpi, 160 dpi & 240 dpi. if use images of different densities should resolution(should 120 dpi resolution 240x320, 160 dpi resolution 320x480 & 240 dpi resolution 480x800). or if using different dpi images resolution should same(320x480) densities . regards, anuj ideally should have drawables different densities different screens. can u

java - Does Oracle's XMLType support JDBC batch updates? -

does oracle's jdbc implementation support xmltype batch updates (via preparedstatement.addbatch())? after lot of research, appears known limitation of oracle's jdbc implementation not support "stream types" bind variables (xmltype being stream type). according own documentation : oracle's implementation of standard update batching not support stream types bind values. (this true of oracle update batching.) attempt use stream types result in exception.

c++ - configuring boost::thread stack size -

is there way configure boost::thread stack size? no, afaik. maybe try native_handle() thread's member function , set stack size call os' api ( pthread_attr_setstacksize() on posix systems maybe?).

build - How to use NAnt with C# 4.0 and Mono? -

according nant website , nant supports .net framework 4.0 mono 3.5 profile. there way use nant while developing c# 4.0 app using mono 2.8? switch xbuild, http://www.mono-project.com/microsoft.build or nant , fill in gaps.

c++ cli - Using directive to specify class alias in C++/CLI -

in c#, there 3 types of using directives: using system; // specify namespace using diag = system.diagnostics; // specify namespace alias using dbg = system.diagnostics.debug; // specify class alias in c++/cli, know equivalents first two: using namespace system; namespace diag = system::diagnostics; is there way third 1 in c++/cli? doing namespace dbg = system::diagnostics::debug; gives error c2879: 'system::diagnostics::debug' : existing namespace can given alternative name namespace alias definition the alterntive i've come #define dbg system::diagnostics::debug , i'd prefer proper using directive, if available. a c++ typedef trick here. typedef system::diagnostics::debug dbg;

vba - Script to create a follow up action on an email message in Outlook -

i 2 messages everday. second message must arrive within 3.5 hours; if not, have start figuring out went wrong second process kept email getting sent. here's i'd see happen. message 1 arrives a rule executes , flags message follow-up (or really) 3.5 hours time. there's "run script" option in outlook's rules wizard use trigger script. bonus points: 3 . when second email arrives, clears follow-up flag first message. here's did: sub myrule(item outlook.mailitem) msgbox "mail 1 has arrived: " & item.subject dim newmail outlook.mailitem set newmail = outlook.createitem(olmailitem) newmail.to = item.to newmail.subject = "!!!start looking issues!!!!" newmail.body = "something might have gone wrong process.. did not receive closing mail " + item.subject + " received on " + item.receivedtime newmail.deferreddeliverytime = dateadd("h", 3.5, now) newmail.send end

java - count lines of code between two versions -

is there way compare lines of code between 2 clearcase versions , or matter whatever version controller , want compare 2 different version compare main branch development branch. i'm looking topic java if need compare+view+edit lines vonc's recommendation of winmerge excellent, but if need compare number of lines of code (count) sloc diff tool projectcodemeter or cloc better.

.net - Techniques for integrating an ASP.NET intranet app with the Outlook calendar -

i can ignore braying of users no longer. want task scheduling system , @ point have deliver. thinking of making own (can't hard), users have 2 side-by-side task managements systems since use outlook same thing. in terms of outlook calendar / task integration, 2 possible approaches occurred me: 1) use javascript , automation i seem remember it's possible automation in javascript. pros: i've done automation before. cons: automation horrible! some persistence (outlook entities) responsibility of client-side code, , rest responsibility of server-side code. feels horrible. possible security concerns / blocking dept. 2) use .net api interact exchange server directly the intranet uses single-sign on, should make security issues easier. pros: all persistence code server-side. cons: i don't know such api exists. as ever, stand on shoulders of giants. can has trodden path before give me guidance? we did same ki

performance - MySQL - basic 2 table query slow - where, index? -

i have mysql 5.0 query regularly taking 14+ seconds, called web page, , users impatient. it's simple, selecting 11 columns 2 tables. have 3 questions: does placement of join matter? does order of clause matter, or mysql optimize? would , index in case? sql: select table1.id, table1.dateopened, table1.status, table2.name, etc (table1 join table2 on((table1.currentname = table2.id))) table1.type = 'add' , (status = 'open' or status = 'pending'); table/column info: table1 has 750,000 rows, table2 1.5m rows. indexed: table1.id, table2.id int columns: id, table1.currentname table1.status = populated 1 of 4 values, maybe 300 'open' or 'pending' table1.type = 3 possible values: 'add', 'change', or null is there advantage joining in from, vs adding 'table1.currentname = table2.id' in clause? there 3 clauses (with join). ran explain various order combinations, , results seemed same. i th

java - Strange problem with rendered=true/false issues in JSF -

i having simple annoying issue jsf. have datatable (with simple first next etc paging option) , want populate same page users initial selection. initial form <b><h:selectoneradio id="radio1" layout="pagedirection" style="font-weight: bold" value="#{displaynoc.slection}"> <f:selectitem itemlabel="search noc" itemvalue="n" id="selectitem1" /> <f:selectitem itemlabel="search title" itemvalue="t" id="selectitem2" /> </h:selectoneradio></td> <hx:commandexbutton type="submit" image="images/btn_search.jpg" action="#{displaynoc.process_request}" onclick="return validate_listnoc(this.form)"></hx:commandexbutton></b> once user select radio button , click "search", populating datatable (which hidden in same page rendered properties false) , paging button (at stage have next butto

authorization - iPhone NSURLConnection pop-up for entering user/password requested? -

i observed in hotel when other apps trying access internet pop-up appears ask iphone user enter user id , password of hotel's wireless lan. guess kind of redirect on requests protect misuse of wlan. i have app , use nsurlconnection not getting pop-up instead goes via regular data network of carrier. removed sim see happens , connection fails error "the internet connection appears offline". i wonder whether because nsurlconnection not provide such pop-up , other apps (e.g. safari, e.g. whatsapp) use different api. 1 other hand thought might documentation says "authorization challenge". have implemented delegate methods not called. if experience on can me. search documentation uirequirespersistentwifi info.plist key - there tradeoffs (users alert every time open application if phone in airplane mode - doesn't seem way turn off) should force make connection.

How to set absolute position of the widgets in qt -

i using qt develop rich ui application. i need position widgets @ absolute positions i should able put widget in background / foreground add few effects. simple example be, have show boiler water level inside feed tank. take feed tank image , embed in label. position progress bar in center of feedtank display water level. now in case progress bar in foreground , label in background. regards, you need create widget, indicate parent qwidget , display it. don't add parent layout else not able move want. don't forget indicate parent else displayed independent widget. in these conditions widget considered child of qwidget not member of parent's layout. "floating" child , must manage it's behavior when resizing parent's qwidget.

C Newbie: Help with Simple Function -

spoiler: absolute beginner c. threw threw program test knowledge, compiler giving me errors. problem , why? #include <stdio.h> void main() { char *string = "abcdefghi"; printf("%s\n\n", string); printf("%s\n\n", substr(string, 1, 2)); } char * substr(char *string, int start, int length) { int i; char *temp; for(i = 0; < length; i++) { temp[i] = string[i+start]; } return temp; } edit: sorry, it's 1 here, i've been trying figure out. the errors are: main.c: in function ‘main’: main.c:9: warning: format ‘%s’ expects type ‘char *’, argument 2 has type ‘int’ main.c: @ top level: main.c:12: error: conflicting types ‘substr’ here errors see: use of uninitialized pointer in substr declare char *temp; , use without initializing anything. not compile-time error, program crash when run it, since temp point random memory address. case of undefined behavior , , c chock fu

sql - Pass R variable to RODBC's sqlQuery? -

is there way pass variable defined within r sqlquery function within rodbc package? specifically, need pass such variable either scalar/table-valued function, stored procedure, and/or perhaps clause of select statement. for example, let: x <- 1 ## user-defined then, example <- sqlquery(mydb,"select * dbo.my_table_fn (x)") or... example2 <- sqlquery(mydb,"select * dbo.some_random_table foo foo.id = x") or... example3 <- sqlquery(mydb,"exec dbo.my_stored_proc (x)") obviously, none of these work, i'm thinking there's enables sort of functionality. build string intend pass. instead of example <- sqlquery(mydb,"select * dbo.my_table_fn (x)") do example <- sqlquery(mydb, paste("select * dbo.my_table_fn (", x, ")", sep="")) which fill in value of x .

tfs2008 - Move project from TFS2005 to TFS 2008 -

does know how export/transfer single project 1 tfs server another? i have 2 tfs servers @ work, old 1 (demo1) started off demo thing , stayed in use, , new server: tfs1. all done before time , i've had deal issues. most of projects didn't need history/branch info. 1 did. unfortunatly decided long while ago move projects (no history straight copy off file) except 1 large project. this means tfs1 has own history on bunch of smaller projects , demo1 solely used large project. we want move 1 project , history, (branches less important can take straight copies of release code) does know how export/transfer single project 1 tfs server another? there tool out there can sort of thing? you should start taking @ tfs integration platform on codeplex. used tfs tfs migration tool. you'll have modify tool pretty pick history. it's been while since we've used it, pretty straightforward modify. alternatively, write specific-purpose tool relatively you

python - Another sigmoidal regression equation question -

Image
i posted an earlier version of yesterday , cannot seem add version posting because seems have closed posting editing, here new version in new posting. i have script below following things: 1.) plot best fit curve sigmoidal data. 2.) re-size data based on new max , min coordinates x , y. 3.) calculate , plot new best fit curve resized data. steps 1 , 2 seem work fine, step 3 not. if run script, see plots totally invalid curve re-sized data. can show me how revise code below creates , plots true best fit sigmoidal curve re-sized data? needs reproducible when re-sized across spectrum of possible max , min values. i seem able track problem new_p, defined in following line of code: new_p, new_cov, new_infodict, new_mesg, new_ier = scipy.optimize.leastsq( residuals,new_p_guess,args=(newx,newy),full_output=1,warning=true) but cannot figure out how deeper problem that. think problem may have difference between global , local variables, perhaps else. here curre

Program to convert context free language to push down automata? -

i can't find applet or program online convert context free language push down automata... appreciated. it easy hand. pda has start state s , final state f, 2 states has. make transition ((s, empty, empty),(f, s)), s start symbol of cfg. each rule x -> y, x non terminal symbol , y possibly empty string of terminals , nonterminals, make transition ((f, empty, x),(f,y)). finally, each terminal symbol a, add rule ((f, a, a),(f, empty)). what start pushing start symbol on stack. replaces nonterminal finds @ top of stack right hand side of production rule, , matches , pops terminal characters @ top of stack.

asp.net mvc - Strongly Typed Views Model on a RedirectToAction -

i have 2 action methods this [httppost] public actionresult search(models.inputmodel input) { if (!issearchcriteriavalid(input)) return redirecttoaction("index"); tempdata[tempdatasearchinput] = input; return redirecttoaction("list"); } public actionresult list() { var input = tempdata[tempdatasearchinput] models.inputmodel; if (!issearchcriteriavalid(input)) return redirecttoaction("index"); var result = new list<mydto>(); automapper.mapper.map( _repository.getby(input), results); var model = new models.displaylistmodel { result = result }; return view("list", model); } is there standard best practices way this? erx_vb.next.coder correct. code in search action not needed. assume did this, because form posting /[controller]/search? can still use search.aspx view if , point form /[controller]

Javascript Random problem? -

var swf=["1.swf","2.swf","3.swf"]; var = math.floor(math.random()*swf.length); alert(swf[i]); // swf[1] >> 2.swf this case ,random output one number. how random output two different numbers ? var swf = ['1.swf', '2.swf', '3.swf'], // shuffle swf = swf.sort(function () { return math.floor(math.random() * 3) - 1; }); // use swf[0] // use swf[1] even though above should work fine, academical correctness , highest performance , compatibility, may want shuffle instead: var n = swf.length; for(var = n - 1; > 0; i--) { var j = math.floor(math.random() * (i + 1)); var tmp = swf[i]; swf[i] = swf[j]; swf[j] = tmp; } credits tvanfosson , fisher/yates. :)

python - Apache with mod_wsgi segfaults -

i use apache2 mod_wsgi django communicate soap information , return information use soap! the apache return none,and log child pid * exit signal segmentation fault (11)! who can me?my english badly,do understand said? read: http://code.google.com/p/modwsgi/wiki/frequentlyaskedquestions#apache_process_crashes

jsp - Multiple Select in Spring 3.0 MVC -

ok i've been trying accomplish multiple selects in spring mvc while , have had no luck. basically have skill class: public class skill { private long id; private string name; private string description; //getters , setters } and employee has multiple skills: public class employee { private long id; private string firstname; private string lastname; private set<skill> skills; //getters , setters } all of these mapped hibernate shouldn't issue. now able in jsp select skills employee <select multiple="true"> element. i have tried in jsp no luck: <form:select multiple="true" path="skills"> <form:options items="skilloptionlist" itemvalue="name" itemlabel="name"/> <form:select> here controller: @controller @sessionattributes public class employeecontroller { @autowired private employeeservice service; @requestmappin

c - Integer cube root -

i'm looking fast code 64-bit (unsigned) cube roots. (i'm using c , compiling gcc, imagine of work required language- , compiler-agnostic.) denote ulong 64-bit unisgned integer. given input n require (integral) return value r such that r * r * r <= n && n < (r + 1) * (r + 1) * (r + 1) that is, want cube root of n, rounded down. basic code like return (ulong)pow(n, 1.0/3); is incorrect because of rounding toward end of range. unsophisticated code like ulong cuberoot(ulong n) { ulong ret = pow(n + 0.5, 1.0/3); if (n < 100000000000001ull) return ret; if (n >= 18446724184312856125ull) return 2642245ull; if (ret * ret * ret > n) { ret--; while (ret * ret * ret > n) ret--; return ret; } while ((ret + 1) * (ret + 1) * (ret + 1) <= n) ret++; return ret; } gives correct result, slower needs be. this code math library , called many times various func

cocoa - NSScrollView scroll position -

i have nsview in nsscrollview. nsview large , need scroll manage object inside. i want draw static rectangle in center of nsview without scrolling. want scrolling point (the nsclippoint?) in drawrect method of nsview can draw rectangle @ last step of drawrect make on top. i have looked through doc , find methods set scroll point, not getting it. how can point? the answer [[myscrollview contentview] documentvisiblerect]

computer science - What does "in constant time" imply? -

i work programmer, have no computer science background, i've been following along excellent mit opencourseware intro computer science , programming. in course of which, question asked: "will program written using function definitions , calls, basic arithmetic operators, assignment , conditionals run in constant time?" i thought answer yes, since of these operations seem pretty simple. smart people knew, correct answer no, apparently because of potential indefinite recursion. it seems don't understand implications of "in constant time". way pictured meaning, sounded meant simple operation take known amount of time complete. accept recursion can lead program running forever, aren't individual operations still taking finite , measurable amount of time each... if there infinite number of them? or answer mean 2 infinitely recursive programs cannot validly said take same amount of time run? if can give me authoritative definition of "in con

php - Adding null values to an array -

i have method: public function search($searchkey=null, $summary=null, $title=null, $authors=null, $paginationpage=0) { ... } and i'm trying retrieve parameters this: $class = new search(); // parameters $reflectionmethod = new \reflectionmethod($class, "search"); try { foreach($reflectionmethod->getparameters() $parameter) { if(array_key_exists($parameter->name, $this->params)) { $parameters[$parameter->name] = $this->params[$parameter->name]; } elseif($parameter->isdefaultvalueavailable()) { $paramaters[$parameter->name] = $parameter->getdefaultvalue(); } else { ... } } catch(\exception $e) { ... } // call function return call_user_func_array(array($class, "search"), $parameters); my $this->params has content: array 'paginationpage' => int 2 'id' => int 30 'searchkey' => string 'test' (length=4)

c# - Removing the hard coded value to app.config file -

i have developed form takes user user id , password , display list of databases available in local server.now have done in hard coded format...like this public void binddbdropdown() { //create connection object sqlconnection sconnection = new sqlconnection( configurationsettings.appsettings["connectionstring"]); //to open connection. sconnection.open(); //query select list of databases. string selectdatabasenames = @"select name master..sysdatabases"; //create command object sqlcommand scommand = new sqlcommand(selectdatabasenames, sconnection); try { //create data set dataset sdataset = new dataset("master..sysdatabases"); //create dataadapter object sqldataadapter sdataadapter = new sqldataadapter(selectdatabasenames, sconnection); sdataadapter.tablemappings.add("table", "master..sysdatabases")