Posts

Showing posts from 2012

ruby on rails - how to check if parent exists in has many relation -

i have 3 models: user: has_many :comments video: has_many :comments comment: belongs_to :video, :user videos/show.html.erb <%= form_for(@comment, :method => :post ) |f| %> <%= f.text_area :body %> <%= f.hidden_field :video_id, :value =>"4" %> <%= f.submit "submit" %> <% end %> comments_controller def create @comment = comment.new(params[:comment].merge(:user_id => current_user.id)) @comment.save end how can check existence of video before create comment? this should present validation in comment model. class comment < activerecord::base validates_presence_of :video

jquery - Drop down slide menu for iPhone web app -

i'm creating iphone web app , want add drop down menu in top menu bar preserve page space. how menu slide? have list items in unordered list in div. have jquery installed can use that. check out this link filament group.

groovy - grails spring-security-core plugin does not make under intellij idea 9/10 -

i've been playing grails framework lately idea , has gone until stalled spring-security-core grails plugin. plugin , project work fine when using grails compile/run-app/etc, intellij idea (9) no longer able "make" project, giving me errors: steps: grails create-app my-app grails install-plugin spring-security-core import my-app grails project click make this produces errors similar following... $home\.grails\1.3.6\projects\macs\plugins\spring-security-core-1.1\src\java\org\codehaus\groovy\grails\plugins\springsecurity\ipaddressfilter.java cannot find symbol variable reflectionutils this error repeated several java class files reference reflectionutils groovy class file org.codehaus.groovy.grails.plugins.springsecurity.reflectionutils in same package, found in spring-security-core/src/groovy directory (as opposed spring-security-core/src/java) the ide source parser seems resolve things correctly, there no red marks littering file, , navigation finds fi...

javascript - jQuery parents then locate a div to hide -

ok, i've got .parents() function goes outside located class/id. in case, (.wrapper). <div class="wrapper"> <div class="hide">hide class</div> <div class="boxclass></div> </div> i've got list of these div's on single page, so, if click "hide class" text, fadeout, since in list, has same class name. now, question. use .parents() locate (.wrapper) (i know can done (.parent)). how can use .parents go , select (fadeout) class inside it? ex, boxclass? in case, they're siblings, use siblings() (docs) method in handler. $(this).siblings('.boxclass').fadeout(); or if they're not siblings, use closest() (docs) method find() (docs) method. $(this).closest('.wrapper').find('.boxclass').fadeout(); inside handler this represents element invoked handler. such, direct reference specific .hide element clicked.

vsto - How to programmatically use Word's "Compare and Merge Documents..." functionality from C#? -

question is possible call word 2003's tools > compare , merge documents..." function c# , feedback whether differences found or not? what have found far it possible call functionality this. don't know how feedback whether differences found. private void compareandmergewithfileb(string fullfilepath) { string filename = fullfilepath; object mergetarget = wdmergetarget.wdmergetargetselected; object detectformatchanges = false; object useformattingfrom = wduseformattingfrom.wdformattingfromprompt; object addtorecentfiles = true; word.activedocument.merge(filename, mergetarget, detectformatchanges, useformattingfrom, addtorecentfiles); } absolutely. once merge complete, work revisions collection extract details changes.

maven 2 - What Maven2 plugins are available for JAXB2? -

i'd generate java source code xml schema file using jaxb2 via maven2 plugin (as in this blog post ). there seem 2 maven plugins jaxb: "maven 2 jaxb 2.x plugin" (org.jvnet.jaxb2.maven2:maven-jaxb2-plugin) hosted @ java.net, , "maven jaxb 2.1 plugin" (org.codehaus.mojo:jaxb2-maven-plugin) hosted @ codehaus. it seems me 1 @ java.net has more features, xjc plugins. java.net page refers highsource.org documentation, unfortunately seems unavailable recently. so what's best choice? know what's going on highsource.org? what's else using? i found following working enough system. <plugin> <groupid>org.jvnet.jaxb2.maven2</groupid> <artifactid>maven-jaxb2-plugin</artifactid> </plugin>

eclipse - Do I need to prevent caching on Android emulator? -

i using phonegap develop cross-device (simple) applications, , using eclipse android emulator. problem encountering not appear code changes reflected application installed on emulator. have tried uninstalling application emulator, cleaning , re-building within eclipse, neither of has worked. is there manual script need run re-install .apk? newbie @ mobile development, please bear me. :) eclipse should automatically rebuild application if option activated. take @ project -> build automatically the adt should reinstall application if run project. take @ console (not logcat) of eclipse, should see information reinstalling application (at least thats when deploy on device). if want try if change made, try use log statement change have feeling not current version. can find out if @ least deploy worked. if nothing of helped, should dig deeper...

What is the easiest way to practice PHP on Ubuntu? -

