Posts

Showing posts from February, 2014

jsp - How to loop the value stored in session? -

sorry interrupt of you. i have question session. in case, need check session has stored value or not. if session not null, want loop value comparison. now, use if statement check last record of book id repetitive or not. but don't know how use loop check there book id repetitive or not. would 1 provide advice me acheive goal? many thanks. here source code: <%@ page contenttype="text/html; charset=big5"%> <%@ page import="java.io.*" %> <%@ page import="java.sql.*" %> <%@ page import ="javax.sql.*" %> <%@ page import="java.util.*" %> <%@ page import="java.lang.*"%> <%! public class bookinfo { private string id; private string name; private int count; public bookinfo(string id, string name, int count) { this.id = id; this.name = name; this.count = count; } public string ...

android - Image sd card path from intent gallery -

i starting gallery through intent otherwise giving problem display gallery in grid view. want actual sd card path of image selection gallery, opened intent. here code.. intent photopickerintent = new intent(intent.action_get_content); photopickerintent.settype("image/jpg"); photopickerintent.putextra(intent.extra_stream, uri.parse("file:///sdcard/pictures/image.jpg")); startactivityforresult(photopickerintent, 1); protected void onactivityresult(int requestcode, int resultcode, intent intent) { super.onactivityresult(requestcode, resultcode, intent); if (resultcode == result_canceled) { showtoast(this,"activity cancelled"); return; } else if(resultcode == result_ok) { system.out.println("requestcode--"+requestcode); system.out.println("resultcode--"+resultcode); system.out.println("data--"+intent.g...

python - What is the trick in this website? -

i can access webpage in firefox browser: http://www.ip-adress.com/ip_tracer/74.82.190.99 can information ip. however, when fetch using python, there errors: import urllib f = urllib.urlopen("http://www.ip-adress.com/ip_tracer/74.82.190.99") print f.read() i error: <!doctype html public "-//ietf//dtd html 2.0//en"> <html><head> <title>403 forbidden</title> </head><body> <h1>forbidden</h1> <p>you don't have permission access /ip_tracer/74.82.190.99 on server.</p> </body></html> i take page's source code: <form action="/ip_tracer/" method="post"> <div> <input id="ipqry" name="qry" type="text" value="74.82.190.99" size="18" maxlength="255" onclick="cleanup(this)"> <input type="submit" value="track ip, host or website" onclick="progress...

iphone - Ads providers for mobile application -

i monetize free mobile application of ads. what mobile ad solutions available on market? have dedicated sdk android or iphone? only solution know admob. are there solutions dedicated central european market? there many avaliable like: admob greystrip mobclix and iphone iad

.net - WPF Editable ComboBox Text Search Behavior -

i have combobox binded entity observablecollection on itemssource. this: key desc1 desc2 c0001 mydesc mydesc d0001 mydesc mydesc a0001 mydesc mydesc the combobox defined: <combobox iseditable=true displaymemberpath="key" selectedvaluepath="key" itemssource="{binding path=mylist, mode=oneway}" /> now have problem... if type character on empty editable textbox of combobox, first element "startswith" typed character matched. so, if type "c", selecteditem element "c0001"...and avoid this! i different search logic find selecteditem based on full text typed. in way: text typed selecteditem c null c0 null c00 null c000 null c0001 [c0001, mydesc, mydesc] ok! is possible? how can do? this behaviour has been combos in windows. if want this, you're better off search field , pickable list of results. ...

ASP.Net calculate City from ZIP? -

i have user registration. in this, of course, user must enter zip. now make way in city calculate zip. the idea have myself database-table (or txt-file) , in table / file city. is best / fastest way or there another? hosting database 1 possibility, use service on cloud. here's 1 such service .

Easier way to run a Java application from Maven? -

if have understood correctly, need type run project maven: mvn compile mvn exec:java -dexec.mainclass="com.foo.bar.blah.main" is there way can make simpler? optimally do mvn run 1) create new profile called "run" (or name of choice) <profiles> <profile> <id>run</id> 2) set profile's default goal "verify" (or can choose "install", choosing phase after compile ensure code automatically compiled before running class) <profiles> <profile> <id>run</id> <build> <defaultgoal>verify</defaultgoal> 3) add exec-maven-plugin profile (see this ), configure run in 'verify' phase. <execution> <phase>test</phase> 4) can run class using following: mvn -prun

visual studio 2010 - how to add double or datetime type in attribute in class diagram in modeling project? -

Image
how add double or datetime type in attribute in class diagram in modeling project? right-click class on diagram , choose add | field context menu. type in type column type, there should intellisense ready you. by way, talking issue:

CSS min-height not behaving as expected -

Image
three boxes, container, left box , main box. /* left menu */ .leftmenu{ width: 200px; border:2px solid green; height:100px; float:left; min-height:100%; } /* main content area */ .mainbox{ border:2px solid red; min-height:100%; } .mainwrapper{ border:2px solid white; } with html: <div class="mainwrapper"> <div class="leftmenu"> left </div> <div class="mainbox"> main<br /><br /><br /><br /><br /> </div> </div> my question is, why green box (left menu) overflowing outside wrapper? to solve it, either have <div style="clear:both"></div> before closing outer div or use clearfix (recommended) at: http://positioniseverything.net/easyclearing.html

authentication - How to Get User unique identification upon Gmail login using Zend Framework -

i had implemented oauth google using zend framework . can right user authenticating using gmail id , password , after displaying google docs. how identify user whether old user or new user. what unique identification google providing after login in our website. thank you $consumer = new zend_oauth_consumer($oauthoptions); if (!isset($_session['request_token'])) { $_session['request_token'] = serialize($consumer->getrequesttoken(array('scope' => implode(' ', $scopes)))); $approvalurl = $consumer->getredirecturl(array('hd' => 'default')); echo "<a href=\"$approvalurl\"><h2>login google</h2></a>"; exit(0);} if (!isset($_session['access_token'])) { if (!empty($_get) && isset($_session['request_token'])) { $_session['access_token'] = serialize($consumer->getaccesstoken($_get, unserialize($_session['request_token'])));} }} $acces...

