Posts

Showing posts from September, 2011

android - Cannot set both FLAG_ACTIVITY_SINGLE_TOP and FLAG_ACTIVITY_CLEAR_TOP in one intent? -

i'm using flag flag_activity_single_top , flag_activity_clear_top go previous "standard" activity. use flag_activity_single_top prevent re-creating new instance. found flag flag_activity_single_top neglected , activity finished , re-created. here found in docs. flag_activity_clear_top : says can add flag_activity_single_top when using flag_activity_clear_top prevent "finish - recreate". here doc. flag_activity_clear_top : note: if launch mode of designated activity "standard", removed stack , new instance launched in place handle incoming intent. that's because new instance created new intent when launch mode "standard". did misunderstand first doc? the documentation suggests flag_activity_clear_top need set. have set both prevent activity being created again. this did trick in case: (main being activity wanted return to) intent tabintent = new intent(this, main.class); tabintent.setflags(intent.f...

java - Ireports and barcode -

i doing report contains barcodes, when compile it, gives me error compilation exceptions: com.jaspersoft.ireport.designer.compiler.errorscollector@eed1de net.sf.jasperreports.engine.jrexception: errors encountered when compiling report expressions class file: 1. it.businesslogic.ireport.barcode.bcimage cannot resolved type value = (java.awt.image)(it.businesslogic.ireport.barcode.bcimage.getbarcodeimage(26,"*"+((java.lang.string)field_nridentsns.getvalue())+"*",false,false,null,0,0)); //$jr_expr_id=9$ <--------------------------------------> 2. it.businesslogic.ireport.barcode.bcimage cannot resolved type value = (java.awt.image)(it.businesslogic.ireport.barcode.bcimage.getbarcodeimage(26,"*"+((java.lang.string)field_nridentsns.getvalue())+"*",false,false,null,0,0)); //$jr_expr_id=13$ <----------...

c# - Suggestions on ways to compare two files and show differences, maybe by rehosting a version comparion tool? -

i'm trying find way have version comparison between 2 files (.docx files), files compared , differences highlighted. ability output report. i thinking maybe it's possible rehost comparison tool used team foundation server or similar. documents hundreds of pages long. can u use 3rd party? have used beyond compare 3 has file compare xml stuff. api in sense run batch scripts , dump output in format want

java - Modify JSTL import tag to show gzipped text in JSP -

in jsps using jstl show contents of simple text files reside on server follows: c:import url="http://www.mysite.com/texts/name_id.txt" charencoding="utf-8"/> these text files can quite long , there many of them want compress them , serve compressed version import tag. can give me suggestions on how modify jstl import tag, or create own tag achieves same result when text file compressed? suspect should use apache commons codec, or java.util.zip enough? for reference, source jstl 1.2 import tag can seen at: http://grepcode.com/file/repo1.maven.org/maven2/javax.servlet/jstl/1.2/org/apache/taglibs/standard/tag/rt/core/importtag.java http://grepcode.com/file/repo1.maven.org/maven2/javax.servlet/jstl/1.2/org/apache/taglibs/standard/tag/common/core/importsupport.java#importsupport regards create servlet mapped on url pattern of /texts/* , following job in doget() . string path = request.getrequesturi().substring(request.getcontextpath().lengt...

Attaching file to an email in python leads to a blank file name? -

the following snipit of code works fine, except fact resulting attachment file name blank in email (the file opens 'noname' in gmail). doing wrong? file_name = recordingurl.split("/")[-1] file_name=file_name+ ".wav" urlretrieve(recordingurl, file_name) # create container (outer) email message. msg = mimemultipart() msg['subject'] = 'new feedback %s (%a:%a)' % ( from, int(recordingduration) / 60, int(recordingduration) % 60) msg['from'] = "noreply@example.info" msg['to'] = 'user@gmail.com' msg.preamble = msg['subject'] file = open(file_name, 'rb') audio = mimeaudio(file.read()) file.close() msg.attach(audio) # send email via our own smtp server. s = smtplib.smtp() s.connect() s.sen...

c++ - Sort array/vector of string -

how can sort array/vector repetition of elements? example input leo mike eric leo leo output _ _ _ or leo leo leo eric leo mike eric mike i recommend processing data in 3 passes: use std::sort repeated elements adjacent each other. iterate on sorted range recording length , position of each equal_range. now can resort sequence based on data you've recovered in step 2. may consider using stable_search in phase if secondary search key alphabetical.

Slow postgresql query if where clause matches no rows -

i have simple table in postgresql 9.0.3 database holds data polled wind turbine controller. each row represents value of particular sensor @ particular time. table has around 90m rows: wtdata=> \d integer_data table "public.integer_data" column | type | modifiers --------+--------------------------+----------- date | timestamp time zone | not null name | character varying(64) | not null value | integer | not null indexes: "integer_data_pkey" primary key, btree (date, name) "integer_data_date_idx" btree (date) "integer_data_name_idx" btree (name) one query need find last time variable updated: select max(date) integer_data name = '<name of variable>'; this query works fine when searching variable exists in table: wtdata=> select max(date) integer_data name = 'status_of_outputs_uint16'; max -----------------------...

c# - IE9 is duplicating master page content -

create brand new asp.net webforms project. add master page , webforms page uses master page. master page <%@ master language="c#" autoeventwireup="true" codebehind="site1.master.cs" inherits="aspweird.site1" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:contentplaceholder id="head" runat="server"> </asp:contentplaceholder> </head> <body> <form id="form1" runat="server"> <div> <div id="main_content_container"> <div id="main_content_row"> <div id="main_content_column"> <asp:contentplaceholder id="co...

optimization - iPhone - Resizing an UIImage in less than a second on an iPhone 4 -

i have 5mp image coming camera. want downsize put imageview without having wait long (it take logn time uiimageview display 5 mp picture). tried many methods resize / resample image make fit just-screen resolution (retina one). take around 1 sec downsize image. would know optimised way able resize 5mp image retina 960 x 640 resolution fast possible, , @ least @ less 0.7 sec on iphone 4 ? this favorite blog post , code resize images. haven't benchmarked know of no faster way. http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/

Optimizing wcf service in IIS -

i hosting asp.net web site containing wcf web service in iis 7. web service exposed using .svc file resides inside web site's virtual directory. there's section document optimizing web service performance removing unnecessary http modules: http://msdn.microsoft.com/en-us/library/ee377061(v=bts.10).aspx my question how can in web config without affecting web site? asp.net web site contains authentication stuff , requires of modules (eg, formsauthentication). there way enable modules web site disable them when clients access web service? thanks

razor - ASP.NET 3: What is a way to know what views and layouts are used? -

there following layouts , view: _globallayout.cshtml _subloyout.cshtml somepage.cshtml in _globallayout.cshtml want list of used layouts , current view name. for example, in _globallayout.cshtml : <html> <head> @html.some_method_that_will_know_about_used_layouts_and_view(); </head> <body> @renderbody(); </body> </html> the some_method_that_will_know_about_used_layouts_and_view return content using info used layouts , used view. how can implement method? the notion of current view doesn't make sense. haven't yet rendered body ( @renderbody() ) , expect view name? current action , controller though viewcontext : @{ var currentcontroller = viewcontext.routedata.getrequiredstring("controller"); var currentaction = viewcontext.routedata.getrequiredstring("action"); } the main question remains though: why need , trying achieve it?

servlets - MVC Design - How many controllers? -

Image
overview i’m building simple web application consisting of canvas , elements on canvas. the canvas supports following operations: load, save the elements support following operations: move, resize javascript on web page sends message server each operation , server sends appropriate response. my design note: arrow between canvas , element objects supposed denote canvas object contains list of element objects. didn't have right symbols diagram. example work flow an element on canvas moved generating element_moved message. the front controller manages session , passes message canvas controller correct canvas object. the canvas controller inspects message , sees element on canvas , passes on element controller. the element controller parses message , updates appropriate element object directly. question is hierarchical arrangement of controllers common place in mvc designs or missing point? i've searched several hours haven't found sites discuss...

zipfile - Strange "BadZipfile: Bad CRC-32" problem -

this code simplification of code in django app receives uploaded zip file via http multi-part post , read-only processing of data inside: #!/usr/bin/env python import csv, sys, stringio, traceback, zipfile try: import io except importerror: sys.stderr.write('could not import `io` module.\n') def get_zip_file(filename, method): if method == 'direct': return zipfile.zipfile(filename) elif method == 'stringio': data = file(filename).read() return zipfile.zipfile(stringio.stringio(data)) elif method == 'bytesio': data = file(filename).read() return zipfile.zipfile(io.bytesio(data)) def process_zip_file(filename, method, open_defaults_file): zip_file = get_zip_file(filename, method) items_file = zip_file.open('items.csv') csv_file = csv.dictreader(items_file) try: idx, row in enumerate(csv_file): image_filename = row['image1'] ...

java - how would create an alarm manager with reciever to put phone on silent at certain time? -

i have been trying while , cannot figure out best way , not understand teh broadcast reciever does. alarm fired , maybe activity put phone on silent. thanks in advance use alarmmanager 's setrepeating method run task periodically. change ringer can use audiomanger 's setringermode method.

php - Cant understand Why My Sites Keeps Navigating To Its Index Page? -

i creating website using php , jquery , have come problems rearding forms. for example, index.php looks following: <body> <?php echo "<div id=\"web_page\">"; require("public/templates/header.php"); require("public/templates/menu.php"); require("public/templates/home.php"); require("public/templates/footer.php"); echo "</div>"; ?> </body> it loads header, footer, menu area , starting page. files loaded encased in div areas final index.php rendered so: <div id="web_page"> <div id="web_header"> //contents of header.php loaded div// </div> <div id="web_menu"> //contents of menu.php loaded div// </div> <div id="web_contents"> //contents of home.php loaded div// </div> <div id="web_foote...

double pointer reference in C++ -

this may stupid question, i'm gonna ask anyway: suppose have pointer: object* pointer points @ dynamically allocated object. class pointclass { array<object*> m_array1; array<object*> m_array2; void delete1() { (int = 0; < m_array1.length; i++) { delete m_array1[i]; } } void delete2() { (int = 0; < m_array2.length; i++) { delete m_array2[i]; } } } now, put pointer both in m_array1 , in m_array2 . when try delete arrays, in 1 of them have pointer points deallocated space, can't delete again! i can't assign pointers null after deletion because wouldn't affect pointer in other array. how solve it? well simplest way use reference-counting pointer, available in boost::smart_ptrs . otherwise, need assign owners pointers - need decide class responsible allocating/deleting particular pointer. if reason decide should this class, remove duplicates arrays adding pointers set b...

flash - As3 to YouTube Upload -

i know if it's possible capture users webcam in flash , directly upload youtube without backend server setup. or if there third party providers support service. i see youtube offers live streaming api, seems it's available selected users. thank in advance. yes can, using youtube's data api . interact api using xml , http , can upload other functionality (create play lists, search, etc)

Android SetEnable has an obscured view -

i use setenabled on radiogroups, edittext, spinner, , checkbox. when data dark see (have squint @ it). how make disabled controls can viewed user , have differentiated editable mode controls. you have provide drawables background of each control. you'd want implement selector change image based on state.

Self host asp.net mvc site -

is there way self host , asp.net mvc site, wcf services? use httplistener implement http server , inherit marshalbyrefobject process asp.net request. referring self-hosting asp.net mvc

android - Synchronize two Galleries -

i have activity 2 galleries. want synchronise both galleries when i'm moving in 1 gallery, should move other gallery match same item. i don't know how accomplish this. though done synchronising onscroll event, followed attempt on this, doesn't work. assume it's because i'm not interested on scroll event, maybe on fling event? anyway, don't know proper event observe , how implement this. can me out? is possible use 1 gallery , have view displays display both items?

c# - Sending DataType As An Argument? -

i'm trying write method uses following 2 arguments: columntosort columntype the reason want able interpreting 2 things string can give different result comparing same 2 things number. example string: "10" < "2" double: 10 > 2 so basically, want able send double or string datatype method argument, don't know how this, seems should possible in c#. addendum: what want method like: insertrow(customdataobj data, int columntosort, datatype datatype){ foreach(var row in listview){ var value1 = (datatype)listview.items[i].subitems[columntosort]; var value2 = (datatype)data.something; //from here, find data object needs placed in listview , insert } } how called: i think above provides enough of explanation understand how called, if there specific questions, let me know. you can use type parameter type. this void foo(object o, type t) { ... } and call double d = 10.0; foo(d, d.gettype())...

camera - Preview android cam in tabhost -

i have tabhost in android application , want preview camera in 1 of tabs. thanks use surfaceholder in sub activity in normal activity (lot of example it) insert activity in tab in classical way: intent = new intent(this, previewactivity.class); tabhost.addtab(tabhost .newtabspec("previewtab") .setindicator(gettext(r.string.tab_item_preview), getresources().getdrawable(r.drawable.icon_preview)) .setcontent(intent));

c# - How to insert a column with a specific value in sql bulk copy -

i populating table values in excel using sql bulk copy in c#. datatable dt = new datatable(); string line = null; int = 0; using (streamreader sr = file.opentext(@"c:\temp\table1.csv")) { while ((line = sr.readline()) != null) { string[] data = line.split(','); if (data.length > 0) { if (i == 0) { foreach (var item in data) { dt.columns.add(new datacolumn()); } i++; } datarow row = dt.newrow(); row.itemarray = data; dt.rows.add(row); } } } using (sqlconnection cn = new sqlconnection(configurationmanager.connectionstrings["consoleapplication3.properties.settings.daasconnectionstring"].connectionstring)) { cn.open(); using (sqlbulkcopy copy = new sqlbulkcopy(cn)) { copy...

sql server - How can I improve this query for deleting duplicates? -

i working on document management system. documents imported system. due error, of them imported twice. need delete duplicates. have document id previous system, can't delete documents associated multiple accounts , supposed in there twice, have check against well. associated values in different tables. have created following script come doc id's delete incredibly slow (it has been running 4 days on table less 2 million records). declare @docidtodelete int declare @docid int declare @sourcedocid varchar(12) declare @taxid decimal(9,0) declare @account bigint select @docid = min(d.docid) docs d inner join contents c on d.docid = c.docid , c.folid=1 while @docid not null begin --get source document id document select @sourcedocid = val vtab0031 idxid=31 , docid=@docid -- see if there document same source document id select @docidtodelete = isnull(max(v.docid),0) vtab0031 v inner join contents c on v.d...

devexpress - Showing Editors on click of a node in Xtratreelist -

i using latest version of devexpress xtratreelist , have requirement of showing editors on click of each node on tree. please see screenshot http://community.devexpress.com/forums/p/89574/310095.aspx i wondering how can dynamically save , render specific editor(rather form) per node on treelist. clicking on "friends" in screenshot should bring different editor compared clicking on "parties". also, if user tries add more objects on editor parties/friends textbox/listbox, should saved , come fine when click nodes. have ideas regarding how dynamically bring different editors on click of random node on left? this can done handling treelist's focusednodechanged event. need determine current focusednode , its values , show required editor.

c# - Using Tasks with conditional continuations -

i'm little confused how use tasks conditional continuations. if have task, , want continue tasks handle success , error, , wait on complete. void functionthrows() {throw new exception("faulted");} static void mytest() { var taskthrows = task.factory.startnew(() => functionthrows()); var onsuccess = taskthrows.continuewith( prev => console.writeline("success"), taskcontinuationoptions.onlyonrantocompleted); var onerror = taskthrows.continuewith( prev => console.writeline(prev.exception), taskcontinuationoptions.onlyonfaulted); //so far, //this throws because onsuccess cancelled before started task.waitall(onsuccess, onerror); } is preferred way of doing task success/failure branching? also, how supposed join these tasks, suppose i've created long line of continuations, each having own error handling. /...

asp.net mvc - Passing the ErrorMessage for clientside validation -

since there no way validate property (with unobtrusive clientside validation) using multiple regex patterns (because validation type has unique) decided extend fluentvalidation can following. rulefor(x => x.name).notempty().withmessage("name required") .length(3, 20).withmessage("name must contain between 3 , 20 characters") .match(@"^[a-z]").withmessage("name has start uppercase letter") .match(@"^[a-za-z0-9_\-\.]*$").withmessage("name can contain: a-z 0-9 _ - .") .match(@"[a-z0-9]$").withmessage("name has end lowercase letter or digit") .notmatch(@"[_\-\.]{2,}").withmessage("name cannot contain consecutive non-alphanumeric characters"); last thing need figure out how pass errormessage set using withmessage() via getclientvalidationrules() ends in "data-val-customregex[...

linq to sql - MVC 2 with Entity Data Model returning Null for foreign keys -

i creating first mvc 2 applicaiton. i've followed expamples in books have , created ado.net entity data model auto generated model.edms , model.designer.cs files. created repository.cs file in model folder store methods retrieving data. when use theses methods retrieve object tables foriegn key attributes returned null. here 1 of methods private lantracerentities2 entities = new lantracerentities2(); public employee findemployee(string empid) { var emp = employee in entities.employees employee.login == empid select employee; return emp.firstordefault(); } the employee table has following columns: id empfname emplname empinitial phone login email locid locid foriegn key linking location table. when run method returns value every attribute locid. locid null. there data in table. not object have returning null foriegn key attributes. how can method return fk values? it looks comparing wrong property? ...

php - Updating .po files without restarting lighty -

we running php gettext on lighttpd web server. when update .po/.mo files new translations, have restart lighty new translations appear. is lighty caching translations? anyone know how avoid restarting lighty? thanks! as far know, php's gettext extension caching .mo files, that's not lighty's problem :) i'd suggest using zend_translate component. zend_translate_adapter_gettext not use php gettext extension, carries own implementation. besides, zend_translate_adapter_gettext muti-thread safe, not true php gettext extension.

python - Test if a class is inherited from another -

this question more python related django related. want test write test function using django form dynamically fields set. def quiz_form_factory(question): properties = { 'question': forms.integerfield(widget=forms.hiddeninput, initial=question.id), 'answers': forms.modelchoicefield(queryset=question.answers_set) } return type('quizform', (forms.form,), properties) i want test if, quizform class returned inherited forms.form. something like: self.asserttrue(quizform isinheritedfrom forms.form) # know not exist is there way this? use issubclass(myclass, parentclass) . in case: self.asserttrue( issubclass(quizform, forms.form) )

.net - Turning What If into Select Case -

question is, wrote rock paper scissors game in vb.net using if statements , wondered how try , work select case instead. professor pretty awful @ teaching things , didn't let know until today had select case(its due tomorrow ._.) public class form1 dim randomgenerator new random private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load end sub private sub rdorock_checkedchanged(byval sender system.object, byval e system.eventargs) handles rdorock.checkedchanged if rdorock.checked = true picrock.visible = true else picrock.visible = false end if end sub private sub rdopaper_checkedchanged(byval sender system.object, byval e system.eventargs) handles rdopaper.checkedchanged if rdopaper.checked = true picpaper.visible = true else picpaper.visible = false end if end sub private sub rdoscissors_checkedc...

cocoa touch - Can't set outlets when I push a UIViewController without animating -

i have uinavigationcontroller push uiviewcontrollers onto using pushviewcontroller:animated: . after this, call method on incoming view set of ib outlets. unfortunately, these set when animate view. so work: myviewcontroller *newview = [[myviewcontroller alloc] initwithnibname:@"myviewcontroller" bundle:nil]; [self.navigationcontroller pushviewcontroller:newview animated:yes]; [newview updateoutletsforobject:myobject]; but won't: myviewcontroller *newview = [[myviewcontroller alloc] initwithnibname:@"myviewcontroller" bundle:nil]; [self.navigationcontroller pushviewcontroller:newview animated:no]; [newview updateoutletsforobject:myobject]; does know why happening? in advance. it seems me parent view controller shouldn't setting child's outlets. should handling iboutlet connections in -viewdidload of child view controller.

html - how to make this sql statment in codeigniter framework php? -

how make sql statment in codeigniter framework php?? select count(`id`) `c` `products` `valid` = 1 , `sticky` = 2 how make in model like way $this->db->get('products'); how that? $this->db->select('count("id") c'); $this->db->where('valid',1); $this->db->where('sticky',2); $result = $this->db->get('products');

xml - XSLT: Splitting a string and doing something with each character -

i'm xslt newbie. i've gone through tutorials , i've been able 80% of want, xml document. however, stuck on something. in xml document, have attributes consist of values "era", "eda", "edar", , on. these attributes consist of combinations of letters e, d, a, , r. e, d, a, , r map edit , delete , add , , read . if doing imperatively, split string component characters , check each character see if should output edit , delete , add , or read . how can similar in xslt? thinking of using length , substring functions , making loop of sort. inline (or external) map: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:local="http://localhost"> <local:map letter="e" text="edit"/> <local:map letter="d" text="delete"/> <local:map letter="a" text="add"/> <local:map letter=...

ruby - can I use multiple exclusion filters in rspec? -

in _spec.rb file i'm setting exclusion filter like: rspec.configure |config| # need determine once @ front # , result available in instance server_success = server1_available? config.exclusion_filter = { :svr1 => lambda {|what| case when :available !server_success end } } end and later in file do describe :get_items_by_client, :svr1 => :available to prevent test execution if server isn't available. this works fine if run spec file alone. however, have similar code in file controlling tests access different server, , when run them see each of server checks done (i have puts in "serverx_available?" code), 1 set of tests being excluded (even though neither server available). i'm starting think can have single exclusion filter, can find docs anywhere speak that. doable on per-file basis? have single complex filter in support file, how incorporated when i'm doing run of single spec-file? ideally, ...

Facebook Event Json Mesage- how can i get it? -

i ask if know how grab facebook event json message. doesnt matter if has happen programatically. want able read message 1 way or another. thanks in advance. p.s. maybe awful question here go !!! i once had code small chunk of code parse json-encapsulated message. found out there's handy solution if use java resty small, convenient library talk restful services java. it’s surprisingly complex simplest http calls standard java library. resty hopes change that. http://beders.github.com/resty/resty/overview.html resty r = new resty(); object name = r.json("http://ws.geonames.org /postalcodelookupjson?postalcode=66780&country=de") .get("postalcodes[0].placename"); just import small jar lib , you'll surprised. use class getting info url api.

Connection Refused : IOException in android TCP/IP -

im newbie in android. ask if knows why i'm getting "connection refused" ioexception when try establish tcp/ip connection between 2 android device. tried ping both device , responding. please... in advance... e/tcp_ip connect thread( 7466): java.net.connectexception: /192.168.4.100:8080 - connection refused e/tcp_ip connect thread( 7466): @ org.apache.harmony.luni.net.plainsocketimpl.connect(plainsocketimpl.java:254) e/tcp_ip connect thread( 7466): @ org.apache.harmony.luni.net.plainsocketimpl.connect(plainsocketimpl.java:219) e/tcp_ip connect thread( 7466): @ java.net.socket.startupsocket(socket.java:781) e/tcp_ip connect thread( 7466): @ java.net.socket.<init>(socket.java:316) e/tcp_ip connect thread( 7466): @ com.neugent.wifi.tcp_ip$connectthread.run(tcp_ip.java:291) if it's missing internet permission, add line android.manifest file above <application> tag. <uses-permission android:name="android.permission.internet/> ...

c++ - Why has my program stopped working? Are my pointers wrong? -

i'm working on program reads data file formatted so: 21 285 270 272 126 160 103 1 31 198 180 163 89 94 47 1 32 240 230 208 179 163 104 1 33 15 13 12 14 15 15 0 34 63 61 62 24 23 20 2 i'm trying read first number 1 pointer array , other 7 numbers parallel 2 dimensional pointer array reason, every time run code stops working. it's not returning error feel pointer usage wrong because first time using pointers. data file called "election_data_121.txt", fyi. heres code. if take i'd grateful: #include <iostream> #include <fstream> using namespace std; //bool openfilein(fstream &, char *); int main() { const int prec_size = 30; const int canidates = 7; int *precinct_num[prec_size]; int *num_votes[prec_size][canidates]; cout << "declarations made." << endl; fstream datafile; //make file handle cout << "file object made." << endl; //open file , check opened corr...

How to Update this Table? using Php / Mysql -

Image
code in "inc/q/prof.php": <?php // insert comments database user provides $comm = mysql_real_escape_string($_post['addcomment']); // following line has changed: $pid4 = filter_var( $_post['pid'], filter_sanitize_string ); $commentdetail = $_post['addcomment']; $username = "###"; $password = "###"; $pdo4 = new pdo('mysql:host=localhost;dbname=####', $username, $password); $pdo4->setattribute( pdo::attr_errmode, pdo::errmode_exception ); $sth4 = $pdo4->prepare(' insert comment (info, pid, cid) values(?,?,?) select comm.cid professor p, comment comm, course cou p.pid = comm.pid , cou.cid = comm.cid; '); $sth4->execute(array($commentdetail, $pid4, $cid )); ?> html <form action='inc/q/prof.php' method='post'> <input type='text' id='addcomment' name='addcomment' tabindex='3' value='enter comment' /> ...

session - Subdomain cookie sharing in Rails 3 is not working (on Heroku)? -

i'm trying have cookies on site dapshare.com work both root address , 'www' subdomain. a lot of other stackoverflow answers (and great railscasts vid on topic) have suggested adding line session_store.rb: dapshare::application.config.session_store :cookie_store, :key => '_dapshare_session', :domain => :all this doesn't seem make difference: if log in @ dapshare.com, still not logged in @ www.dapshare.com. am doing wrong here? using following code store information in cookie: cookies.permanent.signed[:thing_to_store] = store_information thanks help! short answer: using 'cookies[:new_cookie] =' not seem grab domain session_store config settings. i added :domain new cookie , works: cookies.permanent.signed[:new_cookie] = {:value => new_value, :domain => ".dapshare.com"} for else reading, need specify domain when deleting cookie cookies.delete :new_cookie, :domain => ".dapshare.com" (thank...

iphone - Add login screen infront of TabBar in IOS -

i have application containing tab bar view , have login xib(login.xib) , corresponding class files(logincontroller) in same application. want when application launches, login file should loaded first , once click on login button, tabbar view should launched. tried lot many ways, nothing worked. :( latest 1 tried putting following code in appdelegate file @ end of application didfinishlaunchingwithoptions facing error: logincontroller = [[logincontroller alloc] init]; [window addsubview:tabcontroller.view]; [window addsubview:logincontroller.view]; [window makekeyandvisible]; return yes; error "logincontroller" undeclared. am missing something. please let me know if there other ways through can fulfill requirement. also, on clickbutton() inside login, using event touch inside. logincontroller = [[logincontroller alloc] initwithnibname:@"login" bundle:nil]; [window addsubview:logincontroller.view]; [window makekeyandvisible]; add following l...

python - How do Rpy2, pyrserve and PypeR compare? -

i access r within python program. aware of rpy2, pyrserve , pyper. what advantages or disadvantages of these 3 options? i know 1 of 3 better others, in order given in question: rpy2: c-level interface between python , r (r running embedded process) r objects exposed python without need copy data over conversely, python's numpy arrays can exposed r without making copy low-level interface (close r c-api) , high-level interface (for convenience) in-place modification vectors , arrays possible r callback functions can implemented in python possible have anonymous r objects python label python pickling possible full customization of r's behavior console (so possible implement full r gui) mswindows limited support pyrserve: native python code (will/should/may work cpython, jython, ironpython) use r's rserve advantages , inconveniences linked remote computation , rserve pyper: native python code (will/should/may work cpython, jython, iro...

c++ - Cdatabase in MFC -

how use cdatabase object connect oracle database in mfc? please suggest tutorial or example cdatabase uses ole db or odbc connection database. uisng odbc, (nearly?) specific database server going contained in odbc connection definition rather client code -- could, example, switch odbc connection connect ms sql server 1 time, mysql next, , oracle third time, no modification of client code. using ole db, little more of work ends in client, @kirill pretty right: of connecting 1 db server comes down connection string. vs appwizard can create @ least starting point connection string. big thing want/need change if you've given user-name , password appwizard, they'll embedded in connection string. that's unacceptable real code -- @ least password needs come somewhere @ least semi-secure (e.g., entered user not stored, @ least not permanently).

wpf - Sort ObservableCollection - what is the best approach? -

i have observablecollection , mydata class 4 properties i.e. int id, string name, bool isselected, string isvisible. this observablecollection binded combobox checkboxes(cities data example). now, when user checks checkboxes next time when opens drop down - selections should come on top in ascending order name. i have implemented auto complete when user types in 3 chars in combobox, drop down open showing selections first, then items starting 3 chars type in user. i have researched , implemented following code , working fine, want know whether best approach or can implement in better manner, code : ienumerable<mydata> sort; observablecollection<mydata> tempsortedcities = new observablecollection<mydata>(); sort = city.orderbydescending(item => item.isselected).thenby(item => item.name.toupper()) ; // city observablecollection<mydata> property in model binded combobox in ui foreach (var item in sort) ...

c# - ScrollViewer wpf - doesn't work -

i have wpf application. in window have textblock contains lot of numbers , each number in it's row. want scrollviewer appear when needed. doesn't work... here code <scrollviewer cancontentscroll="true" margin="5,25,5,0" grid.row="2" horizontalscrollbarvisibility="auto" > <textblock maxheight="500" height="auto" width="auto" verticalalignment="top" name="textblock_results"/> </scrollviewer> the text block in scroll viewer not capable of scrolling default. enable scrollviewer perform pixel based scrolling need set can content scroll false. the visibillity of 2 scroll bars controlled independently. have hidden vertical scroll bar in 1 bellow. <window x:class="wpfapplication1.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com...

"SQL Server Compact 2008" including spatial support -

i've read somewhere there "sql server compact 2008" including spatial support search it, can't find anywhere. example, there's nothing on https://connect.microsoft.com/sqlserver/content/content.aspx?contentid=5470 regarding compact version. does know scoop is? i have situation here, have created wpf application sql compact edition database , want store spatial data in it. using google maps , want use geography data type not supported in ce. now, should best approach should follow, should use express edition how encrypt data in db / make safe? you can store geography data in "image" column in sql server compact db, no support geography. can alos encrypty sql server compact db (as know already)

antlr - Can Xtext be used for parsing general purpose programming languages? -

i'm developing general-purpose agent-based programming language (its syntaxt inspired java, , using object in language). since beginning of project doubtful fact of using antlr or xtext . @ time found out xtext implementing subset of feature of antlr. decided use anltr our language losing possibility have full-fledged eclipse editor free our language (such nice features provided xtext). however, best of knowledge, summer xtext project has done big step forward . quoting link: what limitations of xtext? sven: can implement kind of programming language or dsl xtext. there 1 exception, if need use called 'semantic predicates' rather complicated thing don't think worth being explained here. few languages need concept. prominent example c/c++. want topic next release. and reinforced in xtext documentation : what xtext? no matter if want create small textual domain-specific language (dsl) or want implement full-blown general purpos...

http - How do i find out the Structure of a Java Object? -

i working httpexchange class, , want use getattribute function post parameters. if call function , print results works. there has better way access returned object , contained data. the manual here: http://download.oracle.com/javase/6/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/httpexchange.html#getattribute%28java.lang.string%29 how can access object? methods have? i not familiar api, appears httpexchange.getattribute not method use post parameters. rather mechanism sharing information within chain of filters. since implement filters , document , understand attributes can stored. to read post details, wouldn't httpexchange.getrequestbody ?

xml - Android problem with ArrayList of objects in SAX-parser -

i'm trying parse xml page build this: http://pastebin.com/t9cxdngs . i've implemented basic sax parser, following tutorial: anddev sax tutorial . it worked pretty well, except i'm getting values of last tag. solve this, i've implemented arraylist add each object that's made per xml node. i'm getting weird output. each node passes in loop, adds same value again. node 1, value once, node 2, value twice , on... (example: value1, value2value2, value3value3value3) i can't seem figure out what's wrong... here's full source code of page: http://pastebin.com/bkyz0g1u you re-using same object on , on again, ever add 1 object arraylist . replace line: private vacature vacature = new vacature(); with private vacature vacature; and add line: vacature = new vacature(); right after declaration of characters() method: public void characters(char ch[], int start, int length) { i suspect getvacatures() should return arraylist ar...

osx - Problem in porting Chicken of VNC Mac application into iphone application -

Image
i'm porting chicken of vnc mac application iphone application i having source code of chicken of vnc mac application take vnc of lan connected mac. have same iphone app. while debugging mac source code not able figure out how mac app establish authenticated vnc connection? my current progress have done progress. able connect lan connected mac , can take vnc of it. think way doing wrong. calling unstoppable timer again & again [conn starttalking] , making rfbconnection server on every mseconds uninterrupted connection. right way ? arise new problem cannot scroll vnc view because on every mseconds screen refreshing new rfbconnection. can 1 guide me ? its pretty strange none of experts sharing views on thread see section 7.1 (handshaking messages) , 7.2 (security types) of this page describing rfb protocol .

java - Simple login and logout capabilities for my web app(JSF 2.0) -

this morning rode chapters 39,40 , 41 of jee6 tutorial. very, confused. don't have background on web-app security jee6, , having big difficulties understand , implement. i need create authorization mechanism web app, scenario not simple begginer in jee6 me decided try find easiest way it. i thought explain idea, can correct me , give me advice on how best easiest way it. idea: my web app uses primefaces component called dock pops log in dialog when use clicks in last item. navigation tool located in jsf template used other pages in application. <h:body> <p:dock position="top"> <p:menuitem value="naslovna" icon="unsecuredimages/naslovna.png" url="main.xhtml" alt="the image not found." /> <p:menuitem value="register" icon="unsecuredimages/register.png" url="registration.xhtml" alt="the image not found." /> <p:menuitem valu...

ios4 - iPhone login screen problem -

i have large application. has lot of tables , navigation between them. started project 'navigationbasedproject' (xcode template). need add login @ start of application. here did far: in 'didfinishlaunchingwithoptions' added: loginviewcontroller = [[loginviewcontroller alloc]init]; [loginviewcontroller.view setframe:cgrectmake(0, 0, 320, 480)]; [self.window.rootviewcontroller presentmodalviewcontroller:loginviewcontroller animated:no]; when user data valid dismiss login screen this: [self.loginviewcontroller dismissmodalviewcontrolleranimated:yes]; user can logout application. , present login screen again this: [self.window.rootviewcontroller presentmodalviewcontroller:loginviewcontroller animated:no]; and works. text fields on login screen still filled data user enter login. , afraid have memory issue here. how remove login screen memory when user logs in. don't use gui designer connect code. wonder idea make login screen , modal view...

css - Horizontal flyout menu using display:inline -

is possible create horizontal flyout menu without using float ? tried in this fiddle display:inline . aim have result second example. unfortunately had work float ... do have idea missing? if have link, etc. post it, please. your appreciated. edit: how far got... http://jsfiddle.net/gbmsq/2/ the second list-item should have list under it. set under first list-item. like this? working example: here example 3 uses display: inline-block instead of float , , vertically aligns blocks top updated fiddle updated show first example , latest 1 in op.. both use same css