Posts

Showing posts from June, 2010

Shrink data base SQL Server 2008 -

hi have made maintenance package in have used shrink database task specific database, ran successfully, found slight increase in previous db size. initial size(129 gb) after running package(130gb). i expecting after shrinkning should shrink? might happen? sure package scheduled run , check history found run successfully. any help/ please advise special care required, in advance. do not shrink database during maintenance. there no other more damaging action can do. read more @ auto-shrink – turn off . if database has grown size, grow if shrink it. shrinking database tremendously damaging index fragmentation , slow down reporting , analytic workloads. once shrink, when database grow during normal operations auto-growth events interrupt , freeze database during growth. there 1 thing shrink database had got out of control due rogue action increased it. have shrink in maintenance task means on scheduled interval, , very bad .

.net - AppDomain isolation -

edit seems original post below might have been bit long. simply said, can spawn appdomains , ensure cannot communicate 1 in way? there competitive robotic soccer simulation league called robocup 3d . 1 of fundamental rules communication between agents conducted through central server. server enforces rules of simulation, such limiting distances , rates of message passing across field. teams comprise several agents. rules state each agent must run in own process. rationale being inter-process communication can detected. i've authored .net library robocup called tinman . there talk on relevant mailing lists of teams being entered written in .net first time next year. aside, run on mono. in managed environment clr, believe there performance benefits running agents in single instance of clr, due running single gc. i've asked question whether might acceptable use separate appdomains of same process if case. what i'd know if whether it's possible det...

Python programs on different Operating Systems -

if write python script using python standard libraries, using python 2.6 work on operating systems long python 2.6 installed? depends. there few parts of python standard libraries available on platforms. these parts noted in python documentation. you need careful of how handle things file paths - using os.path.join() , such make sure paths formatted in right way.

iphone - Best Framework for Audio -

in application recording voice of human storing in file in nstemporarydirectory() , playing it. far have used avaudioplayer , avaudiorecorder after time when record simultaneously plays sound don't know why? , more on application crashes in iphone 4. now please suggest me framework use recording changes pitch , can play , importent work on iphones. 1. openal 2. core audio 3. audiotoobox i use avaudioplayer , avaudiorecorder in 1 of apps , don't have problem @ all. maybe issue describe related other problem in app. sure don't have bug in app causes this?

sql - How to rewrite a subquery to use joins when you used DISTINCT in the subquery? -

i have query use sub query, , rewrite join, have better performance. the subquery uses distinct there many records, , problem have end multiple times in join when use join. so how rewrite query use join: select * table1 join table2 b on b.field1 = a.field1 b.field3 = 1531 , a.field4 = 0 , a.field5 in (select distinct field5 table3 field6 = 172) something like: select * table1 join table2 b on b.field1 = a.field1 join ( select distinct field5 table3 field6 = 172 ) c on c.field5 = a.field5 b.field3 = 1531 , a.field4 = 0 it's hard without seeing actual data, if doesn't work, please let me know.

class - How can I reorganize my code into classes in C#? -

i'm working on project in c# w/ xna, , want reorganize , divide parts of classes. at present, it's 1 game.cs file, want clean bit. unfortunately, i'm not familiar classes. perhaps can me figure out how this, or direct me tutorial of sort? well, start off thinking of bits of data go naturally. example, if have player's name, score, position, number of lives etc, suggest should have player class. take @ state, split different groups, , check of existing methods work 1 group of state or another... , put methods state they're interested in. it gets trickier when 1 method needs deal state multiple objects, of course: typically means you'll put code in 1 type , pass other type in parameter. a lot of gut feeling, honest - above starting points. on time gets easier, , you'll start think more in terms of responsibilities data - it's starting point, have data need, not organized in right way... whereas deciding on responsibilities within syste...

java - MapReduce returns NaN -

i have m/r function, , nan value of results. dont have experience js. im escaping js using java drivers. string map = "function(){" + " emit({" + "country: this.info.location.country, " + "industry: this.info.industry}, {count : 1}); }"; string reduce = "function(key, values){var count = 0.0;" + "values.foreach(function(v){ count += v['count'];});" + "return count;}"; mapreduceoutput output = collection.mapreduce(map, reduce, null, new basicdbobject("lid", "foo")); an example ti clear things: {"_id":{"country":"gb", "industry":"foo"}, "value":nan} thanks lot. considering js part, i'm not sure whether following part valid - values.foreach(function(v){ count += v['count'];}); try instead - var v; (v in values) { .... } hope he...

ipad - How to develop iphone app with database? -

i want develop crm iphone app. think there 2 methods deal data store, 1 using sqlite(but can not share datas others ?), other method using webservice(let app curd data 1 web application), want know better? i think question not having 1 or other, have both: webservices expose central server somewhere common data stored , local sqlite database copy of data stored. allows fast search etc. instead of contacting remote server may or may not on-line.

html - What kind of Java libraries are available for generating HTML5? -

our test harness needs generate html tags (for img, table, br, audio, video ..) testing module. looking java libraries can generate html5 compliant code. there thread discusses this, not sure if support html5 there several available: jwebutils summer jsoup itextpdf (i not sure html support)

database - Data modeling question -

