Posts

Showing posts from February, 2010

dns - How can I Force flex apps to load on a local domain? -

i have situation need swf load domain. flex set loads swf file//... i prefer domain local.somedomain.com does know how this? create simple html page has object tag , load there. load same domain html page loaded from. when hit debug button in flex builder, running html page (its in html-template folder called index.template.html). if right click project in navigator , click properties, click run/debug settings, can edit "launch configuration" , tell page load (here, can modify debug or run path url instead of folder path).

php - how do I get month from date in mysql -

i want able fetch results mysql statement this: select * table amount > 1000 but want fetch result constrained month , year (based on input user)... trying this: select * table amount > 1000 , datestart = month('$m') ... $m being month gave error. in table, have 2 dates: startdate , enddate focusing on startdate . input values month , year. how phrase sql statement gets results based on month of year? you close - got comparison backwards (assuming startdate datetime or timestamp data type): select * table amount > 1000 , month(datestart) = {$m} caveats: mind using mysql_escape_string or risk sql injection attacks . function calls on columns means index, if 1 exists, can not used alternatives: because using functions on columns can't use indexes, better approach use between , str_to_date functions: where startdate between str_to_date([start_date], [format]) , str_to_da...

mysql - How to handle large database? -

i working in 1 real-estate website , have large database around 250 fields in table , 15 lakhs (1.5 million) records in table. want give searching functionality in website so, how should design db such can search property fast these 15 lakhs records. want make site http://www.redfin.com/ . is effective 15 lakhs records should in 1 table searching ? i don't understand how should design db? using php + mysql , want ask storage engine(myisam,innodb etc.) preferred type of large database handling ? please me out. are saying database consists of 1 table? that's 250 fields in single table suggests me. if so, i'd recommend consulting design expert have schema normalized bit. as far performance goes, mysql innodb should sufficient long design proper keys , indexes. trick know queries you'll need , creating indexes make them efficient possible. your table might have 250 columns, i'm betting typical queries go after combinations of columns of time. ...

sql - How to recover the old data from table -

i have made update statement in table in sql 2008 updated table wrong data. i didn't have backup db. it's important dates got updated. is there anyway can recover old data table. thanks sna basically no unless want use commercial log reader , try go through fine tooth comb. no backup of database can 'update resume, leave town' scenario - harsh should not happen.

jquery - What triggers the IE Enhanced Security warning -

is there published set of ie enhanced security blocking rules? background: when try out jquery scripts, trigger ie enhanced security warning - matter of trial , error removing bits of code until find offending part,and see if jquery can work without it. commenting out code doesn't work, have delete page. a utility can pinpoint blocked part of html/script useful. edit: trying implement dynamic tooltips using this: http://www.queness.com/post/92/create-a-simple-cssjavascript-tooltip-with-jquery now there no shortage of other ways of doing tooltips, finding out triggers ie enhanced security warnings i'm after. are testing script webserver or local file? there known issue ie enhanced security warnings on local files. in case thats you're issue, there fix consists of placing following between opening tag. <!-- saved url=(0014)about:internet -->

javascript - js override console.log if not defined -

which solution recommend, second simpler ( less code ), there drawbacks on using ? first: (set global debug flag) // first line of code var debug = true; try { console.log } catch(e) { if(e) { debug=false; } }; // later in code if(debug) { console.log(something); } second: override console.log try { console.log } catch(e) { if (e) { console.log = function() {} } }; // , need in code console.log(something); neither, variation of second. lose try...catch , check existence of console object properly: if (typeof console == "undefined") { window.console = { log: function () {} }; } console.log("whatever");

c# - List of generic interfaces -

