Posts

Showing posts from September, 2010

How do I use is_tag on a post in WordPress's archive.php -

i want able add particular thing post on blog based on posts tags. on category pages especially. i'm in archive.php file , want use if ( is_tag() ) print stuff based on if tag there. the problem of course not working. i'm assuming because can't use is_tag on non tag pages? is_tag tells whether page being viewed tag archive page (a page lists posts tag). not function retrieve tags post. use get_the_tags that.

c - 10 element array -

my teacher gave assignment me. question below:= write program prompts user enter 10 double numbers. program should accomplish follwing: a. store information in 10-element array. b. display 10 numbers user. i of above in main(). hint: should use loops, not hardcode values 0 through 9. should easy convert program accept 1000 numbers instead of 10. for bonus mark, @ least 1 of tasks (a or b) in separate function. pass array function; not use global (extern) variables. i confused above. wrote program in source code. doing wrong? below:= #include<stdio.h> int main(void) { int number[10]; int i; (i = 0; <10; i++) printf("%d.\n", i, number[i]); printf("\n\npress [enter] exit program.\n"); fflush(stdin); getchar(); return 0; } thanks. not bad far, i'd make following comments: if need input double numbers, should use double rather int . you need statement...

iphone - NSUserDefaults -- Data persisted for a user of app launch? -

does values stored in nsuserdefaults specific user login? let's if different user logs in application in same device, able see persisted data saved when user 1 logged in same device using nsuserdefaults? if save in nsuserdefault can access key(same saving). logging not considerd.whatever entered specific key can access that. so can values saved in nsuserdefault persists users.

How to call a function during object construction in Javascript? -

i want create object , run 2 of methods on object creation. if object function newobj(){ this.v1 = 10; this.v2 = 20; this.func1 = function(){ ....}; this.func2 = function(){...}; } and call object var temp = new newobj(); i want run func1() , func2() without calling them explicity on temp variable, temp.func1() . want them called when create new object variable. tried putting this.func1() inside newobj declaration doesn't seem work. add method invocation statements in constructor: function newobj(){ this.v1 = 10; this.v2 = 20; this.func1 = function(){ ....}; this.func2 = function(){...}; this.func1(); this.func2(); } i think solution of needs.

c# - Posting image/video to MySpace using API? -

i working in asp.net 3.5 c# 2008.i have done authentication part & i'm able image urls or videos application. i'm able send messages myspace. post images & videos. please let me know how can post images/videos application. here link documentation on using media items api. http://wiki.developer.myspace.com/index.php?title=opensocial_0.9_mediaitems it explains how use it. you need issue post request on following url http://api.myspace.com/1.0/mediaitems/{personid}/{selector}/@videos if image set content-type image/{type} content-type="image/jpg" jpg these formats supported: .jpg, .gif, .bmp, .tiff, .png. similarly videos use content type content-type=”video/mpeg” these formats supported .avi,.mov,.mpg,.wmv. for more details please consider checking out above link. for details on post request or structure check out http://www.jmarshall.com/easy/http/

WPF custom control question -

i've done before cannot find old code. how embed window inside window. let created custom form , saved window1.xaml, , want embed in window2.xaml, without copy , pasting xaml code.. tia edit: think question misleading, i'll rephrase it. i have window1.xaml added custom headers , background images/colors. then in window2.xaml, want window1 custom control , embed here. not sure if content presenters, still googling answer :) i believe should make use of pages or usercontrols in such cases. way can navigate other parts/pages/controls defined in application. codekaizen right , can't host window inside window

c# - What does it mean to put DataMemberAttribute on interface member? -

what mean put datamemberattribute on interface member? how affect derived classes? as shown in following signature, datamember attribute not inheritable [attributeusageattribute(attributetargets.property|attributetargets.field, inherited = false, allowmultiple = false)] public sealed class datamemberattribute : attribute therefore, makes little sense decorate interface members attribute have decorate implementing classes' members attribute too.

c# - Unhandled exception coming from GC thread when a static-constructor / type-initializer fails -

