Posts

Showing posts from August, 2013

iphone - How do I get the current location from the location manager? -

i want app exact location (longitude , latitude) of every second, possible ? have code far, every 3 second app current location doesnt update if move... - (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation{ nslog(@"lol"); [locationmanager stopupdatinglocation]; if (wtf == 2) { [[nsuserdefaults standarduserdefaults] setobject:newlocation forkey:@"old"]; nslog(@"wtf"); wtf =0; } oldlocation = [[nsuserdefaults standarduserdefaults] objectforkey:@"old"]; double rep = [oldlocation distancefromlocation:newlocation]; nsstring *label1 = [nsstring stringwithformat:@"%2.90f",oldlocation.coordinate.latitude]; nsstring *label2 = [nsstring stringwithformat:@"%2.90f",newlocation.coordinate.latitude]; if ([label1 isequal:label2]) { nslog(@...

html - <iframe> - How to show the whole height of referenced page? -

i have application embed inside our companies cms. way (i told), load in <iframe> . easy: set height , width 100% ! except, doesn't work. i did find out setting frameborder 0 , @ least looks part of site, i'd prefer not have ugly scrollbar inside page allready has one. do know of tricks this? edit: think need clarify question somewhat: the company cms displays fluff , stuff our whole website most pages created through cms my application isn't, let me embedd in <iframe> i have no control on iframe , solution must work referenced page (according src attribute of iframe tag) the cms displays footer, setting height 1 million pixels not idea can access parent pages dom referenced page? might help, can see people might not want possible... this technique seems work ( gleaned several sources, inspired link accepted answer: in parent document: <iframe id="myiframe" name="myiframe" src="http://localho...

java ee - How do I remotely get a checksum for a file on a Windows machine? -

i'm trying check, using automated discovery tool, when jar files in remote j2ee application servers have changed content. currently, system downloads whole jar using wmi checksum locally, slow large jars. for unixy servers (and windows servers cygwin), can log in on ssh , run md5sum foo.jar . ideally, i'd avoid installing software on remote servers (there may thousands), there way on vanilla windows servers? you try sysinternals psexec tool . need checksum utility available on remote machine. unfortunately since became part of microsoft don't make source code available. alternatively, install cygwin ssh daemon on remote machines , use ssh that's bit more involved.

oop - What is the meaning and reasoning behind the Open/Closed Principle? -

the open/closed principle states software entities (classes, modules, etc.) should open extension, closed modification. mean, , why important principle of object-oriented design? specifically, "holy grail" of design in oop of making entity extensible enough (through individual design or through participation in architecture) support future unforseen changes without rewriting code (and without re-compiling **). some ways include polymorphism/inheritance, composition, inversion of control (a.k.a. dip), aspect-oriented programming, patterns such strategy, visitor, template method, , many other principles, patterns, , techniques of ooad. ** see 6 "package principles", rep, ccp, crp, adp, sdp, sap

What is the difference between the WPF TextBlock element and Label control? -

this question has answer here: difference between label , textblock 4 answers visually both of following snippets produce same ui. why there 2 controls.. snippet1 <textblock>name:</textblock> <textbox name="nametextbox" /> snippet2 <label>name:</label> <textbox name="nametextbox" /> ( well gonna answer myself... thought useful tidbit learnt today programming wpf ) the wpf textblock inherits frameworkelement instead of deriving system.windows.control label control. means textblock more lightweight. downside of using textblock no support access/accerelator keys , there no link other controls target. when want display text use textblock . benefit light, performant way display text. when want associate text control textbox use label control . benefits access keys , references target contro...

asp.net - WCF Service support file jsdebug fails to load -

i have wcf service gets called client side javascript. call fails service null javascript error. webdevelopment helper trace shows calls load jsdebug support file results in 404 (file not found) error. restarting iis or clearing out temp asp.net files or setting batch="false" on compilation tag in web.config not resolve problem from browser https://myserver/myapp/services/myservice.svc displays service metadata however https://myserver/myapp/services/myservice.svc/jsdebug results in 404. the issue seems https protocol. http /jsdebug downloads supporting js file. any ideas? tia figured out! here services configuration section web.config look @ bindingconfiguration attribute on endpoint. value "webbinding" points binding name="webbinding" tag in bindings , tells service use transport level security https. in case attribute value empty causing webservice request /js or /jsdebug file on https fail , throw 404 error. <ser...

css - I have a link icon next to each link. How do I exclude the link icon from images? -

i've got following in .css file creating little image next each link on site: div.post .text a[href^="http:"] { background: url(../../pics/remote.gif) right top no-repeat; padding-right: 10px; white-space: nowrap; } how modify snippet (or add new) exclude link icon next images links themselves? if set background color , have negative right margin on image, image cover external link image. example: a[href^="http:"] { background: url(http://en.wikipedia.org/skins-1.5/monobook/external.png) right center no-repeat; padding-right: 14px; white-space: nowrap; } a[href^="http:"] img { margin-right: -14px; border: medium none; background-color: red; } <a href="http://www.google.ca">google</a> <br/> <a href="http://www.google.ca"> <img src="http://upload.wikimedia.org/wikipedia/en/thumb/4/4a/commons-logo.svg/50px-commons-logo.svg.png" /> ...

asp.net - Invalid Viewstate error -

i got error. how can solve this? event # 31890 event log application event type warning opcode info source asp.net 4.0.30319.0 category web event event id 1309 computername web2 date / time 23.07.2010 14:10:09 message event code: 3005 event message: unhandled exception has occurred. event time: 23.07.2010 14:10:09 event time (utc): 23.07.2010 11:10:09 event id: 4ccc84959e7849868332f2f75fadcda9 event sequence: 8713 event occurrence: 15 event detail code: 0 application information: application domain: /lm/w3svc/21/root-3-129243421900200000 trust level: full application virtual path: / application path: e:\core\ecom\emagaza.deneme.com.tr\ machine name: web2 process information: process id: 10148 process name: w3wp.exe account name: nt authority\network service exception information: exception type: httpexception exception message: invalid viewstate. @ system.web.ui.page.decryptstringwithiv(string s, ivtype ivtype) @ sys...

iphone - How to reset UIWebView's zoom? I'm already using scalesPagesToFit = YES; -

i've been looking past week answer question. i have uiwebview, inside of uiscrollview. works great, want content of uiwebview reset zoom, when orientation changes. in html inside uiwebview, set width of viewport (w/ meta tag) "device-width" , on obj-c side, set scalespagestofit = yes; i've tried resetting zoom javascript; replacing meta tags in runtime; reloading; accessing uiscrollview inside of uiwebview; etc... but no success. any of gods know workaround? the 1 can think off recreate uiwebviews every time change orientation, makes them flash white whilst rendering content, looks terrible :( any thoughts? many thanks, andre i'm guessing here , haven't tried, afaik uiwebview has uiscrollview child. 1 should able do: for (uiscrollview *scroll in [mywebview subviews]) { // make sure scroll view , reset zoom scale. if ([scroll respondstoselector:@selector(setzoomscale:)]) [scroll setzoomscale:1.0]; }

configuration - Host and load KML File in Flex project (IGN) -

i'm looking @ tutorial display placemarks using kml file on flex application. i'm using ign api (openscales) in flex project. the example works ( http://openscales.org/userguide/examples/srcview/source/kmlexample.mxml . <os:kml url="http://www.parisavelo.net/velib.kml" proxy="http://openscales.org/proxy.php?url=" numzoomlevels="20" style="{style.getdefaultcirclestyle()}"/> but when i'm hosting same kml file on server : <os:kml url="http://www.cycom.org/velib.kml" proxy="http://openscales.org/proxy.php?url=" numzoomlevels="20" style="{style.getdefaultcirclestyle()}"/> placemarks don't show on map. tried host kml file on different hosts doesn't change. have clue ? thank you. you need add crossdomain.xml server side (in root folder) allow application access km...

security - How do I get rid of a hard disk without exposing my source code? -

what proper way dispose old hard disk contains source code , other intellectual property? throw away in recycle box thought better check users first. there free utilities out there overwrite hard disk (or specific files) random data many times over, making data recovery very, expensive. gnu coreutils has program called shred , microsoft/sysinternals has 1 called sdelete , , there other free alternatives .

vim - How can I stop all the colors being destroyed when I change hi Normal ctermbg -

au insertenter * hi normal ctermbg=233 doing causes colors colorscheme (elflord) go away , change defaults. can stop or work around somehow? the code handling in csapprox is: " colors_name must unset , reset, or vim helpfully reload " colorscheme when set background normal group. " see entries ':hi-normal-cterm' , 'g:colors_name' if exists("g:colors_name") let colors_name = g:colors_name unlet g:colors_name endif " similarly, global variable "syntax_cmd" must set vim " doesn't recognize, lest vim helpfully switch colors " default whenever normal group changed (in syncolor.vim)... if exists("g:syntax_cmd") let syntax_cmd = g:syntax_cmd endif let g:syntax_cmd = "please don't change colors!!!" " ... change normal here ... if exists("colors_name") let g:colors_name = colors_name endif unlet g:syntax_cmd if exists("syntax_cmd") let g:syntax_cm...

forms - how to use accesskey in html -

i want form automatically switch username field password field user types in information. form automatically submit when user presses enter key. how html? you need javascript that: var el = document.getelementbyid('field_id'); el.onkeypress = function(event){ var key = event.keycode || event.which; if (key === 13) { document.formname.submit(); } }; jquery: (based on comment) $(function(){ $('#form_id:input').keypress(function(event){ var key = event.keycode || event.which; if (key === 13) { $(this).parents('form').submit(); } }); });

sql server - Similarity between line strings -

i have number of tracks recorded gps, more formally can described number of line strings. now, of recorded tracks might recordings of same route, because of inaccurasies in gps system, fact recordings made on separate occasions , might have been recorded travelling @ different speeds, won't match perfectly, still close enough when viewed on map human determine it's same route has been recorded. i want find algorithm calculates similarity between 2 line strings. have come home grown methods this, know if problem that's has algorithms solve it. how calculate similarity, given similar means represents same path on map? edit: unsure of i'm talking about, please @ link definition of line string is: http://msdn.microsoft.com/en-us/library/bb895372.aspx - i'm not asking character strings. compute fréchet distance on each pair of tracks. distance can used gauge similarity of tracks. math alert: fréchet pioneer in field of metric space relevant p...

c++ - Strange "Could not deduce template argument for 'T'" error -

the error in this code: //myutil.h template <class t, class predicate> t conditionalinput(lpstr inputmessage, lpstr errormessage, predicate condition); //myutil.cpp template <class t, class pred> t conditionalinput(lpstr inputmessage, lpstr errormessage, pred condition) { t input cout<< inputmessage; cin>> input; while(!condition(input)) { cout<< errormessage; cin>> input; } return input; } ... //c_main.cpp int row; row = conditionalinput("input row of number lookup, row > 0: ", "[input error]: specified number not contained in range [row > 0]. " "please type again: ", [](int x){ return x > 0; }); the error is: error 1 error c2783: 't conditionalinput(lpstr,lpstr,predicate)' : not deduce template argument 't' c_main.cpp 17 1 i've been struggling hours can't see...

oop - What is the dependency inversion principle and why is it important? -

what dependency inversion principle , why important? check document out: the dependency inversion principle . it says: high level modules should not depend upon low-level modules. both should depend upon abstractions. abstractions should never depend upon details. details should depend upon abstractions. as why important, in short: changes risky, , depending on concept instead of on implementation, reduce need change @ call sites. effectively, dip reduces coupling between different pieces of code. idea although there many ways of implementing, say, logging facility, way use should relatively stable in time. if can extract interface represents concept of logging, interface should more stable in time implementation, , call sites should less affected changes make while maintaining or extending logging mechanism. by making implementation depend on interface, possibility choose @ run-time implementation better suited particular environment. depending on cases, may ...

Save data to SQL 2000 from asp.net page using jquery (C#) -

i looking solution implements this. have comments section , want comments posted database using jquery , section gets refreshed without having reload page. how feasible , have security or performance issues? thanx in addition brandon answer, if you're using pure asp.net(not mvc), jquery code call asp.net pagemethod inserts data database. links: http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/ how accept json string array in .aspx page method http://www.clientsideasp.net/2009/03/01/aspnet-ajax-poll-using-jquery-a-complete-implementation-with-admin-part/ cheers

python - How to cache username and passwd in pysvn -

here code #!/usr/bin/python # -*- coding:utf-8 -*- import sys import pysvn def main(): client = pysvn.client() client.callback_get_login = lambda realm, username, may_save:(true, "myusername", "mypasswd", true) print client.cat('http://svn.mydomain.com/file1.py') print client.cat('http://svn.mydomain.com/file2.py') return 0 if __name__ == "__main__": sys.exit(main()) and noticed pysvn established 2 http sessions, in each session, first tried option method without "authorization" header, after server response 401, sent "authorization" header. since 2 url in same domain, why not pysvn send username/passwd directly in subsequence sessions? i have question because i'm suspecting 401 made svn server failed response. , svnkit in eclipse works fine , send "authorization" header automatic. edit: alex martelli: try passing explicit path known-to-be-writable config dir when...

build process - Regression Testing with Rational Robot -

my initial tests have shown robot won't work without active, visible desktop. example, while scheduled task (or executed command continuous integration server) may able start robot command-line process, robot fail execute recorded script. logging build machine allow "active desktop" not acceptable solution. am missing something? possible run pre-recorded rational robot script on continuous integration server in manner doesn't require machine physically logged into? unfortunately, robot require logged on machine , desktop not locked. so, no, not missing something. depending on situation, though, may able work around issue. can clarify type of application trying test? if web app, or client app installed/copied, might able have robot run on vmware image, rather directly on build server itself.

xcode - Use SIP in iPhone app -

i want build iphone app has option make calls on sip (voip) @ moment have no idea how start. does have information topic, or maybe demo project can use implement sip functionality? thanks in advance! you check out siphon .

video streaming - Does anyone know how I can add webcam into my website for Augment Reality? -

does know how can add web-cam website users can print ar code , view on website? thanks. you don't need ar techonolgy print markers... it's enough save image file or pdf (etc) , let user print. to have ar on site need use flash , flartoolkit image recognition , positioning in space. this video tutorial starting point: http://www.gotoandlearn.com/play.php?id=114 good luck!

mysql - How write the values from the database into an array in Flash Builder 4 -

i want display multiple images , when rollover above must tooltips (names). same names in database mysql. naturally, tooltips displayed without delay, preferably put names database array , manipulate them. tell me please wrong? php class connect database: public function getdatamean($id,$dir_id) { $mysql = mysql_connect(database_server, database_username, database_password); mysql_query("set names 'utf8';"); mysql_query("set character set 'utf8';"); mysql_query("set session collation_connection = 'utf8_general_ci';"); mysql_select_db(database_name); $query = "select name files id='".$id."' , dir_id='".$dir_id."'"; $result = mysql_query($query); return $result; } fb4 code: public var names:array = new array(); public var textname:string; protected function decks_clickhandler(event:mouseevent):void {...

What's the best way to hash a url in ruby? -

i'm writing web app points external links. i'm looking create non-sequential, non-guessable id each document can use in url. did obvious thing: treating url string , str#crypt on it, seems choke on non-alphanumberic characters, slashes, dots , underscores. any suggestions on best way solve problem? thanks! depending on how long string can use few alternatives: require 'digest' digest.hexencode('http://foo-bar.com/yay/?foo=bar&a=22') # "687474703a2f2f666f6f2d6261722e636f6d2f7961792f3f666f6f3d62617226613d3232" require 'digest/md5' digest::md5.hexdigest('http://foo-bar.com/yay/?foo=bar&a=22') # "43facc5eb5ce09fd41a6b55dba3fe2fe" require 'digest/sha1' digest::sha1.hexdigest('http://foo-bar.com/yay/?foo=bar&a=22') # "2aba83b05dc9c2d9db7e5d34e69787d0a5e28fc5" require 'digest/sha2' digest::sha2.hexdigest('http://foo-bar.com/yay/?foo=bar&a=22') # "e78...

linux - Advice on buidling an Interactive Voice Response (IVR) system using Asterisk -

what resources can start with? don't have hardware yet, advice can give me if want start development/testing without hardware? get free ebook o'reilly: asterisk: future of telephony. lots of info at: http://www.voip-info.org download "asterisk appliance" distribution asterisknow. comes os, dependencies , asterisk setup, can focus on dial plan , onwards

IronRuby on Rails with IIS 7 -

i'm trying rails app built ironruby running on iis 7. followed tutorial given on ironruby site can't seem work. app runs fine hosted under webbrick iis doesn't seem host properly. here page get. error: exit c:/repositories/rampup/ruby/rampup/config/boot.rb:66:in `exit': exit (systemexit) c:/repositories/rampup/ruby/rampup/config/boot.rb:66:in `load_rails_gem' c:/repositories/rampup/ruby/rampup/config/boot.rb:54:in `load_initializer' c:/repositories/rampup/ruby/rampup/config/boot.rb:38:in `run' c:/repositories/rampup/ruby/rampup/config/boot.rb:11:in `boot!' c:/repositories/rampup/ruby/rampup/config/boot.rb:110 c:/repositories/rampup/ruby/rampup/ironruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' c:/repositories/rampup/ruby/rampup/ironruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' c:/repositories/rampup/ruby/rampup/config/environment.rb:7 c:/repositories/rampu...

sql - Premature Redo Log Switching in Oracle RAC -

what possible causes of premature redo log switching in oracle other reaching specified file size , executing alter system switch logfile ? we have situation (but not all) of our nodes prematurely switching redo log files before filling up. happens every 5 - 15 minutes , size of logs in each case vary wildly (from 15% - 100% of specified size). this article says behaves differently in rac. in parallel server environment, lgwr process in each instance holds kk instance lock on own thread. id2 field identifies thread number. lock used trigger forced log switches remote instances. a log switch forced whenever current scn thread falls behind force scn recorded in database entry section of controlfile. force scn 1 more highest high scn of log file reused in thread.

c# - Testing a Remote Client-Server Application -

yesterday, i posted question on tips doing remote client-server application in c#. now, our group able create one. problem is, cannot think of ways on how can test since on different locations our weekend break. if of has idea on how can test it, please give hints. since have both client , server programs, can run them both on same pc , test them on different machines. (use "localhost" or "127.0.0.1" ip address of server) it's enough test program algorithm, , once work on same pc, should work on 2 machines on internet/lan. of course should understand how networking works. whoever connecting, must visible you. if going connect via internet, server's ip address might not enough. http://www.showmyipaddress.com/ might show isp's front, "white" address. , user, run server might have "grey" ip address, behind nat. if going use showmyipaddress.com , check real ip address typing "ipconfig -all" in windows comman...

Best C++ IDE or Editor for Windows -

what best c++ ide or editor using on windows? use notepad++, missing intellisense visual studio. i've found latest release of netbeans, includes c/c++ support, excellent. http://www.netbeans.org/features/cpp/index.html

java - JSF tags not rendered -

this question has answer here: jsf returns blank/unparsed page plain/raw xhtml/xml/el source instead of rendered html output 1 answer i new jsf, jsf tags not rendered in xhtml file, tried out every possible solution, problem not solved my web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="webapp_id" version="2.5"> <display-name>jsfproject</display-name> <welcome-file-list> <welcome-file>jsfproject/index.html</welcome-file> <welcome-file>jsfproject/index.htm...

c# - Using a lambda expression to avoid using a "magic string" to specify a property -

i writing service take collection of objects of particular type , output primitive, string, , datetime types string in csv format . have both of below statements working. find the lambda based version cleaner. magic string version string csv = new tocsvservice<datetime>(objs) .exclude("minute") .changename("millisecond", "milli") .format("date", "d") .tocsv(); vs. lambda version string csv = new tocsvservice<datetime>(objs) .exclude(p => p.minute) .changename(p => p.millisecond, "milli") .format(p => p.date, "d") .tocsv(); per jon skeet's recommendation of lambda methods share similar method signature public itocsvservice<t> exclude<tresult>( expression<func<t, tresult>> expression) i pass expression.body findmemberexpression . i've adapted code findmemberexpression method of expressionprocessor.cs nhlam...

css - List Item Background Image - Neighbor Floated Content Overlaps -

i've used list item background images customized bullets hundreds of times in past, , somehow never came across issue. essentially, have img floated left of unordered list. bullet background images set top-left of each li. however, floated image covering bullets, browser treating list if it's still full width (as if floated image isn't there). it's bit hard explain. here screenshot notes. http://img695.imageshack.us/img695/1328/cssquestion.jpg here code snippets (sorry, can't upload server @ moment): <h2>about us</h2> <img src="image.jpg" class="img-left" /> <h3>heading</h3> <p>text</p> <ul> <li>list item one</li> <li>list item two</li> <li>list item three</li> </ul> ul { padding: 0; margin: 0; } ul li { background: url(../i...

coding style - What's the least useful comment you've ever seen? -

we know commenting our code important part of coding style making our code understandable next person comes along, or ourselves in 6 months or so. however, comment doesn't cut mustard. i'm not talking obvious jokes or vented frustraton, i'm talking comments appear making attempt @ explanation, poorly might not there. comments too short , too cryptic , or just plain wrong . as cautonary tale, share you've seen that bad , , if it's not obvious, show code referring , point out what's wrong it? should have gone in there instead? see also: when not comment code how comments? (best practices) what best comment in source code have ever encountered? just typical comp sci 101 type comments: $i = 0; //set 0 $i++; //use sneaky trick add 1 i! if ($i==$j) { // made sure use == rather = here avoid bug that sort of thing.

c++ - How can boost::bind does not match the signature provided but works fine? -

my confuse code: #include "stdafx.h" #include <boost/bind.hpp> using namespace std; void fool(std::string s) { std::cout<<s<<endl; } void fool2() { std::cout<<"test2 called\n"<<endl; } void fool3(std::string s1,std::string s2) { std::cout<<"test3 called\n"<<endl; } typedef boost::function<void(std::string)> myhandler; void mywait(myhandler handler) { handler("hello wait"); } int main() { mywait(boost::bind(fool,_1)); //it works fine expected. mywait(boost::bind(fool2)); //how works? fool2 doesnot match signature of "boost::function<void(std::string)>" //mywait(boost::bind(fool3,_1,_2)); //if fool2 works fine, why not work? return 0; } the follow link same question. http://forums.opensuse.org/english/development/programming-scripting/441878-how-can-boost-bind-swallow-argument-member-function.html i read article: [how boost bind library can improve c...

sql server 2008 - sys.columns access issue -

i using sql server 2008 enterprise on windows server 2008 enterprise. wondering sql server authentication mode (not windows authentication mode), how grant non-sa user able access view? thanks in advance, george check link below http://blog.gre-sqlserver-solutions.com/2010/02/sql-agent-giving-non-sa-users.html and also http://www.sypron.nl/grant_sa.html update create user. open sql management studio sa user, right click view want give permission, find permissions part , add created non-sa sql user. there's security->users folder in db tree, can create user. good luck!

java - Is there a way to run a method/class only on Tomcat/Wildfly/Glassfish startup? -

i need remove temp files on tomcat startup, pass folder contains temp files in applicationcontext.xml. is there way run method/class on tomcat startup? you write servletcontextlistener calls method contextinitialized() method. attach listener webapp in web.xml, e.g. <listener> <listener-class>my.listener</listener-class> </listener> and package my; public class listener implements javax.servlet.servletcontextlistener { public void contextinitialized(servletcontext context) { myotherclass.callme(); } } strictly speaking, run once on webapp startup, rather tomcat startup, may amount same thing.

regex - Django urls conf -

so worked django bit , understand regex rudimentary. i know if there request "maps"(not sure means) urls definition in view. that clear , understandable 1 page. if want design urlpattern multiple pages and/or whole website. dont understand part. is there way without regex? if not: way create robust structure regex? can add , remove pages quickly. how flatpages differ form other pages in regard? if possible , reasonable achieve following urls.py? flatpages usual sites website needs: home media . . . contacts dynamically created sites within that similar webgallery (but not) where on first site have text , checkboxes. , have 1 item of media on every page next button. urls this myapp/start/ and then myapp/start/1 n and myapp/ in main navigation , flatpage. i used static pages , somehow dont understand how can structure these different pages. seems flatpages static. can work easier them. maybe later run problems using approach. if there g...

git svn - GIT pull from a bare repository -

i have git repo setup using "git svn" subversion repo. made clone of called b, b bare repository(git clone --bare). clone c b, work on c , periodically push changes b (the reason made b bare). now, when want pickup latest updates subversion run "git svn rebase" on repo a. how pull these updates b. moving b , executing "git pull" fails error - "fatal: /usr/local/git-1.7.0/libexec/git-core/git-pull cannot used without working tree.". correct way move updates b since b bare, want push changes b. what you've described seems lot of pushing , pulling without obvious benefit. use git-svn working directly in repository created using git svn clone . there particular reason why you're creating repositories?

Image manipulation in C# -

i loading jpg image hard disk byte[]. there way resize image (reduce resolution) without need put in bitmap object? thanks there ways whether better... jpg compressed image format means image manipulation on need interpret data. bimap object if want go route you'll need understanding jpeg spec, creating kind of parser, etc. might there shortcuts can used without needing full intepretation of original jpg think bad idea. oh, , not forget there different file formats jpg apparently (jfif , exif) ened understand... i'd think hard before avoiding objects designed sort of thing trying do.

Deep cloning multidimensional arrays in Java...? -

this question has answer here: how do deep copy of 2d array in java? 5 answers i have 2 multidimensional arrays (well they're 2d) have inferred size. how deep clone them? here's have gotten far: public foo(character[][] original){ clone = new character[original.length][]; for(int = 0; < original.length; i++) clone[i] = (character[]) original[i].clone(); } a test equality original.equals(clone); spits out false. why? :| /**creates independent copy(clone) of boolean array. * @param array array cloned. * @return independent 'deep' structure clone of array. */ public static boolean[][] clone2darray(boolean[][] array) { int rows=array.length ; //int rowis=array[0].length ; //clone 'shallow' structure of array boolean[][] newarray =(boolean[][]) array.clone(); //clone 'deep' structur...

.net - WMI + Bitlocker + C# Get encrypted Volumes produces timeout -

i want create wrapper class specific wmi functions affect bitlocker functionality. first step bitlocker volumes of machine created console application , did this: private static managementclass management; private static managementobjectcollection volumes = null; static void main(string[] args) { managementpath path = new managementpath(); path.server = ""; path.namespacepath = "\\root\\cimv2\\security\\microsoftvolumeencryption"; path.classname = "win32_encryptablevolume"; connectionoptions options = new connectionoptions(); options.authentication = authenticationlevel.packetprivacy; options.impersonation = impersonationlevel.impersonate; managementscope scope = new managementscope(path, options); objectgetoptions getoptions = new objectgetoptions(); management = new managementclass(scope, path, getoptions); management.get(); volumes = m...

networking - Emulating a UPnP router -

i want add option of automatic port forwarding (nat traversal) application. i know can done using upnp (specifically part communicates device presenting igd - internet gateway device). i need able test port forwarding feature while developing it. , whatever big router system company traffic routered over doesn't provide upnp. wouldn't want me messing around while it's in live service. my question is: does know of software acts or emulates upnp compatible router? you use windows firewall / internet connection sharing, supports upnp default. setup machine, internet connection sharing activated, , have upnp router. also, check upnp forum more information here . later edit: you try setting linux/unix firwall igd activated. here forum post ubuntu . and there miniupnp project too.

c++ - How to understand everything regarding a Simple Program creation? -

i have referred quite few books on c, c++, etc. in fact have read dragon book on compilers. basic doubt remains, there link or book can read explains simple c program creating writing source code in editor compilation linking? would appreciate internet link provided. as example *nix os: http://www.thegeekstuff.com/2009/09/how-to-write-compile-and-execute-c-program-on-unix-os-with-hello-world-example/ . (there source code edited text editor, not ide) found link using google "c hello world howto" request. can try similar requests if need windows (or other os) specific manual

php - Wordpress | Automatically repost entries to the start page by date -

i'm looking solution regularly show post on startpage. way archieve update last modification date of post, can done using sql statement. alas skips regular wordpress update hooks such "post new entries twitter". so i'm looking php cronjob script "emulate" user updating modification date of post , clicking publish button. how can this? adding wp_load.php script , ... ? thanks advice, johannes you can't use "stick post front page" function under "visibilty" in "publish" section of post editor? , use twitter plugin posting options retweet when post edited?

android - Is it possible to send message via GTalk Intent? -

i'm looking solution send multicast (text) messages google contacts android app. there way gtalk app (intent), or have use own xmpp implementation? recommendations appropriate solution/framework besides gtalk piggybacking? thx hi android share service want, please check url http://davanum.wordpress.com/2007/11/14/sending-xmpp-messages-in-android-standalone-sample-ant-buildxmlintellij-project/ which explain want. have fun

excel - vba: multi-dimensional arrays REDIM -

i have array: dim qcno(4, 2, 350) string the problem have there requirement matrix bigger. need 350 go 1000. is possible redim preserve on 3 dimensional array? if so, how it? preserve maintain existing values. dim qcno() string redim qcno(4,2,350) string redim preserve qcno(4, 2, 1000) string

architecture - Loading scheme for icons -

what best scheme loading icons application? a little bit of background... i’m creating ftp-like application has 4 panes (local folder pane, local file pane, cloud folder pane, cloud file pane). in both file panes, 1 of columns filename, want display icon next (just see in windows explorer). do fact not have physical file files in cloud, have poke registry (with file extension in hand) , exefilename , iconindex combination file type, , there retrieve icon. said, think have below options, , opinion: 1) load exefilename/iconindex combinations every extension (eg: .doc, .txt) on program load , needed query , use them call out extracticon win32 api. 2) poke registry when needed exefilename/iconindex combinations , call out extracticon win32 api icon of associated file type. 3) save 1 byte file of every extension known, directory , call out shgetfileinfo win32 api , pluck associated icon file when needed. 4) save physical icon file every file extension @ time of install di...

user interface - how to design multiple lookups -

the user of application wants assign task programmer. the "edit task" form presented user. a popup (actually absolutely positioned div) window comes programmers choose from. the programmer not there user asks "new programmer" screen. popup replaced "new programmer" form. the user fill data, , comes "works at" field. a (2nd or 3d) popup comes stack "places" choose from. this can go ad infinitum. how design applications, avoid infinite stack of lookup/entry forms? alternatively creating (recursive) stack, make sequential queue of information still needs entered (similar wizard). i.e. select programmer, item "(new - ask details later)". if it's going wizard, should have forth-and-back buttons everywhere.

regex - Is there a single regular expression to replace a number in a delimited list? -

i have string can range empty string arbitrary list of comma delimited numbers. example: "1,2,3" unfortunately write code remove element have bunch of if statements--mainly deal if first, last, or element in list. keep thinking there has got better way! for example, need able remove element ' 2 ' in following lists: "1,2,3" "1,3,2" "2,1,3" "2" "12,2,21" "" this should want: /(\b|,)2(\b|,)/

php - Mysql Query: error that says subquery returns more than 1 row -

i trying complex query 2 tables...it's question skill quiz. table **orders customer**s id id date first_name shipping_amount last_name order_status city customer_id (customers.id) state output -----------+------------+ | state | # orders | +-----------+------------+ | ny | 55 | | ca | 40 | | nj | 33 | | fl | 21 | | mo | 12 | +-----------+------------+ i have been working on query , looks this... select distinct state, (select count(id) orders customers group state order orders desc) customers it gave me error says subquery returns more 1 row try this: select c.state, count(o.id) orders customers c, orders o ...

c# - How i can calculate 2d bounding box with 3d transformation -

i'm working on opengl project. set perspective projection , render transformed rectangle (rotated, scaled) how can calculate rectangle's bounding box (rectangle position,size) thank you you'd run rectangle through same matrices opengl transform 3d points 2d screen-space ones. input vectors, multiply them want apply object, modelview matrix, projection matrix, have screen-space coords. check whether resulting coordinates on-screen, can calculate minimum/maximum x , y coordinates, , have bounding rectangle. see here (9.100), if you've got glu utility library functions available: http://www.opengl.org/resources/faq/technical/transformations.htm hope helps.

How can I generate random integers in a range in Smalltalk? -

a class taking requires of our coding in smalltalk (it's design class). on 1 of our projects, looking things, , having tough time finding how them. seems people modify own version of smalltalk need do. not @ liberty this, cause error on prof's computer when doesn't have same built-in methods do. here's i'm looking do: random numbers. need create random number between 1 , 1000. right i'm faking doing rand := random new. rand := (rand nextvalue) * 1000. rand := rand asinteger. this gives me number between 0 , 1000. there way in 1 command? similar random between: 0 and: 1000 and/or statements. 1 bugs living daylights out of me. have tried several different configurations of (statement) and: (statement) iftrue... (statement) , (statement) iftrue... so i'm faking nested iftrue statements: (statement) iftrue:[ (statement) iftrue:[... what correct way and/or , random in smalltalk? the problem that (expr) and: (expr) iftrue: a...

Update an event in Outlook 2007 with an iCalendar file -

there a previous thread question , , hints @ answer, not work. i have ics file. validates . looks this: begin:vcalendar version:2.0 prodid:-//wa//frweb//en begin:vevent uid:frical201 sequence:0 dtstamp:20081108t151809z dtstart:20081109t121200 summary:11/9/2008 12:12:00 pm trip jfk airport (jfk) location:jfk airport (jfk) end:vevent end:vcalendar i double-click , goes outlook 2007 perfectly. then, double-click ics file looks this: begin:vcalendar version:2.0 prodid:-//wa//frweb//en begin:vevent method:request uid:frical201 sequence:1 dtstamp:20081108t161809z dtstart:20081109t121300 summary:11/9/2008 12:13:00 pm trip jfk airport (jfk) location:jfk airport (jfk) end:vevent end:vcalendar as explained in rfc , uid same , sequence number 1 greater, expect outlook update previous event entry, insert second one. how can formulate ics file outlook knows update event? original poster in thread referenced above said got respond method , organizer in experience method has no effect...

Silverlight App. with OOB hangs/waits with Secure WCF Service -

i have sl 4 application (with oob , elevated privileges) makes connection secure wcf service. wcf service never called, application waits connect , afterwards timeouts. have checked fiddler , wireshark , saw no connection made, application waits! know if elevated privileges not requested application crossdomain.xml etc. setup need done, that's because use oob , elevated privileges. , if make sl app. not oob, application connects , gets crossdomain.xml , gets security exception, expected. to investigate problem further, setup machine vs 2010, sl4 etc. created new sl4 project , wcf service not secure. in oob mode elevated privileges same problem occured again. please note machine clean xp(you might think libraries might mixed up). have checked problem wpf application insted of sl , normal, connection made. below sample solution, please try , send feedback. my platform described below: windows 7 silverlight 4, oob, elevated privileges vs 2010 a wcf service. download...

dynamic - Displaying emoticons in Android -

my im app has support emoticons. gifs , have textual representations, used in input box if user selects 1 of them. i'd display them images after have been sent.currently custom array adapter displays sent message in textview of row. what proper method display images dynamically based on occurrence of textual representation? have search emoticon texts, , if 1 found, remove textview layout (relativelayout fits most?) , add textview beginning of im, imageview emoticon , textview. if more emoticons sent simultaneously can messy. is there easier , more logical way? i try using regular expression replace occurrences of each emoticon <img> tag. then, convert html spannedstring via html.fromhtml() . spannedstring can used in settext() call on textview .

msbuild - How to start on MS-Build -

i wish start using ms-build. have lots of projects build manually (from visual studio) of now. want automate build process , preferably machine onto don't wish install visual studio. started reading ms-build on msdn. yet step step guidance start , how do. questions like: how can start ms-build? there download-able? what first step? how create ms-build script? and lot similar questions. can guide me? ms build comes .net framework , executable (msbuild.exe) located in .net-framework directory, (depending on version): c:\windows\microsoft.net\framework\v4.0.30319 c:\windows\microsoft.net\framework\v3.5 c:\windows\microsoft.net\framework\v2.0.50727 (the right version in %path% when using "visual studio command prompt" start menu.) msbuild files xml-files. can start making new text file, lets "c:\myscript.msbuild", , copy-paste file: <project defaulttargets="mytarget" xmlns="http://schemas.microsoft.com/developer/msb...

In Visual Studio 2008, how can I add a 'using blah.myblah;' to all new page codebehinds? -

is there way modify default template new pages includes custom 'using' statements? from steve's blog , suggests edit class.cs file located in: %program files%\microsoft visual studio 9.0\common7\ide\itemtemplates\csharp\code\1033\class.zip be sure regenerate template cache running: %program files%\microsoft visual studio 9.0\common7\ide\devenv.exe /setup make sure wait process exit (watch task manager!). web templates in different zip: %program files%\microsoft visual studio 9.0\common7\ide\itemtemplates\csharp\web\1033\webform.zip

java - problem using UserService of google appengine -

public class myservlet extends httpservlet { public void doget(httpservletrequest request, httpservletresponse response) throws ioexception { userservice userservice = userservicefactory.getuserservice(); string thisurl = request.getrequesturi(); if (request.getuserprincipal() != null) { response.getwriter().println("<p>hello, " + request.getuserprincipal().getname() + "! can <a href=\"" + userservice.createlogouturl(thisurl) + "\">sign out</a>.</p>"); system.out.println("<p>hello, " + request.getuserprincipal().getname() + "! can <a href=\"" + userservice.createlogouturl(thisurl) + "\">sign out</a>.</p...

perforce - P4, How to find changelist user from a given changelist? -

anybody knows how change list user given changelist(say, #12345)? p4 describe -s #12345 give output this: change #12345 user@user_clientspec on 2010/07/26 10:26:29 affected files... ....... is there command give user name. not client spec shows user@user_clientspec. appreciate help. thanks, tom p4 change -o 12345 | grep ^user: or, if you're on recent version of 'p4' command line: p4 -f "%user%" -ztag change -o 12345

build automation - How to automatically set Version Info in Delphi? -

i have codegear delphi 2007 project automatically set debug module attributes depending on whether project in debug or release mode. i can manually set value right clicking on project->version info->edit values needed. these project whole , same debug , release builds. is there way automatically set manifest debug if #debug compiler directive present? is there way detect exe build debug or release version? you if other way around if use commandline compiler. tell compiler compile debug or release. set compiler directive debug debug build (it default). msbuild yourproject.dproj /p:configuration=release msbuild yourproject.dproj /p:configuration=debug

javascript - Help with auto-resize of background image -

is there way automatically resize background image of element. example, in html, links have background image. image has slanted left , right border , round top corners. one specify width of anchor element accommodate background image. problem width should dynamic , background image should adjust if link's width smaller width of image.. kinda doing other way around.. do solutions this? thanks! there standard way of achieving using 2 elements. <a href="foo.html" class="button"><span>button text</span></a> as can see put span inside link going have button. image using need split 2 pieces 1 left side , middle portion of button , on right side. set contained span have wide left side of button image. link contain right side of button. css should this a{ background: url("rightimg.png") right no-repeat; display:block; padding-right: [width of image]; width:auto; height:[height of image]; line-height:[h...

Using $Rev:$ SVN keyword in C# code? -

does know syntax use file revision keyword within code in c#? know how use in sql server can't seem syntax right. have added property file in display version. your c# files should contain $lastchangedrevision: $ svn revision added. however, need set svn:keywords property correctly files in want value expanded. for example, following result in string containing revision. string revision = "$lastchangedrevision: $"; the svn:keywords property should include lastchangedrevision in space-separated list of values. you can make automatic cs extension editing tortoisesvn configuration. this, go tortoisesvn explorer menu , select settings... . on general tab, click edit button next subversion configuration file: . scroll down , add line 1 [auto-props] section (just example, may have more or less keywords , may set other properties): *.cs = svn:keywords=lastchangeddate lastchangedby lastchangedrevision id url;

php - using foreach loop for multiple MySQL inserts -

i'm using following snippet break string array, insert them database. //split tags individual words $tag_array = explode(',', $tags); foreach($tag_array $tag){ addslashes($tag); echo $tag."&nbsp;"; $addtagsquery = "insert `my_blog`.`tags` (`id`, `name`) values ('".$id."', '".$tag."');"; $tagsresult = $db->query($addtagsquery); if($tagsresult){ echo "tag added <br />"; } else { echo "tag not added <br />"; } } my problem lies within scenario multiple tag (strings) submitted. unfortunately, first string in array inserted. insight why first string in array inserted mysql database appreciated. $id not being incremented in loop. chances getting duplicate error, whatever reason not telling (poor error hand...

memory - Why is PHP Doctine's free() not working? -

this 1 of doctrine users out there. have php cli daemon process checks table every n seconds find entries haven't been processed. it's fifo. anyways, exceed memory allocated php becuase doctrine not free it's resources. combat problem provides free query object. can't seem make work though. here's code: 22 print "you using " . (memory_get_usage() / 1024). "\n"; 23 $query = doctrine_query::create() 24 ->from('submissionqueue s') 25 ->where('s.time_acted_on null') 26 ->orderby('s.time_queued') 27 ->limit(1) 28 ->execute(); 29 print $query[0]->time_queued . "\n"; 30 $query->free(); any ideas doing wrong? edit: using 1.0.3 edit: have tried of below suggestions. hopeful unset() had in there before found free() . here more of code possibly aid in help. before question open...