Posts

Showing posts from July, 2014

mysql - how to change the date format as it not the same with the database -

as coding show @ textbox 18/02/2012 (for example). in database 02/18/2012. txtreqdate.text = calendar.selectionstart.tostring("dd/mm/yyyy") cbotermcode.focus() calendar.visible = false but when want retrieve related data date using coding below : sqlcbo2 = "select distinct gear_code gear est_start_date='" & txtreqdate.text & "'" it invalid date. cannot change date format in database. if change code txtreqdate.text = calendar.selectionstart.tostring("dd/mm/yyyy") txtreqdate.text = calendar.selectionstart.toshortdatestring appear 02/18/2012 @ textbox data appear want 18/02/2012 appear @ textbox. you make use of str_to_date function parse data , transform date value. use (correct syntactical error): where should put it. example?? sqlcbo2 = "select distinct gear_code gear est_start_date=str_to_date('" & txtreqdate.text & "','%d/%m/%y')"

c# - Like button javascript loading -

i have website quotes(platon,aristotel etc..).all of quotes displayed on 1 site, pulled database.i have method automaticly creates button each of these quotes when web site gets loaded: system.web.ui.htmlcontrols.htmlcontainercontrol fbiframe = new system.web.ui.htmlcontrols.htmlgenericcontrol("iframe"); fbiframe.attributes["scrolling"] = "no"; fbiframe.attributes["frameborder"] = "0"; fbiframe.attributes["style"] = "border:none; overflow:hidden; width:250px; height:21px;"; fbiframe.attributes["allowtransparency"] = "true"; fbiframe.attributes["src"] = "//www.facebook.com/plugins/like.php?href=" + httputility.urlencode("http://www.example.com/like/" + quote[0]) + "&send=false&layout=button_count&width=250&show_faces=false&act

asp.net mvc - RouteHandler for Static Content -