How to use push notification in titanium for Android -

i have worked in android , got small apps in android. newly working in titanium. i stuck on how push notification in titanium android? problem little worse. need push notification versions of android. google providing c2dm v2.2 , above. got know urban airship not sure used in titanium. use urban airship need install seperate app not recommended. support highly welcomed. please response possible. in advance. rai, it's not form ask, essentially, same question in multiple ways. need read on titanium api, answered in how write android code in titanium

asp.net - Setting the date format on an excel cell programmatically -

i generate excel sheet aout of table in asp. exporting works fine using in-house developed framework export table. problem i'm having dates written in columns strings , not initialized proper cell format. there way format date without 3rd party software setting value of cell string?? such as: sheet[i,j].value = "{:datetime}"+datestringproperlyformatted i'm not in front of appropriate box test @ moment, should able format range like: rangeofinterest.numberformat = "mm/dd/yyyy" the range single cell, or whatever you'd like. entire row with: rangeofinterest.entirecolumn.numberformat = "mm/dd/yyyy" there's :"entrerow" version too, although don't recall having ever used it.

javascript - Combo box behaviour in IE7 -

hi know not idea due 1 use case populating combo box more 10000 items. behaving weired in ie7 in other browsers working fine in ie7 taking time downloading page. sometime ie7 hangs up is there known bug ie7 issue. thanks, amit not sure whether can done speed up. 1 thing loading options dynamically through ajax, , adding them dom nodes existing select element. @ least allow whole page load before rest of data fetched. there ready-made js/jquery-based ajax combo boxes well. 1 loading strategy might yield better results. i have no experience them can't tell 1 suitable you, these seem worth checking out: dhtmlxcombo (not free) more in this question

socks - Perl Socket Connection Check -

i've been trying debug perl issue awhile had made no head way. i'm trying determain if connection socks4/5 connection. # ./pctest.pl name "main::junk" used once: possible typo @ ./pctest.pl line 60. name "main::empty" used once: possible typo @ ./pctest.pl line 60. io::socket::inet: bad hostname 'c1(x' ...propagated @ ./pctest.pl line 52. i've had error (before added or die @$; @ end): can't use undefined value symbol reference @ ./pctest.pl line 56. . ... $look = io::socket::inet->new( peeraddr => $_, proto => 'tcp', timeout => 5 ) or die @$; $sock4 = pack( "ccs", 4, 1, 80 ); print $look $sock4; read( $look, $recv, 10 ); ( $empty, $granted, $junk ) = unpack( "c c c6", $recv ); if( $granted == 0x5a ) { print " yes\n"; } else { ...

c# - FOR UPDATE inside a transaction doesn't lock rows -