i learning php , i'm looking simplest way run practice scripts. have netbeans installed. install lamp: sudo apt-get install lamp-server^ (be sure use caret), it's breeze (at least in ubuntu 10.10). installs apache , mysql automatically. open netbeans, set root /var/www root folder , off go! did not time ago , took me 20 minutes in (if install phpmyadmin, careful 'coz creates symlink in /usr/share instead of link in root /var/www, took me of time figure out)

SQL Server 2008 bulk update using stored procedure -

i have 2 tables in db. each "name" column , "count" column each. i update count column in second table count in first table "name" columns equal. example: first table: name count jack 25 mike 44 name count jack 23 mike 9 david 88 result (the second table that...) name count jack 25 mike 44 david 88 notes: 1. both tables huge. (although second table bigger...) 2. update must fast possible... (if there more options other stored procedures, love hear.) 3. "count" defined bigint while "name" nvarchar(100) 4. "count" field in first table bigger equivalent in the second table. i think there more options (other stored procedure) maybe merge or transaction long fastest way... thanks! the best way keep simple update table2 set count = t1.count table1 table2.name = table1.name , table2.count <> table1.count if performance of ...

Asp.net MVC 3 partial view postback -

i new mvc , have question have page (asp.net mvc 3) called profile contains 3 partial view called (1) address,qualification,experience. each of partial view should allow add details , save details/contents without affecting others. how can attach action each partial view save button , postback result without refreshing other partial view. can explain me , without using jquery/ajax without ajax or jquery you'd stuck doing horrible iframes... stick jquery, best , easiest way. actually, here 1 way might able it. name "submit" buttons according method want called. then, have of 3 sets of data inputs within 1 <form></form> posts intermediate controller endpoint. in intermediate controller endpoint, determine button pressed, pass correct data normal control methods, , push other data view. way can fill out inputs, click appropriate submit button, correct data gets used! other data gets pushed view , approprate input boxes filled out.

mysql find/replace string in fields -

i have table has few varchar fields named this: image_fullres | image_highres | image_mediumres | image_lowres | image_thumbnail i have same value each of these fields(differing row), image_fullres has same path image_lowres , on. an example value these paths http://mysite.com/images/image1.jpg i have each of these fields contain different , appropriate path name, so: image_fullres has value of http://mysite.com/images/fullres/image1.jpg image_highres has value of http://mysite.com/images/highres/image1.jpg image_mediumres has value of http://mysite.com/images/mediumres/image1.jpg and on... since of data in database duplicate paths row, sql can execute change value of each field's data appropriate path? example: update table set image_fullres = replace(image_fullres, 'http://mysite.com/images/', 'http://mysite.com/images/fullres/') this update image_fullres column rows in table. can 1 such statement each column, or combin...

Html.ValidationMessageFor in partial view(ASP.NET MVC3) -

currently have partial view textbox , validationmessagefor. works fine , message displays expected when input not valid. i'm doing little html refactoring , want bump validationmessagefor view contains partial view. have working correctly there couple of snags. @html.validationmessagefor(m => m.mileage, string.empty, new { id = "spanmileageerror", @class = "mileageerrorspanclass" }) the model view vehicle object. model partialview different object @html.textboxfor(v => v.vehicle.mileage, new { placeholder = mileageplaceholdertext, id = model.textboxid, maxlength = "7", @class="mileagetextboxclass" }) this configuration gives name textbox ("vehicle.mileage") validation attribute ("data-valmsg-for") equal "mileage" , not "vehicle.mileage". how can correct validationmessagefor helper emit correct html make validation work? here rendered html of current view prior html re...

java - Using Google voice and video chat plugin to record voice -

i'm trying develop application records audio browser. can use google vioce , video chat plugin gmail internally uses record audio? if yes, how can this? if no, there other way can record audio using j2ee? thanks. at moment, flash seems realistic option.

iphone - Why am i getting a black frame and not the picker? -

i have simple code or @ least think it's simple. // implement loadview create view hierarchy programmatically, without using nib. - (void)loadview { cgrect rect = cgrectmake(0.0f, 20.0f, 320.0f, 216.0f); uipickerview *mypickerview = [[uipickerview alloc] initwithframe:rect]; self.view = mypickerview; [mypickerview release]; } i running general view based template xcode. can see loadview getting called black frame instead of uipickerview. what doing wrong ? /donnib have implemented picker's datasource methods? need otherwise won't show. link apple documentation here: http://developer.apple.com/library/ios/#documentation/iphone/reference/uipickerviewdatasource_protocol/reference/reference.html#//apple_ref/occ/intf/uipickerviewdatasource

javascript - How do I trigger a sharethis button regen? -

i'm changing of properties of sharethis button dynamically, , looking cause regen. how do that? depends on customization want do, if you're dynamically adding sharethis button, call stbuttons.locateelements(); that re-run init code sharethis js it's magic again.

XSLT 2.0 - Template Matching With Contains() -

i'm wondering if possible write template match contains() function. i have document has multiple elements need renamed common element. of following need renamed op: op1.2, op7.3, op2.4, op5.6`, etc. yes, can use contains() inside of predicate filter in match criteria elements. <xsl:template match="*[contains(local-name(),'op')]> <op> <xsl:apply-templates select="@*|node()"/> </op> </xsl:template> you use starts-with() *[starts-with(local-name(),'op')] if using xslt 2.0 use matches() function, supports regex patterns more complex matching. *[matches(local-name(),'^op')]

MongoDB & Java Connection Error -

i trying run java program java/mongo driver on separate computer 1 running mongod. modified java/mongo tutorial code include ip address. package mongotest; import com.mongodb.*; public class main { static dbcursor cur; static dbcollection coll; public static void main(string[] args) { mongo m; try{ m = new mongo("192.168.0.102"); // <---- not connect. time out db db = m.getdb("playerdb"); coll = db.getcollection("players"); cur = coll.find(); //while (cur.hasnext()) // coll.remove(cur.next()); coll.ensureindex(new basicdbobject("playerid", 1).append("unique", true)); boolean unique = true; cur = coll.find(); printresults(cur, "find records"); boolean cancreate; cancreate = createaccount("josh", "1", cur, coll); cancreate = createaccount("jason", "1", cur, ...

tsql - A more elegant way of selecting and inserting from 2 tables SQL Server -

i have 2 tables like: id name ------------- 1 somevalue 2 somevalue 3 somevalue 4 somevalue ... id name ------------- 1 var 2 var2 3 var3 4 var4 ... i want insert in @table 2 results table1, and, 3 results table2, different id, have like: declare @vars table( field1 varchar(80), field2 varchar(80), field3 varchar(80), field4 varchar(80), field5 varchar(80) ) insert @vars(field1, field2, field3, field4, field5) select a.name, b.name, c.name, d.name, e.name @table1 a, @table1 b, @table2 c, @table2 d, @table2 e a.id = 1 , b.id = 25 , c.id = 12 , d.id = 25 , e.id = 14 i expected values, but... is there more elegant way this? guess i´m doing more needed. p.d. like: field1 field2 field3 field4 field5 ------------------------------------- val1 var2 v...

spring - JMS, ActiveMQ plugin - ClassNotFoundException -

i'm trying use activemq plugin, have troubles. pom.xml: <dependency> <groupid>org.apache.activemq</groupid> <artifactid>activemq-core</artifactid> <version>5.4.2</version> </dependency> <dependency> <groupid>org.apache.xbean</groupid> <artifactid>xbean-spring</artifactid> <version>3.7</version> </dependency> ... <pluginmanagement> <plugins> ... <plugin> <groupid>org.apache.activemq.tooling</groupid> <artifactid>maven-activemq-plugin</artifactid> <version>5.4.2</version> <configuration> <configuri>xbean:file:src/main/resources/jms/activemq/activemq.xml</configuri> <fork>false</fork> <s...

Comparing Associative array and standard array PHP -

i have 2 arrays array1: array ( [0] => array ( [0] => 3 [1] => 1 [2] => 4 ) [1] => array ( [0] => 1 [1] => 6 ) ) array2: array ( [0] => 1 [1] => 3 [2] => 2 ) i used array_diff comparing , getting difference values, same key coming ie., array_diff(array1,array2) returns array([0] =>3 [2] => 4) but there other way difference , having result array([0] =>3 [1] => 4).. assuming you've got array_diff working on multidimensional array somehow, docs: this function checks 1 dimension of n-dimensional array. of course can check deeper dimensions using array_diff($array1[0], $array2[0]);. use array_values around it. array_values(array_diff($array1, $array2));

java - Updating JTable after inline edit -

i have 2 classes, 1 make frame , other handle , implement interface tablemodel. when editing cells inline , updating values in class implements tablemodel need refresh table show updated data (as table needs auto sort when inline edit cell rows may need re-ordered). problem i'm having after updating data can't figure out how refresh table, i've tried hacky way of refreshing when click off cell or press enter feel there more elegant solution, ideas? the tablemodel responsible invoking firetablecellchanged(...) method when data changed in model. sorting happen automatically. read jtable api , follow link swing tutorial on how use tables more information tablemodels , sorting. i suggest use defaulttablemodel don't have worry since implements tablemodel methods.

object - Java can't find symbol -

this error message test.java:17: cannot find symbol symbol : class mouseadapter location: class test private class click extends mouseadapter ^ test.java:19: cannot find symbol symbol : class mouseevent location: class test.click public void mouseentered(mouseevent e) ^ test.java:14: cannot find symbol symbol : variable trayicon location: class test trayicon.addmouselistener(new click()); ^ 3 errors import javax.swing.*; import javax.swing.event.*; import java.awt.*; public class test extends jframe { private jframe frame; public void init() { trayicon.addmouselistener(new click()); } private class click extends mouseadapter { public void mouseentered(mouseevent e) { { frame.setvisible(true); } } } } reproducing error: $cat ...

php - foreach $_POST.. is this bad? -

is bad practice use use foreach make array of post data vs defining posts accepting? class foo { function __construct() { foreach($_post $key => $var) { $this->post[] = $key = $var; } } function bar() { echo $this->post['postdata']; } } vs; class foo { function __construct() { $this->post = array( "postdata" => $_post['postdata'] ); } function bar() { echo $this->post['postdata']; } } there no great harm in automatically processing of posted fields, long processing limited storing in hash. matter of fact, can make fore easier maintain code. the moment start doing (especially system related) data, need validate.

javascript - How do I use a regular expression to match a fixed-length number with a hyphen in the middle? -

i new regular expressions , wanted know how write regular expression following: validates string 123-0123456789. numeric values , hyphen should allowed. also, verify there 3 numeric chars before hyphen , 10 chars after hyphen. the given answers won't work strings more digits (like '012-0123456789876'), need: str.match(/^\d{3}-\d{10}$/) != null; or /^\d{3}-\d{10}$/.test(str);

c++ - Qt Tabs for Files -

well, i'm working on ide system, can open multiple files @ same time. i'm noob tabs. i'm trying tabsystem, click file on file tree , opens new tab , show it's content. can switch other tag switch one, drag tabs, etc. any idea? to display project tree use qtreewidget. file content use qtextedit(for starter). use qtabwidget show multiple qtextedits in different tabs.

android - Problem starting with chronometer -

my chronometer starting 0:10 or other times... s not starting 0:01 itself..any 1 can me thank you, i got answer final chronometer chrono = (chronometer)findviewbyid(r.id.chronometer); chrono.setbase(systemclock.elapsedrealtime()); chrono.start(); once others thank you,,

c - Fair comparison of code size -

i have written 2 different c implementations of algorithm runs on embedded processor (arm). fair way compare these 2 implementations in terms of code size, when downloading executable following figures: implementation 1 .text size 55098 bytes .data size 2048 bytes implementation 2 .text size 54598 bytes .data size 2048 bytes the difference in .text segment 500 bytes, in relative terms not lot. problem is, figure contains boot code wrapped around executable can invoked in standalone mode, ie., without operating system on embedded processor. i wondering if has idea how actual code size of executable without bloated code. many andrew your c compiler can produce assembly source code can examine. another possibility @ map file linker, should give sizes of individual functions. you @ binary code debugger. to asm output or map file(s), need specify appropriate options compiler and/or linker. these options depends on tool chain (compiler, linker) use. to as...

php - mySQL table updates, but not fast enough for a select statement on the same page to access the updates - any ideas? -

i trying write code updates mysql table, , selects out of same table in same page. however, find when update query, select query, not recognize changes. if, however, refresh page, recognized changes. i first have insert statement this $query = 'insert matches (uid, win) values ($uid, $win)'; mysql_query($query) or die(mysql_error() . ' in ' . $query); then, after this, have select statement like $query = "select * matches uid = $uid"; $resultmain = mysql_query($query) or die(mysql_error() . ' in ' . $query); of course simplified queries but, general idea - , happens is: select statement not recognize update run before it. however, if reload page, , select statement runs again after time, recognize change. i googled , surprised not come across yet. there way force wait until mysql update query finished before selecting? if not, might have use javascript automatically reload page, sounds messy solution. any appreciated, has been ...

jquery - How to position error message -

i'm using jquery post form , if there error, need show user. ideally, echo message in place on form i'm able have echo @ top of screen not because form long , neither top or bottom readily viewable without having scroll or down. how can fix this? best way handle this? perhaps best way roll own modal dialogue solution, or overlay you'll put message in. there jquery plugins that, simplemodal or jquery ui dialogue (this one's bit heavier).

MYSQL / php basic question -

i want see if specified value there in table t1 . , if value exists want enter value's in table t2 , how can in php ? i want check existence insert values following command i want in format if ( table1.id = exist's ) {insert table2 ( values ) } what proper way write code php? well, might you. updated answer well, table tb1 +-------+-------------+------+-----+---------+-------+ | field | type | null | key | default | | +-------+-------------+------+-----+---------+-------+ | fld1 | varchar(20) | yes | | null | | | fld2 | varchar(20) | yes | | null | | | fld3 | varchar(20) | yes | | null | | +-------+-------------+------+-----+---------+-------+ and table tb2 +-------+-------------+------+-----+---------+-------+ | field | type | null | key | default | | +-------+-------------+------+-----+---------+-------+ | fld1 | varchar(20) | yes | | null | | | fld2 | varchar(20)...

Is it possible to add the AUTO_INCREMENT option to a column after creating a table in MySQL 5.1? -

i have table id column make auto-increment column. short of cloning table newly created 1 auto-increment id column, renaming tables, can done? i know can use alter table add auto-increment column, can add auto_increment option existing column primary key? yes, can. if have primary key table, can alter auto_increment alter table `table` change `column` `column` int( 11 ) not null auto_increment

windows 7 - how to make a batch file that will run on startup and then email me -

i want create batch file run on windows startup. i'm running windows 7 professional. there login screen on startup, can bypass if needbe if don't have bonus. i batch file email me through client, prefrebly hotmail, outlook, gmail, when pc turned on. the reason wanting script i'm accessing router remotely turn on pc via wol , notified in event accessed else. thanks put batch file or batch file shortcut in location c:\users\%username%\appdata\roaming\microsoft\windows\start menu\programs it make batch file run startup u asked for!! and difficult or impossible send email using batch file!! possible via executable file(.exe etc not cmd). update: more on win10 firewall not allow such program top exist , work in way!

gis - Remember state of Google Maps v3 -

i displaying map placemarks , kml overlays. when user clicks away, want state of map remembered when user returns. first question is: can save entire state of map somehow; overlays , everything? for now, have been saving lat/long , zoom , replaying kml overlays, haven't had success this. save cookies on bounds changed or window unload events, problem loading saved values. reason being map loads asynchronously. i've tried using map idle event, fires more once. seems fire, run code in handler, fire again when it's finished code. infinite loop? anyway, replaying of kml overlay overrides whatever lat/long/zoom specified. so main question is: how restore saved map overlays? i don't think google maps can save state of map, have yourself. you correctly used idle event init overlays. idle event triggered every time map becomes idle after zooming or panning, if want 1 time listener idle event (or other event), can way: var map = new google.maps.map(documen...

javascript - Hover over any paragraph, append div with little message, hover off, it fades out, is this right? -

http://jsfiddle.net/nicktheandroid/3araq/ when p hovered over, #both appended paragraph , centered. when hover off , onto new paragraph, fades out on first p , fades in on hovered p. best way it? later on i'll use allow people click bookmark image, when hover p code below does, when click on p create bookmark paragraph, need code below. thanks! $('p').hover(function() { $(this).append('<span id="both">bookmark this</span>') $('#both').animate({opacity: 1.0}) }, function(){ $('#both').fadeout(600, function(){ $(this).remove() }) }); it's not working smoothly, it's not right.... just use class instead of id: $('p').hover(function() { $(this).append('<span class="both">bookmark this</span>') $('.both').animate({opacity: 1.0}) }, function(){ $('.both').fadeout(600, function(){ ...

iphone - When declare a property(retain) in objective c, what's the default implementation of set/get method -

i newer objective c. have read memory management document on apple's "memory management rules". still not clear how manage reference property. what's default implementation of set/get access methods property declared "retain" annotation? this assuming, please give comments. thanks. @interface subclass : nsobject { nsstring * _name; } ... ... @property (nonatomic, retain) nsstring * name; ... ... @end -(nsstring *) setname { return _name; } -(void) setname: (nsstring *) pname{ // correct version of default set method retain if( _name != pname ) { [_name release]; _name = [pname retain]; } } so dealloc method, ok? - (void)dealloc { self.name = nil; // or [_name release], _name = nil; } as matteo alessani says, can synthesize property default implementations. for reference, what's generated (i got reading objective-c declared properties , piecing information together): - (nsstring *)name { ...

Error in Bash script arithmetic syntax -

script: #!/bin/bash vpct=5.3 echo $((vpct*15)) error: ./abc.sh: line 5: 5.3: syntax error: invalid arithmetic operator (error token ".3") i know don't need script multiply 5.3 * 15 , small script single out error. please advise. besides bc , there other tools can tools can try awk -v vpct="$vpct" 'begin{print vpct * 15}' echo $vpct | ruby -e 'print gets.to_f * 15 ' echo "$vpct 15 * p" | dc

perl - Change the width of all lines in a PDF programmatically -

i made handwritten slides using ipad app, , found out line thin projected on big screen in room. unfortunately app doesn't have ability change stroke widths afterwards... (geez.) have exported pdf file. as programmer should able solve problem programmatically, by changing width of lines on pdf by, say, factor of two. so, question easiest way achieve objective. there perl module allows me inspect lines on pdf, example? -- update ok, converted pdf ps file via ps2pdf (which uses ghostscript), , replaced 3 w 6 w etc. using text editor. (here w macro expanding setlinewidth .) converted resulting ps file pdf. problem solved. but there nicer way? you use inkscape convert .pdf .svg, parse script (python, example, doesn't matter), convert .pdf . if isn't enough programmatic, command line option available: >inkscape -l test.pdf output.svg and after processing: >inkscape -l processed.svg final.pdf

How to use Perl Regex to detect <p> inside another <p> -

i trying parse "wrong html" fix using perl regex. wrong html following: <p>foo<p>bar</p>foo</p> i perl regex return me : <p>foo<p> i tried like: '|(<p\b[^>]*>(?!</p>)*?<p[^>]*>)|' no success because cannot repeat (?!</p>)*? is there way in perl regex charactère except following sequence (in case </p> ) try like: <p>(?:(?!</?p>).)*</p>(?!(?:(?!</?p>).)*(<p>|$)) a quick break down: <p>(?:(?!</?p>).)*</p> matches <p> ... </p> not contain either <p> , </p> . , part: (?!(?:(?!</?p>).)*(<p>|$)) is "true" when looking ahead ( (?! ... ) ) there no <p> or end of input ( (<p>|$) ), without <p> , </p> in between ( (?:(?!</?p>).)* ). a demo: my $txt="<p>aaa aa a</p> <p>foo <p>bar</p> foo</p> <p> bb ...

wpf - C+Ctrl KeyBinding is not causing copying to happen -

i have set listbox so: <listbox itemssource="{binding logs, mode=oneway}" x:name="loglistview"> <listbox.itemtemplate> <datatemplate> <textblock text="{binding path=.}"> <textblock.inputbindings> <keybinding key="c" modifiers="ctrl" command="copy"/> </textblock.inputbindings> <textblock.commandbindings> <commandbinding command="copy" executed="keycopylog_executed" canexecute="copylog_canexecute"/> </textblock.commandbindings> <textblock.contextmenu> <contextmenu> <menuitem command="copy"...

objective c - How to test an iPhone app on a device for the first time? -

i developing app iphone. how can test app on device? what procedures follow? please give information regarding problem. things need are your private key. your provisioning profile (with uuid of device added). go project settings , change code signing entity distribution profile. then can build , run after connecting device.

c++ - Are there noteworthy uses of m4 besides autoconf? -

does know of uses of m4 besides autoconf (preferably in c or c++ environment) more academic excerise, because helped solve problem otherwise (for example 'standard' preprocessor) have been difficult solve. i ask because thinking way project in c++ want reduce or minimize redundancies using scripts, preprocessors, whatevers. i have once used m4 generate c++ header file text file containing simple version string (major.minor.micro-status), , information subversion, windows visual studio project. m4 smallest macro engine embed , use specific goal. it looked this: #ifndef __version_h__ #define __version_h__ divert(-1) define(`cpp_define', `#define $1 $2') define(`version', include(`version.txt')) define(`my_software_major', regexp(version, `\([0-9]+\)\.[0-9]+\.[0-9]+', `\1')) define(`my_software_minor', regexp(version, `[0-9]+\.\([0-9]\)+\.[0-9]+', `\1')) define(`my_software_micro', regexp(version, `[0-9]+\.[0-9]+\.\...

How to connect to a SQLite3 db with PHP -

i'm new sqlite3 , php , wondering whether , how connect sqlite3 database php. how data db , possible output them on browser screen? i've been searching web while now, couldn't find anything. thank you. <?php $db = new sqlite3('mysqlitedb.db'); $results = $db->query('select bar foo'); while ($row = $results->fetcharray()) { var_dump($row); } ?> taken here: php: sqlite3::query - manual

html - is there a difference from a css point of view between -

<div> <form> </form> </div> and.. <form> <div> </div> </form> this can change inheritance, perceived width, , selectors use. so, yes, there difference.

c# - Why does DirectoryEntry("WinNT://") not show group everyone? -

the below function (is supposed to) lists groups on local machine. question: why "everyone" group not show ? if change directory permissions user, see "everyone" group, must there, somewhere. public shared function getallgroups() datatable return getallgroups(system.environment.machinename) end function ' tools.permissions.local.getallgroups() ' public shared function getallgroups(byval strdomain string) datatable dim dt new datatable dim dr datarow = nothing try dim bexception boolean = false dim delocalmachine system.directoryservices.directoryentry = new system.directoryservices.directoryentry("winnt://" + strdomain) 'dim derootobject system.directoryservices.directoryentry = getdirectoryentry(strpath, strusername, strpassword, bexception) ' if bexception return nothing end if each child sys...

HTML Components (htc) -

can 1 suggest me tutorial or book learning html components (htc) ? well here resources on them: http://www.w3.org/tr/note-htmlcomponents http://msdn.microsoft.com/en-us/library/ms532146(v=vs.85).aspx i'm not 100% sure meant "learning html components", assume after.

php - mod_rewite / query_string -

i basic results mysql database , list on page, on page i've added links variable user_id: href=\"http://localhost/testing/template.php?user_id=$user_id\" >click here on template.php file i'll $user_id , display relevant full data. the thing don't want user_id=249 http://localhost/testing/template.php ?**user_id=**249 show in url i'd "http://localhost/testing/template.php/249". i've been looking few days no success, possible? or template file need user_id=$user_id displayed in order variable? thanks! ===================== to update: added code rewriteengine on rewritebase /testing/ rewriterule ^template.php/([0-9]+)(/)?$ template.php?user_id=$1 [l] changed link variable href="localhost/testing/template.php/{$user_id}" >click here the re-write works, i'm not getting variable $user_id = $_get["user_id"]; on template.php page i added following template.php page see whats being passed through...

image processing - How to compare a matrix element with its neighbours without using a loop in MATLAB? -

i have matrix in matlab. want check 4-connected neighbours (left, right, top, bottom) every element. if current element less of neighbours set 0 otherwise keep value. can done loop, expensive have thousands of these matrices. you might recognize nonmaxima suppression after edge detection. one way function nlfilter image processing toolbox , applies given function each m-by-n block of matrix: >> = magic(6) %# sample matrix = 35 1 6 26 19 24 3 32 7 21 23 25 31 9 2 22 27 20 8 28 33 17 10 15 30 5 34 12 14 16 4 36 29 13 18 11 >> b = nlfilter(a,[3 3],@(b) b(5)*all(b(5) >= b([2 4 6 8]))) b = 35 0 0 26 0 0 0 32 0 0 0 25 31 0 0 0 27 0 0 0 0 0 0 0 30 0 34 0 0 16 0 36 0 0 18 0 the above code defines...

Is there a limit to DB2 JDBC transaction size? -

i need insert large number of rows (up 100,000) 6 different db2 tables. using java jdbc it. in single database transaction whole thing can rolled if issues encountered. there limit somewhere (in jdbc driver or in db2) how many inserts can handled in single transaction? using db2 version 8. the size of single transaction limited size of database transaction logs. sufficiently large transaction log can asking. you don't platform running db2 on, linux/unix/windows transaction log size controlled 3 database configuration parameters - logfilsiz (the size of each transaction log file), logprimary (the number of primary transaction logs) , logsecond (the number of secondary transaction log files).

Advice on creating an interpreted syntax in Java -

i deal lot pos (point of sale) terminals in line of work. talk system endpoint written in java communicated end system. for receipts, write code in endpoint generate data needs printed. these receipts can take 40 characters per line, hardcode each receipt type needs printed. what come sort of scripting syntax use generate these receipts. my idea have gui program can design receipt such as welcome john doe services current balance $(f4).format(currency) or of like. interpret syntax $(f4).format(currency) , pull data , format correctly. i love advice in should start looking on how this. write in java not sure start. rather try , stay away substring magic. thanks in advance. edit: sorry should have mentioned, software extend written in j++ cant use java 5 or 6, lastest java can use 1.4 scripting java platform want start, rhino javascript engine embedded in java 6 run-time should @ using ease of configuration. if insist on domain specific language easiest...

.net - ASP.NET Button style issue in Update Panel for IE -

Image
i facing odd error related css. have email form has buttons. fields of form in update panel. the error facing buttons inside update panel appearing bigger(enlarged) actual size specified. behavior specific ie browsers. don't have same issue ff. here's screen shot. http://i53.tinypic.com/260ucko.jpg the 2 button @ bottom not inside update panel. thanks piyush

iphone - How to add facebook like icon in detail view? -

Image
i working on navigation based app. every cell has detail view. have textview in detail view shows details of selected cell. possible add facebook icon in end of textview? , if no how should that. thanx in advance. you can put icon after textview, or can overlay on top of textview. it's simple putting there in interface builder: or, set frame properties of text view , image view overlap, , place image view on top of text view (simplest way "addsubview" 2nd, place on top).

java - Bring MS Word Application to the front using ComfyJ -

i'm using comfyj 2.7 try , open new word document in ms word 2007 on windows 7. have been create word document , save application remains minimized in task bar. i have tried using following calls on application try , activate window , bring fore. app.activate(); app.getactivewindow().activate(); app.getactivedocument().activate(); app.activate seems make application request move fore because task bar item starts flashing, not bring word application fore. has been able use comfyj interop ms word? have tried app.getactivedocument().activewindow.windowstate property? if taskbar flashes, sounds maybe document being started minimized. may need set windowstate normal.

Python - Parsing Columns and Rows -

i running trouble parsing contents of text file 2d array/list. cannot use built-in libraries, have taken different approach. text file looks like, followed code 1,0,4,3,6,7,4,8,3,2,1,0 2,3,6,3,2,1,7,4,3,1,1,0 5,2,1,3,4,6,4,8,9,5,2,1 def twodarray(): network = [[]] filename = open('twodarray.txt', 'r') line in filename.readlines(): col = line.split(line, ',') row = line.split(',') network.append(col,row) print "network = " print network if __name__ == "__main__": twodarray() i ran code got error: traceback (most recent call last): file "2darray.py", line 22, in <module> twodarray() file "2darray.py", line 8, in twodarray col = line.split(line, ',') typeerror: integer required i using comma separate both row , column not sure how differentiate between 2 - confused why telling me integer required when file m...

Need suggestion for vim font and font size for window xp for C++ programming -

inconsolata looks horrible since there no anti-aliasing. new courier bold looks ok looking better programming font. suggestions? font smoothing (cleartype) off default on xp can activate easily. here one of many tutorials can find on google.

java - Events and event handling under the hood -

i've been working through simple programs using sdl , made me think java guis i've written. in simple sdl programs, have loop checks events (keypresses, mouse clicks etc...) , reacts them. it's polling input. in java, attach listeners gui objects , listeners triggered when events occur. my question is, java handle polling loop in background , work out things gui control clicked can trigger correct listener, or there more complex going on? i know qt has similar event system java use slots connect handler gui control. handling polling , working out control clicked us? or again, there more complex going on? update maybe wasn't clear enough question. i'm looking find out how event bridges os layer - application layer boundary. application poll os layer , pull event information application? or os have way interrupt/notify application event has occurred , push event info application. a third solution has been suggested me application calls blockin...

asp.net - How to use the multiple login for multiple folders using web.config? -

Image
possible duplicate: how apply asp.net authorization in 2 different folders ? how use multiple login multiple folders ? i have 2 different login pags in folders admin , vendors ...i want when of user directly access of page inside admin folder redirect login page of admin folder ...... and if of user directly access of page inside vendors folder redirect login page of vendors folder ...... this won't work - need mark both folders separate, isolated web applications in order have 2 different login configurations. because specify different login pages, you'd need web.config in each of subfolders. if tried this, you'd see trying change login page not allowed web application starts @ /. instead, consider putting single login page in root , in page, examine redirecturl parameter see page user clicked on , change theme (or whatever you're trying do) accordingly. if you're trying keep 2 separate groups of users , authentication sources, hav...

c# - World Time Widget - Display the time in a city -

i need implement world time widget allow user select city, hit button , display time in city them. has got pointers me please? take @ timezoneinfo class ( msdn link ). class, introduced in .net 3.5 handles of heavy lifting you. the steps you're asking follows: in dropdown list of cities, set value each city timezoneinfo displayname. see here how use timezoneinfo.getsystemtimezones method . take bit of work but, thanksfully, you'll have once. when user selects city, use timezoneinfo.converttime method convert time , you're done. there several different methods in timezoneinfo class , closer inspection solution.

Java tree beginner questions? -

today told create tree data structure below class, public class node(){ private string lable; private list<node> children; } after started create tree, struck @ first. it contains node inside node. totally confused. well, tree maybe familiar you. may think whats this! clear. how getting confused that. for me, first time trying create tree in java. honest, used setters , getters inside class in java. these methods, cannot think of inserting new nodes after first level. i have seen examples in google , many in stackoverflow. beginner(in tree) me looks incomplete. may may thought, op can continue that. if explain me concept , how add more children, generic example appreciative. update: it may weired you, how started @ beginning. node node = new node(); string label = "bikes"; arraylist<node> children = new arraylist<node>(); node childnode = new node(); childnode.setlabel("yamaha"); children.add(childnode); ch...

html - Value jumps between textboxes on refresh -

i have page 6 textboxes, if enter values in text boxes , refresh page - values jump next text box (actually 2nd next text box). so if have entered values following [1] [2] [3] [4] [5] [6] after refresh becomes: [0] [0] [1] [2] [3] [4] on next refresh values shifted 2 text boxes again. text boxes created with: <input type='text' id='foo' class='bar' value='0'/> i think important use flexbox jquery plugin replaces given element two new input elements. removing flexbox solve issue. you can try out here enter values in "stat weights" row @ bottom of big table, after hitting f5 value jump have described. browser: firefox questions: 1) how fix this? 2) normal behavior browser try put entered value after refresh? or have rogue code somewhere doing that? untested: give inputs unique name values.