my clients use 1 of following when sign application: foo api (requires " auth_key ", " password ", " email ") acme api (requires " secure_code ", " username ", " password ") bar api (requires " xyz_code ", " pass_key ") (fake names, , 15 more omitted simplicity) i prefer not have 10-15 tables in database different api integration options offer (particularly when they're same thing , choose 1 whole list). my solution this: make api_configuration table column called api_name holds code specific api (e.g. "foo_api" ) make table called credentials_attribute foreign key api_configuration , column called name , , column called value . then build ui choosing api. if choose acme api, it'll ask "secure_code", "username", , "password", , create row in credentials_attribute each of name/value pairs. on orm model api_configuration can make ...

mercurial - Is there any way to change how graphs are drawn in TortoiseHg? -

Image
being used how clearcase draw graphs find mercurial's , tortoisehg's way confusing @ first glance. this how i'd represented: static positions branches. e.g. maintenance branch left/right , preferably in straight line , not current spaghetti curved branch (see below link). this how looks using tortoisehg explorer. graph test repository. :-) is there way change how graphs drawn in mercurial? [edit] check out machg , how draws graphs. more in line of i'd see myself. the problem forking commit creates "anonymous" branch (as opposed named branch, different concept), , default graph view can't place commits in static columns without having ids. thus, implementor gave , have current graph. now, think first view give awesome, , should possible use heuristics assign ids anonymous branches depending on (developer1-a, developer2-a, developer2-b, etc). that'd cool. :) contribution time! update what i'd see: commits sorted ...

php - Creating a variable by pulling a value from a MySQL database -

i using mysql table called "login" includes fields called "username" , "subcheckr." i run php query create new variable equal "subcheckr" in table "username" equals variable called $u. let's want call variable "$variable." how can this? query below have far. thanks in advance, john $sqlstremail = "select subcheckr login username = '$u'"; i don't know if understood correctly if: just this. $sqlstremail = "select subcheckr login username = '$u'"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $variable = $row["subcheckr"]; in case don't know, query vulnerable sql injections. use mysql_real_escape() filter $u variable.

sockets - Are there applications where the number of network ports is not enough? -

in tcp/ip, port number specified 16-bit field, yielding total of 65536 port numbers. however, lower range (don't know how far goes) reserved system , cannot utilized application. assuming 60,000 port numbers available, should more plenty nework application. however, mmorpg games have tens of thousands of concurrently connected users @ time. this got me wondering: there situations network application can run out of ports? how can limitation worked around? you don't need 1 port per connection. a connection uniquely identified tuple of (host address, host port, remote address, remote port). it's host ip address same each connection, can still service 100,000 clients on single machine 1 port. (in theory: you'll run problems, unrelated ports, before that.)

.net - How to open a apsx page from SilverLight Application as a modal-dialog? -

how can call aspx page silverlight application, opens in modal dialog , blocks interaction sl application until dialog closed? thanks you can use childwindow control , set content webbrowser control pointing page's url work in oob mode only

java - Importing ant build.xml in Eclipse -

i have android project uses ant build, possible import ant project in eclipse ide? update : there option create project using ant build.xml in eclipse file->new->project->java->java project existing ant buildfile. , if build.xml file selected show error specified buildfile not contain javac task i guess javac declared in task <taskdef name="setup" classname="com.android.ant.setuptask" classpathref="android.antlibs"/> from this link : open eclipse, select file > new > project select " java project existing ant build file " show build file , write project name

c++ - Static lib loading related issue -

suppose want version libs in binaries made. static libs, thought approach work not: libinfo.h - base class libinfo classes. registers object in gvlibinfo vector when child constructed. #ifndef iface_h #define iface_h #include <vector> class libinfo; extern std::vector<libinfo*> gvlibinfo; class libinfo { public: virtual int getversion() = 0; void reglib() { gvlibinfo.push_back(this); } libinfo() { reglib(); } virtual ~libinfo() {} }; #endif lib1.h - derived libinfo , creates object l1 . lib2.h same except getversion returns 2. #ifndef lib1_h #define lib1_h #include "libinfo.h" class lib1 : public libinfo { public: int getversion() { return 1; } private: }; lib1 l1; #endif main.cpp #include "lib1.h" #include <iostream> using namespace std; vector<libinfo*> gv...

process - Remove shipping methods completely from magento? -

how can remove shipping methods/processes magento? thanks if setup products virtual or downloadable products, checkout process skip shipping step , collect payment information. should achieve aim?

sql - PhpMyadmin CSV Import data order? Mine is jubmled from CSV order? -

i'm trying import csv data file database in same order in csv file. when import order jumbled how appears in file. is there way force phpmyadmin import in exact same order csv? sql databases don't have order default. if want ordering, provide column sort on, use column in order in queries. for situation, @ making autoincrement primary key. key increment import , suitable requirements.

bootstrapping - Zend Framework: How to call a custom function created in bootstrap? -

i using zend framework v 1.10 i have created custom function in bootstrap file: <?php class bootstrap extends zend_application_bootstrap_bootstrap { public function init(){ } public function helloworld(){ echo 'hello';} } ?> how call helloworld() function action within index controller? any appreciated. thanks anyone can call function in bootstrap class without making object of class. bootstrap automatically calls custom functions have _init keyword prefix. such as: public function _initindia() { echo 'proud indian'; }

Execute SSIS Package based on a Flag bit -

how execute ssis package based on flag bit present in table. what understand is, need create variable , assigned value in sql server table. and use precedence constraints control flow. if flag bit "0" run , make 1 @ end, if "1" should not running package still package should completing success how accomplish this? you can run execute sql task value sql server table. value can assigned variable in task. execute sql task should first task run. create precedence constraint execute sql task , task run if flag bit set run. can selecting execute sql task , dragging green arrow next task. right-click on new precedence constraint line , select edit. in constaint options panel, set evaluation operation "expression , constraint". leave value option "success". enter @[myvariable] == 0 in expression field, myvariable name of variable contains flag bit value. when package runs, stop if conditions in precedence constraint not ...

objective c - NSTokenField representing Core Data to-many relationship -