i made test select row, created previously, 2 threads: create table `customers` ( `id` int(11) not null auto_increment, primary key (`id`), ) engine=innodb var t1 = new thread(new threadstart(delegate() { using (var conn = new mysqlconnection("server=localhost;database=test;uid=root;pwd=test;")) { conn.open(); using (var trans = conn.begintransaction()) { using (var cmd = new mysqlcommand("select id customers id = 8534 update;", conn, trans)) { using (var reader = cmd.executereader()) { console.writeline("enter t1: " + reader.read()); thread.sleep(2000); console.writeline("exit t1"); } } } }; })); var t2 = new thread(new threadstart(delegate() { using (var c...

linux - perl one-liner like grep? -

i'd perl one-liner grep a bit this, i'm not sure add make work $ (echo ; echo b ; echo c) | perl -e 'a' added answer here covers , more https://superuser.com/questions/416419/perl-for-matching-with-regex-in-terminal (echo a; echo b; echo c) | perl -ne 'print if /a/'

c# - how to exclude app.config from setup deployment project -

how exclude app.config setup deployment project? i must maintain encrypted sections in app.config , (semi) embeded way know running code rsaprotectedconfigurationprovider or dpapi provider. since have run code question arises: when run it. since there seem problems using rsa under windows 7 (some end user's not have admin rights on it) concentrated on dpapi machine dependent. therefore can not encrypt app.config on developer machine. have on target machine. if application not find config files, creates one. , that's trying do: exclude app.config msi setup project, whe app run first time, settings created defaults , encryption code runs on it. hope clear enough. in setup deployment project primary output folder enter in exclude property: app.config

math - Drawing a plane -

i want draw plane given equation: ax+by+cz+d=0. first tried draw him seting x,y , z equation. did not work fine because there planes 0x+0y+z + 0 = 0 , etc... my current solution this: - draw plane on zy plane giving 4 coordinates goes infinity. - find out rotation should done in order bring normal of given plane(a,b,c) lay on z axis. - find translation should done in order plane on x axis. - make opposit transformation rotation , translation hence the plane in place. ok this great thing can make proper math calculations(tried alot of times...) dot product , etc.... can me in understanding exact way should done or give me formula in put abcd , right transformation? any helpful! is you're asking? transforming simple plane xy plane plane simple: your plane ax+by+cz+d=0 the xy plane z=0. i.e. a=b=d=0, while c=whatever want. we'll 1 simplicity's sake. when have plane in form, normal of plane defined vector (a,b,c) so want rotation take (0,0...

c# 4.0 - Ajax Script manager problem -

i developed 1 webapplication. in 1 web page shows " 1 instance of script manager allowed " error displayed. have override master page script manager . there way it. then use tool script manager control override master page script manager problem.

cakephp column mapping -

i have started working cakephp, complete newbie working in framework , have taken on legacy system pretty awful database structure. went in , added primary keys tables didn't have them. however, can't find information on map columns in model, , use links can oriented in area. i'm starting user table, has been named "system". created model called user: class user extends appmodel { var $name = 'user'; var $usetable = 'system'; } i want map columns property names more in line conventions without changing existing database, since using table. table structure is: table: system field name datatype nullable default ------------------------------------------------------------------ user_id tinyint(4) no none auto_increment s_rec_type tinyint(4) yes null s_user_id varchar(20) yes null s_init char(2) yes null s_password varchar(12) yes null ...

c# - Winform freezes when I try to close it -

i have following code private void btnclose_click(object sender, system.eventargs e) { close(); } // btnclose_click after running close winforms function application freezes. idea why can happen? i use .net 2.0 , run under windows 7 vs2005 edit: after pressed pause in debugger came private void mainform_closing(object sender, system.componentmodel.canceleventargs e) { // gui if (fscannerthread_running) { fscannerthread_running = false; fscannerthread.join(); } } and stacked in fscannerthread.join(); idea how can kill ? use bool thread.join(int milliseconds) overload, , if result false, abort() thread. private void mainform_closing(object sender, system.componentmodel.canceleventargs e) { // gui if (fscannerthread_running) { fscannerthread_running = false; if (!fscannerthread.join(1000)) // give thread 1 sec stop { fscanner.abort(); } } } note should catch threadabortex...

java - Increment an object name within a loop -

i using loop create grid of 60 jbuttons. want have name of actionlistener increment each time loops runs: for (int y = 0; y < game.getheight(); y++) { (int x = 0; x < game.getwidth(); x++) { jbutton square = new jbutton(); square.setfont(new font("verdana", font.plain, 20)); actionlistener bh = new button_handler(); square.addactionlistener(bh); grid.add(square); } so name increment (bh_1, bh_2, bh_3, etc). thanks! if goal able keep track of actionlisteners name after creation, want use array this. (if not why want name them differently, need more info.) assume have actionlistener[60] called actionlisteners , counter called buttoncount . jbutton square = new jbutton(); square.setfont(new font("verdana", font.plain, 20)); actionlistener bh = new button_handler(); actionlisteners[buttoncount++] = bh; // store handler in array later square.addactionlistener(bh);...

c++ - How can I use Boost.Bind on compound types? -

i have std::map<int, std::pair<short, float> > , , need find minimal short in map. how can use boost::bind std::min_element() this? boost::lambda ? the map iterator give pair first int key , second map's pair value, if had iterator it , you'd want minimum of it->second.first values. min_element function expects comparison function third argument, need build comparison function projects second.first of 2 arguments. we'll start typedefs make code more readable: typedef std::pair<short, float> val_type; typedef std::map<int, val_type> map_type; map_type m; we're going use boost.lambda overloaded operators, allowing use operator< . boost.bind can bind member variables member functions, we'll take advantage of that, too. #include <boost/bind.hpp> #include <boost/lambda/lambda.hpp> using boost::bind; // comparison (_1.second.first < _2.second.first) std::cout << std::min_element(m.beg...

c++ - Drawing any rectangle to a GTK+ DrawingArea fills the whole DrawingArea -

i have gtk+ drawingarea should display rectangle in top left corner. when draw rectangle using cairo, whole drawing area filled color of rectangle. how can prevent that? why cairo that? doing wrong? #include <gtkmm.h> class window : public gtk::window { private: gtk::drawingarea area; bool on_area_expose(gdkeventexpose* event) { gtk::allocation allocation = area.get_allocation(); cairo::refptr<cairo::context> context = area.get_window()->create_cairo_context(); int width = allocation.get_width(); int height = allocation.get_height(); context->set_source_rgba(0, 0, 0, 1); context->rectangle(0, 0, double(width)/10, double(height)/10); context->paint(); return true; } public: window() : gtk::window() { area.signal_expose_event().connect( sigc::mem_fun(*this, &window::on_area_expose)); add(area); } }; int main(int argc, char* argv[]) { gtk::m...

asp.net mvc - jqGrid evaluation -

before dive deep using jqgrid have few questions others have invested lot of time might answer. does support easy/simple hidding of columns, instance, in application users have option choose own settings, , might set column hidden? require conditional rendering of js, html , data preparation (in mvc controllers)? is possible use without ajax posting functionality , instance, when edit row (inplace or dialog) update html (to exact, dom) don't ajax post yet until doing "full" postback? in general, suitable cases our data not yet exist in datastore (we creating on fly , data inserted after postback)? you might consider scenario have create new invoice form , part of invoice there multiple invoice items. these of course cannot saved prior saving invoice (we need invoice attach items it). postback entire form, create invoice , enumerate table items insert invoice items. hopefully worked heavily jqgrid know answers. 1) jqgrid column definition support hi...

.net - Exception when change Border property from other thread -

i've component in wpf, component use border , use border background property change background color of entire component. the problem, when try alternate between 2 different colors, timer, invalidoperationexception thrown. "the calling thread cannot access object because different thread owns it". on timer method put code change border properties in dispatcher object. mainborder.dispatcher.begininvoke((threadstart)delegate() { mainborder.borderbrush = mybrush; mainborder.background = mybrush; }, null); but exception thrown , not understand doing wrong! example in same time doing code lbholderservico.dispatcher.begininvoke((threadstart)delegate() { lbholderservico.foreground = new solidcolorbrush(holdlabelsfontcolor); }, null); to change label font color , works fine. thanks , regards an alternative define brushes/animations resources , start animations or assign brushes when n...

iPhone: Display a semi-transparent video on top of a UIView? -

is possible have semi-transparent video (created blue-screen) playing on top of uiview ? wondering in case that's not doable mpmovieplayerviewcontroller might using opengl es , video texture ? thank in advance, f. it possible using ffmpeg library. here link, can download example link then have set alpha property uiimageview. i'm not sure performance, try :)

Xcode, iphone, Sqlite, need a sign function for group by? -

i need sql sign function group query group positive , negative amounts. unfortunately sqlite doesn't include one. can suggest workaround ? or how ad 1 work libsqlite3.dylib framework used in xcode ? my query quite complicated select fcid, sum(price), (select sum(price) tmp b ((b.due < a.due) or ((b.due = a.due) , (b.pid <= a.pid)))) accumulated_price tmp due >= '2011-01-25' , due < '2011-02-24' , price <> 0 group fcid order due, pid; what i'm trying do, group on sign(price) 2 result , negative value , positive value. these represent total expenses , total income. would have added these tags (but i'm not allowed create new ones libsqlite3.dylib libsqlite3) don't know if it's best choice, can try: select your_val > 0, sum(aggregated_value) your_table group your_val > 0; this way, should have 0 0 or negative values , 1 positive values. update: if fcid field need sign for, can try: sele...

html - Div layout with 3 columns: fixed - liquid - fixed -

i'm trying build 3 column layout has 1 fixed column on left, fluid column in middle , fixed column on right. anyone seen this? there similar problems here, not solution looking for. css layout 2-column fixed-fluid http://www.dynamicdrive.com/style/layouts/category/c13/ http://www.dynamicdrive.com/style/layouts/item/css-liquid-layout-31-fixed-fluid-fixed/ yes?

networking - Problem during the insatallation of NS 2.29 on windows -

i have install ns 2.29 network simulator on windows, first installed cygwin. while installing ns2 can not detect xorg-x11-base neither xfree86-base, again installed x11 package , installed xcygwin, components installed, still ns2 can't recognize it. tried install ns2 regardless of after 80 % of installation error occurred. "./sctp/sctp.h:705:error: qualification 'sctpagent::' on member 'dumpsendbuffer' ".

objective c - xcode debugger value of expression -

in xcode, insert breakpoint @ line.. say line is: abc = [books valueforkey:@"officialname"]; x = [appdelegate.books count]; my question in debugger, if hover on abc, display value but if want see runtime value of expression "appdelegate.books count" it not show value. how can value of expression normal var ? this unorthodox, in order find in loop (see hmthur's comment in other answer): for (x=0;x<[arr count];x++) firstly, spread loop on 3 seperate lines, can debug step them 1 bit @ time: for (x = 0; x < [arr count]; x++) now put breakpoint @ start of loop. step down x < [arr count] has been executed, not x++ now in watch window of debugger, open registers group. the result returned [arr count] present in $eax register. this unorthodox, don't rely on developing life-critical software! stick original answer in interests of sanity.

python - Move items from one QListWidget to another -

i have qlistwidgets, 1 source list, 1 destiny list , 1 button. whenever button clicked, want selected item(s) source list removed , inserted destiny list. tried source_list.removewidgetitem(aselecteditem) not thing. :( doing wrong? need update list afterwards somehow? takeitem take item source_list , give pointer can use append destination list. like: source_list = new qlistwidget(); dest_list = new qlistwidget(); new qlistwidgetitem(tr("oak"), source_list); new qlistwidgetitem(tr("birch"), source_list); connect(source_list, signal(clicked(qmodelindex)), this, slot(swapentry(qmodelindex))); void mywidget::swapentry(qmodelindex index) { dest_list->insertitem(dest_list->count(), source_list->takeitem(index.row())); }

How to write this SQL query in Linq To SQL -

i know how write following sql query in linq. i've tried without luck. /*variable*/ topicid = '4a31c2ee-48af-4b87-b300-112acb822ad0' select * contents c left join contenttotopicrelations ctr on ctr.contentid = c.contentid , ctr.topicid = topidid ctr.contentid null basically, contents not in contenttotopicrelations table for particular topicid . datacontext.contents.where(c => !datacontext.contenttotopicrelations.any(ctr => ctr.contantid == c.contentid && ctr.topicid == topicid)) it identical select * content not exists(...) . , in general case better left join , checking null (it depends on table statistics but..), because give (again, in general case) semi left join instead of left join (in execution plan). for left join use code following (but recommend using code generates not exists task): c in datacontext.contents join tempctr in datacontext.contenttotopicrelations on new { c.contentid, topicid) equals new { tempct...

jquery - Select only one element at a time from a group ("OR" case) -

i have group or list of elements, , need select 1 element list, in "or" case: select 1 or one, not more one . in following demo you'll see accordion has 2 lists, top , bottom. top list ( title 1 ) should have "or" case; bottom list working fine "and" case. i'm not sure if solution needs separate function work (which i've tried myself, no success), or if has included in main function. i think need give corresponding ul own class able target it, that's did: <ul class="acitem or-list"> . fyi, did not create majority of script, received doing since i'm starting delve jquery. any on appreciated. thanks. have considered radio button group instead of list 1? you seem trying replicate behavior, , far more robust use compnents have "or" behavior naturally. can pretty theming radio buttons jquery ui. see demo . in similar way, replace list 2 checkboxes ( demo here ).

r - Sorting a Square Matrix -

i have 75 x 75 square matrix. values in it, other labels decimals. want pairs of labels having values above or below cutoff set. say, have following b c d 1 0.2 0.43 0.16 b 0.2 1 0.86 0.28 c 0.43 0.86 1 0.76 d 0.16 0.28 0.76 1 i want b c 0.86 c d 0.76 c 0.43 how can go (without getting duplicates)? thanks first need convert representation 1 row each value; 1 way converting matrix , data.frame. avoid duplicates, set lower triangle (possibly including diagonal) na before converting data frame, , take subset of data frame values aren't nas. mtx <- matrix( rnorm(16), 4, 4, dimnames = list( letters[1:4], letters[1:4])) mtx[lower.tri(mtx, diag=true)] <- na dx <- as.data.frame(as.table(mtx)) dx <- subset(dx, !is.na(freq)) you can take subset desired resulting data frame. > subset(dx, freq>0) var1 var2 freq 5 b 1.9564158 9 c 1.7188939 14 b d 0.1848542...

javascript - ASP.NET - onclick attribute added to Button means page cannot determine source of postback -

i've added javascript onclick of button in asp.net disable button (in order prevent user submitting form twice). when click button, page posts fine no control event handler runs - asp.net seems unable determine control posted page back. i'm bit stumped unexpected behaviour. can explain , suggest alternative way of doing this? try this: <asp:button id="button1" usesubmitbehavior="false" onclientclick="javascript:document.getelementbyid('button1').disabled = true; __dopostback('__page', '');" onclick="button1_click" runat="server" text="button" /> it'll come through no request inspection needed. after comment how add onclick: add _ dopostback(' _page', 'yourbuttonname') , inspect event args on server side.

php - SPHINX (search) : faking sql like on query -

i pretty new sphinx, have question it. let's have table called tv_releases my sphinx.conf contains (small portion) : source tv_releases { type = mysql sql_host = localhost sql_user = --------- sql_pass = --------- sql_db = -------- sql_port = 3306 sql_query_pre = set names utf8 #ingore example ( delta updates ). sql_query_pre = replace title_counter select 3, max(id) tv_releases sql_query = select id,rel ,tv_id,total_subs tv_releases\ #ignore example ( delta updates). id<=( select max_doc_id title_counter counter_id=3 ) sql_attr_uint = total_subs sql_attr_uint = tv_id } indexing fine , querying also. now sphinxapi ( php ) (portion) : $sp = new sphinxclient(); ---... $sp->setmatchmode(sph_match_all); $sp->setarrayresult(true); $sp->setlimits ( 0, 100); $sp->setsortmode ( sph_sort_extended, "@relevance desc, ....more options" );...

Issue with php strtotime function when using ordinal values -

i sometime unexpected results when using ordinal values strtotime. example, why date("m j", strtotime("second tuesday february 2011")) result in "feb 15" (which third tuesday in 2011? you missing 'of'. $ php -r 'echo date("m j", strtotime("second tuesday february 2011"));' feb 15 $ php -r 'echo date("m j", strtotime("second tuesday of february 2011"));' feb 8 php version: $ php -v php 5.3.3 (cli) (built: aug 22 2010 19:41:55) copyright (c) 1997-2010 php group zend engine v2.3.0, copyright (c) 1998-2010 zend technologies the documentation tells cause this: also observe "of" in "ordinal space dayname space 'of' " , "'last' space dayname space ...

Read a file into a multidimensional array with dynamic allocation in C -

how can read data file structure 1 below multidimensional array of integers in c? file: 3 4 30 29 23 43 4 43 i need put inside of "int** matrix" variable using dynamic allocation. updated: i want example code can go on , study relation between functionalities listed below: multidimensional arrays , relation pointer-to-pointer; dynamic allocation of memory , explanation it's use; how deal data coming external source don't know size of, how separate rows/cols our array inside of c program. sharing code: int** buildmatrixfromfile(char* infile, int rows, int cols){ file *fpdata; // deal external file int** arreturn; // hold dynamic array int i,j; // walk thru array printf("file name: %s\n\n", infile); fpdata = fopen(infile, "r"); // open file reading data arreturn = malloc(rows * sizeof(int *)); if (arreturn == null) { puts("\nfailure trying allocate room row poin...

ruby on rails - Problem getting cucumber scenario with selenium and xhr post to work -

i have cucumber scenario test xhr post returns js code used modified page. the problem i'm having when test manually works both in ff or chrome, when run cucumber , selenium not working (with firefox). did debugging , i'm getting js answer correctly, not being executed since doesn't modified page need. i'm using jquery sexy post , part in charge of executing response in: if (config.autoclear && (xhr.status >= 200) && (xhr.status <= 204)) clearfields(form); form.trigger("sexypost.complete", [xhr.responsetext]); it seems form.trigger("sexypost.complete", [xhr.responsetext]); not being executed, if put alert like: alert(xhr.responsetext); i can confirm answer indeed correct one. has had similar problem before?. udpate i figure out trigger being executed, though isn't call eval. eval(xhr.responsetext); try changing post get. had same issue running selenium , pantomjs. using $.ajax() post returne...

network programming - Cant choose the right networking solution for my Java app -

i writing distributed java application make heavy use of networking, , needs fast . let's pretend have class called widget . widgets created client-side (most swing box) need persisted server-side , shared/distributed amongst other connected clients. so, need way serialize widget instances, send them server, server manage them , update connected clients state changes in widgets interested in. (so, once widget created , sent server-side, can theoretically "pulled down" , modified other client. performance must, must binary protocol. prefer non-blocking sockets, , very, scalable. so i'm looking @ rmi, nio , netty feasible solutions. if understand java networking correctly, seems indicate rmi considerably slower nio. i've heard rmi lacking in scalability department. nio on other hand, gives more flexibility , considerably more complicated. netty seems have best documentation, seems slower nio , may not capable of need do. for widget distribution, i'm...

PHP SimpleXML question...iterate through each line of XML determine tag used -

im intermeediate php developer trying take first shots @ parsing through xml. understand basics, looping through nodes , printing them , attributes. 1 thing im lost on how examine , write conditions on tag names in xml document? so need read each line of xml file: determine if open <level> tag , replace <ul> determine of <file> tag , replace <li>file</li> determine if </level> tag , replace </ul> the level tags have attributes telling them apart. the xml looks this <level dirname="1"> <file>filename1</file> <file>filename2</file> <file>filename3</file> <file>filename4</file> </level> <level dirname="2"> <file>filename1</file> <file>filename2</file> <file>filename3</file> <file>filename4</file> </level> <level dirname="3"> <...

Windows 7 integration with Delphi -

i need components integrate app windows 7. i'm talking taskbar's ability have progressbar, buttons, text , on. what best know? i don't know components, i've seen few blog posts explain how implement yourself. check out http://www.drbob42.com/examines/examinc5.htm , http://alex.ciobanu.org/?p=215 , example.

c# - accesing the value of properties using reflection -

i have object , want write , xml element each property in object , value string in middle: system.type type = cabecera.gettype(); system.reflection.propertyinfo[] propiedades = type.getproperties(); xml.writestartdocument(); xml.writestartelement("factura"); xml.writestartelement("cabfac"); //inicio de cabecera // imprime inicio valor y fin de elemento por cada propiedad del objeto foreach (system.reflection.propertyinfo propiedad in propiedades) { xml.writestartelement(propiedad.name); xml.writestring("value"); // here problem xml.writeendelement(); } xml.writeendelement(); //fin de factura xml.writeenddocument(); xml.close(); how can change "value" propiedad.value x) try: xml.writestring(propiedad.getvalue(cabecera, null).tostring());

apache - Perl CGI Scripts cannot find modules in library -

this apache / perl problem having. i using cpan module in perl cgi application. spreadsheet::parseexcel i have installed cpan module tar.gz files. i have installed dependencies. however, did non-root user. library contains these files under user folder, /home/user/lib now, have configured apache2 on box. html directory /var/www/html , cgi folder /var/www/html/cgi-bin. have verified work because of scripts in folder not require special modules work in firefox browser, ie. hello world, data dumps, simple forms. however, when try run scripts use "spreadsheet::parseexcel", error module cannot found in @inc. however, have "use lib" statement @ beginning of script adds library. the scripts can run in putty without problem. when running script browser getting issue. this web application written on box , works fine on box. because developped there of course. put apache2 on personal ubuntu machine, , installed web application , modules here, , works on ...

html - What exactly is the HTML5 <command> tag and what is the browser support -

i've read html5 spec <command> , found information on element vague. i've tried out , found not working in chrome (latest version) , is working on safari (even older ones), sorry no ff (don't shoot me please) - mac test. i can't understand use of element or if i'm using correctly. i thank in advance clarification it! it works on firefox 3.6.13 windows way. the command element meant encapsulate can do. can rendered within menu (since menu presents items can invoke). the idea it provides abstraction layer between ui , commands, can make multiple ui elements refer same command. gives flexibility of having 1 command element, rendered in menu, invoked via url in middle of page button @ bottom of page. disabling command disables access paths (url/button/menu) action behind command. where @ - of 26 jan 2010 there scarce information how linking multiple elements work (since browsers have started implementing it!) 1 of intentions. ...

html - @font-face not cooperating in Firefox -

i have tried numerous things, including clicking on of questions related question (there tons!) , tried of "solutions" none worked me. tried wrapping .eot file in conditional ie statement didn't work either. said @font-face won't work in firefox if not hosting file on own server... or that. anyway, go here see comparison between other browsers vs firefox. please don't bash! did try every solution google , stackoverflow had offer. (keep in mind tumblr theme, , files/images must hosted via tumblr's uploader .) thanks in advance! also, here code have been using: <!--[if ie]> <style> @font-face { font-family: 's'; src: url('http://static.tumblr.com/ctwb3zj/5btlflus9/zegoelight-u-webfont.eot'); } </style> <![endif]--> <style> @font-face { font-family: 's'; src: url('http://static.tumblr.com/ctwb3zj/5btlflus9/zegoelight-u-webfont.eot'); src: local('s'), local('s'), ...

c++ cli - How can I force a listbox to a certain height? (height is automatically adjusted so the bottom row is not partially visible) -

i resizing , positioning listbox this: rectangle r (x, y, width, height); listbox->bounds = r; the height seems automatically adjusted become multiple of height of item. (making these numbers up): if height of each row 10, , set listbox height 105, automatically adjusted become 100. happens when listbox not populated. result minor cosmetic problem occurring when user re-sizes window (and listbox re-sized along it). is there way force height? setting integralheight property false allows partial display of items. listbox height can adjusted arbitrarily.

wordpress - PHP Include based on date -

trying change includes based on specific date. work: if (date('m/d/y') < date('m/d/y', strtotime("01/10/2011"))) { //display } else if (date ('m/d/y') >= date('m/d/y', strtotime("01/10/2011")) && date ('m/d/y') <= date("m/d/y', strtotime("05/10/2011")) // display else else { //display different } if understanding strtotime function correctly, figure work. not sure understanding correctly. let me know! date returns string 2011-01-26 , can't compare string 2011-02-23 useful result. need compare timestamps produced strtotime or time : if (time() /* (now) */ < strtotime('2011-01-26')) ...

vb.net - How to separate paragraphs in a textbox? -

if have textbox, , want generate paragraph it, makes sense want use linebreaks. idea? for line break specify environment.newline in str = "this line" & environment.newline & " , " & environment.newline use 2 newline paragraph separation para = environment.newline & environment.newline & "my para body" & environment.newline & environment.newline put text in textbox mytxtbox.text = str

iphone - three20 TTTabBar performance? -

i used tttabbar in three20 library. seems simulator. scroll speed slower in device (iphone 4). all did replacing few names in it. curious if maybe did wrong. tried sample project provided library. , it's slow too! how use not slowly? i think tttabbar used in 'usa today' app. looks same, it's not slow. there must way. it can depend on content going load (meaning web content), images web service in scrollview. or maybe have provided animation component within scrollview. check out. if animation give minimum animation time device can not respond fast touch or gesture in simulator. is three20 library free of cost? have 1 pdf book turn pages gesture (how can know particular library free of cost?).

How connect to Java program from Oracle -

i want copy folder , included in ftp oracle. i found out work little bit hard oracle decided write program in java , copy file java program dont have idea how can make connection between oracle program , java. i want submit source folder , destination folder , java program copy me , if copy completed inform oracle program(form). would please advise me should use java ftp files or better use oracle forms technology transferring files? i appreciate if provide me sample in java see how can transfer files ftp address.(if have sample in oracle more better) thanks see pl/sql utility library page http://code.google.com/p/plsql-utils/ specifically "transfer files (ftp) using pl/sql" section, there find code need in pl/sql (no java required).

How does one find the start of the "Central Directory" in zip files? -

wikipedia has excellent description of zip file format , "central directory" structure confusing me. this: this ordering allows zip file created in 1 pass, decompressed first reading central directory @ end. the problem trailing header central directory variable length. how then, can start of central directory parse? (oh, , did spend time looking @ appnote.txt in vain before coming here , asking :p) my condolences, reading wikipedia description gives me strong impression need fair amount of guess + check work: hunt backwards end 0x06054b50 end-of-directory tag, forward 16 bytes find offset start-of-directory tag 0x02014b50, , hope it. sanity checks looking comment length , comment string tags after end-of-directory tag, sure feels zip decoders work because people don't put funny characters zip comments, filenames, , forth. based entirely on wikipedia page, anyhow.

asp.net mvc 3 - Loading a partial view in jquery.dialog -

i new mvc , trying create dummy application learn mvc 3. have worked way through music store example , trying extend more real world application. example whenever want new item redirected create view fine want instead of doing full page post want use jquery.dialog open modal popup allow user insert new item. so far have <script type="text/javascript"> $(function () { $('#dialog').dialog({ autoopen: false, width: 400, resizable: false, title: "hi there", modal: true, buttons: { "close": function () { $(this).dialog("close"); } } }); $('#my-button').click(function () { $('#dialog').dialog('open'); });}); </script> <div id="dialog" title="create album" style="overflow: hidden;"...

linux - How to get rid of libthread_db -

on embedded file system, rid of libthread_db. understanding was necessary when debugging program using pthread. however, here observation : if libthread_db not present @ boot time (when first pthread using programm launched), launching such program causes segfault. adding libthread_db later (ie after pthread program has segfaulted) doesn't change anything. every program uses pthread segfault on launch. so seems libthread_db essential run sort of program using pthread. libthread_db never used threaded program. only used debugger. your assertion libthread_db somehow required run program using pthreads incorrect. if pthread programs crash when libthread_db removed system, else broken on embedded target; removal of libthread_db merely triggers else. you can trivially confirm this: build pthread program on regular linux system. run program under strace , , observe libthread_db not appear in strace output. rename /lib/libthread_db.so.1 else, , observe te...

java - Is it a known IE bug? Didn't pass submit parameter to request -

if have <form> @ least 2 <input type="text" ..> , , submit button <input type="submit" name="somename" ..> - then, when press enter on textfield - ie (i tried 7th version) correctly submits form, passing submit=somename params request. but, when there 1 text field <input type="text" ..> (+ number of dropdowns or checkboxes or radio) - pressing 'enter' submits form without passing 'submit=somename' request. but there java frameworks (atg, etc), handle form submits submit param, calling corresponding method in form handler. so, if there no submit button param in request - handling of submit fails. have seen such behaviour before? there solution http://betweengo.com/2005/08/08/internet-explorer-form-does-not-invoke-atg-handler/

linux - Startup script always crashing on ubuntu 9.10 server edition -

i wrote startup script starts @ startup ubuntu 9.10 server edition , rsync of directories specified in path, did startup in old fashion way linking script init.d , placing on run level, working , able start on startup after while service of script not running. crashes on middle after 5 minutes when system , code inside script line of rsync sure not problem , have invoke script again start services? wrong this? can help?? check /var/log/ directory log entries -- don't know upstart should, hope kill /etc/init.d/rc* task runs 5 minutes. init scripts should use start-stop-daemon start specific programs run long time. (that way, same programs can gracefully shut down @ reboot or shutdown time.) scripts should run in under second or so. i'd suggest writing actual upstart management script , placing /etc/init/ instead of fighting init script. don't think upstart going away :) might used it.

if statement - Possibly using if-else jquery in order to prevent additional animations -

i'm new jquery , apologize if problem has obvious answer. i've researched on different ways of solving situation end same problem. i have few webpages linked , use jquery animate menu bar on each page same way. the page loads menu bar visible , scrolls down portion of visible (i achieved using jquery css bottom value animation). when user hovers on bar, moves it's original (onload) position contents once again visible. the problem have jquery code on document.ready consecutively move bar down , upon hovering move content up-- so when link clicked , new page loaded, menu bar moves little (due presence of mouse on bar on new page well) instead of first moving way down. i want functionality on every page, bar moves down partially visible , moves on later interaction. here code have been using , on breaking down or inserting if-else logic based on div css bottom property or prevent bar moving first moving way down (that executing second part of jquery code before...

php - Convert video while uploading -

i want convert video (say wmv format flv) while user uploads it. can either convert video or upload individually, how them @ once? iam using ffmpeg conversion, like: ffmpeg -i wmv.wmv wmv.flv but iam unsure steps followed convert , upload video. need use ajax or that? ffmpeg pretty powerful plugin for php side execution example <?php /*** convert video flash ***/ exec("ffmpeg -i video.wmv -ar 22050 -ab 32 -f flv -s 320x240 video.flv"); ?> the terms used -i input file name -ar audio sampling rate in hz -ab audio bit rate in kbit/s -f output format -s output dimension to know advanced uses of ffmpeg check link ffmpeg tricks should know about

sql server - Create a unique identifier using SQL -

is there sql coding can generate unique identifier on click of default button? i'm looking system number physical paper files before placed storage. problem there 3 offices, , each office needs sequential number system (i.e. p001, p002, p003 , c001, c002...). below code have far generate prefix unique id number. select case when ptbranch=3 'p' when ptbranch=4 'a' else 'c' end + convert(varchar(2),getdate(),12) lamatter ptmatter = $matter$ the idea code generate whole file number e.g. p110001, p110002 (where p, c or denotes office file in, , 11 denotes year file placed storage) any pointers appreciated the sql server function newid() generate guid . your sql queries not generate buttons or else. sql language querying databases, not writing software interfaces.

What is the correct pattern to provide client-server backward compatibility? -

i'm developing client-server application , can't force users not use older versions of client, or other clients, since protocol webdav. what need support of them, kind of backward compatibility, server side behave different way, depending on client version working with. my question how prepare application situation, before facing it. need use design pattern? how design backward compatibility? if create proper api ( facade design pattern) server, you'd make life easier in future. suppose server provides api consists of services a, b & c. these services implemented in business logic layer. access these services clients through facade, no direct access. facade (version 1) exposes a, b & c. no big deal far... now suppose need add service d, remove service b, , change service c. create new facade (version 2), exposes services a, d , updated c. in business layer add logic service d, mark b "obsolete", , change in c, depends if change backwa...

multithreading - Object-oriented semaphore usage in C++ -

i know how use unix semaphores in c. before using them must call constructor-ish function named sem_init , after using them have call destructor-like function named sem_destroy . i know can keep doing in c++ because of backwards compatibility c, c++ have real object-oriented way use semaphores? if insist on using posix semaphores , not boost, can of course wrap sem_t in class: class semaphore { sem_t sem; public: semaphore(int shared, unsigned value) { sem_init(&sem, shared, value); } ~semaphore() { sem_destroy(&sem); } int wait() { return sem_wait(&sem); } int try_wait() { return sem_trywait(&sem); } int unlock() { return sem_post(&sem); } }; exercise reader: may want add exceptions instead of c-style error codes , perhaps other features. also, class should noncopyable. easiest way achieve inheriting boost::noncopyable ;) edit : @ringding remarks, looping on eintr wise thing do. int semaphore::wait() { ...

.net - Is there any connection string parser in C#? -

i have connection string , want able peek out example "data source". there parser, or have search string? yes, there's system.data.common.dbconnectionstringbuilder class. the dbconnectionstringbuilder class provides base class typed connection string builders (sqlconnectionstringbuilder, oledbconnectionstringbuilder, , on) derive. connection string builders let developers programmatically create syntactically correct connection strings, , parse , rebuild existing connection strings. the subclasses of interest are: system.data.entityclient.entityconnectionstringbuilder system.data.odbc.odbcconnectionstringbuilder system.data.oledb.oledbconnectionstringbuilder system.data.oracleclient.oracleconnectionstringbuilder system.data.sqlclient.sqlconnectionstringbuilder for example, "peek out data source" sql-server connection string, can do: var builder = new sqlconnectionstringbuilder(connectionstring); var datasource = ...

Official list of countries for iPhone AppStore and In-App Purchase? -

i looking official list of countries : 1 - users can download free applications using appstore? 2 - users can download paid applications using appstore? 3 - users can use in-app purchase buy additional features application (consumable, non-consumable or subscription products)? unfortunately, did not manage find one... have find this post user doesn't quote source. could provide me 1 or several links toward offical apple resources information available? thanks! the full list available during submission of app through itunes connect . ( edit: i'd forgotten apps submitted through app loader/xcode, form if edit existing app.) developer guide there shows screenshot of country list, though don't know if image up-to-date. i'm sure answer pointed copied-and-pasted list form in itunes connect, did list. here's full list @ time (updated new countries of december 2011), form: algeria angola anguilla antigua , barbuda argentina armenia aust...

Verifying program correctness using phantom types in Haskell -

suppose i'm working code of stack machine, can simple operations (push constant, add, mul, dup, swap, pop, convert types) on ints , doubles. now program i'm writing takes description in other language , translates code stack machine. need calculate maximum size of stack. i suspect it's possible use haskell type checker eliminate bugs, e.g.: popping empty stack multiplying doubles using int multiplication i thought declare, example: dup :: stack (a :%: b) -> stack (a :%: b :%: b) int2double :: stack (a :%: sint) -> stack (a :%: sdouble) and on. don't know how generate code , calculate stack size. is possible this? , simple/convenient/worth it? see chris okasaki's "techniques embedding postfix languages in haskell": http://www.eecs.usma.edu/webs/people/okasaki/pubs.html#hw02 also, this: {-# language typeoperators #-} module stacks data :* b = :* b deriving show data nilstack = nilstack deriving show infixr 1 :* clas...

php - How to embed mysql db content into 3rd party sites without providing remote access -

i writing set of html based resources, stored in mysql db on our server. resources contain images references, stored relative paths. i can login admin panel , create , edit resources easily. this bit done, , working well. however, going want provide resource in 2 ways: packaged , hosted. 1 providing real problems hosted solution: we want host database , image resources, want give access resources via set of templates other users host on own site. can brand templates accordingly, , have resource available @ own url e.g. http://www.example.com/discojoe there 2 questions have on process, causing me real headaches: • realise obvious security implication of providing read-only access our mysql server. alternative think of server side code running on our server, when requested, squirts requested data user. removes need them have mysql connection. are there examples of above type of scenario online can read on, or can give pointers on how go addressing solution? • users ...

How to seed mysql database by running sql scripts in Ruby Rails platform? -

i have been java programmer , beginner ruby rails. in java, seed database ant task run, ant task execute sql script. sql script set of insert statements. i expect there must equivalent of ant task on ruby rails platform running sql script? edited in response answer nikita: although 1 can use migration 1 of way seeding data. don't want rework of writing migration classes corresponding sql scripts. need solution through have exec sql script file only. want manage database through sql code. i don't using migrations seed large amounts of "static" data. can execute sql statements db/seeds.rb by: # empty soon-to-be-seeded table mymodel.delete_all # current db connection connection = activerecord::base.connection(); # execute sql statement connection.execute("insert my_models (id, name) values (1, 'example 1'), (2, 'example 2'), (3, 'example 3');") basically, once have current connection, can call sql s...

How to serialize a form into an object with jQuery? -

$('form').serialize() generate a=1&b=2 ,but want {a:1,b:2} . how this? further more,is possible kind of job arbitrary container div ? jquery doesn't support this. you'll have use json.stringify, supported in modern browsers, support in older browsers, have include json2 library <script> you have like: (function ($) { jquery.fn.jsonserialize = function () { var obj = {}; var form = this[0]; if (form.tagname !== "form") { return ""; } $(form.elements).each(function () { obj[this.name] = $(this).val(); }); return json.stringify(obj); } }(jquery)); then use follows: var stringified = $('#yourform').jsonserialize();