if have generic interface couple of implementing classes such as: public interface idataelement<t> { int dataelement { get; set; } t value { get; set; } } public class integerdataelement : idataelement<int> { public int dataelement { get; set; } public int value { get; set; } } public class stringdataelement : idataelement<string> { public int dataelement { get; set; } public string value { get; set; } } is possible pass collection of implementing classes of differing types, without having resort passing object. it not appear possible define return values as public idataelement<t>[] getdata() or public idataelement<object>[] getdata() any suggestions? you can declare: public idataelement<t>[] getdata<t>() and public idataelement<object>[] getdata() although latter isn't you're after (your interface won't variant in c# 4 uses t in both input , output position; if v...

c# - How can I remove accents on a string? -

possible duplicate: how remove diacritics (accents) string in .net? i have following string áéíóú which need convert to aeiou how can achieve it? (i don't need compare, need new string save) not duplicate of how remove diacritics (accents) string in .net? . accepted answer there doesn't explain , that's why i've "reopened" it. it depends on requirements. uses, normalising nfd , filtering out combining chars do. cases, normalising nfkd more appropriate (if want removed further distinctions between characters). some other distinctions not caught this, notably stroked latin characters. there's no clear non-locale-specific way (should ł considered equivalent l or w?) may need customise beyond this. there cases nfd , nfkd don't work quite expected, allow consistency between unicode versions. hence: public static ienumerable<char> removediacriticsenum(string src, bool compatnorm, func<char, char> cust...

sql server - MS SQL Timeout on ASP.NET Page but not in SSMS -

when sproc executed on 1 of our asp.net pages, times out on sql server exception timeout expired. timeout period elapsed prior completion of operation or server not responding. . when execute same sproc in ssms, returns relatively quickly. sql server , iis on same box. logged in same user in both places. other pages fine. probably parameter sniffing. my answer here gives queries can use retrieve both execution plans (the ssms 1 , asp.net one) compare , contrast. edit this might more useful query actually. use yourdatabase; select * sys.dm_exec_cached_plans cross apply sys.dm_exec_sql_text(plan_handle) cross apply sys.dm_exec_query_plan(plan_handle) cross apply sys.dm_exec_plan_attributes(plan_handle) epa sys.dm_exec_sql_text.objectid=object_id('yourprocname') , attribute='set_options'

ruby - Accessing SSL enabled Google Apps feed with http protocol -

building app using calendar on google apps domain has ssl enforced domain-wide. found problem when building rails app using gcal4ruby library , used allcalendars feed url non-ssl protocol (gcal4ruby debug output snippet [sic]): … url = http://www.google.com/calendar/feeds/default/allcalendars/full starting post header: authorizationgooglelogin auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgdata-version2.1 redirect recieved, resending https://www.google.com/calendar/feeds/default/allcalendars/full?gsessionid=xxxxxxxxxxxxxxxxxxxxxx redirect recieved, resending https://www.google.com/calendar/feeds/default/allcalendars/full?gsessionid=xxxxxxxxxxxxxxxxxxxxxx redirect recieved, resending https://www.google.com/calendar/feeds/default/allcalendars/full?gsessionid=xxxxxxxxxxxxxxxxxxxxxx … this interesting because seemed continue forever. think i've fixed in gcal4ruby locally creating ability use allcalendars feed https protocol (i.e: https://www.google.com/calendar/feeds/default/allcale...

html - How can I take an xml string and display it on my page similiar to how StackOverflow does it with 'insert code'? -

i'm using datacontractserializer convert , object returned wcf call xml. client see xml string in webpage. if output string directly label, browser strips out angle brackets obviously. question how can similar stackoverflow? doing find & replace replace angle brackets html entities? see doing code tag inside pre tag , making spans appropriate class. there existing utility out there can use instead of writing kind of parsing routine. i'm sure free must out there. if can direct right place or code can accomplish this, appreciate it. apologize if more of meta.stackoverflow question. tips. the basic answer html displayed typed, special characters , all, need replace special characters ( < , > etc.), escaped equivalents ( &gt; , &lt; etc.). beyond if want syntax colouring you'll have parse input identify keywords etc. a full list of special characters , escape codes can found here , 1 site of many.

code generation - qt qmake extra compilers with dependencies among generated files -

can qmake handle dependencies of generated source files? we have prf file this: idl_h.name = generate .h file ${qmake_file_base}.idl idl_h.input = idls # variable containing our input files idl_h.variable_out = headers idl_h.commands = <command takes .idl , genrates .h> idl_h.output = $$idl_gen_dir/${qmake_file_base}.h qmake_extra_compilers += idl_h this generation works fine , creates .h files @ make time. problem input files ( $$idls ) depend on each other, , not built in correct order. have app.idl , containing: #include "common.idl" it seems following should work idl_h.depend_command = g++ -ee ... $$idl_gen_dir/${qmake_file_base}.h but apparently depend_command is not executed . another idea parse dependencies out of original idl: idl_h.depends = $$system(cat ${qmake_file_in} | grep "^#include" | sed -re 's/#include\s+["<]([^.]+)\.idl[">]/\1.h/') but seems qmake syntax failing me. try adding i...

sql - Is a view in the database updatable? -

can update view in database? if so, how? if not, why not? the actual answer "it depends", there no absolutes. the basic criteria has updateable view in opinion of database engine , can engine uniquely identify row(s) updated , secondly fields updateable. if view has calculated field or represents product of parent/child join default answer no. however possible cheat... in ms sql server , oracle (to take 2 examples) can have triggers fire when attempt insert or update view such can make server doesn't think updateable - because have knowledge server can't infer schema.

Could this be C# Model View Controler console app in and if not why? -

just trying grasp mvc doing ... , still not sure got right .. using system; using system.text; namespace mvpconsoleapp { class program { static void main(string[] args) { view objview = new view(); controller objcontroller = new controller(objview); objcontroller.buildui(); objview.waitandread(); } } //eof program class view { private string _prop1gui ; public string prop1gui { { return _prop1gui; } set { _prop1gui = value; } } private string _prop2gui; public string prop2gui { { return _prop2gui; } set { _prop2gui = value; } } public void waitandread() { string bothprops = console.readline(); string ...

How can I retrieve dynamic added content using jQuery? -

my scenario this: when page loaded, listbox countries loaded. by selecting item dropw down list, country item in listbox selected using jquery. now country selected in listbox, call function retrieves cities , populate city listbox. the code looks this: $('#mydropdownlist').change(function() { (...) // selected country set here populatecitylistbox(); //this alert undefined. because it's triggered before callback in populatecitylistbox() alert(jquery('#citylistbox option[value=oslo]').val()); }); function populatecitylistbox() { //get id selected country var ctryid = jquery("select#countrylistbox").val(); jquery.post("wp-content/themes/storelocator/include/jquery_bll.php", { instance: 'getcitiesbycountry', countryid: ctryid }, function(data) { var options = ''; (var = 0; < data.length; i++) { options += '<option value...

Android tabwidget -

i using tabwidget when apply white theme on tab widget selected tab text remain black unselected tab text turn white , invisible, how can change color of tab widget indicator text. alt text http://img684.imageshack.us/img684/3238/tabt.jpg fixed issue using following code tabhost.gettabwidget().setbackgroundcolor(color.black);

wpftoolkit - WPF Datepicker Control None option(WPF ToolKit) -

how provide option select no dates(none) in datepicker control? please help!! thanks sharath now, have installed wpf toolkit , tried it... i found out if manually delete text in textbox part of datepicker, selecteddate deleted. optionally, can add button deletes selecteddate directly. wpf code: <my:datepicker name="datepicker1" height="26" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" /> <button name="btndeletedate" height="26" width="90">set no date</button> code behind (vb): private sub btndeletedate_click(byval sender system.object, byval e system.windows.routedeventargs) handles btndeletedate.click datepicker1.selecteddate = nothing end sub if want todays date not highlighted grey, can set istodayhighlighted false. it still "active date" though, visible box around date kind of "cursor" start point if move around arrows on keyb...

ASP.NET MVC app can't find Views since I moved my app to a new directory -

i copied app , put somewhere else. changed iis @ new place , ran it. debugging - runs through controllers in new location fine. when nips off view goes old location of app?!? have changed in routes? routing engine grabs views when controller requests them. perhaps issue in global.asax file? i'm afraid that's can offer, without more information.

bash - When do you use brace expansion? -

i understood brace expansion is. don't know use that. when use it? please give me convenient examples. thanks. the range expression form of brace expansion used in place of seq in for loop: for in {1..100} # 100 times done

user interface - How to create or modify the google maps controls?s -

i wonder how sites trulia.com , fotocasa.com customized google maps ui website ex1: http://www.trulia.com/for_sale/pinecrest,fl/x_map/#for_sale/pinecrest,fl/x_map/2_p/ they created custom controls maps (think custom html elements overlayed on map), explained examples in google maps api v3 ( click here ).

command line - How to output my ruby commandline text in different colours -

how can make puts commands output commandline based ruby program colour? appreciated references how call each different colour also. lets start this.. puts "the following word blue.. im blue!" puts "the following word green.. im green!" puts "the following word red.. im red!" and different text want in different colours want, idea. im using ubuntu, need change approach program outputs correctly in diff os? i found this article describing easy way write coloured texts console. article describes little example seems trick (i took liberty improve slightly): def colorize(text, color_code) "\e[#{color_code}m#{text}\e[0m" end def red(text); colorize(text, 31); end def green(text); colorize(text, 32); end # actual example puts 'importing categories [ ' + green('done') + ' ]' puts 'importing tags [' + red('failed') + ']' best seems define of colours. can extent example wh...

authentication - WCF The remote server returned an error: (404) Not Found -

i have simple wcf service hosting on iis6 on server on network. when use following binding on server in network got 404, if made clientcredentialtype none, works, works on machine, why windows authentication fails on server, 404 means cannot see endpoint, if proxy problem how fix that. <basichttpbinding> <binding name="httpwindowsauthentication" maxreceivedmessagesize="1048576" bypassproxyonlocal="true" usedefaultwebproxy="false"> <security mode="transportcredentialonly"> <transport clientcredentialtype="windows" proxycredentialtype="none"/> </security> </binding> </basichttpbinding> thanks it security related, since works when change clientcredentialtype. that 404, improve security, system saying "i cannot find file", instead of saying "yes there file name not allowed @ it...

java - SwarmCache Hibernate configuration -

could hint me how configure swarmcache hibernate work in cluster (distributed cache)? there other alternatives (please, don't suggest jboss cache)? actually, don't know why hibernate documentation (see 19.2. second level cache ) doesn't mention them cluster safe both oscache , ehcache usable in clustered environments. because hibernate doesn't officially supports them. nevertheless, know both work in distributed environment because did ehcache , matt raible did oscache ( patching hibernate recommended though). check out matt's blog post oscache vs. ehcache hibernate's 2nd level cache , it's informative. back question now... it's hard give precise answer didn't give details on requirements , constraints take account that: jgroups is toolkit reliable multicast communication (note doesn't mean ip multicast, jgroups can use transports such tcp). my understanding of previous point using jboss cache isn't excluded (see thi...

api - PHP Twitter replace link and hashtag with real link -

i looping on json response twitter api. each api response gives me tweet similar to: hi name @john, , love #soccer, visit me i trying replace @john , , insert <a href=http://twitter.com/john>@john</a> comma ( , ) after @john , problem. how replace dots, commas, etc before , after tag? $str = preg_replace("/@(\w+)/i", "<a href=\"http://twitter.com/$1\">$0</a>", $str);

c++ - itoa function problem -

i'm working on eclipse inside ubuntu environment on c++ project. i use itoa function (which works on visual studio) , compiler complains itoa undeclared. i included <stdio.h> , <stdlib.h> , <iostream> doesn't help. www.cplusplus.com says: this function not defined in ansi-c , not part of c++, supported compilers. therefore, i'd suggest don't use it. however, can achieve quite straightforwardly using stringstream follows: stringstream ss; ss << myint; string mystring = ss.str();

architecture - How to share settings in SOA systems? -

i have thinked of 3 alternatives: the settings handed 1 service next in each transaction. each service can provide settings next upon request. the settings stored in central service services must access time time. what favorite approach , why? your third approach best because in opinion each service needs autonomous other service. autonomous services 1 of tenants of soa.

Using SVN with a MySQL database ran by xamp - yes or no? (and how?) -

for current php/mysql project (over group of 4 5 team members), using setup: each developer codes , test on localhost running xamp, , upload test server via svn. one question have how synchronize mysql database? may have added new table project , php code references it, other team members need access table code (once got through svn) work. we not working in same office time, having lan , mysql server in office not feasible. toying 2 solutions setup test db online, , have coders reference that, when coding localhost. downside: can't test if happen not have internet access. somehow sync localhost copy of mysql db. kind of silly? , if consider this, how do it? (which folder add svn?) (i guess related question how automatically update live mysql db testing db, regardless if on remote server or hosted locally via xamp. advice regarding welcomed!) it's reasonable maintain database schema in source control -- in fact, database-driven products that. have no idea...

Button with dynamic text in Flash CS5 -

i'm new flash pro programming, , trying create button-type symbol can set label. problems i'm running follows. if make symbol type=button, can't add actionscripts in frames and/or access subcomponents? why so? if make symbol type=movieclip, can add actionscript , access sub-components, can't figure out how make handcursor show on hover? any ideas appreciated. thanks.. there couple of ways it. first off - have ability access sub components of button , can add actionscript it. however, same , build button using movieclips gives more freedom. to overcome hand pointer issue - there 2 ways reproduce this. firstly (my preference), build button object. invisible, or @ worst 1% opacity. , i'd place on upper layer of movieclip. not require hover states or code - can reproduce hand icon. the second option within code. 1 problem tend create - need same code sub components, if not - might have selective text in reproduced movieclip of change mous...

codeigniter - doctrine Command Line Interface doesn't work -

i followed instructions on page : http://www.doctrine-project.org/projects/orm/1.2/docs/cookbook/code-igniter-and-doctrine/en i did things command line interface doesn't work me when execute doctrine shell script in terminal show me this define('basepath','.'); // mockup app executed ci ;) chdir(dirname(__file__)); include('doctrine.php'); instead of real result : $ cd system/application $ ./doctrine doctrine command line interface ./doctrine build-all ./doctrine build-all-load ./doctrine build-all-reload ./doctrine compile ./doctrine create-db ./doctrine create-tables ./doctrine dql ./doctrine drop-db ./doctrine dump-data ./doctrine generate-migration ./doctrine generate-migrations-db ./doctrine generate-migrations-models ./doctrine generate-models-db ./doctrine generate-models-yaml ./doctrine generate-sql ./doctrine generate-yaml-db ./doctrine generate-yaml-models ./doctrine load-data ./doctrine migrate ./doctrine rebuild-db i don'...

c# - Making thread wait for exit without resorting to Thread.Sleep() -

i'm having problem trying wrap head around i'm doing wrong while attempting simple threading operation in 1 of applications. here's i'm after: want main thread spawn separate thread; separate thread open program, feed program argument (a filename) , once program closes, child thread terminate , main thread can continue it's work. i've created simple code example illustrate. , truely, doesn't have separate thread, needs wait until program done it's work. doing wrong here? appreciated! class program { static void main(string[] args) { console.writeline("opening...."); var t = new thread(startprogram); t.start(); t.join(); console.writeline("closed"); console.readline(); } private static void startprogram() { var startinfo = new processstartinfo(); startinfo.filename = @"c:\program.exe"; startinfo.arguments = @"file....

integer - Java reverse an int value without using array -

can explain me how reverse integer without using array or string. got code online, not understand why + input % 10 , divide again. while (input != 0) { reversednum = reversednum * 10 + input % 10; input = input / 10; } and how use sample code reverse odd number. example got input 12345, reverse odd number output 531. i not clear odd number. way code works (it not java specific algorithm) eg. input =2345 first time in while loop rev=5 input=234 second time rev=5*10+4=54 input=23 third time rev=54*10+3 input=2 fourth time rev=543*10+2 input=0 so reversed number 5432. if want odd numbers in reversed number then. code is: while (input != 0) { last_digit = input % 10; if (last_digit % 2 != 0) { reversednum = reversednum * 10 + last_digit; } input = input / 10; }

c# - Identifying derived types from a list of base class objects -

this may seem kind of "homework-ish" and/or trivial, real business purpose; it's easiest way think of explain i'm conceptually trying do. suppose have animal class, , other classes (bird, cat, kangaroo). each of these inherits animal. animal might this: public class animal { public animal() { } public string name { get; set; } public string animaltype { get; set; } public list<animal> friends { get; set; } } kangaroo might this: public class kangaroo : animal { public kangaroo() { } public int taillengthinches { get; set; } } suppose kangaroo has 2 friends, bird , cat. how add list of "animal" friends (as type animal), preserve ability access properties of derived classes? (as in, still need able work properties specific type of animal, feathercolor bird, example, though considered "animals". the reason trying when later list of animal's "friends", vital know type of ...

.net - How to hash only image data in a jpg file with dotnet? -

i have ~20000 jpg images, of duplicates. unfortunately, files have been been tagged exif metadata, simple file hash cannot identify duplicated one. i attempting create powershell script process these, can find no way extract bitmap data. the system.drawing.bitmap can return bitmap object, not bytes. there's gethash() function, apparently acts on whole file. how can hash these files in way exif information excluded? i'd prefer avoid external dependencies if possible. this powershell v2.0 advanced function implemention. bit long have verified gives same hashcode (generated bitmap pixels) on same picture different metadata , file sizes. pipeline capable version accepts wildcards , literal paths: function get-bitmaphashcode { [cmdletbinding(defaultparametersetname="path")] param( [parameter(mandatory=$true, position=0, parametersetname="path", valuefrompipeline=$tr...

c# - Is that synchro-construction correct? -

i have multi-threaded application. threads use abc.connector. want 1 thread @ time have access connector property. class abc { /// <summary> /// synchronization object. /// </summary> static object _syncobject = new object(); static dataaccess _connector; /// <summary> /// global object data access. /// </summary> public static dataaccess connector { { lock (_syncobject) { return _connector.createcopy(); // copy of original _connector } } set { lock (_syncobject) { _connector = value; } } } } is correct ? well, make getting , setting connector property thread-safe (although i'd make _syncobject read-only). however, doesn't make dataaccess thread-safe... mutex apply while threads getting , setting property . in other words, if 2 threads bot...

How can I decode HTML entities in C++? -

how can decode html entities in c++? for example: html: &quot;music&quot; &amp; &quot;video&quot; decoded: "music" & "video" thanks. if you're comfortable using c-strings, might interested in my answer similar question. there's no need compile code c++: compile entities.c -std=c99 , link object file c++ code, eg if have follwing example program foo.cpp #include <iostream> extern "c" size_t decode_html_entities_utf8(char *dest, const char *src); int main() { char line[100]; std::cout << "enter encoded line: "; std::cin.getline(line, sizeof line); decode_html_entities_utf8(line, 0); std::cout << line; return 0; } use g++ -o foo foo.cpp entities.o

sql server - SQL 2000/2005/2008 - Find Unique Constraint Name for a column -

i have table column needs data type upgrading. running alter script causes errors due unnamed unique constraint. i need drop constraint unfortunately not know name. have script lists unique constraints on table need find out how go 1 step further , associate constraint names columns. select * sysobjects sysobjects.xtype = 'uq' , sysobjects.parent_obj= object_id(n'users') this returns uq__users__45f365d3 uq__users__46e78aoc i need know columns theses linked in order delete right one. need support sql 2000, 2005, , 2008. any suggestions appreciated. thanks ben you should able use information_schema.constraint_column_usage establish this. select constraint_name information_schema.constraint_column_usage table_name = 'tablename' , column_name = 'columnname' not whether view supported in sql 2000 though.

c++ - Initializiation confusion -

not sure of appropriate title, stems discussion: do parentheses after type name make difference new? on visual studio 2008, when run following code: struct stan { float man; }; int main() { stan *s1 = new stan; stan *s2 = new stan(); } examining locals, s1 has uninitialized float random value. s2 value initialized 0. however, if add string data member, float in both instances uninitialized. struct stan { std::string str; float man; }; however, string in both instances initialized. tried adding other non-pod classes instead of string, latter case occurs if add string data member. gather adding string still keeps pod class? if wasn't pod class, should have value initialized regardless of parenthesis, right? ideas why floats(and other primitive data types matter) aren't initialized when add string data member? adding string stops struct being pod class because pod class must aggregate class no members of type no...

svn - Connect to Subversion Remotely -

i have set subversion on 1 system , works fine on computer. mean can connect svn://localhost , commit , update , ... . want connect svn repository remotely system. gives me error : error: propfind of '/projects/test': 504 proxy timeout ( connection timed out. more information event, see isa server help. ) ( http://192.163.10.163 ) idea? thanx in advance configure firewall correctly.

Web scraping with Python -

i'd grab daily sunrise/sunset times web site. possible scrape web content python? modules used? there tutorial available? use urllib2 in combination brilliant beautifulsoup library: import urllib2 beautifulsoup import beautifulsoup # or if you're using beautifulsoup4: # bs4 import beautifulsoup soup = beautifulsoup(urllib2.urlopen('http://example.com').read()) row in soup('table', {'class': 'spad'})[0].tbody('tr'): tds = row('td') print tds[0].string, tds[1].string # print date , sunrise

spring - @PostConstruct Annotation and JSF -

i have problem on project implemented on jsf 1.2 (myfaces 1.2.6) , integrated spring. the problem @postconstruct annotation. executed see executed before managed properties populated. first suspect managed properties taken spring context tried simple integer managed property, see not populated too. do have idea? thanks in advance. i have solved it. bug of myfaces 1.2.6. it resolved when upgraded 1.2.7

c# - How can I get the sum of numbers from a diagonal line? -

here sum diagonal top-left bottom-right: public int sumardiagonal() { int x = 0; (int f = 0; f < filas; f++) { (int c = 0; c < columnas; c++) { if (f == c) { x += m[f,c]; } } } return x; } how can go top-right bottom-left? your original code 2 nested loops not efficient. better this: public int sumardiagonal() { int x = 0; (int = 0; < math.min(filas,columnas); ++i) x += m[i,i]; return x; } public int sumarantidiagonal() { int x = 0; (int = 0; < math.min(filas,columnas); ++i) x += m[filas - 1 - i,i]; return x; }

help to understand XPath -

i have such xpath expression : link[@rel='alternate' , @type='text/html' or not(@rel)]/@href | link/text() ? acctually don't understand symbol | the pipe ( | ) in xpath combines expressions. return href attribute link elements (that match predicate) , text content of links so given fragment like <link>test</link> <link href="http://www.google.com">google</link> <link rel="zzzz" href="http://www.stackoverflow.com">stack overflow</link> you'd get: test http://www.google.com google stack overflow

fullscreen - SDL - (Hardware) Pixel Scaling -

in sdl game, i'd retain fixed resolution of game area, both gameplay , performance reasons. what wanted have small resolution (e.g. 320 * 240), , when resizing window / switching fullscreen mode letting sdl / graphics card scale each pixel. however problems occur are: the rendered picture gets 'blurry' the actual drawing area smaller screen, there black regions on top, bottom left , right what can solve this? i have seen work in other games before use stretch functions sdl stretch-blit surface, or upload surface opengl texture each frame , render appropriately-sized quad.

recursion - Visualisation of Tree Hierarchy in HTML -

i looking of inspiration doing interaction design on hierachy/tree structure. (products number of subproducts, rules apply selecting subproducts). i want have tree there visible connection between sub-nodes , parent node. , want visualize rules apply selecting them. typical rules: mandatory: select 1 of 1 sub-product optional: select 0 or more of several subproducts mutual exclusive: select 1 of several subproducts i hope idea. i looking inspiration in area. suggestions, examples, tips welcome here several: http://thejit.org/ http://www.jsviz.org/blog/ http://vis.stanford.edu/protovis/ if willing use other html/javascript, flare excellent library adobe flash.

database - Following multiple log files efficiently -

i'm intending create programme can permanently follow large dynamic set of log files copy entries on database easier near-realtime statistics. log files written diverse daemons , applications, format of them known can parsed. of daemons write logs 1 file per day, apache's cronolog creates files access.20100928. files appear each new day , may disappear when they're gzipped away next day. the target platform ubuntu server, 64 bit. what best approach efficiently reading log files? i think of scripting languages php either open files theirselves , read new data or use system tools tail -f follow logs, or other runtimes mono. bash shell scripts aren't suited parsing log lines , inserting them database server (mysql), not mention easy configuration of app. if programme read log files, i'd think should stat() file once in second or size , open file when it's grown. after reading file (which should return complete lines) call tell() current position , next...

html - How to compare XML element with XSL variable -

i using xslt transform xml document html use in email. need compare xml elements xml element value know format give value. have xml structure such: <main> <comparer>1</comparer> <items> <item> <name>blarg</name> <values> <value>1</value> <value>2</value> </values> </items> </main> the item information being used build table: <table> <tr> <td>blarg</td> <td>1</td> <td>2</td> </tr> </table> what need able use xsl compare item values 'comparer' node value , if equal bold cell in table otherwise cell value snot bolded. need accomplish without use of javascript has done in xsl. right now, looking @ using xsl:variable attempting use xsl:when compare. unfortunately, having little luck. have started pl...

c# - Microsoft Word 2007 VSTO, Create table outside word? -

i using vsto fill data table in microsoft word 2007 template. amount of data varies , filling many pages (+50) takes lot of time. the code use create table: word.table table = doc.tables.add(tableposition, numberofrows, 8, ref system.reflection.missing.value, ref system.reflection.missing.value); i suspect time consumption due communication between visual studio (c#) , word each time insert data cell. if case, might faster create table in c# , afterwards insert word. the microsot.office.interop.word.table abstract class - cannot this word.table table = new word.table(); which have been handy. are there other possibilities when using vsto? try creating table in html clipboard format, add clipboard, paste. try creating table in html , inserting it. try creating tab-delimited string newline character each record. insert ...

java - What is the difference between Tomcat, JBoss and Glassfish? -

i starting enterprise java , book following mentions use jboss. netbeans ships glassfish. have used tomcat in past. what differences between these 3 programs? tomcat servlet container, i.e. implements servlets , jsp specification. glassfish , jboss full java ee servers (including stuff ejb, jms, ...), glassfish being reference implementation of latest java ee 6 stack, jboss in 2010 not supporting yet.

iphone - How is screenshots slideshow implemented in App Store? -

i slideshow of application screenshots in application info in app store. have idea how implemented? may there tutorials or source code available? not find any. may not same, similar, user can slide images in imageview good thanks check out tutorial, using uiscrollview pagingenabled set yes . http://blog.proculo.de/archives/180-paging-enabled-uiscrollview-with-previews.html

.net - What's the best way to determine that threads have stopped? -

i have windows service has number of threads need stopped before service stops. i'm using model stopping threads , signalling have been stopped: threadpool.queueuserworkitem(new waitcallback(delegate { thread1running = true; try { while (running) { autoreset1.waitone(timespan.fromseconds(30.0)); if (running) { // stuff } } } { thread1running = false; } })); when comes time shut service stop, set running false , call set() on autoresets out there. instantly signals threads stop sleeping or stop once they've finished processing they're working on. works well. but, part i'm nervous about, verifying has stopped. i'm doing now: int32 tries = 0; while (tries < 5 && (thread1running || thread2running || thread3running)) { tries++; thread.sleep(timespan.fromseconds(5.0)); } the main reason don't it's time based,...

dns - how to redirect any domain name to our web application -

we have saas web app, written in zend mvc (php) users can enter own domain name in settings page. when enter e.g. www.customdomain.com want domain redirect our web application can serve own pages our app. we same subdomains having *.ourapp.com entry in our dns configuration. works great subdomains customdomain.ourapp.com. this doesn't seem work full domain names www.customdomain.com. what's easiest way have domain address link our application, can read out incoming domain name , act accordingly in our app? for letting dns entry point @ servers: domain registered (and owned customer): make him configure cname entry server's ip. (even google let enduser hand - automating might hard) domain free: register it, configure cname (you own it) if want redirect, user can upload html file or .htaccess file, performs redirect. has done customer, too.

asp.net - Graphical Interface for adding users to aspnet_Membership and aspnet_Users etc -

this might pretty basic question, how add new users aspnet_users table in asp.net 2.0 app? i know using sql script, , being mindful of associations, know i've seen graphical interface it... can't find code adding new users in web app i'm maintaining (it might in there can't find it). can point me in right direction? let me know if need more info! -ev in visual studio, in solution explorer on right, there should "asp.net configuration" icon (looks world , hammer). click on , can configure site via gui. if adding basic users table, easy way. however, mean have create accounts them manually. usually, i'd stick sql script or sql management studio (as cheeso) pointed out.

What's the best way of making 3D models and designing levels? -

okay. want know how make game 3d models , design levels. start? free open source solution best. additionally, how create realistic looking textures on 3d objects? is blender choice? is there outsource or market place purchasing game assets? first, unfortunately wrong site these sort of questions since you're not (apparently, correct me if i'm wrong) asking programming own 3d engine/whatnot how create 3d content artistic feat. i'd suggest head on cgtalk , vfxtalk , both have own subforums people interested of programming 3d stuff. however , since used 3d hobbyist (lightwave 3d, woo!) feel should answer questions here goes: first , reasonable open source solution blender 3d thought. it's quite horrible in usability , nothing well, it's jack of trades , master of none , not mention it's abysmal usability. code pov might interesting though since basic , rather advanced things related 3d programming whole. second , materials have been hot ...

sql - Getting Parent of Parent in Self Join Table -

i have self join table. table being used join 4 level, i.e.; region -> country -> county -> town how can parent of parent of town. 2 level query select t.shortname town, (select c.shortname locations c c.locationid = t.parentid) county locations t t.locationid = 100 now want country parent of county. either hardcode join or use recursive cte. ;with locs ( select 1 level, shortname, parentid locations locationid = 100 union select level + 1, l.shortname, l.parentid locations l join locs on locs.parentid = l.locationid ) select * locs;

scripting - Create Tablespace Script in Oracle 10g -

i using below script generating ddl create tablespaces in database. select 'create tablespace ' || df.tablespace_name || chr(10) || ' datafile ''' || df.file_name || ''' size ' || df.bytes || decode(autoextensible,'n',null, chr(10) || ' autoextend on maxsize ' || maxbytes) || chr(10) || 'default storage ( initial ' || initial_extent || decode (next_extent, null, null, ' next ' || next_extent ) || ' minextents ' || min_extents || ' maxextents ' || decode(max_extents,'2147483645','unlimited',max_extents) || ') ;' "script recreate tablespaces" dba_data_files df, dba_tablespaces t df.tablespace_name=t.tablespace_name; it works good. when tablespace contains 2 datafiles creates seperate command create tablespace. creates 2 create tablespace commands if tablespace contains 2 datafiles. please share thoughts. cheers, srinivasan thirunavukkaras...

javascript - Why would Safari offer nearly opposite results here? -

test here: http://jsperf.com/test-for-speed-of-various-conditionals i'm interested if others getting same results, , people might think of why results vary (esp. w/ safari) across browsers. interesting how democratically firefox handles various cases. please inform if there terribly wrong methodology :) firefox 3.6/mac osx 10.64: switch = 824,352 ops/sec (14% slower) if/else = 530,062 (44% slower, slowest) hash/lazy = 968,035 (fastest) hash/if/else = 963,765 (0% slower) chrome 6.0.472.63/mac osx 10.64: switch = 10,220,039 ops/sec (62% slower) if/else = 7,744,284 (71% slower, slowest) hash/lazy = 27,130,039 (fastest) hash/if/else = 25,297,370 (6% slower) safari 5.0.2/mac osx 10.64: switch = 15,044,132 ops/sec (fastest) if/else = 1,793,051 (88% slower, slowest) hash/lazy = 10,381,941 (30% slower) hash/if/else = 11,119,576 (26% slower) opera 10.10/mac osx 10.64: switch ...

Optimizing Put Performance in Berkeley DB -

i started playing berkeley db few days ago i'm trying see if there's i've been missing when comes storing data fast possible. here's info data: - comes in 512 byte chunks - chunks come in order - chunks deleted in fifo order - if lose data off end because of power failure that's ok long whole db isn't broken after reading bunch of documentation seemed queue db wanted. however, after trying test code fastest results 1mbyte per second looping through db->put db_append set. tried using transactions , bulk puts both of these slowed things down considerably didn't pursue them time. inserting fresh db created on nandflash chip on freescale i.mx35 dev board. since we're looking @ least 2mbytes per second write speeds, wondering if there's missed can improve speeds since know hardware can write faster this. try putting db_config: set_flags db_txn_write_nosync set_flags db_txn_nosync from experience, these increase write...

iphone - NSTimer not invalidating or is refiring -

so here problem have, created 2 nstimer objects , fired when button pressed. user has 20 seconds press button forces alert popup enter validation code, , when press confirm button on alert supposed stop timer. happening works until press confirm instead of timer stopping hangs second( im thinking delay caused keyboard dismiss animation) , timer continues. appreciated , here relevant code: #import "hackergameviewcontroller.h" #import <audiotoolbox/audiotoolbox.h> @implementation hackergameviewcontroller @synthesize decryptlabel, cracklabel, decryptbutton, crackbutton, submit, numbertodecrypt, numbertocrack, stopdecryptbutton, stopcrackbutton, inputcode; @synthesize soundfileurlrefbeep; @synthesize soundfileurlrefbuzz; @synthesize soundfileobjectbeep; @synthesize soundfileobjectbuzz; nstimer *decrypttimer; nstimer *cracktimer; int cracktime; int decrypttime; nsstring *codetoconfirm; #pragma mark uialertview - (void)confirm:(uialertview *)confirm clickedbutton...

Where can I find a C programming reference? -

where can find c programming reference list declaration of built-in functions? "the c programming language"

Dojo: dijit.form.select won't fire "onClick" event the first time clicked -

i've been through dojo docs api , tried google can't find solution problem, hope here can me out. i'm trying create dijit.form.select programmatically (using dojo 1.4) , connect "onclick"-event of widget. here's part of code: var dataselect = new dijit.form.select({ id : "myselect", name : "myselect", labelattr: "label", labeltype: "html" }, "selectid"); dataselect.addoption({value: "value", label: "first item label"}); dojo.connect(dataselect, "onclick", function() { alert("clicked!"); }); what does: select-box created replacing input-field id "selectid", option "first item label" created. everythings right until here. connect "onclick"-event of select, supposed load more options via ajax (but display alert testing purposes in example). the problem: when c...

Compare Monday's data to previous Mondays in SQL Server -

i trying figure out how compare current day's data same data week ago, 2 weeks, etc. let's have table called "order" 2 columns: order table ----------- orderid int identity orderdate datetime if today, monday, able compare number of orders today previous mondays entire year. possible single sql server query? i'm using sql 2008 if makes difference. select cast (orderdate date) [date], count(*) orders orderdate > dateadd(year,-1, getdate()) , datepart(dw,orderdate ) = datepart(dw,getdate()) group cast (orderdate date)

google app engine - How can I call a GWT RPC method on a server from a non GWT (but Java) gapplication? -

i have regular java application , want access gwt rpc endpoint. idea how make happen? gwt application on gae/j , use rest example have gwt rpc endpoints , don't want build façade. yes, have seen invoke gwt rpc service java directly , discussion goes different direction. gwt syncproxy allows access gwt rpc services (e.g methods) pure java (not jsni) code. see http://www.gdevelop.com/w/blog/2010/01/10/testing-gwt-rpc-services/ details.

jQuery Cycle pagerAnchorBuilder Wordpress Modularity Theme -

the modularity wordpress theme includes "post slider" built around jquery cycle. uses pager display small number above sliders. love able change number post title. the code in theme follows: $doc_ready_script .= ' jquery(function() { jquery("#slider-posts").cycle({ fx: "scrollhorz", timeout: 0, prev: "#prev", next: "#next", pager: "#slider-nav", containerresize: 0 }); });'; i not jquery coder (as might able tell!) , thought simple adjustment code follows trick: $doc_ready_script .= ' jquery(function() { jquery("#slider-posts").cycle({ fx: "scrollhorz", timeout: 0, prev: "#prev", next: "#next", pager: "#slider-nav", containerresize: 0, pageranchorbuilder: function(idx, slide) { return '<li><a href="#...

osx - Why does Ruby's ri not return to a bash command prompt? -

when execute ri ... in terminal on mac, get, maybe, 50 blank lines, output i'm expecting, last line: (end) , (end) displayed white letters on black background. not returned bash, -- ri still running, , can't enter anything. also, why blank lines? why happening? the output being piped through pager (the value of environment variable $pager , /usr/bin/more or /usr/bin/less ). allows page through screenfuls of data hitting spacebar (among other nice features), instead of having scroll , down in terminal. exit, type q .

android - View user's twitter feed in Twitter app? -

i have user's twitter handle. right i'm opening through web page like: string url = "http://www.twitter.com/" + "example_handle"; intent intent = new intent(intent.action_view, uri.parse(url)); startactivity(intent); if user has twitter android app installed, there different intent can use gives user option view user's twitter feed in twitter app, instead of forcing them directly browser? i'm not sure if author's of twitter app have exposed such intent, thanks afaik, twitter app undocumented standpoint of developer integration this. we told released open source. possible that, @ time, document integration strategies this.

how to get mysql command line client not to print blob fields in select * -

exploring tables have blob fields. how select * command line client , have surpress printing (or truncate standard field width) blob fields rather scrolling bunch of binary junk on screen? mysql 5.1 client. want select * , not list of non-blob fields individually, development. this can performed natively in mysql, it's quite unwieldy: set @sql=concat('select ', (select group_concat(column_name) information_schema.columns table_schema='test' , table_name='test' , data_type!='blob'), ' test.test'); prepare preparedsql @sql; execute preparedsql; deallocate prepare preparedsql; i prefer bash aliases/function mysql procedures they're more transportable between systems: function blobless() { cols='' _ifs=$ifs ifs=$(echo -en "\n\b") col in $(mysql --skip-column-names -e "select column_name information_schema.columns table_schema='$1' , table_name='$2' , ...

python - twisted: no exception trace if error from a callback -

consider following code: df = defer.deferred() def hah(_): raise valueerror("4") df.addcallback(hah) df.callback(hah) when runs, exception gets eaten. did go? how can displayed? doing defer.setdebugging(true) has no effect. i ask because other times, printout saying "unhandled error in deferred:". how happen in case? see if add errback df errback gets called exception, want print error , nothing else, , don't want manually add handler every deferred create. the exception still sitting in deferred. there 2 possible outcomes @ point: you add errback deferred. do, called failure containing exception raised. you let deferred garbage collected (explicitly delete df , or return function, or lose reference in other way). triggers ''unhandled error in deferred'' code. because errback can added deferred @ time (ie, first point above), deferreds don't otherwise unhandled errors right away. don't know if error unhandl...

language agnostic - Why should you ever have to care whether an object reference is an interface or a class? -

i seem run discussion of whether or not apply sort of prefix/suffix convention interface type names, typically adding "i" beginning of name. personally i'm in camp advocates no prefix, that's not question about. rather, it's 1 of arguments hear in discussion: you can no longer see at-a-glance whether interface or class. the question pops in head is: apart object creation, why should ever have care whether object reference class or interface? i've tagged question language agnostic, has been pointed out may not be. contend because while specific language implementation details may interesting, i'd keep on conceptual level. in other words, think that, conceptually, you'd never have care whether object reference typed class or interface i'm not sure , hence question. this not discussion ides , or don't when visualizing different types; caring type of object necessity when browsing through code (packages/sources/whatever form...