i'm having problem figuring out how represent many-to-many relationship model in nstokenfield. have 2 (relevant) models: item tag an item can have many tags , tag can have many items. it's inverse to-many relationship. what represent these tags in nstokenfield. end tokenfield automatically suggesting matches (found out way tokenfield:completionsforsubstring:indexoftoken:indexofselecteditem) , being able add new tag entities if wasn't matched existing one. okay, hope you're still me. i'm trying bindings , array controllers (since makes sense, right?) i have array controller, "item array controller", bound app delegates managedobjectcontext. tableview showing items has binding array controller. my nstokenfield's value has binding array controllers selection key , model key path: tags. with config, nstokenfield won't show tags. gives me: <nstokenfieldcell: 0x10014dc60>: unknown object type assigned (relationship objects {( ...

java - Can't start Eclipse 3.5.2? -

i'm running windows vista x64, , have jdk 1.6.0_21 (x64 version, believe) installed. downloaded eclipse 3.5.2 because want android development (apparently can't use 3.6 yet due bugs...), keep running same error message whenever try start eclipse: http://img42.imageshack.us/img42/8282/42786776.jpg does know why happening? need 32-bit version of java or java 5 or something? if so, how specify eclipse uses different version of java (preferably i'd specify in eclipse.ini file , not mess environment variables). you need use 32 bit vm since using 32 bit eclipse. 3.5, 64 bit windows builds hard find, though think exist. if eclipse 64 bit version, launcher org.eclipse.equinox.launcher.win32.win32.x86_64 , yours org.eclipse.equinox.launcher.win32.win32.x86 without _x64. listed around middle of error message. to change vm, add -vm parameter eclipse.ini. add mine first entry, though i'm not sure that's important. should this: -vm c:\path\to\java\bin\jav...

types - Zend Db Float Problem -

i have mysql table structured: float(10,2) for example insert row. $value = array('price' => '13539.51'); $db->insert($value); when check row phpmyadmin, fine. when read row zend db, price value "13539.509765625". how can fix problem. $select = $db->select(); $select->where('id = ?' 1); echo $db->fetchrow($select)->price; //13539.509765625 i think issue lies data type chose column , not zend_db. might want alter decimal(10,2). http://dev.mysql.com/doc/refman/5.1/en/numeric-types.html cheers, angel

Syntax highlighting in .net richtextbox, how do I deal with newlines? -