python - Variable updating one step behind in list searcher in Tkinter -

i'm trying build search engine check list , remove list items not meet search parameters. know there several problems program such not add things list when backspace , in updating loop tack on '*' thinking search strings beginning current parameters, cross bridges later. class studentfinderwindow(tkinter.toplevel): def __init__(self): tkinter.toplevel.__init__(self) # create window searchresultlist = ['student1', 'student2', 'student3'] # test list. ##### window attributes self.title('edit students') #sets window title. ##### puts stuff window. # text editstudentinfolabel = tkinter.label(self,text='select student list below or search 1 in search box provided') editstudentinfolabel.grid(row=0, column=0) # entry box self.searchrepositoryentry = tkinter.entry(self) self.searchrepositoryentry.grid(row=1, column=0) # list box self.searchresults = tkinter.listbox(self) sel...

informatica powercenter - Pull from multiple databases in the same source qualifier? -

i'm wondering if possible pull more 1 database in same source qualifier. can specify single database connection per source qualifier i'm not sure if possible. ben, if both same database vendor , db links set up, can use dblinks in source qualifier. select a.col1, b.col2 schema1.table1 a, schema1.table2@db2 b a.col3 = b.col4; but if heterogeneous databases, think best way implement create 2 different source qualifiers (or different ups based on requirement , number of columns) , use parameter file / session mention different connections.

Allowing UserProfileManager Permissions in SharePoint 2010 -

i trying display list of users in custom webpart using userprofilemanager. reason, can view webpart , profiles output screen (maybe because administrator). when standard user logs in, encounter 403 page. i have done reading on , know permissions. have in code: private datatable getprofiles() { datatable dtuserprofile = new datatable(); //...datatable columns spsecurity.runwithelevatedprivileges(delegate() { guid guid = spcontext.current.site.id; using (spsite intranet = new spsite(guid)) { spusertoken usertoken = intranet.owner.usertoken; //get current intranet context. spservicecontext scontext = spservicecontext.getcontext(intranet); userprofilemanager profilemanager = new userprofilemanager(scontext); int totalusers = int.parse(profilemanager.count.tostring()); random random = new random(); ...