(title was: "typeloadexception not wrapped targetinvocationexception reflection used") with bltoolkit figured out interesting fact - methodinfo.invoke not catching exception in calling method. see example - emulates exception in static constructor method, invoking via reflection. problem testcomponent inherits component , have overridden dispose method. in sample 2 messages - 1 "handle" , 1 "unhandle" - seems components have different handling inside reflection on lower levels. if comment out method dispose(bool disposing) - receive "handle" message. can give explanation why happen , propose solution? try-catch inside bltoolkit cannot marked answer - not member of team :) class program { static void main() { appdomain.currentdomain.unhandledexception += (sender, eventargs) => console.writeline("unhandled " + eventargs.exceptionobject.gettype().fullname); try { ...

mysql php - latin1? -

i have mysql table, made in latin1 style , way. how can make table latin1 except 1 column, need able accept chinese characters? also, whats best structure column chinese characters? alter table your_table modify column chinese_column varchar(255) collate utf8_general_ci; <-- or relevant collate details can found here

mysql - SQL - Count by range -

how can select number of population age group count ( 0->10) count ( 11->20) there other question same, can found solution on: in sql, how can "group by" in ranges? the syntax valid mysql too.

php - Creating Outlook mail with Swedish characters from UTF-8-encoded webpage -

i've got database-driven website, written in php, needs create e-mails data. data , every page encoded in utf-8, , contains plenty of swedish characters åäö. i've got following in mailto-link: <a href="mailto:name@domain.com?body=hej!%0d%0aåäöÅÄÖ">mailto-link</a> and e-mail body supposed come out as hej! åäöÅÄÖ this works using internet explorer 8 , firefox @ least (haven't tested in chrome or safari) outlook 2007. however, in internet explorer 7 or earlier åäö comes out weird characters. many of our clients stuck ie 6 , 7. suggestions on how make work? i think wast number of possible browser/email client combinations out there going give endless amount of grief if try solve "mailto:" link. theoretically url-encoding should work, when i've dabbled in past figured out easier send email php in stead. that brings other challenges though, such making sure don't make possible spammers use server email gateway (eg. us...

Why doesn't this regex work as expected in Java? -

trivial regex question (the answer java-specific): "#this comment in file".matches("^#") this returns false. far can see, ^ means means , # has no special meaning, i'd translate ^# "a '#' @ beginning of string". should match. , does, in perl: perl -e "print '#this comment'=~/^#/;" prints "1". i'm pretty sure answer java specific. please enlighten me? thank you. matcher.matches() checks see if entire input string matched regex. since regex matches first character, returns false . you'll want use matcher.find() instead. granted, can bit tricky find concrete specification, it's there: string.matches() defined doing same thing pattern.matches(regex, str) . pattern.matches() in turn defined pattern.compile(regex).matcher(input).matches() . pattern.compile() returns pattern . pattern.matcher() returns matcher matcher.matches() documented (emphasis mine): att...

Android Sync video with timer -

i'm using android construct video player using videoview . i've managed video player running , i'm setting counter using chronometer starts ticking when select file. however, video clip takes few seconds start running while timer has begun counting few seconds when clip starts. how can code sync counter media file? i've checked around can't seem find answer. video = (videoview) findviewbyid(r.id.video); play = (button) findviewbyid(r.id.play); pause = (button) findviewbyid(r.id.pause); stop = (button) findviewbyid(r.id.stop); reset = (button) findviewbyid(r.id.reset); chronometer counter = (chronometer) findviewbyid(r.id.chrono); starttime = systemclock.elapsedrealtime(); time = (textview) findviewbyid(r.id.time); try { video.setvideopath(link); video.start(); video.requestfocus(); } catch (illegalargumentexception e) { e.printstacktrace(); } catch (illegalstateexception e) {...

python - PyFlakes for Javascript? -

is there such standalone package javascript, pyflakes python? see there jslint, looks depends on external things rhino. i prefer basic&compact pyflakes, because shows me 80% of bugs make , has 20% (or less) of complexity of other tools pylint. ideally should have working recipe plugging emacs, can figure out myself if tool promising. if want standalone version of jslint, take @ jslint4java project. embeds rhino , jslint executable jar file. the example of using emacs in this gist .

vertical alignment - will display: table-cell be deprecated in future CSS? -

does know sure if css display:table-cell deprecated in future? i need advice project working on. if there evidence deprecated avoid using it. thanks. i realize comes close opinion question thankful advice references or suggestions. not in forseeable future. it’s in both css2.1 , css3 tables (same functionality css2.1), , has been interoperably implemented in major current browsers.

wordpress - Ajaxify WP Options - Problems with using jquery serialize and checkboxes -

i've been working on theme options panel wordpress. i've run bug when start using more 1 checkbox option. my code uses jquery serialize form data , submit wp's ajax-url. add callback function , wp knows send data function have set save options db. it works when check boxes on, hit save , no problem. values saved. boxes checked if try uncheck 1 or 2 of 3 , click save... on refresh boxes still checked. values still 'on' in db. think b/c jquery doesn't serialize unchecked checkboxes, aren't passed update_option array. since aren't in update_option array values keys stays same in db. hence, no change. strangely (to me atleast) if uncheck 3 of test checkboxes update properly. so, looking work around update options correct values , remove checkbox values have been unchecked. <?php add_action('admin_menu', 'test_add_theme_page'); function test_add_theme_page() { if ( isset( $_get['page'] ) && $_ge...

php - How to limit number of logins at a time? -

hello have website. created using php,mysql. want set limit like.. 10 user can login website @ same time. how can kind of setting? body knows solution kindly me.. use database table store number of logged in users need come way of imposing time limit on users. suggest field in table notes last activity. when new user attempts login need apply logic (pseudocode): if(<10users){ login } elseif(any of users have no activity 30 mins){ remove user , login } else { inform user of no space } you need update last activity every time logged in user visits new page.

firefox - Javascript in browser, print data to file -

im running javascript trading application in browser, provided bank. application gives me realtime data on stock quotes etc. there anyway can browser make data available outside browser, writing info file every ten seconds? im using firefox. no, javascript running in sandbox. can write html5 database build in browser. may be, application using soap-service, can use directly.

c - GNU Debugger (GDB) and "help info leaks"? -

i running gdb 7.2 on linux 64 bit machine. works fine want try use gdb me detect memory leaks shown in following article: http://geocities.ws/murugesan/technical/gdb/memoryleak_gdb.html there section says: gdb info leaks command availability check: # gdb -q (gdb) info leaks if find command,then gdb capable debug program memory leaks. else support of gdb find memory leaks not available in gdb version. when "help info leaks" nothing ;-( do have specific compiled file? "file myprog", , everything? btw: how guys find using gdb finding memory leaks? the title of page is: "memory leak detection on hp-unix platforms". the "info leaks" added hp-ux extension gdb, , never made fsf release of gdb (which linux distributions use). on linux, use valgrind. on solaris, use libumem .

objective c - How can i test iphone application for memory leaks? -

what methods/tools can use check if in application iphone there no memory leaks? or how find , fix them? use instruments: first build , install app on simulator. stop process again (the red shield says "task"), go run->run perfomance tool->leaks. start instruments preconfigured leaks , memory allocation tool. more info check out apple's memory usage performance guidelines (which has section on finding leaks): http://developer.apple.com/library/ios/#documentation/performance/conceptual/managingmemory/managingmemory.html

iphone - presenting viewController after contact has been selected in peoplePickerNavigationController? -

i having little problem - (btw have looked on how can present modal view controller after selecting contact? didnt me) basically want let user select contact using - peoplepickernavigationcontroller. after selection want presentmodalviewcontroller use personref data. can see "add person" method called iphone not present view. update - works if cancel animation in dismiss dismissmodalviewcontrolleranimated , in presentmodalviewcontroller, looks pretty ugly. this function called after user selects contact - - (bool)peoplepickernavigationcontroller:(abpeoplepickernavigationcontroller *)peoplepicker shouldcontinueafterselectingperson:(abrecordref)personref { temprecordid = abrecordgetrecordid(personref); bool hasdeletedate = [globalfunctions checktoseeifinhibye:temprecordid]; if (hasdeletedate) { [globalfunctions alert:nslocalizedstring(@"", @"") ]; }else{ [self addcustomvaluesafterselection]; [se...

c - Two filters circularly linked by two named pipes (FIFO) on Linux -

i want make 2 processes communicate each other via 2 named pipes on linux. each process unix filter : reads data on standard input , writes data on standard output. circularly linked in output of first input of second , other way around. here code of first filter (a.c) : #include <stdio.h> int main( void ){ file* ferr = fopen( "/dev/stderr", "w" ); double d; fprintf(ferr,"a going write\n"); printf("%lf\n",1.); fprintf(ferr,"a wrote %lf\n",1.); while( 1 ){ fprintf(ferr,"a going read\n"); if( scanf("%lf",&d) == eof ){ break; } fprintf(ferr,"a recieved : %lf\n",d); d += 1; fprintf(ferr,"a going write\n"); printf("%lf\n",d); fprintf(ferr,"a wrote %lf\n",d); } return 0; } here code of second filter (b.c) : #include <stdio.h> int main( void ){ file* ferr = fopen( "/dev/stderr", "...

ASP.NET MVC Select list -

when user clicks edit button , user full profile information displayed in textbox , user can make changes in it.. problem : when user register , user selects option list of value below.. (i.e) <select id="security_question" name="security_question"> <option value="choosequestion" style="font-style:italic;"> choose question ... </option> <option value="what first phone number?">what first phone number?</option> <option value="what vehicle registration number?">what vehicle registration number?</option> </select> when user pressed edit button after logged in , have show select list , user selected value( selected when user registers ) should selected in list... how ???? thank you.. good morning assuming view strongly-typed viewmodel, let's entity called "useraccount" attribute called "secretquestion", setup select box using html...

php - Why does this return Resource id #2? -

possible duplicate: how “echo” “resource id #6” mysql response in php? i new @ php , sql , i'm trying make php page list numbers of enries in table. i'm using code returns resource id #2: $rt=mysql_query("select count(*) persons"); echo mysql_error(); echo "<h1>number:</h1>".$rt; because mysql ressource when mysql_query() . use mysql_fetch_assoc() next row. returns array column names indices. in case it's count(*) . here's fix , minor improvements of snippet: $rt = mysql_query("select count(*) persons") or die(mysql_error()); $row = mysql_fetch_row($rt); if($row) echo "<h1>number:</h1>" . $row[0]; if need rows of resultset use snippet: while($row = mysql_fetch_assoc($rt)) { var_dump($row); }

windows - Prevent the entire screen from updating -

edit 1: actually, wanted avoid the flicker caused closing word document , opening one. looks approach not feasible. greetings, possible prevent entire screen (not desktop) updating? question derived this one . want that, in word add-in, lock entire screen update when i'm closing word document , opening one, , re-enable update when i'm done. an idea be: get image of entire screen (how?); show top-most window show screen image captured in step 1, cover entire screen; do job , close top-most window when done. is possible? or have other better ideas? thanks! to prevent screen updates: sendmessage(getdesktopwindow, wm_setredraw, 0, 0); to re-enable screen updates: sendmessage(getdesktopwindow, wm_setredraw, 1, 0);

svn - VisualSVN got corrupted -

we're running visualsvn server, , last night seemed have gotten corrupted. can gather, "current" file got corrupted, , can't figure out how rebuild this. it consists of single line of text, broken 3 sections. first 1 current revision, , there now, other 2 sections missing, , hard deduce. i finding hard swallow there no way rebuild file existing file structure. revisions , files present, it's "current" file looks out of whack. the "current" file i'm referring in "db" folder under repository folder. any appreciated. do think corruption? chances it's not going case - restore backups , continue there. if need keep changes committed since last backup, can hack in repo files added db/revs abnd revprops directory, you'll need edit curent file - might want ask collabnet support in extreme case. if can, latest files , re-commit them after restoring backups. or.. if don't have backup. firstly, allow...

php/CSS formatting -

we have changed hosting providers our php/css website. on new providers server formatting site looks bit odd. ie text not correct , titles not in correct place. of files have been uploaded including css files. is there should for? maybe permissions? great never mind how simple. thanks i'm getting multiple css errors off "migrated" site in firefox error console: bad selectors, bad font names, etc.. of these errors don't occur on old site. in other words, new site isn't identical old one. the big 1 /styles/stylesheet.css php file, raw php code being served instead of css: <?php header("content-type: text/css; charset=utf-8"); $default = array( 'fontsize' => '75%' ); the syntax errors killing of css rules, explains differences.

c# - Using WCF Data Services with Windows Applications -

does make sense use wcf data services in normal windows applications (winforms or wpf) or technology suitable web- or silverlight applications? what advantages in comparison normal wcf? it personal preference in case, frankly. real difference between data services "regular" services data services make conventions-based assumptions transport , data format. if using restful service makes sense (which true services key operations data querying or manipulation functions), yes. if have more workflow-oriented operations, maybe not (maybe, b/c restful services can still represent workflows if want to, it's not accepted strength).

c++ - Detecting if casting an int to an enum results into a non-enumerated value -

let's have : enum cardcolor { hearts, diamonds, clubs, spades}; cardcolor mycolor = static_cast<cardcolor>(100); is there (simple) way detect, either @ compile-time or @ runtime, value of mycolor doesn't correspond enumerated value ? and more generally, if enum values not following each other, instance : enum cardcolor { hearts = 0, diamonds, clubs = 4, spades}; cashcow presents a decent answer question: it's straightforward write custom function perform checked cast. unfortunately, it's lot of work , must make sure keep synchronized enumeration list of enumerators in enumeration definition same list of enumerators in checked cast function. have write 1 of these each enumeration want able perform checked cast. instead of doing manual work, can automate generation of of code using preprocessor (with little boost preprocessor library). here macro generates enumeration definition along checked_enum_cast function. it's bit scary l...

java - Using AspectJ to replace third party objects with mocks in Unit Tests -

i'm writing web services client using spring-ws , webservicetemplate class. down in bowls of webservicetemplate class, webserviceconnection created. webserviceconnection.send used send message. i'd intercept call webserviceconnection.send , replace logic examines object passed webserviceconnetion.send. it strikes me place use aspects. however, i'm not sure how can have aspects run when i'm executing unit tests. have different aspects run based on tests i'm executing. anyone have ideas on how this? you can use runtime weaving aspectj. don't have compile aspects yout app, enought include them when testing. since there has meta-inf/aop.xml on classpath when using aspectj, , since have start jvm -agent:mypath/aspectjweaver.jar, have tools @ hand use aspectj when testing. oh, , if use aspectj compile app, can still use additional aspects when testing if combine runtime weaving , compile time weaving.

svn - How to structure a repository that consists of several libraries and applications -

i've won task of restructuring/recreating existing code repository, either using git or subversion. repository history not important in special case. after analyzing situation i've found problems determining layout. i've read through lot of blogs , threads, i'm still unsure best layout. the existing repository contains set of include files, set of libraries partially dependent on each other, , many of them depend on set of include files. additionally, there 2 application projects depend on set of libraries. furthermore, there set of scripts makes use of 1 of applications , additional configuration information. i've drawn graph clarify situation: +---------->include files | ^ | | library -----> library b <----- library c <----- library d ^ ^ | ^ | | | | | +--------------------------------+ | ...

Android: Native App Background resolution? 480x800? or 480x774? -

i targeting devices have native resolution of 480x800; however, background image (480x800) gets resized (shrink down) 480x774 because of title bar on top. know dell streak or samsung galaxy tab have shorter (in terms of resolution) title bar since screen size bigger (although resolution same: 480x800) is there way make background stretch way top (including title bar) bottom? don't care top part of image covered android title bar. i don't want 480x800 background image shrink down. i use fill parent: android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background"

HTML Document markup for accessibility -

i wondering proper way of structuring document-like html page. it's obvious title of page should marked <h1> , section headings <h2> . as footer, right now, have: <div id="footer">footer content</div> and displayed in every page of document. realized screen reader not notify users if it's reading footer content. feel uses should have option skip reading footer content. is necessary let screen reader announce it's going read footer content , there proper way so? thanks! a common way allow screen readers skip on repeated parts of website include hidden anchor position right after element you'd skip. for example, on 1 of our websites, allow skipping on our navigation bar. <div id="navbar"> <a title="skip navigation" href="#skipnav"></a> <a href="/"><img id="home" src="transparent.gif" alt="home" /></a> ...

sql - MS Access 2003: Check if data is within range from another table -

i have 2 tables, table hours, , table b have grade, , minimum hour required what i'm trying assign tableb.grade tablea depending on how hours each record has. example: tablea name hours person 205 person b 105 person c 400 table b grade hoursrequired 1 0 2 100 3 200 4 300 my expected report name hours grade person 105 2 person b 205 3 person c 400 4 any advise on sql coding or restructuring of table appreciated. i @andomar's suggestion. however, if subqueries confuse you, revise tableb this: grade low_end high_end 1 0 99 2 100 199 3 200 299 4 300 2147483647 then use query: select a.person_name, a.hours, b.grade tablea a, tableb b (((a.hours) between [b].[low_end] , [b].[high_end])) order a.person_name; name reserved word re-named name field person_name.

sql - Conversion of legacy outer join to ANSI -

i have come across following legacy pl/sql , find outer joins against scalar constants confusing. first of all, can please confirm attempt convert ansi correct. legacy code : cursor c1item (c1item_iel_id number) select `<columns>` iel_item iit, iel_item_property iip iit.iit_change_type = 'i' , iip.iip_change_type (+) = 'i' , iip.it_id (+) = iit.it_id , iit.iel_id = c1item_iel_id , iip.iel_id (+) = c1item_iel_id; ansi code cursor c1item (c1item_iel_id number) select `<columns>` iel_item iit left outer join iel_item_property iip on iip.it_id = iit.it_id , iit.iit_change_type = 'i' , iip.iip_change_type = 'i' , iit.iel_id = c1item_iel_id , iip.iel_id = c1item_iel_id; if correct, don't see point of using outer join. surely if primary key it_id in table iit not have corresponding foreign key in table iip both iip.iit_change_type , iip.iel_id ...

Wordpress List Page -

i'm trying convert html wordpress theme. navigation this <li><a href="">home</a><small>home</small></li> <li><a href="">flavors</a><small>subtitle</small></li> <li><a href="">about us</a><small>subtitle 2</small></li> <li><a href="">photos</a><small>subtitle 3</small></li> <li><a href="">our shop</a><small>subtitle 4</small></li> my code far is <li><a href="<?php bloginfo('url'); ?>" title="home">home</a><small>home</small></li> wp_list_pages('title_li=&link_after=<small>'.get_post_meta($post->id, 'subtitle', true).'</small>'); as goes, doesn't work. add custom field subtitle every page put subtitle thing, can't call in wp_li...

php - Magento - Display payment fee on the order page (admin backend) -

during checkout process can use addtotal method on address object add payment fee displayed user. $address->addtotal(array ( 'code' => $this->getcode(), 'title' => mage::helper('payment')->__('invoice fee'), 'value' => $fee )); is there equivilent on order/invoice object in administration backend? if not, how can display payment fee on order page (backend)? i've got payment fee in sales_flat_order table. in backend must provide sort of block. config.xml <config> ... <adminhtml> <layout> <updates> <your_module> <file>yourlayout.xml</file> </your_module> </updates> </layout> </adminhtml> </config> design/adminhtml/default/default/layout/yourlayout.xml <layout> <adminhtml_sales_order_view> <...

xcode - Open method opens files with full path only C++ -

file opens if write full path (full-path/roots.txt). file fails open if write filename (roots.txt) and yet, roots.txt in same folder main.cpp. there settings should check on xcode? here's code: string line; ifstream infile; infile.clear(); // infile.open("roots.txt"); infile.open("/users/programming/c++/roots/roots.txt"); if (infile.fail()) cout << "could not open file: " << strerror(errno); getline(infile, line); cout << line; if works when attempt open file absolute path , fails filename, relative path incorrect. ensure roots.txt placed in current working directory. getcwd function declared in unistd.h .

Django - access m2m objects (or raw pks) from ``clean`` before model is saved -

of course can't use self.related_field.objects.all() , or you'll ...needs have primary key... error, if want run custom validation inside of model.clean , there appears no way access data. of course can use form.clean this, i'm not using forms. what asking impossible - m2m records cannot exist until main object has primary key value. there no way access data because not exist.

perl - malformed header from script. Bad header=<!DOCTYPE html> -

i receiving following server error on perl script: malformed header script. bad header=: youtube_perl.pl, here source code: #!"c:\xampp\perl\bin\perl.exe" -t use strict; use warnings; use cgi; use cgi::carp qw/fatalstobrowser/; use www::mechanize; $q = cgi->new; $url = 'http://www.youtube.com'; $mechanize = www::mechanize->new(autocheck => 1); $mechanize->get($url); $page = $mechanize->content(); print $page; thanks in advance! figured out. had add following before attempted print page: print "content-type: text/html\n\n"; i guess perl can not print html pages without defining header first.

Populating WebMatrix SQL Server Compact -

are there ways populate webmatrix sql server script can test website better? need data on server. suggestions welcome. you can use erikej's tools data existing sql server (full) database , script fill sql server compact 4 database: http://erikej.blogspot.com/2010/02/how-to-use-exportsqlce-to-migrate-from.html

Bind jQuery method to Html loaded through an Ajax call -

i have content loaded ajax call want bind custom method (not event) dom elements achieve functionality. most of solutions find online binding events page $(".example").ajax({ 'success': function(data) { something() } }) i want achieve 'on load of content' because there no event there.. $('.post').live('load', function() { ..... }); consider .ajaxcomplete . http://api.jquery.com/ajaxcomplete/ for example: // have anonymous function. make named function. function myinitialize(scope) { $('.button', scope).button(); } // call in document ready initialize stuff loaded in page. $(myinitialize(null)); // call again in .ajaxcomplete // 'this' div loaded or has new content. $('*').ajaxcomplete(myinitialize(this));

How to use complex SQL scripts with python -

i write sp inside mysql , excute call statement. looking write in python instead. got stuck using sql script on multiple lines. conn = pyodbc.connect('dsn=mysql;pwd=xxxx') csr = conn.cursor() sql= 'select something, table foo=bar order foo ' csr.execute(sql) sqld = csr.fetchall() heh, don't mind make proper answer. string literals in triple quotes can include linebreaks , won't cause syntax errors. otherwise (with "string" or 'string') need include backslash before every linebreak make work. , experience, that's easy screw up. :) as minor note, in python variables started lowercase letter, names starting capital letters being given classes. so: sql = """select something, table foo=bar order foo"""

asp.net - SiteMap change SiteMapProvider? -

i've got custom menu navigation built web.sitemap file, first line of like: sitemapnodecollection toplevelnodes = sitemap.rootnode.childnodes; this works - gets top level nodes web.sitemap file, , allows me through each sitemapnode , stuff. however, want able create multiple web.sitemap files, , programmatically determine web.sitemap file use, can't seem find out how this. i'm assuming either create 1 custom sitemapprovider can perform logic determine web.sitemap file load, or have multiple providers, each 1 sitemapfile property set specific *.sitemap file, , switch providers programmatically before access sitemap.rootnode. i think it's easier have 1 custom provider, , override part looks actual physical sitemap file location, i'm unclear how i've googled lot, answers seem regarding standard sitemappath controls , on, , how set sitemapdatasource, don't think relevant approach. first need specify of sitemap files in web.config such: ...

rsync using --delete but want to not delete symlinks at destination -

using rsync, source directory has number of files , directories. destination has been synced, mirrors files , directories. however, have manually created symlink in destination not exist in source. i need use --delete operation in rsync. there way rsync not remove symlink? there no option achieve way suggested simplest solution described problem add filenames of symlinks rsync exclude pattern like: --exclude="folder/symlinkname1" --exclude="folder/symlinkname2" if there many symlinks can keep list of them in exclude pattern file file may autogenerated little script or bash 1 liner...

Charactor Length Javascript -

how control element's character length element using javascript. should not allow insert char in middle of character? you can use maxlength attribute: you can extend using javascript http://www.mediacollege.com/internet/javascript/form/limit-characters.html

Find path dir from mysql in php -

i saving file paths in database this id | file_path ------------------------------------------------------------ 1 home/games/ps3/cod.png 2 home/err.png 3 home/games/ps3logo.png 4 home/games/xboxlogo.png 5 home/games/pclogo.png 6 home/games/wiilogo.png 7 home/msg.png i trying use php search files , files dir selected $folder_path = "home/games/ps3"; i want show images in ps3 folder? try using regex so: $query = "select * files file_path rlike '^".$folder_path."/[^/]*\$'"; the query should like: select * files file_path rlike '^home/games/ps3/[^/]*$'

html - Applying CSS transform rotation to an element using @font-face -

i've been trying apply transform rule elements have @font-face font applied them. h1 { -webkit-transform: rotate(-1deg); -moz-transform: rotate(-1deg); -o-transform: rotate(-1deg); transform: rotate(-1deg); } when transform rule applied, rotation i'm after, text not appear correctly — although it's rotated, it's though each character bound origin sits on pixel, , line of text looks jagged. if replace font system font, problem goes away, appear related use of @font-face . i've tested in variety of browsers on os x , windows, , show similar results. has come across problem before, or can give advice on why might occurring? check out source experiment . it uses @font-face rotate other nifty css3 effects.

html - CSS Bug For Floating Menu Commands? -

Image
http://jsbin.com/ewipi3 basically, should work... shouldn't it? the sample css simple: command,a {float:left;border:1px solid blue;} and html simple: <menu> <command>example</command> <command>example</command> <command>example</command> </menu> <br style="clear:both"> <a href="#example">example</a> <a href="#example">example</a> <a href="#example">example</a> if guys think bug ill submit bug report. oops! sorry! meant chrome , firefox 4! http://jsbin.com/ewipi3/6 it should in browsers: http://i.stack.imgur.com/xnghe.png basically, text outside elements. it shouldn't this? and should this? see working here . btw not sure if understood answer correctly, please comment if otherwise!

Javascript Focus() function not working -

i have textbox want set focus on, doesn't work. document.getelementbyid("txtcity").focus(); any idea? maybe calling javascript before input element rendered? position input element before javascript or wait until page loaded before trigger javascript. in order, works fine: <input type="text" id="test" /> <script type="text/javascript"> document.getelementbyid("test").focus(); </script> in jquery place code within .ready() method execute code first when dom loaded: <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function () { $("#test").focus(); // document.getelementbyid("test").focus(); }); </script>

RVM, Ruby 1.9.2, Rails 3, Passenger 3.0.2 (Bundler::GemNotFound) -

i'm using rvm, ruby 1.9.2, rails 3, passenger 3.0.2 configured nginx, setup server configuration correctly. app working far. but new app, when booting server http://myapp.local (its configured hosts point server bind on nginx conf) returns (bundler::gemnotfound) error. how around this? thanks. believe or not common problem rails developers come across. have @ post details fix think looking for. best of luck. http://dalibornasevic.com/posts/21-rvm-and-passenger-setup-for-rails-2-and-rails-3-apps

Browser on Android 2.2: Strange password field behaviour -

i have signed poker website (www.pokerstrategy.com). use tool manage passwords , generate passwords me. generated 22 character password using uppercase , lowercase letters, numbers , braces. password works when entered using normal pc. however, entering same password on android, in android browser, site tells me password wrong. have quadruple checked password typing text editor on android phone , copypastaing password field. same message arises. my problem is: find information on this? cannot ask site problem limited mobile device. cannot ask google ("hey guys, when enter password on www.pokerstrategy.com, tells me wrong. check code!"). i'm asking you: has had similar phenomenon? there limit number of characters can inserted password field determined browser instead of html code? i'd watch videos in bed, i'd appreciate help. if find out how it, set bounty on this. check have cookies enabled in browser settings. my guess...

javascript - Reusing HTML5 Audio Object in Mobile Safari -

i want play short (less 1s) audio file in response user input on web app running in mobile safari on ipad minimum latency between event , audio playback. playback can triggered multiple times between page reloads, therefore want cache audio file. the following plays file on first click after nothing happens: var audio = new audio("ack.mp3"); $("#button").click(function(e) { e.preventdefault(); audio.play(); } if add event listener "ended" event reloads file can 2 playbacks same object , silence: var audio = new audio("ack.mp3"); audio.addeventlistener('ended', function() { audio.load(); }, false); $("#button").click(function(e) { e.preventdefault(); audio.play(); } if manually set currenttime attribute 0 this: var audio = new audio("ack.mp3"); audio.addeventlistener('ended', function() { audio.currenttime=0; }, false); $("#button").click(function(e) { e.preventdefault(); ...

how to put a ringtone on android emulator -

i want put ringtone on android emulator howevey can't seem find easy there someting i'm missing? you need create /sdcard/media/audio/ringtones/ directory on sdcard. to login via adb shell , mkdir /media/audio/ringtones/ push file ringtones. go sounds on emulator , select sound, menu , select "use ringtone". if can't create directory, su , try again.

Google Maps Custom Control positioning -

i trying figure out how position control center of page. when use "bottom_center" centers left end of div center of map. i'd offset center of div in bottom center of map. i've search hours , haven't found info on doing this.. does have idea how or can point me @ resource explain little better? thanks! the below modified version of converting latlng/pixel coordinate control <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>latlng coordinates control</title> <style type="text/css"> #map { width: 800px; height: 600px; } #latlng-control { background: #ffc; border: 1px solid #676767; font-family: arial, helvetica, sans-serif; font-size: 0.7em; padding: 2px 4px; position: absolute; } </style> <script type=...

c# - Talking to a network device -

i have device on network need data out of using c#. know have use sockets within c# know of program lets me trial sending , receiving data device. example going vague documentation have, can pass device binary number , send me result. there software let me test this?? thankyou the question felt bit vague, here goes hope acceptable answer: you'll need more information on protocol. myself, after i've gathered information know, write small script in linqpad in order craft packets , record responses. it might use third party software listen responses, wireshark / microsoft network monitor. also, listening devices chatter can process, , can aforementioned wireshark or mnm. in order effective, you'll need listening traffic using hub or network tee. have fun.

unit testing - What mock object libraries are there available for D? -

i starting in d2 programming language. love fact unit testing part of language can't seem find mock object libraries it. there standard 1 out there? the mock object library know of dmocks , abandoned. may not compile recent compiler versions. maybe blackhole , whitehole , autoimplement std.typecons extent.

objective c - How do you get the timestamp from web page -

what's easiest way timestamp web page objective-c (ios sdk)? what mean "timestamp web page". all http server dishes client on url stream of octets , assortment of response headers. http server hand date header, since gives time response sent back, it's not good.

unicode - What characters are allowed in Perl identifiers? -

i'm working on regular expressions homework 1 question is: using language reference manuals online determine regular expressions integer numeric constants , identifiers java, python, perl, , c. i don't need on regular expression, have no idea identifiers in perl. found pages describing valid identifiers c , python , java , can't find perl. edit: clarify, finding documentation meant easy (like doing google search python identifiers ). i'm not taking class in "doing google searches". perl integer constants integer constants in perl can in base 16 if start ^0x in base 2 if start ^0b in base 8 if start 0 otherwise in base 10. following leader number of valid digits in base and optional underscores . note digit not mean \p{posix_digit} ; means \p{decimal_number} , quite different, know. please note leading minus sign not part of integer constant, proven by: $ perl -mo=concise,-exec -le '$x = -3**$y' 1 <0> e...

asp.net mvc - MVC3/CTP5/ViewModel/Master-Detail -

i trying wrangle in code first approach , have gap in understanding here. have collection of posts , files. public class post { public post(){attachements = new list<files>();} [key] public int id{get;set;} public string title{get;set} public string body{get;set;} public virtual icollection<files> attachments {get;set;} } public class file{ [key] public int id{get;set;} public string filename {get;set;} } and think have viewmodel down following public class myview{ public post post {get;set;} public list<files> files {get;set;} public myview(post p, list<file> f){this.post = p; this.files = f;} everything works fine list , display ... when try create new post , files falls apart. i've tried using viewmodel not sure how add items list in view model. i created view based on 'post' , have partial view uploads files , keeps list of them in hidden field can work, not sure if elegant solution. could let me know if way off base ... hope ...

jQuery Redis hit counter to track view of cached Rails pages -

i have static cached pages want track hits of , order popularity. what best way of tracking these views in redis , loading them main database? right thinking of using jquery this $.get("/track/", { id: "1234" } ); and using redis gem in "track" controller call redis.incr "1234" once day run cron of like pages.each |p| p.hits = redis.get(p.id.to_s) end here final rake task, in case helps anyone require 'redis' task :cron => :environment uri = uri.parse(redis_url) redis = redis.new(:host => uri.host, :port => uri.port, :password => uri.password) pages.all.each |p| views = redis.get(p.id.to_s) if views p.hits = p.hits + views.to_i if p.save redis.set pid, "0" end end end end

version control - Should I submit unchanged files to Perforce? -

i'm using perforce integrate 2 codelines. in resulting changelist, there files marked opened integration, have not changed. should submit these unchanged files or should revert them? i want revert them because don't want these unchanged files pollute changelist. but, if submit them, have feeling perforce might have use of "fact" (that files have been integrated) future integration. yes, should submit them. create integration record record changes have been "integrated" (which may not mean actual changes occurred on target).

build - When my project is released, Should I commit outputs to svn? -

when finished our release process, got lot of outputs exe, dll, , setup files. should store them in subversion? actually next release process, need outputs. because need make setup file previous outputs. of output(exe, dll etc) should included if file isn't changed through build process so i've stored of previous outputs in build machine, instead of svn. better move outputs svn? no, should keep them in build machine. svn nothing executables , libraries. that's build servers for. it's not if svn produce diff executables made sense. if need access them internet or number of machines, can use ftp or similar.

asp.net - Loading a css file dynamically? Code inside -

i have following code in <head> <% if(context.user.isinrole("reseller")) {%> <link href="<%: themelocation %>" rel="stylesheet" type="text/css" /> <%} else {%> <link href="<%= url.content("~/content/custom-theme/jquery-ui-1.8.5.custom.css") %>" rel="stylesheet" type="text/css" /> <%} %> the issue themelocation, declared above block of code - so: <% var reseller = new reseller(); var storesettings = new storesettings(); var themelocation = ""; if (context.user.identity.isauthenticated) { var resellerrepository = new resellerrepository(); reseller = resellerrepository.getresellerbyusername(context.user.identity.name); var storesettingsrepository = new storesettingsrepository(); storesettings = storesettingsrepository.getstoresettings((int) reseller.storesettingsid); themelocati...