i trying highlight syntax in richtextcontrol (quoted text, xml tags, xml comments). apart obvious problem created own stupidity (for example, run through text highlight syntax takes on second , cannot check syntax whenever character typed) ran issue caused newlines in text. this feeble attempt syntaxhighlight: while < l ssrelevanttext = t.text.substring(i) ssselectedtext = regex.match(ssrelevanttext, pattern, regexoptions.singleline).value idxselectionstart = t.find(ssselectedtext, i, richtextboxfinds.none) idxselectionlength = ssselectedtext.length t.selectionstart = idxselectionstart t.selectionlength = idxselectionlength t.selectioncolor = color = idxselectionstart + idxselectionlength t.selectionstart = idxcursorbeforeselection t.selectionlength = 0 t.selectioncolor = color.black end while (i removed comments because, ironically, vb comments break so's syntax-highlig...

index out of range exception when storing into asp.net session -

please bare me, i'm new asp.net. i'm building web app build report, there many arguments give each 1 name, , want save them indexed numbers can handle them loops later on throughout application. however, i'm getting index out of range on first session item(0)...as understand it, don't have instantiate session myself , should work right? session[0] = txtcompliancecaseid.text; session[1] = ddlstate.selectedvalue; session[2] = txtactingsupervisor.text; session[3] = ddlrisktolerance.selectedvalue; etc... the session object string dictionary; should store objects in string keys. writing session[0] or set first item in session state. since session state starts empty, throws exception. instead, should use strings, this: session["compliance id"] = txtcompliancecaseid.text; session["state"] = ddlstate.selectedvalue; session["supervisor"] = txtactingsupervisor.text; session["risk tole...

java - DAO and Service layers (JPA/Hibernate + Spring) -

this question has answer here: java ee architecture - dao's still recommended when using orm jpa 2? 2 answers i'm designing new app based on jpa/hibernate, spring , wicket. distinction between dao , service layers isn't clear me though. according wikipedia, dao an object provides abstract interface type of database or persistence mechanism, providing specific operations without exposing details of database. i wondering whether dao contain methods don't have data access, way easier executed using query? example "get list of airlines operate on set of airports"? sounds me more of service-layer method, i'm not sure if using jpa entitymanager in service layer example of practice? a dao should provide access single related source of data and, depending on how complicated business model, return either full fledged bus...

Xslt for-each and key match -

i have 2 xml data sources this: <orders> <order> <ordernumber>123</ordernumber> <subtotal>20</subtotal> <total>23.5</total> </order> <order> <ordernumber>234</ordernumber> <subtotal>19</subtotal> <total>26.5</total> </order> </orders> <orderitems> <item> <ordernumber>123</ordernumber> <productname>test1</productname> <sku>s9sdidk</sku> <item> <item> <ordernumber>123</ordernumber> <productname>test2</productname> <sku>123232</sku> <item> <item> <ordernumber>234</ordernumber> <productname>test3</productname> <sku>s9sd2d32k</sku> <item> <item> <ordernumber>234</ordernumber> <productname>test4</productname> <sku>s9swe23</sku> <item> ...

how can i change the keyboard at runtime in iphone -

how can change keyboard @ runtime in iphone? i have bar segmented control in have 2 options "name" , "phone no". , have textbox. want when user selects "name" , type in textbox default keyboard should display when user selects "phone no" , type in textbox "number pad" keyboard should display. plz me. regards mike this defined in uitextinputtraits protocol reference. can use textfield.keyboardtype = uikeyboardtypenumberpad; to change keyboard type of field.

How to set-up transactions for both web application and batch jobs using Spring and Hibernate -

Image
i have application uses spring 2.5 , hibernate 3. there's web application presentation layer, servive layer , dao layer, quartz jobs sharing same service , dao layers. transactions initialized in different layers @transactional annotations, this: it led me problem described here: controlling inner transaction settings outer transaction spring 2.5 i read bit how set-up transactions wire spring , hibernate together. looks recommended approach initialize transactions in service layer. what don't transactions exist because required hibernate work properly. and when need transaction job calling multiple service methods, seems don't have choice keep initializing transactions jobs. moving @transactional annotations dao service doesn't seem make difference. how recommend set-up transactions kind of application? i read bit how set-up transactions wire spring , hibernate together. looks recommended approach initialize transactions in service layer....

programming languages - Meaning of Leaky Abstraction? -

what term "leaky abstraction" mean? (please explain examples. have hard time grokking mere theory.) here's meatspace example: automobiles have abstractions drivers. in purest form, there's steering wheel, accelerator , brake. abstraction hides lot of detail what's under hood: engine, cams, timing belt, spark plugs, radiator, etc. the neat thing abstraction can replace parts of implementation improved parts without retraining user. let's replace distributor cap electronic ignition, , replace fixed cam variable cam. these changes improve performance user still steers wheel , uses pedals start , stop. it's quite remarkable... 16 year old or 80 year old can operate complicated piece of machinery without knowing how works inside! but there leaks. transmission small leak. in automatic transmission can feel car lose power moment switches gears, whereas in cvt feel smooth torque way up. there bigger leaks, too. if rev engine fast, may damage...

mixing JQuery and Objective C -

is possible use jquery effects in existing xcode project? please let me know if possible. short answer without more details no, inasmuch objective-c compiled language produces runtime package run on appropriate devices , jquery set of javascript libraries interpreted when run in browser or or on server side javascript engine such nodejs. it's possible might writing application in xcode users browser window once inside browser answer might yes can run jquery inside supposes writing html/js inside area. the other question why want to? if writing xcode have full access apple ui's native touch devices developing , (certainly) give wider set of options.

emacs - How do you list and manage hidden buffers? -

when calling switch-to-buffer , in minibuffer, when press space , can see hidden buffers don't see, *minibuf-0* example. how list hidden buffers list of buffers shown list-buffers ? if it's not possible using list-buffers , how manage them ? you can tweak function show buffers, so: (defun list-all-buffers (&optional files-only) "display list of names of existing buffers. list displayed in buffer named `*buffer list*'. non-null optional arg files-only means mention file buffers. more information, see function `buffer-menu'." (interactive "p") (display-buffer (list-buffers-noselect files-only (buffer-list)))) (define-key ctl-x-map "\c-b" 'list-all-buffers)

c# - Initialize runtime value-type array with specific value? -

is there way can initialize following runtime array true s without looping on using foreach? here declaration: bool[] foo = new bool[somevariable.count]; thanks! bool[] foo = enumerable.repeat(true, somevariable.count) .toarray();

javascript - add commas to a number in jQuery -

i have these numbers 10999 , 8094 , 456 and want add comma in right place if needs looks this 10,999 , 8,094 , 456 these within p tag <p class="points">10999</p> etc. can done? i've attempted here of other posts http://jsfiddle.net/pdwtu/1/ can't seem work thanks jamie update messed around bit , managed figure out here http://jsfiddle.net/w5jwy/1/ going @ new globalization plugin better way of doing it thanks jamie works on browsers, need. function commaseparatenumber(val){ while (/(\d+)(\d{3})/.test(val.tostring())){ val = val.tostring().replace(/(\d+)(\d{3})/, '$1'+','+'$2'); } return val; } wrote compact, , point, regex. straight js, can use in jquery so: $('#elementid').html(commaseparatenumber(1234567890)); or $('#inputid').val(commaseparatenumber(1234567890));

Javascript: different keyCodes on different browsers? -

so i've seen forums posts different browsers reporting differenct keycodes, seems avoid "why?". i trying capture colon (:) keycode , realized firefox reports e.keycode 56. while chrome reports 186 (i think that's was). is there univeral way of getting right keycode across browsers? and why different if same keys? i more curious whether there international way of getting same key press. thanks. see http://unixpapa.com/js/key.html explanation why have different keys. not know of international way match keys.

mvvm - Testing the View in a WPF MVMM application -

i'm getting started in exciting world of wpf development, having been c++ developer many years. testing applications rich user interfaces has of course, been hard. 1 of problems compounding has traditionally been in windows apps, ui, ui logic , app logic interdependent, , cannot tested in isolation. i'm drawn mvvm approach allow me separate ui application, , run large amounts of automated tests on view models, underneath logic be, view being dumb client of view model. that's , good, , neatly separates out testing of application logic application ui. but, provides no solution testing ui itself. though view typically contain little logic, still have potential contain huge amount of bugs of various kinds. what's current state of art in testing view itself? thanks tom this double edged sword. see attempting grab low hanging fruit , build there. in theory mvvm purist state absolutely no logic exists in view's code behind. making use of prism inst...

c++ - Overloading increment operator, looping, and edge cases -

i have enum, looks this: enum suit {clubs, diamonds, hearts, spades}; i want overload increment operator, can loop on these 4 dudes. when variable clubs, diamonds, or hearts there no issue. spades condition giving me little trouble. my first instinct define when variable spades, incrementation sets equal clubs. problem seems make impossible loop on 4 values in enum. if like for(suit i=clubs;i<spades;++i) {cout<<i<<endl;} then output goes hearts. if do for(suit i=clubs;i<=spades;++i) {cout<<i<<endl;} then output loops forever! so, can think of few workarounds this... i'm not sure idiomatic c++ thing to. should redefine incrementation attempting increment spade results in spade? or maybe throws exception? to reiterate: can think of few hacky ways fix issue. want guidance of experienced programmers tell me think "normal" way solve problem. you add enum values start , termination conditions, , alte...

iphone - How to extract a value of a string which is there in url -

i have url , want extract part of string. the url in similar format this: www.google.com?id=10&jkhsds=fg.php. i want extract value of id. how this? if create nsurl object, so: nsurl *url = [nsurl urlwithstring:@"http://www.google.com"]; you can use methods of nsurl object whatever need, e.g. scheme , host , port , path , , query . see here: http://developer.apple.com/library/mac/#documentation/cocoa/reference/foundation/classes/nsurl_class/reference/reference.html

asp.net - c#: crawler project -

could easy follow code examples on following: use browser control launch request target website. capture response target website. convert response dom object. iterate through dom object , capture things "firstname" "lastname" etc if part of response. thanks here code uses webrequest object retrieve data , captures response stream. public static stream getexternaldata( string url, string postdata, int timeout ) { servicepointmanager.servercertificatevalidationcallback += delegate( object sender, x509certificate certificate, x509chain chain, sslpolicyerrors sslpolicyerrors ) { // if trust callee implicitly, return true...otherwise, perform validation logic retu...

javascript - How do I animate a protovis streamgraph? -

i'm having trouble figuring out how animate protovis streamgraph. think best way pass array of i, j indexes .layers() , have .x() , .y() functions actual updating values. there simpler way? couldn't update data before every render? assuming data has changed, i'm not sure see benefit doing otherwise, think whole vis need re-render. function getdata(offset) { // get/create data here, maybe seeded offset } var offset = 0; // ... define scales , stuff var vis = new pv.panel() .width(w) .height(h); vis.add(pv.layout.stack) // wrap in function re-evaluate on render .layers(function() getdata(offset)) .offset("wiggle") .x(x.by(pv.index)) .y(y) .layer.add(pv.area); // use setinterval animate setinterval(function() { offset++; // still working on offset idea vis.render(); }, 20); this seems work, though depends kind of animation you're looking create - there may more efficient approaches kinds of anima...

ggplot2 - time series in R -

here question: have these data summary(data) date 1990/01: 1 1990/02: 1 1990/03: 1 1990/04: 1 1990/05: 1 1990/06: 1 (other):242 attribute min. :164.9 1st qu.:201.5 median :244.1 mean :274.6 3rd qu.:313.3 max. :512.1 na's : 1.0 and want draw time series plot so tried this: qplot(as.date(date, "%y/%m/%d"), attribute, data = data, geom = "line", main="attribute per month 1990-2010", xlab="month-year", ylab="attribute" , colour = i("steelblue4"),fill = i("steelblue4")) and got: error in seq.int(r1$year, to$year, by) : 'from' must finite in addition: warning messages: 1: in min(x) : no non-missing arguments min; returning inf 2: in max(x) : no non-missing arguments max; returning -inf any ideas solve it? thank yo...

Access KML Markers in Google Maps -

is there way create "sidebar" kml file when using google maps api? i'm loading markers on map using this: var mymarkerlayer = new google.maps.kmllayer('http://example.com/westcoast.kml'); this works great far, how can grab data , loop through points? i avoid using third party library, if possible- although jquery ok. kml xml document can process using jquery extract data need. can store coordinates , placenames in local array , use data purpose want eg. can use navigate point on map when person clicks on place name on sidebar. below example on how process kml file , implement navigation based on data in file..one word of caution not large kml files doubles load time (browser has load file process features)... <script type="text/javascript" src= "http://maps.google.com/maps/api/js?sensor=false"> </script> <script src="../js/jquery-1.4.2.min.js"> </script> <script> var map; ...

c# - How to open new OpenFileDialog automatically in Vista/Win7? -

Image
i'm on vista , i'm using microsoft.win32.openfiledialog class. when call showdialog() the old xp-style dialog: how the new vista-style dialog fallback the old one on windowsxp? a bit of rumble: i don't understand why didn't replace dialog in vista, kept both of them. legacy apps never open new dialog, unless updated. yes, you'd have upgrade .net 4.0 new dialog. if you're stuck on 3.5 can use system.windows.forms.openfiledialog, did update use new ifiledialog com interface. the fallback automatic can use autoupgradeenabled property force legacy, if necessary. not, unlikely .net program modify dialog.

Need the more recent between two DATETIME's in SQL -

i have 2 sql datetime's need compare. need set value of column more recent date between two. there function this? use case statement. update yourtable set yourcolumn = case when @date1 > @date2 @date1 else @date2 end where...

objective c - (UIApplication *) Why is there a space before the asterisk? -

-(void)applicationdidfinishlaunching:(uiapplication *) app { after uiapplication why there space before asterisk? this characteristic c code , i'm new objective-c forgive me if isn't proper objective c syntax. answer question. answers being style correct regard parameter such given in question. issue when declaring multiple variables on single line in c or c++ (this part i'm not sure if obj-c supports this). int* i; and int *i; are equivalent; when dealing multiple declarations int* i, j; is not same as int *i, *j; the * applied variable , not int, require * on each variable wish make pointer. so purpose of having space after class name stylistic nod that.

Get DisplayName Attribute without using LabelFor Helper in asp.net MVC -

what best way retrieve display name attribute item in model? see lot of people using labelfor helper everything, label isn't appropriate if want list data out. there easy way name attribute if want print out in, paragraph? <p> <%= html.encode( modelmetadata.fromlambdaexpression<yourviewmodel, string>( x => x.someproperty, viewdata).displayname ) %> <p> obviously in order avoid spaghetti code idea write helper: public static class htmlextensions { public static mvchtmlstring getdisplayname<tmodel, tproperty>( htmlhelper<tmodel> htmlhelper, expression<func<tmodel, tproperty>> expression ) { var metadata = modelmetadata.fromlambdaexpression<tmodel, tproperty>(expression, htmlhelper.viewdata); string value = metadata.displayname ?? (metadata.propertyname ?? expressionhelper.getexpressiontext(expression)); return mvchtmlstring.create(...

javascript - jQuery start typing between tags -

i making wysiwyg editor, want preventdefault on enter key, , instead, when enter pressed, creates new line, tags <div></div> . each <div> 1 line. don't know how create <div> , have pointer start between each <div> this: <div>line 1 here</div> // press enter <div>start typing next line here</div> // when press enter, creates div , automatically when start typing in between tags. then after press new line again, creates <div> next line... can help? don't need preventdefault , new action taken if enter pressed. on face of it, shouldn't difficult. however, browser inconsistencies make problematic. the basic approach is: capture enter keypress , prevent browser default behaviour. easy far. use dom range in browsers or textrange in ie current caret location browser's selection object. fiddly in ie. create new <div> if caret @ end of current <div> or split current <div>...

read pages html with jquery -

i want use jquery read html of web page. use following $.ajax({ url: page, datatype: 'html' }); where page address of page. this works fine if want read page same domain calling page. however if want read page different domain, returns blank. anyone know how can read html different domain? it's simple: can't. there tricks execute javascript code other domains (jsonp), if other side supports it. html, out of luck. the way can go have proxy running on server redirects requests through domain.

python: breaking a string into substrings using a for loop -

i have string this: row='saint george 1739 1799 violin concerti g 029 039 050 symphonie concertante 2 violins g 024 bertrand cervera in 024 039 christophe guiot in 024 029 , thibault vieux violin soloists orchestre les archets de paris' i have loop: for n in range (1,int(len(row)/55)+1): print row[(n-1)*55:n*55] it working well!! however, cutting spaces: saint george 1739 1799 violin concerti g 029 039 050 sy mphonie concertante 2 violins g 024 bertrand cerv era in 024 039 christophe guiot in 024 029 , thibault i not want cut spaces (however still want either 55 characters or less per line) import textwrap row='saint george 1739 1799 violin concerti g 029 039 050 symphonie concertante 2 violins g 024 bertrand cervera in 024 039 christophe guiot in 024 029 , thibault vieux violin soloists orchestre les archets de paris' print(textwrap.fill(row,width=55)) # saint george 1739 1799 violin concerti g 029 039 050 # symphonie concertante 2 violins ...

linux - How to develop Android Apps using a Samsumg Galaxy 5 device? -

Image
i developing first android app. have application running on emulator (eclipse + android dev. tools) on ubuntu 10.04 lts - lucid lynx - released in april 2010. have tryied steps provided on android developers portal on link, whenever try list connected device using ./adb devices following: mmaia@mmaia-desktop:~/tools/android-sdk-linux_86/tools$ ./adb devices list of devices attached ???????????? no permissions i have checked , when run virtual emulator same command returns: list of devices attached ???????????? no permissions emulator-5554 device also when ask eclipse run emulator finds device(galaxy 5), see image below, can't find serial, because of permission, able choose virtual emulator. how configure permission use galaxy 5 device while developing android under ubuntu 10.04? []s just few ideas: make sure not created udev rules, did chmod a+r /etc/udev/rules.d/51-android.rules use dmesg shortly after plugging in phone verify it's e...

c - How to find how much space is allocated by a call to malloc()? -

i'm trying write size function this: size(void *p,int size); which return size of array pointed p. example: int *a = malloc((sizeof(int)*100)); size(a,sizeof(int)); // should return 100 i think possible because if recall, malloc keeps track of space allocated in header bytes. here's have far: int size(void *p, int size) { p = (unsigned int *)p - 1; unsigned int elements = (*(unsigned int *)p); return elements/size; } now, assuming size of space allocated in 4 bytes before pointer, should return bytes, or offset. i'm bit in dark. can't figure out specifics of how malloc formats these header bytes. how malloc pack header bits? thanks, appreciate this. i'm sure there things wrong code , it's not particularly portable , may system dependent, i'm doing fun. if peek , poke around beyond memory malloc() returns recommend obtaining source code of allocator. faster , safer experimenting. ;-)

.net - Execute Selenium 2 Tests Against Remote Browser -

i'd have configuration build server runs nunit test opens , drives browser on remote machine. best way accomplish this? it easy in selenium 1, because java proxy server sat between tests , browser. in selenium 2, tests communicate directly browser (at least in ie , firefox). is there way this? possibly wcf service or something? you need standalone selenium server (current selenium-server-standalone-2.0a6.jar) http://code.google.com/p/selenium/ . start command line on remote machine (you need java installed there): java -jar selenium-server-standalone-2.0a6.jar also there's .net implementation of server , version behind java one then should use remotewebdriver : iwebdriver driver = new remotewebdriver(new uri("http://127.0.0.1:4444/wd/hub"),desiredcapabilities.internetexplorer()); and use driver in "local" tests more info: http://code.google.com/p/selenium/wiki/remotewebdriver http://www.google.com/codesearch/p?hl=en#cjyjm...

php - Deny all access to files via http unless a certain condition is true -

i creating php application , i'm having bit of trouble finding solution problem i'm having. need somehow deny access trying access files on web server (likely returning 403 forbidden error or something) via http unless condition true, such condition checked on per-connection basis. need find best way this, i'm guessing need set special settings in apache can modify php, these apache settings configurable via php. can guess, can write php have little experience advanced apache configurations. i thinking on maybe if used chmod via php change file's permissions validated user , have them change when connection closed work, if there concurrent connections users connecting afterwords have full access regardless of whether or not valid, bypass validation. maybe there better way however. thanks help! put files directory , deactivate http access via .htaccess. write php script checks condition , if true return requested file via php this: <?php define(dir,...

Randomly iterate over ArrayList<Integer> in Java -

seems basic question. i've arraylist<integer> al , iterate on it. normally, for(int : al) { // code } does trick. requirement iterate not in sequence randomly. you can use collections.shuffle() on list. note shuffle list itself, if order important should make copy of (and shuffle copy). alternatively create random array has elements 0 - list.size()-1 , using indices access "random" elements in list .

amazon s3 - CSS image sprites loading slower through CloudFront than local -

i changed css image sprites run local cloudfront , there's noticeable lag, across pages , page reloads. ideas why might happening? moving images localhost server (in case cloudfront ) incur speed penalty (relative localhost , certainly). because great hosting service browser has send http request via internet to server, find out whether document's been modified since cached, or not (not modified: http response 304 ). assuming document doesn't need downloaded again/re-cached should end of image-requests css (particularly if you're using css-sprites). if image-sprites have re-downloaded because cache has expired, or document's changed, browser has download file again, via internet , network. , incurs cost due contention on own network/intranet, between house , neighbours between home , cabinet , whatever speed isp provides you. whereas localhost same machine, , (likely) has response measured in milliseconds. in contrast, accessing amazon's c...

Android Dialog with dynamic text (API level < 8) killed on rotation -

i want create dialog string build @ runtime. looks api level 8 allows call showdialog bundle, have write app run on older oss. how create dialog simple error string , make sure doesn't die when rotate screen. i realize if override oncreatedialog, me. problem is, takes int constant. need pass string knows put in dialog. if build dialog myself , call .show() on it, won't live through screen orientation change. if you're targeting api level <8, it's sort of pain. set string message property on activity use onsaveinstancestate(bundle) , onrestoreinstancestate(bundle) manage property through configuration changes (such re-orientation) in onpreparedialog(int, dialog) , set message of dialog property. if don't set in onpreparedialog, it'll re-display previous dialog (in case message needs change between dialogs.) code: @override protected void onsaveinstancestate(bundle outstate) { super.onsaveinstancestate(outstate); // sa...

css - How do I span two divs side-by-side for the full screen width? -

there lot of questions regarding side-by-side divs. didn't miss those. need spans whole width of screen. situation: i need 3 divs positioned side-by-side. left, middle, , right divs we'll call them. middle div holds header contents of site , fixed width (800px). want left , right div span rest of screen width on either side. so.. <-left-> | middle | <- right -> the reason want way because middle (content holding) div has backgrond gradient. let's left side of gradient white , right side black. need left div white continuation , right div black. way looks 1 fluid heading spans whole width of screen. thanks. a solution problem once implemented using 2 div elements, absolutely positioned, center div overlay. have working example here: jsfiddle solution this way, doesn't matter how wide screen is: div's span 50% of screen, , middle part behind centered div. note might have use javascript workaround height-issues.

sql - Select top record from group -

how table name code abc code1 def code1 ghi code2 jkl code2 omn code3 get result: name code abc code1 ghi code2 omn code3 is there simple solution? i considered want results alphabetical. select min(name), code mytable group code

c++ - Converting arrays in stl like copy -

it's time 'how do in c++ without loosing grip'-question! this time: considering following code taken cplusplus.com : template<class inputiterator, class outputiterator> outputiterator copy ( inputiterator first, inputiterator last, outputiterator result ) { while (first!=last) *result++ = *first++; return result; } is there way cast *first type of *result ? in other words: there way determine (at compiletime) type of result? yes, type of *result ('cause type of result outputiterator ) typename std::iterator_traits<outputiterator>::value_type of course, if outputiterator pointer or correctly written stl-compatible iterator. otherwise, no, think there no way. in upcoming c++0x, easier, is, decltype(*result) hth, armen

How to get the path of the PHP BIN from PHP? -

how can bin path of php php? saw in phpinfo(); need method gets in linux , windows systems. you can use: $_server['_'] also constant php_bindir gives directory php executable found. sample on codepad , ideone looks security reasons $_server values not exposed.( guess..plz correct me if i'm wrong).

flex - Get or Set Cell Values in a Datagrid progmatically -

in flex 4 using pre populated data grid, how can or set specific values programatically, ie wont using selecteditems etc. how reference value of cell in row 4 colum 6 example. please , thank in advance help. craig cast dataprovider of datagrid listcollectionview , use getitemat method. listcollectionview(datagrid.dataprovider).getitemat(requiredrow).appropriateproperty = newvalue; update: in case column name dynamic, can fetch using like: var data_field:string = dgviewpreview.columns[6].datafield; //for 6th column listcollectionview(datagrid.dataprovider).getitemat(requiredrow)[data_field] = newvalue;

c - Malloc, free and segmentation fault -

i don't understand why, in code, call "free" cause segmentation fault: #include <stdio.h> #include <string.h> #include <stdlib.h> char *char_arr_allocator(int length); int main(int argc, char* argv[0]){ char* stringa = null; stringa = char_arr_allocator(100); printf("stringa address: %p\n", stringa); // same address "arr" printf("stringa: %s\n",stringa); //free(stringa); return 0; } char *char_arr_allocator(int length) { char *arr; arr = malloc(length*sizeof(char)); arr = "xxxxxxx"; printf("arr address: %p\n", arr); // same address "stringa" return arr; } can explain me? thanks, segolas you allocating memory using malloc correctly: arr = malloc(length*sizeof(char)); then this: arr = "xxxxxxx"; this cause arr point address of string literal "xxxxxxx" , leaking malloc ed memory. , calling free on...

javascript - Limit File Types Shown in Browse Window -

is there no way @ limit file types shown in browse file window? tried this: <input type="file" accept="text/xml" name="parameter_file" /> firefox, ie ignore it. found below excerpt question: accept attribute introduced in rfc 1867, intending enable file-type filtering based on mime type file-select control. most, if not all, browsers make no use of attribute. how else can this? know can achieve flash don't want use flash. i checking selected file type on server side improve user experience making easier show xml files. thanks help. afaik, there no way this. next best thing use js check file extension before form submitted user won't waste time uploading file not accepted, server-side file type check routine should kept, because first method bypassed turning js off. here's jquery solution: how have jquery restrict file types on upload? hope helps.

mysql - Why 'foreign key constraint fails' when foreign key exists? -

i have simple query update `t_timecard_detail` set `timeoff_request_id` = 'adad8e0d-c22b-41c3-a460-6cf982729299' `id` = 'cfc7a0a1-4e03-46a4-af89-069a0661cf55'; which gives error error 1452 (23000): cannot add or update child row: foreign key constraint fails (`demo1_timeapp`.`t_timecard_detail`, constraint `timeoff_request_id_refs_id_48fe5c4` foreign key (`timeoff_request_id`) references `t_timeoff_request` (`id`)) constraint constraint `timeoff_request_id_refs_id_48fe5c4` foreign key (`timeoff_request_id`) references `t_timeoff_request` (`id`) though id 'adad8e0d-c22b-41c3-a460-6cf982729299' exists in t_timeoff_request table mysql> select `id` t_timeoff_request `id`='adad8e0d-c22b-41c3-a460-6cf982729299'; +--------------------------------------+ | id | +--------------------------------------+ | adad8e0d-c22b-41c3-a460-6cf982729299 | +--------------------------------------+ so not sure why mysql...

apache - Create Addon Domains from PHP -

i have vps (centos) cpanel , suphp enabled. apache/2.0.63 (unix) mod_ssl/2.0.63 openssl/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 frontpage/5.0.2.2635 mod_fcgid/2.3.5 as root created account , set domain it. can login account's cpanel , create addon domains. project want allow visitors of website same thing (create addon domains) php script. i guess it's impossible php only, since requires changing config files php has no right , don't know if it's possible obtain necessary privileges php process. suspect have create command file , use system() or similar php function call it. again i'm not sure how give command file enough rights. maybe there can user switch commands , necessary stuff change config files... please advise. thank you. you need add dns entry point *.yourdomain.com application , application should handle page show based on value of $_server['http_host'] . build system lets end-users create accounts, guess ...

Fluent NHibernate different Conventions for different base types -

at moment keeping entities , mappings same assembly. our entities derived basic class entity entitywithtypedid also having table name convention telling pluralize table names. now want create other 2 base types e.q. aggregaterootentity , aggregateentity, both derive entity. , create 2 set of conventions both base entities: let's say: for entities derived aggregaterootentity tables should prefixed "ag_" , id incremental generated, entities derived aggregateentity tables should prefixed "a_" , ids should assigned. is possible set conventions based on conditions? you can multiple conventions, each checking specific type in accept methods something like: public class legacyentitytableconvention : iclassconvention, iclassconventionacceptance { public void accept(iacceptancecriteria<iclassinspector> criteria) { criteria.expect(x => x.entitytype.isany(typeof(oldclass), typeof(anotheroldclass))); } public void apply(iclass...

java - Richfaces and Headless mode -

i working on richfaces , seem work on dev machine (windows os). deploying on linux machine,i don't see images comes richfaces components(like sorting images) , throws exception. java.lang.internalerror: can't connect x11 window server using 'tnsd03748:1.0' value of display variable. @ sun.awt.x11graphicsenvironment.initdisplay(native method) @ sun.awt.x11graphicsenvironment.access$000(x11graphicsenvironment.java:53) @ sun.awt.x11graphicsenvironment$1.run(x11graphicsenvironment.java:142) which can happen when code tries deal gui on linux/unix environment headless. maybe issue resolved when add -djava.awt.headless=true .i want know has come across such issue richfaces , there configuration right.? i'm using richfaces on centos, , haven't had problem. can't check now, guess tomcat has been installed default use headless=true , give try.

qt - QtBrowserPlugin crash when I nest other plugin into it: is my fix correct? -

there qtbrowserplugin contains qwebview load page contains other plugin. (opera (some_page (my_qtbrowser_plugin (qwebview (some_other_page (some_other_plugin)))))) why after loading page loads or attempts load other plugin stops dispatching events qtbrowserplugin (crashes on js call outside: http://sprunge.us/heza ) in stacktrace see: #3 <signal handler called> #4 0xb63ae1f2 in webcore::identifierrep::string() const () /usr/local/trolltech/qt-4.7.0/lib/libqtwebkit.so.4 #5 0xb63b339c in _npn_utf8fromidentifier () /usr/local/trolltech/qt-4.7.0/lib/libqtwebkit.so.4 #6 0xb76e3d51 in npn_utf8fromidentifier (identifier=0x7ffffffe) @ .../src/qtbrowserplugin.cpp:200 #7 0xb76e4aaf in npclass_hasmethod (npobj=0x80e5c80, name=0x7ffffffe) @ .../src/qtbrowserplugin.cpp:364 why code in qtbrowserplugin calls things in qtwebkit? there other ideas how debug/fix it? update i've found calls qtbrowserplugin.c...