we want route static content (js, css, images - png, gif, jpeg, jpg) of our application routehandler. we'll best practices speeding web sites . adding etags, cache control, expires, etc our static content. how can that? you should in iis. but if want have total control on (can't find reason though!), can add catch route last route. like: routes.maproute( "static", "{*path}", new { controller = "home", action = "static"}); then add action control handle it: public actionresult static(string path) { //path after / //use server.mappath load //add headers response, etc return file(); } but bad in opinion. obvious thing taking path url , map server. happens if path /../../windows/... ? nothing, don't it.

c# - How to set property value using Expressions? -

this question has answer here: how set value property selector expression<func<t,tresult>> 5 answers given following method: public static void setpropertyvalue(object target, string propname, object value) { var propinfo = target.gettype().getproperty(propname, bindingflags.instance | bindingflags.public | bindingflags.nonpublic | bindingflags.declaredonly); if (propinfo == null) throw new argumentoutofrangeexception("propname", "property not found on target"); else propinfo.setvalue(target, value, null); } how go writing it's expression enabled equivalent without needing pass in parameter target? why instead of setting property directly can hear say. example suppose have following class property has public getter private setter: public class customer { public strin

how to get correct position after filtering the Listview in android application -

in app, when user types in search box list gets filtered position of list items gets changed. , due changed position when user clicks on list item, results in unwanted activity. because have set events list items according position. there parameter of list items/row remains same after getting list filtered?

parsing - How to parse dhcpd.conf files with python and bicop? -

i want edit files (dhcpd.conf, dns files) python. looking option , found bicop library. try do: from bicop import parse parse("/home/tigov/dhcp/dhcpd.conf") and got: traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/local/lib/python2.6/dist-packages/bicop/config.py", line 83, in parse return _parse(tokenizer, dictclass=dictclass) file "/usr/local/lib/python2.6/dist-packages/bicop/config.py", line 141, in _parse raise parseerror, (input.infile, input.lineno, "unexpected end of file") bicop.config.parseerror: none[1]: unexpected end of file any ideas have do, or "bicop how to"? or maybe library this? (iscpy library doesn't work me) , sorry, english weak. it looks examples bicop don't work. parse accepts string input. try this: from bicop import parse parse(open("/home/tigov/dhcp/dhcpd.conf").read())

Checksum field in PostgreSQL to content comparison -

i have field in table large content (text or binary data). if want know if text equals one, can use checksum compare 2 texts. can define field unique avoid repeated content too. my doubt if create checksum field, comparison speed up, postgresql (without need programmer intervention) or need manually? edit: better, create checksum text field, use checksum or 2 ways same thing? there no default "checksum" large columns in postgresql, have implement 1 yourself. reply comment hash indexes provide fast performance equality checks. , updated automatically. not integrated in postgresql (yet), use discouraged - read manual . and cannot query values , use them in application instance. checksum column, need add index performance if table big , maintain column. use trigger before insert or update that. so, hash index may or may not you. @a.h.'s idea fits problem ...

c - Nested loop:inner loop is skipped once when executed -

int t,r,c; int matrix[100][100][100]; int i,j,k=0,l=0; int te,ck=0; scanf("%d",&t); for(te=0;te<t;te++) { printf("rc"); scanf("%d %d",&r, &c); for(i=0;i<r;i++) { for(j=0;j<c;j++) { printf("te= %d i= %d j= %d",te,i,j); fflush(stdin); matrix[te][i][j] = getchar(); } } } sample o/p abhi@ubuntu:~/desktop$ ./spoon.o 3 rc3 6 te= 0 i= 0 j= 0te= 0 i= 0 j= 1 the control directly asks value j=1 , j=0 skipped.why? fflush(stdin) not way clear input buffer. use: void flushinputbuffer( void ) { int c; while( (c = fgetc( stdin )) != eof && c != '\n' ); }

c# - Selenium: Unable to access iframe and data inside it -

i have html code iframe: <iframe class="class1" prio="0" title="details" type="detail" source="/something/somepage.aspx" style="display:none" frameborder="0"></iframe> this frame has menu, text input , buttons inside opens popup on current page. popup gets data source page above. i tried different approaches i.e. finding index manually of iframe , display title see if @ right frame had no luck it. i trying type data in form in iframe , main page being clueless. please ! switchto() method takes index, name or frame element, can try use name or frame element. //find frame class/title/type/source iwebelement detailframe = driver.findelement(by.xpath("//iframe[@class='class1']")); driver.switchto().frame(detailframe); //alternatively, find frame first, use getattribute() frame name iwebelement detailframe = driver.findelement(by.xpath("//iframe[@class='class

lisp - Creating a list of Fibonacci numbers in Scheme? -

i've made basic program output fibonacci sequence whatever length "n". here's code have: (define (fibh n) (if (< n 2) n (+ (fibh (- n 1)) (fibh (- n 2))))) (define (fib n) (do ((i 1 (+ 1))) ((> n)) (display (fibh i)))) it output, example, 112358 . what want list such (1 1 2 3 5 8) . any explanation how appreciated. (map fibh '(1 2 3 4 5 6)) would trick. if don't want enumerate integers hand, implement simple recursive function you, like: (define (count n) (if (= n) '() (cons (count (+ 1) n)))) (note: not tail-recursive, algorithm compute fibonacci numbers, that's not prime concern.)

Rewrite Jquery to Regular Javascript -

how rewrite below code in regular javascript. dont want load jquery library. $(document).ready( function() { $('.navigation li').click(function() { $('.navigation li').removeclass('navactive'); $(this).addclass("navactive"); bgimage = $(this).find('a').attr('href').replace('#', '')+'.jpg'; $('.background').css("background-image", 'url(images/skins/'+bgimage+')'); }); }); the jquery library complex, , lot of stuff behind scenes. accurately answer question you'd need give bit more information, such as: which browsers planning on supporting? jquery @ staying cross browser compatible, relies on hacky things this. ideally don't want include things in own code, it's better hide them away in library. do have control on page? rewrite treat navigation control, have things image url in variable, rather having 'extract' <a /> tag?

About spring mvc configuration -

i trying build web app using spring mvc. far, when start server, 404. please give me suggestion configuration. web.xml: <servlet> <servlet-name>action</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.jsp</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> action-servlet.xml: <bean id="viewresolver" class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="viewclass"><value>org.springframework.web.servlet.view.jstlview</value></property> <property name="prefix"><value>/web-inf/jsp/</value></property>

SQL server 2005 grouping values, display only changes -

posting again i've made updates. i'm trying group set of values, want display values if there change. imagine value fluctuating, ranging 1, 4, 3, 1, 1 , 1 again. some example data value | date_loaded | 1 | 2012-03-07 | 1 | 2012-03-06 | 1 | 2012-03-05 | 3 | 2012-03-04 | 4 | 2012-03-03 | 1 | 2012-03-02 | i want display each of values in order of fluctuated, group them together. see in order, 1, 4, 3, 1, rather 3 1's recently. so display latest value, it's earliest date, e.g. value | date_loaded | 1 | 2012-03-05 | 3 | 2012-03-04 | 4 | 2012-03-03 | 1 | 2012-03-02 | what best way go this? possible if statement? if value 1 different value 2, +1 "change" ? therefore i'd able group values "change1", "change2" etc.? how about: ;with data ( select 1 [value],'2012-03-07' date union select 1,'2012-03-06' union select 1,'2012-03-05' union selec

What would be the easiest way to get all user stories for a Portfolio Item in rally API? -

what easiest way user stories portfolio item in rally api? right now, api returns immediate children. similar previous question, there way filter using api in such way related user stories? currently performance reasons results wsapi are limited 1 level of hierarchy. once have immediate children results first query have loop on each 1 , issue new query children (and forth recursively until have leaf children). are doing in app? can little challenging manage async callbacks , stitch data correctly rallydatasource should @ least making querying part simpler...

What's wrong with this example ANTLR 3 Python grammer? -

i'm trying learn use antlr, , seem have come across error while following "tutorial": https://theantlrguy.atlassian.net/wiki/display/antlr3/five+minute+introduction+to+antlr+3 essentially, create file simplecalc.g: grammar simplecalc;   options {     language = python; }   tokens {     plus    = '+' ;     minus   = '-' ;     mult    = '*' ;     div = '/' ; }   @header { import sys import traceback   simplecalclexer import simplecalclexer }   @main { def main(argv, otherarg=none):   char_stream = antlrfilestream(sys.argv[1])   lexer = simplecalclexer(char_stream)   tokens = commontokenstream(lexer)   parser = simplecalcparser(tokens);     try:         parser.expr()   except recognitionexception:     traceback.print_stack() }   /*------------------------------------------------------------------  * parser rules  *------------------------------------------------------------------*/   expr    : term ( ( plus | minus )  term )* ;   term

compiler errors - Maven : mvn install results to Compilation failure -

when running command "mvn clean", returns build success when running "mvn install", returns compilation failure. please me out trace causing error? in advance. edit : added logs. [error] \users...\workspace\project\src\main\java\c om\project\interceptor.java:[30,22] cannot find symbo l symbol : variable httpservletresponse location: class com.project.interceptor [info] 49 errors [info] ------------------------------------------------------------- [info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 2.730s [info] finished at: thu mar 08 11:14:16 cst 2012 [info] final memory: 9m/24m [info] ------------------------------------------------------------------------ [error] failed execute goal org.apache.maven.plugins:maven-compiler-plugin:2. 3.2:compile (default-compile) on project project: compilation failure: co mpi

c - Why does my compiler not accept fork(), despite my inclusion of <unistd.h>? -

here's code (created test fork()): #include <stdio.h> #include <ctype.h> #include <limits.h> #include <string.h> #include <stdlib.h> #include <unistd.h> int main() { int pid; pid=fork(); if (pid==0) { printf("i child\n"); printf("my pid=%d\n", getpid()); } return 0; } i following warnings: warning: implicit declaration of function 'fork' undefined reference 'fork' what wrong it? unistd.h , fork part of posix standard . aren't available on windows ( text.exe in gcc command hints that's you're not on *nix). it looks you're using gcc part of mingw , provide unistd.h header not implement functions fork . cygwin does provide implementations of functions fork . however, since homework should have instructions on how obtain working environment.

JQuery simulate Hover event on another div / Trigger Tooltip by multiple triggers -

my goal trigger tooltip within map area hovering in list next map. tooltips should therefore appear in map , not in list. also, hovering on map should trigger tooltip. example: have map of city , want dots on map explained tooltip - xy's restaurant, xy park, xy museum. hovering on dots should trigger tooltip, hovering in list. i used plugin: http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ hovering on map works charm, cannot tooltips appear when hovering on list. think doesn't work because uses mouse position calculate tooltip position. at moment use $(function() { $("a.tooltip").tooltip({ positionleft: true }); }); </script> for map part: <a class="tooltip" target="_blank" title="area-tooltip 1" href="xy"></a> but don't know how let "area-tooltip 1" tooltip appear on map trigger (list) <a class="tooltiplist" href="xy" target=&q

python - Macro tool for maya -

on seeing photoshop action, curious develop macro tool maya using python. started working on it. here sample, path = "c:/desktop/file.txt" = open(path, 'w') #cmds.scripteditorinfo(ch = true, chf = true) cmds.scripteditorinfo( hfn=path, wh=true) a.close() i able record things. here recorded information. createpolygonpyramid; performpolyprimitive pyramid 0; settoolto createpolypyramidctx; optionvar -query toolmessagevisible; optionvar -query toolmessagetime; optionvar -query toolmessageverticaloffset; optionvar -query toolmessagehorizontaloffset; headsupmessage -time 0.7 -verticaloffset -40 -horizontaloffset 0 -viewport 1 - uvtextureeditor 0"drag on grid."; changetoolicon; polypyramid -ch on -o on -w 10.727425 -cuv 3 ; escapecurrenttool; autoupdateattred; updateanimlayereditor("animlayertab"); statuslineupdateinputfield; changetoolicon; the problem un-able categories things (record required things). records information. tried u

ios - Source control in XCode is a nightmare - can anyone offer advice? -

using git xcode (4.3) real nightmare. here's scenario... i want add new feature, create new topic branch. i add new feature , i'm ready commit, rebase , merge... i commit changes - fine. i jump master pull changes (in case else has updated code). get: error: local changes following files overwritten checkout: myproject/project.xcworkspace/xcuserdata/bodacious.xcuserdatad/userinterfacestate.xcuserstate huh? committed. xcode likes change project.xcworkspace files every other second makes impossible make clean, atomic commits. what's more, if commit changes in project.xcworkspace , jump branch (in order merge master example) xcode complain files have changed , crash too. from gather, i can't add these files .gitignore either. do have accept concise , orderly git strategy not possible xcode, close xcode before doing git management, or there option available? i add files .gitignore file. there no need share them other developers. so

iphone - Update a .csv file on server from iPad programmatically -

i developing simple ipad application should submit text form .csv file. manage update .csv file saved locally in documents folder on computer. however, need keep file on server, download file, append data, , upload again (export bulk of data file on server). idea how that? i guess ftp might easiest way, see this question your other options involve writing server-side service post data to.

iphone - Playing two videos after another causes short black screen -

i have app play movie after touch on view , when movie finished. place button on view. on clicking button second movie plays. seems loaded , short black screen appears. want avoid black screen now... heres code: initialization in viewdidload [super viewdidload]; // additional setup after loading view, typically nib. nsstring *movpath = [[nsbundle mainbundle] pathforresource:@"movie1" oftype:@"m4v"]; mpviewcontroller = [[mpmovieplayerviewcontroller alloc] initwithcontenturl:[nsurl fileurlwithpath:movpath]]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(moviefinishedcallback:) name:mpmovieplayerplaybackdidfinishnotification object:nil]; mp = [mpviewcontroller movieplayer]; // [mp setmoviecontrolmode:mpmoviecontrolmodehidden]; // [mp.view setframe:cgrectmake(0, 0, 250, 263)]; mp.controlstyle = mpmoviecontrolstylenone; mp.sh

PHP: Changing referer with header() -

my cms links other sites convenience , i'd hide referer other sites don't see directory , query string of cms. have cms linking php file elswhere on server in turn redirects link via header() referer still cms, not linking php. furthermore... header("referer: nowhere"); header("location: $_request[urltolinkto]"); ... doesn't appear change anything. no matter put referer, it's 1 cms user clicked on link. can referer changed (to linking php), or have use javascript or meta refresh? the referer header browser sends server. changing respose server browser, not work way (unlike cookie header). far know have no server-side control of browser's behavior on sending referer.

iphone - Can iOS really support AES 256? -

i have read header of commoncryptor.h , , can find kccalgorithmaes128 but there few answer in stating can, e.g. aes encryption nsstring on iphone anyone can answer? you can use openssl on iphone, , support aes 256. that being said, kccalgorithmaes128 means block length of 128, not key length. according this example code (found in this answer ) need use kcckeysizeaes256 keylength parameter support 256 bit keys.

android - how to make left right activity slider? -

any suggestions how make activity slider "slide left" , "slide right" typical image slider?? i tried with: (implements ontouchlistener) public boolean ontouch(view v, motionevent event) { switch (event.getaction()) { case motionevent.action_down: { // code break; } case motionevent.action_up: { // code break; } case motionevent.action_move: { // code break; } } return true; } but don't have left, right choice. i don't need use buttons, need somethings image slider ipad2 activities customer app. thanks you need calculate own slide left , right movement motionevent.action_up a pressed gesture has finished, motion contains final release location intermediate points since last down or move event. motionevent.action_down a pressed gesture ha

jquery - How to add javascript functions to divs loaded externally? -

i have page , pageb. page loads page b div. there divs in page b when want execute functions onclick. problem no matter place pageb's javascript doesn't work. i assumed if had function ot initalise pagesb's javascript after loaded div work... no success... any responses helpful... regards j if you're loading page b ajax, javascript inside page b getting stripped out. due security concern. an alternative way work separate structure this page html page javascript page b html page b javascript now, when load page should load following: page html page javascript page b javascript then, when make ajax call load page b html, call page b javascript (which loaded) , should work. here's example of i'm describing: http://jsfiddle.net/josephbulger/zsmqe/

deployment - Deploying with Git/Github -

we trying setup automated deployment environemt git/github. have 3 different environments; local, test , live. when add new feature on local, first upload files test server test newly created feature. if ok, upload files live server. "uploading" process not perfect solution, forget upload files. btw have mobile app on iphone , android, mobile may fourth environment us. what try setup automated deployment environment. when commit new feature test server, after testing new feature want push live server. there may lots of commits on test server want push specific commits live server. couldn't find how cope 3-4 environments , not mess codes. how push correct codes live server? how manage our test , live servers? there recources telling how setup different environments , deployment processes git/github? there articles tell step-by-step? i've read articles none of them tell how cope local, test , live environments. http://ryanflorence.com/simple-git-deployment/

testing - Eclipse and test packages now in white and un-runnable -

Image
i have issue eclipse , test packages. show white icons instead of default brown color used in eclipse packages... see image below: what more can't run tests eclipse now. must missing basic configuration somewhere. can help? i think these packages have been 'excluded' build path. (that's how can make packages/classes way) right click on "given project" --> "build path" --> "configure build path". see "source" tab. each source folder have 3 subsections: included, excluded, native library location. check if there files/packages excluded.

java - dao, tx, service structure: where to place a method querying an abstract entity? -

i have abstract entity 4 other entities inherit from. relationship works well, want query abstract entity entities regardless of types. have no idea place such method since parent entity dao abstract. entityparent (abstract) -> entitytype1, entitytype2, entitytype3, entitytype4 daos this: entityparentdao (abstract) -> entitytype1dao, entitytype2dao, entitytype3dao, entitytype4dao tx this: entityparenttx (abstract) -> entitytype1tx, entitytype2tx, entitytype3tx, entitytype4tx my project structure goes follows: entities -> dao each entity -> tx each dao -> service combining several txs there service uses of * tx *s that's within scope of project. criteria/hql query should placed? doesn't sound quite right. for example let's have car parent entity , have children entities coupe , sedan , minivan , on , want list of cars given property common , therefore in entity (and table) car . place query/method given structure i'm following?

php - Load CSS file from a header used in many pages -

i used create unique header , load in pages this. <?php require_once('include/_header.php'); ?> <div id="main"> <!-- page --> </div> <? require_once('include/_footer.php'); ?> in root folder have folder named css put css stylesheets in header call <link rel="stylesheet" href="css/style.css" type="text/css"> . now, suppose have create subfolder inside root , create web page it. when call stylesheets header, page doesn't show correctly, because call stylesheet in wrong way. how can call stylesheet in way can reachable position? here schema: css -style.css include -_header.php -_footer.php folder -mypage.php use absolute path: <link rel="stylesheet" href="/css/style.css" type="text/css"> (note slash before css directory)

html - Special scroll-bar design can it be made in all browsers? -

Image
is scroll-bar possible make in browsers ? doesn't have arrows , scroll in different shape. it possible requires javascript (it's not available in css) try use example plugin (it requires jquery): http://jscrollpane.kelvinluck.com/

android - Unable to change text color of ListFragment items -

i have listfragment populated cursor. have list background set white, , reason text set white. i've tried changing textcolor attribute in layout xml, doesn't seem have effect. can point out i'm missing? thanks. from listfragment: @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); string[] = {dbconstants.col_family_name}; int[] = {android.r.id.text1}; getloadermanager().initloader(family_loader, null, this); adapter = new simplecursoradapter(getactivity().getapplicationcontext(), r.layout.simple_spinner_drop_down_view, null, from, to, cursoradapter.flag_register_content_observer); setlistadapter(adapter); } @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); registerforcontextmenu(getlistview()); getlistview().setbackgroundresource(android.r.color.white); getlistview().setcachecolorhint(android.r.color.transparen

country - Where can I get a list of Countries, States and Cities? -

this seems duplicate, since there identical questions out there. unfortunately of answers of these questions missing 1 detail: the states . where can list of countries, states , cities? for example, want this: | sydney | new south wales | australia | or | miami | florida | united states | i don't want this, excludes state: | miami | united states | is there place can kind of data? i've tried following data sources: http://www.maxmind.com/app/csv http://www.geodatasource.com/world-cities-database/free http://developer.yahoo.com/geo/geoplanet/data/ but of them exclude states . the un maintains list of countries , "states" / regions economic trade. db available here: http://www.unece.org/cefact/locode/welcome.html

c# - error executing child request for server.transfer with Handler -

i have created handler process .html pages in asp.net c# web application. use url rewriting concepts. handler works fine when html requrest come server/website. coding details follows: web.config handler code: <add verb="*" path="*.html," validate="false" type="myproject.contenthandler,myproject" /> contenthandler.cs code: public void processrequest(httpcontext context) { string strmappage = string.empty; if (context.request.url.tostring().contains("category")) { strmappage = "/links.aspx?id=" + producid; } else { strmappage = context.request.url.tostring(); } context.server.transfer(strmappage); } this method works fine .html request page http://localhost:9111/user-category-1.html when try open page '/js/tinymce/imagemanager/index.html' throws error "error execut

google app engine - Prevent database from being cleaned up on re-deploy -

when re-deploy app app engine, app existing data in datastore cleaned-up. how prevent happening? update:1 using java, 1.6.3. on production system. the datastore in production not flushed if redeploy. if change model definitions , structures might data need not belong new(er) model definition... if speaking datastore on local machine start dev server --datastore_path=/tmp/myapp_datastore myapp if using python. don't know equivalent java sdk is. need provide more details.

.net - WCF 4 REST - Acquiring the underlying response stream object for writing -

background: using visual studio 2010 online template "wcf rest service template 40(cs)" , works great json based service. i've got working return stream when returning image. scenario: looking server push & multipart/x-mixed-replace technology replace polling images method using. the problem: issue facing unable find way underlying response stream rest request, know the template trying abstracting away me, in order implement multipart/x-mixed-replace mechanism need write directly stream , have full control of write client. any appreciated. server push tech seems cool! i have returned sorts of things in response, including documents, spreadsheets etc. looks this: [servicecontract] public class myservice { [operationcontract] [webget(uritemplate="{id}")] public stream getdocuments(int id) { weboperationcontext.current.outgoingresponse.contenttype = getcontenttype(); stream result = createtemporarystream();

how can there be same md5 value for two different length strings -

i have md5 function have confirmed work both files , strings. when use on variable sized chunks of large files generates md5 values same size of chunks different. i wonder if there probability 2 chunks different lengths may be same content result in similar md5 fingerprints. the odds happens 1 / (2^128), since md5 128-bit hash. means 1/(3.4 x 10^38), it's unlikely not impossible. it's more probable, think, you're doing wrong , calculating md5 of same text/file every time.

Deploy webapp on remote tomcat server from netbeans -

is possible deploy service on remote tomcat server within local netbeans ide? i using tomcat 6.0.35 on remote windows 2003 server , netbeans ide 7.0.1 you modify build script (solutions maven , ant can found here @ so)

api - Prob in publishing post on aggregation view -

i have created timeline app local ip, status of app "pending". it's working account have created app when trying submit/publish message on different user's wall getting error message "(#200) requires extended permission: publish_actions or app must on whitelist". have defined permission "publish_actions": $loginurl = $facebook->getloginurl( array( 'display' => 'popup', 'next' => $fbconfig['baseurl'] . '?loginsucc=1', 'cancel_url'=> $fbconfig['baseurl'] . '?cancel=1', 'scope' => 'publish_checkins,publish_actions, email, offline_access, read_stream, publish_stream, user_birthday, user_location, user_work_history, user_about_me, user_hometown', 'redirect_uri' => $fbconfig['baseurl'] ) ); i have used php sdk this, code mentioned below:

arrays - javascript operator "in" -

i'm used python, so a = [1,2,3] 1 in # -> true b = ["1", "2", "3", "x"] "x" in b # -> true why in javascript a = [1,2,3] 1 in // -> true b = ["1", "2", "3", "x"] "x" in b // -> false and weirder "1" in b // -> true in works on keys of arrays, not values. 1 in a succeeds because there element #1 in array, 2 value. "1" fails, because there no 1 property or key in array. details here: https://developer.mozilla.org/en/javascript/reference/operators/in

actionscript 3 - as3 error loading "good" "bad" array -

i creating "good" "bad" array display on screen can later use simple if statements upon if player has collided "good" "bad" objects. cant objects randomly generate on screen following code. // create , set good/bad random word objects public function newobject(e:event) { var goodobjects:array = ["wordobject1"]; var badobjects:array = ["wordobject2"]; if (math.random() < .5) { var r:int = math.floor(math.random()*goodobjects.length); var classref:class = getdefinitionbyname(goodobjects[r]) class; var newobject:movieclip = new classref(); newobject.typestr = "good"; } else { r = math.floor(math.random()*badobjects.length); classref = getdefinitionbyname(badobjects[r]) class; newobject = new classref(); newobject.typestr = "bad"; } n

foursquare - How to get more information on failed FS pushes -

for foursquare app says @ on developer page: 15 failed pushes today is there way additional information on pushes, other fact failed? list of dates/times helpful, entire failed push data ideal. i've been scouring documentation far have had no luck. as jason hall says in comment, there's no way more information foursquare other recent error. you're best bet inspect server logs more information why call failed.

cocoa - AXUIElement available in MonoMac? -

i'd able use cocoa accessibility api in monomac application, can't find references in monomac documentation. has axuielement.h been mapped yet? i couldn't find on either. some parts can implemented dllimport. example, did following: public const string accessibilitylibrary = "/system/library/frameworks/applicationservices.framework/applicationservices"; [dllimport (accessibilitylibrary)] extern static bool axapienabled();

controller - Rails life time of params variable -

in standard "index" method of controller set value in params hash in order use in view if it's not initialized yet in other case nothing. def index params[:my_value] ||= {} end when use include? method on params[:my_value] in view, there's error evaluating nil.include? why there's such error if params[:my_value] cannot nil. if it's nil, value should initialized {}, that's ||= operator does. can problem here? the solution in merge method. turned out a = b.merge(a) and a.merge(b) {|key, v1, v2| v1 } do different things , in first case(which wrong) nil appears somewhere. haven't figured out yet why because merge method return hash , when replaced first variant second ok. don't see problem...

r - Change the axes on a radial barchart -

Image
i want make radial stacked barchart. have this: ggplot(diamonds, aes(clarity, fill= cut)) + geom_bar() + coord_polar() which yields plot this: however crowded. there way change axes barchart hollow? want 0 start not @ center of circle but, say, 1/3 or 1/2 of radius center. ideas that? you can tell coord_plot expand - puts small hole in middle: ggplot(diamonds, aes(clarity, fill= cut)) + geom_bar() + coord_polar(expand=true) then can control y scale expansion (with argument expand=... scale_y_continuous(...) . unfortunately think expansion symmetrical, i.e. if add space @ bottom (i.e. in middle, add @ top (i.e. outside): ggplot(diamonds, aes(clarity, fill= cut)) + geom_bar() + coord_polar(expand=true) + scale_y_continuous(expand=c(0.5, 0))

android - Why my OpenGL sphere looks like a ellipse -

Image
i created 1 sphere using opengl es20 in android. in perspective projection env, animate sphere [-1.5, -2, -2] [-1.5, 2, -2] . problem that, sphere looks ellipse when reach frustum boundary. indeed, circle when @ [0, 0, -2], more away [0,0], more looks ellipse. is standard behavior ? thought, 1 sphere should circle in angles of view. please ? you should lessen field of view; show normal , side effect of artificial nature of 3d projection — 3d projection assumes viewer sitting fixed distance screen , eyes positioned along z directly centre of screen looking forwards. check out related problems described here description of same effect real camera. quite implicit default field of view ninety degrees. when hold phone in hand occupies less ninety degrees of vision. if you're using glfrustum try specifying lesser values left, right, top , bottom. quick fix, throw glscalef by, say, 2.0 onto projection stack (or es 2 equivalent) after computing projection matrix.

directory - linux readdir - Are the entries "." and ".." always read first? -

possible duplicate: does readdir() guarantee order? i'm guessing isn't case, , i'd need manually check name of each entry instead of skipping first couple. correct? the posix standard not guarantee order of directory entries whatsoever. such, if you're interested in filtering out . , .. , need compare them.

vb.net - Changing the backcolor of a button -

i have problem changing color of button (in vb.net). have searched web , plenty of people willing tell me how change color problem - doesn't. doesn't, when has finished rest of code in sub. can furnish me explanation please why doesn't happen when ask? i'm using visual studio 2008 after changing colour call application.doevents() this gives gui chance update.

c# - Complete a workflow from within an activity -

is possible complete workflow within custom activity? i'm trying create work flow several if statements , i'd work flow complete after first 1 if condition met or else pass on next statement etc. have several checks planning on creating custom activity handle me rather adding several decision on work flow feel make workflow complex. if create activity derived nativeactivity can control scheduling of child activities. in essenence creating own control flow activity. need create designer isn't difficult.

Scala Syntax Highlighting in Eclipse -

i'm using eclipse & scala plugin write scala code. editor seems have limited syntax highlighting options - example change formatting of variables (i them blue) , method defs. i know there few other highlighter plugins out there eclipsescolorer, seem lose features of scala (or other langauges) editor auto complete , suggestions. is there plugin or way can modify scala plugin finer control on scala syntax coloring/formatting options? some of being worked on. nightly build page has 'semantic highlighting' (making variables blue etc) marked 'coming soon. also current roadmap may when released version on eclipse-scala ide. (as 'coming soon' date dependent 'today' 10/march/12 )

shell - an ONLINE COMPILE app using NODE.JS? -

assume want online compile web app based on node.js that: user can upload code (cpp example) the server compile , , response result (succeed or not) user give input program (stdin) the server run program , response result (stdout) so means interacting system, or shell; run programs on server, result; which module(s) support these function? is there example thing? such tool exist.... codepad hope did me while practicing c interviews :>

github - RubyMine project directory disappears after git pull -

my coworker , started working on same project using github , rubymine. our original sin push .idea folder (created , updated automatically rubymine) in local repository github. folder creates conflict co-worker's local repository every time pulls remote. to fix issue, have delete .idea folder remote repository. now, master branch, pull remote repository, , seems .idea files removed (i not sure). therefore, rubymine won't let me see project folders (i.e., app, config, public) in project view, though these folders still there. my question is: how can restore original setting in rubymine can see project folders? the files .idea folder should not push workspace.xml , tasks.xml. first should untrack files with: git rm --cached .idea/workspace.xml git rm --cached .idea/tasks.xml next add them .gitignore: .idea/workspace.xml .idea/tasks.xml now remove .idea folder , reopen project folder rubymine.

char - Scanning in more than one word in C -

i trying make program needs scans in more 1 word, , not know how unspecified length. first port of call scanf, scans in 1 word (i know can scanf("%d %s",temp,temporary);, not know how many words needs), looked around , found fgets. 1 issue cannot find how make move next code, eg scanf("%99s",temp); printf("\n%s",temp); if (strcmp(temp,"edit") == 0) { editloader(); } would run editloader(), while: fgets(temp,99,stdin); while(fgets(temporary,sizeof(temporary),stdin)) { sprintf(temp,"%s\n%s",temp,temporary); } if (strcmp(temp,"hi there")==0) { editloader(); } will not move onto strcmp() code, , stick on original loop. should instead? i scan in each loop word scanf() , copy strcpy() in "main" string.

c++ - Undefined reference for a static QStringList -

so, want create "recent files" section in "file menu" of spreadsheet application. while building application, function supposed update recentfileactions qstringlist generates following error /home/axel/qtsdk/code/qmainwindow/mainwindow.cpp:-1: error: undefined reference 'mainwindow::recentfiles' so error recentfiles isn't defined? because have in private section of header: qstringlist static recentfiles; this whole updaterecentfileactions() function: void mainwindow::updaterecentfileactions(){ qmutablestringlistiterator i(recentfiles); while (i.hasnext()) { if (!qfile::exists(i.next())) i.remove(); } (int j = 0; j < maxrecentfiles; ++j) { if (j < recentfiles.count()) { qstring text = tr("&%1 %2") .arg(j + 1) .arg(strippedname(recentfiles[j])); recentfileactions[j]->settext(text); recentfileactions[j]->setdata(recentfiles[j]); recentfileactions[j

c++ - 2D Group Collision Detection -

i'm trying implement collision detection in game, seemed easy @ first has mutated monster can't quite tackle without help. the game rts @ point, right it's bunch of units can told move particular location on screen. but, units keep disappearing 1 unit, defined bounding boxes each unit , tested collision between units after moving them in game loop separate them. that didn't work because had not implemented way of knowing particular unit shifting not take other unit's place (which had iterated through). i tried maintain positions (or regions) occupied shift there no units. not work in cases, such when unit shifted in of 4 corners of screen, can't go beyond screen's bounds , cannot occupy regions occupied units colliding with. i'm still pretty sure i'm overly complicating can done different approach. each unit has it's own bounding sphere, position, direction vector , velocity vector. class unit { friend class party; protect

.net - "Add Service Reference" Generates No Proxy Methods -

i want connect web service, http://aye.comp.nus.edu.sg/parscit/wing.nus.wsdl so clicked add service reference , pointed path, can't figure out how invoke service. reference.cs class contains this: //------------------------------------------------------------------------------ // <auto-generated> // code generated tool. // runtime version:4.0.30319.261 // // changes file may cause incorrect behavior , lost if // code regenerated. // </auto-generated> //------------------------------------------------------------------------------ so think didn't generate methods. should try? i looking @ through mobile phone, maybe problem, wsdl doesn't not contain method definitions. why not seeing methods...there none.

javascript - What do I need to do to get my callback function to run before other things? -

so in js file have this: if(players[i].src.indexof("http:\/\/vimeo.com/moogaloop") == 0){ var videoid = players[i].src.split("clip_id=")[1].substring(0, 8); var callback = 'getthumb'; var jsonurl = 'http://vimeo.com/api/v2/video/' + videoid + '.json?callback=' + callback; var js = document.createelement('script'); js.setattribute('type', 'text/javascript'); js.setattribute('src', jsonurl); document.getelementsbytagname('head').item(0).appendchild(js); var thumb; function getthumb(video) { thumb = video[0].thumbnail_medium; } the purpose thumbnail of vimeo video. problem having runs through , stuff after , runs function. issue need thumbnail stuff after it, tries undefined variable. works otherwise, meaning if ran in order wanted to, work fine. you should put code needs run after code in callback in callback, rather merely after in file.

algorithm - wilson score interval possible results range -

this question wilson score confidence interval (see here explanation). i not completly understand scoring equation: equaltion http://www.evanmiller.org/rating-equation.png but.. need know range of possible results. i need give 1 out of 3 medals user accordig rate. (i have recipes created users, can "like" on them, , accordingly calculate rate of recipe. user rate calculated according recipes rates.) thanks yoav the equation returning bounds on probability, range should greater or equal 0 , less or equal 1.

air - how do I do a multiply effect in adobe flash builder for a button? -

in adobe photoshop or illustrator, can effect called multiply on layer. is there way me same thing button in adobe flash builder? use blendmode property of button. allow set variety of filters including multiply, overlay, screen etc. for full list see adobe's section on applying blend modes

mysql - How to update DB records using a dynamically generated link -

i have requirement generate email administrator whenever user sign up. administrator approve registration clicking on link provided in email , database should updated, without admin login administrator console. i looking best practice code scenario keeping application security intact. can generate email dynamic rendom value attached link(provided in email) url, not sure how keep track of on application side? any thoughts? you generate random validation number when user signs up, , store in database user record. generate email link such http://foo.bar.com/approveuser.action?userid=<theuserid>&validationtoken=<therandomnumber> when approveuser action invoked, check if validation token stored in database given user id matches token sent parameter, , if so, approve user.

How to integrate socket camera in android zxing library -

i have created project zxing library , integrate webcam in emulator, i've followed these instructions a java application webcambroadcaster working , when run it, starts webcam , shows video captured. but don't know how can integrate socketcamera in zxing library i'm new android, can this?

c# - How to setup syntax highlighting for interfaces and delegates in Visual Studio 11 Beta? -

Image
in vs2010 types has been highlighted, looks this: works me... (that's using vs11 beta, professional edition.) look in tools / options / fonts , colors , find "user types (interfaces)" , "user types (delegate)". both should default teal. if they're not, try changing them explicitly - or hit "use defaults" button reset all fonts , colors defaults.

java - How to pass `this` to Dozer field mapping? -

in app have dozer mapping looks this: <mapping> <class-a>java.util.hashmap</class-a> <class-b>org.mycompany.targetclass</class-b> <field custom-converter="org.example.myconverter"> <a>this</a> <b>anotherfield</b> </field> </mapping> myconverter instance of configurablecustomconverter : public class myconverter implements configurablecustomconverter { private string parameter; @override public object convert( object existingdestinationfieldvalue, object sourcefieldvalue, class<?> destinationclass, class<?> sourceclass) { // sourceclass java.lang.object , // sourcefieldvalue null!!! } @override public void setparameter(string parameter) { this.parameter = parameter; } } why things noted in in-source comment happen? you need tell dozer key of

javascript - PHP / Ajax cannot send value -

i have problem ajax , php.i have next code $("form").submit(function() { var poruka = $("#poruka").val(); $.ajax({ type: "get", url: "/ajax/gather/send/"+ poruka + "/'.$id.'", success: function(){ loaduj('.$id.'); alert("your message "+poruka); }, error: function(){ alert("fail"); } }); }); "poruka" message , it's taken form <form action='javascript:;'> <input type='text' name='poruka' id='poruka' placeholder='poruka..' style='width:100%;'> <input type='button' name='button' hidden> </form> and when try send php won't insert database : php code : $text = $_post['text']; $id = $_post['id']; if($text != ""){ mysql_query("insert messages (text,id2) values ('$text&#

scala - How to handle optional query parameters in Play framework -

lets have functioning play 2.0 framework based application in scala serves url such as: http://localhost:9000/birthdays which responds listing of known birthdays i want enhance adding ability restrict results optional "from" (date) , "to" request params such as http://localhost:9000/birthdays?from=20120131&to=20120229 (dates here interpreted yyyymmdd) my question how handle request param binding , interpretation in play 2.0 scala, given both of these params should optional. should these parameters somehow expressed in "routes" specification? alternatively, should responding controller method pick apart params request object somehow? there way this? encode optional parameters option[string] (or option[java.util.date] , you’ll have implement own querystringbindable[date] ): def birthdays(from: option[string], to: option[string]) = action { // … } and declare following route: get /birthday controllers.applicatio

Can I call the android contact picker and force it to start using portrait orientation? -

i know how force orientation on activities (using xml layout or programatically). but can force contact picker start in portrait mode? i call contactpicker using following code: intent intent = new intent(intent.action_pick, contactscontract.contacts.content_uri); startactivityforresult(intent, contact_picker_req_code); but can force contact picker start in portrait mode? no. developer of app handle portrait versus landscape how developer wanted handled.

orm - Override behaviors in Entity Framework -

we have data model has requirements. find way make these requirements transparent possible while using ef. first, model must support soft-delete. i've seen questions around , think relatively straight forward. second, have "insert only" policy. means no updates. when update made, new entry must inserted instead. able treat operation update, , have framework change insert behind scenes. third, due #2 when query, need order descending on identity column , return first record only. when doing query returns many records. essentially, creates version history. fourth, don't want have implement logic in each query. nice have framework can treat each query if normal crud type transaction. has implemented such data model in ef? techniques did use? i'm aware of can done in views and/or sprocs, if use views have maintain relationships manually (ef can't read relationships through views). triggers possibility, our dba's want few triggers pos

php - Is it possible to do Double mod_rewrite? -

so build simple mvc app because want learn new stuff. everething thing work need change url in .httacces <ifmodule mod_rewrite.c> rewriteengine on rewritebase /mymvc/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?%{query_string} [ne,l] rewriterule .* - [e=http_authorization:%{http:authorization},l] </ifmodule> and url http://mysite/mymvc/about were controller,but if move in root be http://mysite/about but don't want .. want http://mysite/page:about now problem use explode('/',$path) $path = $_server['request_uri']; because folder use second array , if change http://mysite/page:about there no / .. i have seen people use prefix of file name let : page_about.php so url http://mysite/mymvc/page/about but still ugly .. tips instead of using explode try: preg_split("/:|\//", $path); this explode either : or / .

php - How I can uploads text files with HTML 5? -

i have following problem. use tutorial creating multiple file uploader: http://tutorialzine.com/2011/09/html5-file-upload-jquery-php/ but code uploding images. want code upload text files, not images. there possibility happen. in file script.js changed type of file code, don't work. // called before each upload started beforeeach: function(file){ if(!value.match(/\.(txt)|(csv)$/)){ alert('only txt , csv files!'); // returning false cause // file rejected return false; } }, the error message after uploadied files "your browser not support html5 file uploads!" changes should make work correctly? in advace ! http://www.script-tutorials.com/pure-html5-file-upload/

video - How to debug BlackBerry devices on Mac using the filesystem? -

how go debugging blackberry apps utilise (blackberry's) filesystem on mac? i'm recording video , detecting when video file appears on file system, due restrictions: the blackberry file system auto-mounted when plugged mac the app cannot access filesystem when mounted these 2 things have made debugging app when uses filesystem.. impossible! receive file system error 1003 according results google mean it's mounted , don't have access. is there a simple way round this? i receive 63 signing emails rim. woe me the workaround bit cumbersome, should work you. implement eventlogger instance in application. log necessary info via eventlogger compile , run app on detached device computer. inspect log (press ctrl , hit lglg on device keyboard). additional option - automatically export log text file stored in device filesystem (media card) review on computer.

c++ - Will this code free memory allocated for MULTIMAP? -

i have multimap , pointer multimap . have multimap typedef multimap<class1, class2*> lo_index; . have lo_index * _index; points multimap. free memory spaces allocated maop performing following operation . have reset function following free memory space alocated multimap : ( lo_index ::iterator = _index->begin(); != _index->end(); i++ ) delete (*i).second; // delete entries in index _index->erase( _index->begin(), _index->end() ); what have read in case of set setname.clear() doesnot free allocated space . in http://www.cplusplus.com/reference/stl/multimap/erase/ found erase that this reduces container size number of elements removed, calling each element's destructor. so guess free allocated spaces. want confirm whether code written in reset function freeing memory or not. for multimap, delete (*i).second can't compile because can delete objects via pointer , int not pointer. about erase function: f