Posts

Showing posts from January, 2012

javascript - jquery get value of element's grandchild -

i'm trying grab value of input or select (selecting based on grandparent's id), , test if has been set/answered/responded to. <ul id="foo"> <li>happy text</li> <li><input name="a" type="text" /></li> <li><input name="a" type="radio" value="01" />blah</li> <li><input name="a" type="radio" value="02" />blah</li> </ul> <ul id="bar"> <li>happy text</li> <li><input name="b" type="text" /></li> <li><input name="b" type="radio" value="01" />blah</li> <li><input name="b" type="radio" value="02" />blah</li> </ul> <ul id="baz"> <li>happy text</li> <li> <select nam

c# - Creating New layers in SHARPMAP -

i'm working on sharpmaps, have map of , how add new layers on maps ? as need write name of state on basic layer , color each state different colours. possible achive goal in sharpmaps...? you must use "custom them" color each state , "label layer" name of state you must first 1 delegate method define.the delegate takes featuredatarow parameter , can handle custom style for example private sharpmap.styles.vectorstyle getcountrystyle(sharpmap.data.featuredatarow row) { sharpmap.styles.vectorstyle style = new sharpmap.styles.vectorstyle(); switch (row["name"].tostring().tolower()) { case "denmark": //if country name danmark, fill green style.fill = brushes.green; return style; case "united states": //if country name usa, fill blue , add red outline style.fill = brushes.blue; style.outline = pens.red; return style; case

git svn - How do I remove a working copy created via git-new-workdir without hosing the original repo? -

i'm using git-new-workdir script present in contrib section of git's codebase: https://github.com/git/git/tree/master/contrib/workdir work multiple branches of same code base simultaneously. on windows, using msysgit , repo git svn repo , not pure git. have no problem creating working copies using command saying: git-new-workdir original-working-copy new-working-copy branch-name-to-checkout but when i'm no longer interested in branch , want rid of working copy, doing rm -rfr new-working-copy hoses original-working-copy. in hind sight, kinda obvious, given git-new-workdir uses hard links share same .git repo between multiple working copies. what way clean working copies created way, no longer want on machine? on normal unix systems, git-new-workdir uses symlinks share original repo, , can rm -rf new-working-copy delete new workdir , fine. i have no idea might different msysgit change this. turns out, noted in comments, issue rm on windows use

flash - Is using a global user variable a bad practice? -

i need have access logged in user troughout flash application. therefor i'm concidering making 'user' variable global. i try avoid global variables, seems quite suitable in case , i'm not first concider active user global. know systems drupal uses global variable logged in user. i want know if stackoverflow thinks of bad practice or if there better alternatives. if use global variable, creating dependency on variable in modules use it. so, example, if wanted reuse of modules in project, need take use of global variable account. having said that, don't particularly find bad design have global variable user-id. if wanted reuse of modules use it, want deal users anyways, , have global variable in new application too. there dependency-injection frameworks solve you. whether add value specific project or not depends on many other considerations, , you.

batch file - HSQLDB issue: Starting the HSQL database from Java Code -

when have run hsqldb application have command prompt, double-click server.bat (batch file) start server contain: java -classpath ..\war\web-inf\lib\hsqldb.jar org.hsqldb.server -database test or type start server command command prompt. but, question can start hsql database server coding in java code directly, no need start separately java application? code? note using spring 2.5, spring seecurity 2.0.4 (annotation disable). thank you. what https://javajazzle.wordpress.com/2011/06/23/embedded-database-in-java-use-of-hsqldb/

Is it possible to send a file from the client computer on a perl web application without uploading it to the server first? -

i've looked around internet without getting answer far, here's issue: i have perl web application used small group of people (accessed web browser on windows computers, around 100 users) , on intranet (this application on redhat apache server) , application gets user's inputs , uses www::mechanize send page on (a different server, shouldn't used directly), process form , return result (i know may not sound optimal, done according required), issue here need users able send file (most image of ~500kb, either through www::mechanize along other form data gets submitted, or email attachment, either option equally acceptable), , know file can sent/attached if it's on server, question simple: is possible send file client computer (running perl web application on browser) without uploading server (that send it) first? p.s. not 1 of "give me code" questions, i'm not asking specific code, want know if done (and if have idea how), or if absolutely ha

JSTL stringFormat...set to a VAR? -

hello have this: <c:when test='${results.fieldnames[rowstatus.index] == "nsn"}'> <fmt:formatnumber value="${cell}" pattern="${commas_with_no_decimal_pattern}" var="tarr"/> </c:when> where im setting formatted # var="tarr" . want use string formatter , set var="tarr" . know how set this: <ctl:stringformat format="@@@@-@@-@@@-@@@@">${dispval}</ctl:stringformat> how can set formatted string var? had set var property in ctl:stringformat tld

xml - XPath to find an element whose attribute contains a text, case-insensitively? -

<root> // other nodes <a href="/patternframework/pages/logout.aspx?np=/sites/novatestsite/home.aspx" slick-uniqueid="92">sign out</a> </root> how write xpath returns a tag href contains "logout.aspx"? for instance //a[@href[contains[., "logout.aspx"]] case-sensitive: //a[contains(@href,'logout.aspx')] case-insensitive xpath 2.0: //a[contains(lower-case(@href),'logout.aspx')] case-insensitive xpath 1.0: //a[contains(translate(@href, 'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz'),'logout.aspx')]

android - mobile flex application Basic UI tutorials need -

i want develop flex based android application-- i don't know basic ui components , layouts please 1 give me links beginner tutorials of mobile flex app development i want detail tutorials build ui components if need code examples both mobile , desktop development, best can find beginners tour de flex : http://flex.org/tour/ that , google :) imho, should post questions here if have real problem in development, not tutorial requests. hope helps.

String.split(pattern) throws exception due to { in pattern: java.util.regex.PatternSyntaxException -

i have string in java. here part of i'm concerned {3: {108:tr2011052300088}} later on split on {3: {108: . reason (i've been googling) { , } special character has escaped \} , \{ (clearly doesn't work -> compile time error). others mention bug in java regex. i'm not sure really. exception is: exception in thread "main" java.util.regex.patternsyntaxexception: unclosed counted closure near index 2 {3:{108: @ java.util.regex.pattern.error(unknown source) long story short, code splits string using {3: {108: separator , crashes on it: string query="{3: {108:"; string [] messageparts = message.split(query); i aware of other ways it, albeit more complicated, writing own parser , such. how can string split , not have crash? edit: answer comments: - double slashes don't help: \\{ give \{3:\{108:mamabearid123}} since 2 slashes become 1 - escaping 1 slash won't compile: invalid escape sequence examp

How to find the soapAction with JQuery -

can me jquery? i want find soapaction of element operation name login in following xml (i tried method find didn't have success): <wsdl:definitions name="authenticationservice" targetnamespace="urn:zeitag.ch.tms.authenticationservice:v1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="urn:zeitag.ch.tms.authenticationservice:v1" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/

wpf - XAML sizes not accurate -

from understanding, wpf allows designer set size of (in case rectangle) , displayed on screen size user. example, square should display on screen 1 inch. see frameworkelement.width property on msdn . <rectangle width="1 in" height="1 in" fill="{staticresource st}" /> <drawingbrush alignmentx="left" alignmenty="top"> <drawinggroup x:key="snellent"> <drawinggroup.children> <geometrydrawing brush="black" geometry="f1 m0,0 3,0 1.5,1.5 90 0 1 3,3 h2 l2,4 3,4 3,5 0,5 0,4 1,4 1,1 0,1 m5,5 " /> <geometrydrawing brush="black" geometry="f1 m0,0 5,0 5,5 0,5 0,0" /> </....> --close tags on particular machine (win 7, 24 in monitor, 1920 x 1080 resolution) square larger 1 inch; 1 1/16 inches. (a 3 inch rectangle 3 1/8 inches.) if change resolution on monitor 1o 1280x720, 1 inch rect

Java Rest sending data -

can please me sending data (mp3, wav etc.) using rest service? dont know mime type should use in service method declaration. i have this: > @path("/echo") public class myservice{ @get @produces("text/html") public string get(@context uriinfo ui) { multivaluedmap queryparams=ui.getqueryparameters(); return "tyleczek"; } @post @consumes("application/x-www-form-urlencoded") @produces("text/html") public string post(multivaluedmap queryparams) { return showqueryparams(queryparams); } } i triend sending byte code didnt work. can please me? thank in advance. usually binary content transferred after being encoded in base64. check commons-codec base64 ready-to-use implementation

c# - How to sign a ClickOnce application -

i have clickonce application built client, , need trusted publisher. how go acquiring authenticode certificate , sign application it? when application launched, it's trusted publisher? how install certificate? have install on development server or matter install it? how whole process work? don't want spend 3-5 hundred dollars on certificate, , install wrong , out of luck. are there tutorials on purchasing , installing certificate , signing clickonce application? i went through process. certificate not expensive - got code-signing certificate http://startssl.com - , $100 or in total (and wild-card domain certificate website well). after have certificate, follow faq howto: code signing how-to * sign code (binaries). after that, have go project properties -> signing , upload certificate there (it's clickonce). can skip code signing though , sign clickonce only. clickonce requires certificate code signing, , others not work, see clickonce deploym

c# - Limiting DataGridView cell multi selection to only column or row -

Image
i have datagridview number of columns , rows. have mutliselect enabled, allows selection of cells. i want limit selection vertically, horizontally, full row or full column, never mix of both. user can select dragging starting @ cell either vertically or horizontally. here's small diagram clarify if helps @ all. here's brute force method - when selection changes, de-select cells fall outside current row/column selection: int _selectedrow = -1; int _selectedcolumn = -1; private void datagridview1_selectionchanged(object sender, eventargs e) { switch (datagridview1.selectedcells.count) { case 0: // store no current selection _selectedrow = -1; _selectedcolumn = -1; return; case 1: // store starting point multi-select _selectedrow = datagridview1.selectedcells[0].rowindex; _selectedcolumn = datagridview1.selectedcells[0].columnindex; return;

api - Restricting Django-Rest-Framework default CRUD operations to only GET and restricting POST, PUT and DELETE -

i using django-rest-framework. while following along tutorial able make crud apis defining modelresource. now, want limit access providing apis , not provide access post, put or delete. tried allowed_methods = ('get') but doesn't anything. also, tried override delete function of modelresource doesn't either , delete still works. seems straight forward thing, havent been able figure out after spending couple of hours on it. just saw this. have small error in code. instead of: allowed_methods = ('get') write allowed_methods = ('get',) note trailing comma, make python treat list 1 string instead of list 3 characters. due fact python treats string list of characters, first row evaluates list ('g','e','t') , none of methods available on class.

Breakpoint Convergence in Fortune's Algorithm -

i implementing fortune's sweepline algorithm computing voronoi diagrams. primary reference "computational geometry: algorithms , applications" de berg et al., , while coverage of topic clear, pass on several small important details have been having trouble working out myself. i've searched web help, other websites either give higher overview textbook, or give exact same pseudocode provided book. i need way determine whether pair of breakpoints determined triple of arcs on beach line converges or diverges, in order detect upcoming circle events. seems make decision need knowledge shape of voronoi cell edges breakpoints trace out fortune's algorithm progresses. example, if find slope of edge traced breakpoint calculate 2 lines formed breakpoints , respective slopes intersect, , decide whether converge based on result. however, have no idea how information on slopes, current position of breakpoints. the information have work x,y location of 3 sites , current

ios - Any way to make "Validate Project Settings" warning go away in Xcode 4.3/4.3.1? -

Image
has been able make validate project settings / update recommended settings warning go away in xcode since 4.3? it wants make changes don't want accept. i've tried both "don't perform changes" , unchecking changes don't want , "perform changes" warning refuses go away. in past 1 or other of has made go away. xcode has up'd project format verison in project file 4.3 value, i.e., lastupgradecheck = 0430 but still seems continue check. rdar://11008193 (closed duplicate of 10944711) try editing schemes project. product > edit scheme. go each scheme associated project , explicitly set values want. fixed me.

c# - Access Controls from UserControls in ASPX page -

how access controls usercontrols in aspx page? example: want access gridview in usercontrol on aspx page. please me. try : gridview gridview1 = (gridview)webusercontrol1.findcontrol("gridview1"); where webusercontrol1 id of use control on .aspx page. hope helps..

php - How to sanitize $_REQUEST without mysql_real_escape_sequence() -

i have been using php/mysql while now, want sanitize super globals on start of program havent connected database yet. there other php defined function make variables sql safe. , can tell me why active mysql connection required before using mysql_real_escapce_string i want sanitize super globals on start of program. that isn't best idea. should sanitise variables based on context. if run of variables through mysql_real_escape_string() , may find have issues when want use variable outside of sql context. is there other php defined function make variables sql safe? you use bound parameters library such pdo . can tell me why active mysql connection required before using mysql_real_escape_string() ? i believe because function needs know character set database using can escape correctly.

c# - protected access modifiers in .net -

Image
this question has answer here: why can't access c# protected members except this? 6 answers i created application depicting protected access modifiers, using sample provided on msdn site, seems error prone, below code using: and below sample msdn site: your accessmodifierscsharp class main defined not inherit class1 , has no access protected members. you can access method1 class2 inherit class1 . the difference between code , msdn code class b contains main inherits directly a .

sql - Why select Top clause could lead to long time cost -

the following query takes forever finish. if remove top 10 clause, finishs rather quickly. big_table_1 , big_table_2 2 tables 10^5 records. i used believe top clause reduce time cost, it's apparently not here. why??? select top 10 servicerequestid ( (select * big_table_1 big_table_1.statusid=2 ) cap1 inner join big_table_2 cap2 on cap1.servicerequestid = cap2.customerreferencenumber ) there other stackoverflow discussions on same topic (links @ bottom). noted in comments above might have indexes , optimizer getting confused , using wrong one. my first thought doing select top serviceid (select *....) , optimizer may have difficulty pushing query down inner queries , making using of index. consider rewriting as select top 10 servicerequestid big_table_1 inner join big_table_2 cap2 on cap1.servicerequestid = cap2.customerreferencenumber , big_table_1.statusid = 2 in query, database trying merge results , return the

how persistent order of udp packets in lan? -

generally udp doesn't garantee packets arrive in same order sent. in 1 lan if sender , receiver connected via 1 switch , route never changes possible @ order of udp packets changed? in particular can order of udp packets change somewhere between network card , application? in network card drivers example? can if 2 computers connected via on switch in 100% of cases order of udp packets unchanged? they arrive in order in test setup, relying on fact really bad idea. add sequence number packets or use tcp if appropiate.

jQuery Mobile: Dynamic content not loading when I return to a page -

my data getmovies.php working correctly , loading #moviespage first time load page. however, if navigate away #moviespage , return content not reload. header , footer appear , can see unpopulated <ul> there, not of dynamically loaded <li>s . my code below. any thoughts on how can dynamic data load when return page? $( '#moviespage' ).live( 'pagebeforecreate',function(event){ getmovieslist(); }); function getmovieslist() { $.getjson(serviceurl + 'getmovies.php', function(data) { $('#movieslist li').remove(); movies = data.items; $.each(movies, function(index, movie) { $('#movieslist').append('<li>' + '<img src="posters' + movie.poster + '"/>' + '<div class="movie-toprow"><h4>' + movie.title + '</h4>' + '</li>').listview('refresh'); }); }); } i'm using jque

Writing line to a file using C -

i'm doing this: file *fout; fout = fopen("fileout.txt", "w"); char line[255]; ... strcat(line, "\n"); fputs(line, fout); but find when open file in text editor line 1 line 2 if remove strcat(line, "\n"); get. line 1line2 how fout be line 1 line 2 the puts() function appends newline string given write stdout ; fputs() function not that. since you've not shown code, can hypothesize you've done. but: strcpy(line, "line1"); fputs(line, fout); putc('\n', fout); strcpy(line, "line2\n"); fputs(line, fout); would produce result require, in 2 different ways each used twice achieve consistency (and code should consistent — leave 'elegant variation' literature writing, not programming). in comment, say: i'm looping through file encrypting each line , writing line new file. oh boy! base-64 encoding encrypted data? if not, then: you must include b in fop

C++ read binary file and convert to hex -

i'm having problems reading binary file , converting it's bytes hex representation. what i've tried far: ifstream::pos_type size; char * memblock; ifstream file (toread, ios::in|ios::binary|ios::ate); if (file.is_open()) { size = file.tellg(); memblock = new char [size]; file.seekg (0, ios::beg); file.read (memblock, size); file.close(); cout << "the complete file content in memory" << endl; std::string tohexed = tohex(memblock, true); std::cout << tohexed << std::endl; } converting hex: string tohex(const string& s, bool upper_case) { ostringstream ret; (string::size_type = 0; < s.length(); ++i) ret << std::hex << std::setfill('0') << std::setw(2) << (upper_case ? std::uppercase : std::nouppercase) << (int)s[i]; return ret.str(); } result: 53514c69746520666f726d61742033 . when open original file hex editor, shows: 5

android - Positioning a Custom TableView in a RelativeLayout -

in main activity have relativelayout dynamically adding custom class called icontray extends tablelayout seen below. icontray takes arraylist , builds table. after table built , imageviews have been placed, want position table center screen. question is, how position icontray , do main activity or in itself. my mainactivity: import java.util.arraylist; import android.app.activity; import android.content.context; import android.content.dialoginterface; import android.content.dialoginterface.onclicklistener; import android.graphics.point; import android.os.bundle; import android.util.attributeset; import android.util.displaymetrics; import android.util.log; import android.view.display; import android.view.view; import android.view.view.onlongclicklistener; import android.widget.relativelayout; import android.widget.toast; public class homefavesactivity extends activity implements onclicklistener, onlongclicklistener{ private static final string tag = "homefavescato

linux - Python - import json returning module not found -

i new whole python deal, , admit half lost - don't know whether coming or going. so, here's question , hope can assist me. i running redhat system , default, has python 2.4 installed. have python script gives me error when attempting import json. i have checked phpinfo , shows have json version 1.2.1 (or or other) - why isn't python recognizing json exist? there file need edit manually enter or edit python looks json at, , if so, where? i tried installing simplejson , python 3 - nothing has worked far, , have run out of hair pull out. any appreciated - in advance. php not python , fact php version supports json has no effect on python installation. json module introduced in python 2.6 . you try install simplejson , according documentation, supported since python 2.5. (should have read whole question) . i upgrade python version (most recent version 2.7.2). don't why installation of python 3 didn't work, maybe staying same branch (i.e. 2.7)

How do I use cURL to perform multiple simultaneous requests? -

i'd use curl test flood handling on server. right i'm using on windows command line: curl www.example.com which get page once. i'd same thing, except instead of 1 request, want generate @ least 10 requests @ once. how this? while curl useful , flexible tool, isn't intended type of use. there other tools available let make multiple concurrent requests same url. ab simple yet effective tool of type, works web server (despite introduction focusing on apache server). grinder more sophisticated tool, can let specify many different urls use in load test. lets mix requests cheap , expensive pages, may more closely resemble standard load website.

ios - SQLite select query. Get row with array -

i coder ios , use sqlite data storage. for have 2 tables in database. table_1 , table_2 (it's easier understanding) about struct: table_1 contain id field (int type) , some_value field (text type) table_2 contain id field (int type) , table_1_id field (int type) my question next: how select row table_1 via array table_1_id field table_2, , must select order by. mean order array. for example: if table_2 -> table_1_id contain value 5, 1, 10, 3, 15, 2 the result of output must in order. for query simple: select * table_1 id in (5, 1, 10, 3, 15, 2) but select not return order query return data order 1, 2, 3, 5, 10, 15. i think make relation between table , make select table_2 uses order by, don't know how correct. thanks in advance! (very important me return order - 5, 1, 10, 3, 15, 2) i find result in stackoverflow link this work me: select * "comments" ("comments"."id" in (1,3,2,4)) orde

Adding defaults to column headers in django -

i have script imports data in tables other websites. tables between 5 , 15 columns wide , arbitrarily long. after i've got raw data want opportunity make sure guesses column headers correct. want have @ top list of 15 things column called. way can correct poor decisions made automatic code. so auto code generates 2 arrays, first of strings: possible_headers = ["one", "two", "three"...] second of indexes first array likely_headers = [2, 0, 5...] (the columns headers "three" "one" "six") and use them in template: {% likely_head in likely_headers %} <th> <select name="colheader"> {% poss_head in possible_headers %} {% if forloop.counter0 == likely_headers.forloop.parentloop.counter0 %} <option value="col:{{forloop.counter0}}" selected>{{poss_head}}</option> {% else %} <option value="col:{{forloop.counter0}}">{{poss_head}}<

php - mysql table name with '@' -

one of database table columns have name 'name@from' how can write select query values name@from columns this query gave me error select `name@from` tabname wrap `` around column name :)

c# 4.0 - Send/wait/receive data from CLI app through C# GUI app on VS 2010 -

i have .exe when opened looks this: enter a: (waits input a) enter b: (wait input b once entered) doing calculations.. almost done.. the sum of + b 10 press enter exit.. i've written code based on other examples on stackoverflow (c# gui app on vs 2010): processstartinfo cmdstartinfo = new processstartinfo(); cmdstartinfo.filename = @"c:\mytestservice.exe"; cmdstartinfo.redirectstandardoutput = true; cmdstartinfo.redirectstandarderror = true; cmdstartinfo.redirectstandardinput = true; cmdstartinfo.useshellexecute = false; cmdstartinfo.createnowindow = false; process cmdprocess = new process(); cmdprocess.startinfo = cmdstartinfo; cmdprocess.errordatareceived += cmd_error; cmdprocess.outputdatareceived += cmd_datareceived; cmdprocess.enableraisingevents = true; cmdprocess.start(); cmdprocess.beginoutputreadline(); cmdprocess.beginerrorre

orm - Which metadata definition format to use with doctrine 2 and symfony 2 -

i'm starting use symfony 2 after time using symfony 1.4. know metadata format easiest , fastest learn , use. i know people clean hands when comes better other thing, specially when things supposed equivalent. nevertheless, i'm asking make recommendation considering folowing: i have experience symfony 1.4, using yaml format the amount of documentation each format. any other thing may consider i'm not xd i use yaml configuration files, ... doctrine metadatas. use xml because refer xsd know kind of node can use... for once, xml looks more readable cause each field takes 1 line defined. generally, yaml makes break line each field-node's attribute. edit: after 2 years practicing symfony2, use annotations everywhere doctrine metadata, validation rules. use yaml translations.

osx - mac toolbar style -

does know how make toolbar style top bar of "xcode organizer"? press different item ,different view show down below. has toolbar style tab bar function,many mac apps' preference pane use it,i'm confused. can me please. thank much. plus mac application start documentation nstoolbar . there sample applications started with. good overview making better preferences window - see link demo project on second page of article.

Netbeans reloads no class when "Apply Code Changes" in a maven project with remote jpda debugging -

so have maven project produces jar package containing ant tasks. when run ant build script somewhere else jpda open, , debug tasks, mytask netbeans, apple code changes button doesn't work. here output of netbeans console: cd /trunks/tasks; java_home=/opt/jdk /opt/netbeans-7.0/java/maven/bin/mvn -djpda.stopclass=com.abc.ant.mytask compile scanning projects... ------------------------------------------------------------------------ building tasks 1.0-snapshot ------------------------------------------------------------------------ [resources:resources] using 'utf-8' encoding copy filtered resources. copying 1 resource com/abc/ant [compiler:compile] compiling 1 source file /trunks/tasks/build/classes ------------------------------------------------------------------------ build success ------------------------------------------------------------------------ total time: 1.548s finished at: fri mar 09 17:45:24 cst 2012 final memory: 11m/149m --------------------------

page now found error each and every time in wordpress -

i got problem of not find page , category in wordpress. have complete working site in local on server not able open page. end when "view" page alos did not able see page. cause problem like: `this embarrassing, isn’t it? it seems can’t find you’re looking for. perhaps searching, or 1 of links below, can help.` same error got when see "hello world" post backend. dont know happen. thanks in advance you need check your .htaccess file , enable mod_rewrite in apache2 .

Integrate ruby application within rails app? -

im in need of integrating cramp ( web sockets based chat app ) existing rails app. what steps integrate ruby app views rails app? move views rails app write api communicate it? if app rack app can mount it in routes file. see this railscast practical example. i've had trouble sharing views through rack, may want see if can write in rails engine gives more access containing rails app.

iOS UITextField added via Code has no Cursor -

i've viewcontroller , adding uitextfield subview. functioning expected, there no cursor in textfield. i use following code create , add uitextfield: uitextfield *funktionfield = [[uitextfield alloc] initwithframe:cgrectmake(200, 10+ line *38, myview.frame.size.width - 210, 31)]; funktionfield.backgroundcolor = [uicolor colorwithwhite:1.0 alpha:1.0]; funktionfield.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexiblerightmargin; funktionfield.tag = line; funktionfield.delegate = self; funktionfield.userinteractionenabled = yes; funktionfield.borderstyle = uitextborderstyleroundedrect; funktionfield.clearbuttonmode = uitextfieldviewmodewhileediting; [funktionfield setenabled:yes]; [myview addsubview:funktionfield]; [funktionfield becomefirstresponder]; as said in beginning. keyboard appears , text can edited. delgates called there no cursor. am missing something. when add textfield via ui builder cursor there. regards estartu try this:

Automapper configuration for interesting nested object scenario -

i have interesting scenario , answer isn't jumping out @ me. i've looked other similar questions none seem address type of issue. before ask, not have control on source class layout. my source object looks this: class class1 { string string1 string string2 string string3 string string4 string string5 string string6 } class class2 { string foo string bar } class class3 //the source object!! { class1 inner1 class2 inner2 } and destination looks this: class destination { string string1 string string2 string string3 string string4 string string5 string string6 string string7 } in reality, inner1 huge class , perfect match - except couple exceptions. i'd use automapper directly copy inner1 destination using default matching, copy inner2.foo destination.string6 , inner2.bar destination.string7. edit: should add right mapping inner1 destination , doing couple manual property copies outside of automapper. any s

CSS multiple class selection -

there webpage containing fragment of html: <div class="a b"></div><div class="a"></div> . how can hide second div css, leaving first 1 visible? please note, cannot add other classes, visibility of first div changes (sometimes relative, absolute) , not depend on me. you can hide both show 1 has both classes a , b .a {display: none;} .a.b {display: block;} if mark-up won't change can hide second div following: .a.b + .a {display:none;} this says class a directly follows both classes a , b should hidden.

security - SQL injection and web log files -

i need kow how sql injection recorded in log file. in other words need example of web log file entry contains sql injection. question please: log file recorded first or query executed @ database first? thanks in logs ; search single quote (') or %27 . basic sql injection attack check when attacker checks if server vulnerable. in depth, search ' or 1=1-- (or) @ end of querystring find appended ( and 1=0-- or and 1=1-- ). blind sql injection attack test.

Jquery ajax request on IOS using Phonegap - Ajax not working -

i have simple html login form, deployed on xcode using phonegap framework. when submitlogin button clicked, sent login credentials using ajax request verify login. javascript function handle login: function submitloginform (login_id, login_pass){ //here need communicate php files in server console.log ("debug 1 "); $.ajax({ type: "post", url: "http://192.168.1.9/serverapp/loginhandler.php", data: "login_id=" + login_id + "&login_password=" + login_pass, success: function(loginstatus){ navigator.notification.alert ("login request sent"); console.log ("debug 2"); if (loginstatus == "success"){ console.log ("debug 3 "); location.href = "main.html"; } else{ console.log ("debug 4 "); location.h

haskell - (Unexpected SQL_NO_TOTAL) error on text fields larger than 4096 bytes -

i filed bug report: https://github.com/hdbc/hdbc-odbc/issues/4 but maybe not hdbc-odbc issue, i'll ask here well. os: linux 64 bit (archlinux), ghc-7.4.1, hdbc-odbc-2.3.1.0 connecting ms sql server 2005. retrieving text field larger 4096 bytes. with unixodbc 2.3.0 , freetds 0.82 works fine with unixodbc 2.3.1 , freetds 0.91 gives error "unexpected sql_no_total" tsql utility retrieves , shows large text field fine on freetds 0.91. anyone had problems latest freetds, large text fields , ms sql server ? edit: added correct handling of large text fields hdbc-odbc. patch here: https://github.com/vagifverdi/hdbc-odbc/commit/8134f715c18a0d60cc7b0329c7c2dbfee3e3e932 i added correct handling of large text fields hdbc-odbc. patch here: https://github.com/vagifverdi/hdbc-odbc/commit/8134f715c18a0d60cc7b0329c7c2dbfee3e3e932 it included in latest hdbc-odbc on hackage.

How do I access these weird JSON items with jQuery? -

possible duplicate: selecting json object colon in key i apologize if duplicate question. searched, did! what i'm trying achieve simple date re-format nicer "friday, march 9, 2012". love use 1 of many convenient jquery plugins parse readily available "pubdate" value more useful. unfortunately there forces preventing me importing other scripts, including jquery ui. page template mandated superiors imports jquery , that's it. my json data contains following snippet: "items": [ { "title": "blah blah", "link": "http://url.blah.com", "category": "category blah", "pubdate": "fri, 09 mar 2012 16:16:05 -0500", "y:published": { "hour": "21", "timezone": "utc",

objective c - return dictionary leak cause crash -

i have confusion me property object this nsmutabledictionary* spradsettingvaluebylinkcode; @property (nonatomic, retain) nsmutabledictionary * spradsettingvaluebylinkcode; and synthesize in .m file like @synthesize spradsettingvaluebylinkcode = _spradsettingvaluebylinkcode; then using property setting value return function that _spradsettingvaluebylinkcode = (nsmutabledictionary*)[_dbobject initwithspradersetting:inputlinkcode]; well issue 1) assign property not retain when use dictionary table view 2) if allocate _spradsettingvaluebylinkcode = [[nsmutabledictionary alloc] initwithdictionary:[_dbobject initwithspradersetting:inputlinkcode]]; then can't release because app crash , if not release memory leak so below code if working me perfect not looking right me need ask doing right or wrong? // method use load view of spreadersettings - (void) loadspreadersettingsvalues:(nsstring*)inputlinkcode { [_spradsettingvaluebylinkcode removeallobjects];

php - Set my database file to be accessible to a particular IP -

how possible set database file file.sql/file.db etc accessible particular ip addresses ? tool or methods me ? thank you/ you can use php script act proxy database. script returns file content if (and if) called specific ip, returns error otherwise.

iphone - Persisting an NSDictionary : performance of plist vs NSData serialization -

i considering options improve scene load times in game. game built around home brewed scripting language, convenient defining scene logic , ai tidbits. currently, parse scripts when scene initialized, , of manifests in-core nsdictionaries. dictionaries 'plain vanilla' nssomethingorother, plist'able. as mentioned, persisting these dictionaries once, , storing resulting data in resource bundle, eliminate intensive cpu requirement of parsing syntax , semantics. improvement net difference between clean parse @ scene instantiation vs reloading resulting dictionaries disk. wondering whether dictionary's recovery disk benefit (or lose), performance standpoint, being serialized/deserialized in nsdata. have time in world write-out dictionaries, 1 time operation @ end of packaging cycle game. any thoughts ?

Two Dimensional Array in Javascript Object -

i want create object contains 1 or more 2 dimensional arrays in javascript. i tried following way (in example try add 1 2 dimensional array): var xsize = 8; var ysize = 8; var obj = { field : new array(xsize), field[0] : new array(ysize), foo : 1, bar : 100 } info: - gives me strange error "missing : after property id" not seem make sense - unfortunately didn't find examples showing how far using google - if don't add field[0] ... creating 2nd array works. - changing xsize , ysize numbers new array(8)... doesn't work. i appreciate if show me how or explain why cannot @ , need use other method. thanks lot! the error "missing : after property id" because javascript sees field part of field[0] , expects colon before value of field. instead gets open bracket complains. you can't hard code object definition has dimensions set @ run time. have build object @ run time well. perhaps var xsize = 8; var y

c# - How to refer to children in a tree with millions of nodes -

i'm attempting build tree, each node can have unspecified amount of children nodes. tree have on million nodes in practice. i've managed contruct tree, i'm experiencing memory errors due full heap when fill tree few thousand nodes. reason because i'm attempting store each node's children in dictionary data structure (or data structure matter). thus, @ run-time i've got thousands of such data structures being created since each node can have unspecified amount of children, , each node's children stored in data structure. is there way of doing this? cannot use variable store reference of children, there can unspecified amount of children each node. thus, not binary tree have 2 variables keeping track of left child , right child respectively. please no suggestions method of doing this. i've got reasons needing create tree, , unfortunately cannot otherwise. thanks! how many of nodes "leaf" nodes? perhaps create data structure s

java - Allowing user to play only certain level's & unlocking them -

this has been giving me headache 2 days now! i have game levels. when level selection scene loaded, check maxlevelreached int variable. the first time user plays, maxlevelreached variable 0. the first level = 0 when scene loaded... private int level = 60; if (level >= maxlevelreached || maxlevelreached == 0){ box.setcolor(0, 0, 0); } else { box.setcolor(0, 0.9f, 0); } as see check see if level less or equal maxlevel. so start off user should able play first level, , when completed second level unlocked. know seems simple, reason i've been struggling it. if user clicks on level , isn't unlocked yet, how test start level or not.. log.e("level:"+levelclicked, "level"); if(levelclicked >= maxlevelreached){ levelclicked = leveltoload; intent intent = new intent(level.this, gamelevel.class); intent.putextra("level

language agnostic - Do "basic datatypes" and "built-in datatypes" mean the same? -

i came across definition of primitive data type (on wikipedia) .. either of 2 - 1) built-in datatype 2) basic datatype what difference between 2 ? can give examples explain difference :) :) built in data types more less technically referred basic data types.

Can't select element in DOM with jQuery -

i created page receives button page jquery ajax when click on button nothing happens. code: $(function () { //$("#menu ul li").click(function () { alert("ok"); }); $("a").button(); $("#menu ul li:nth-child(2)").click(function () { $("#ajaxloader").fadein('slow'); $.ajax({ url: "createdatabase.htm", type: "get", datatype: "html", success: function (data) { $("#ajaxloader").fadeout('slow'); $("#sample").html("").append(data).css("textalign", "center").css("paddingtop","30px") ; $("a").button(); } }); }); $("#sample input:submit").click(function () { alert("ok"); }); }); createdb page: <a id="createdb">create database&

Presist an opened Socket between two processes in Android -

is there way share opened socket in 1 process( application) process in android? no can not asking. should take @ how pass socket, inputstream, outputstream objects between activities and android passing objects between activities you can use object save state data application upon it's reopening, there no way share non serializable data between activities in android understand. you should use service you're asking instead of depending on object. see: keep socket connection between activities on android

php - HTMLPurifier inserts \ before quotes -

in system i'm building use ckeditor writing posts. then, when send php validate html created ckeditor htmlpurifier. problem htmlpurifier adds \ before ". example, ckeditor produces: <span style="font-size:36px;"> and after htmlpurifier: <span style=\"font-size:36px;\"> i'm using php 5.2. why htmlpurifier adds these backslashes , must fix it? it's not html purifier adds slashes, php configuration. edit php.ini , disable magic_quotes_gpc . the linked manual suggests add next setting php.ini: magic_quotes_gpc = off if using apache , can use .htaccess files, create 1 with: php_flag magic_quotes_gpc off

android - Dalvik JIT workflow -

i interested on working on dalvik vm (android). trying go through code of jit find out operations performed , how selects traces. unable follow code. request me suggesting relevant functions in jit performs trace selection , translation you try git log --grep jit in dalvik repository, , looking @ changes , files changed. should idea of jit related code is.

R: ordering facets by value rather than alphabetical order in a ggplot2 plot -

Image
a couple of weeks ago used ggplot2 create faceted plot facets ordered last value in data frame. had no major problems until came reordering, haven't assimilated complications of orders, factors , levels. still, after hour or 2 (or three) of referring posts got working. when came script today no longer "working" in sorting facets alphabetical order rather final value of data frame. (i think "fixed" problem while messing around @ r console , did not add solution script.) rather spending couple of hours on tonight i'm going throw myself on mercy of so. q. how can sort facets specified value rather alphabetical order of names of each facet? please note following code example only; real data has several dozen items. edited code below reflect additional input @joran; facets sorted , filled appropriately. mission successful. # version 3 require(ggplot2) ## nb script assumes have ggplot2 v0.90 require(scales) require(plyr) require(lubridate) require(resh

jQuery: trying to use prepend() -

i'm trying use prepend() put text before input text. this try: http://jsfiddle.net/sx7jw/2/ but doesn't work.. any idea? javi you don't want use prepend, adds given text inside input makes text appear in input. like: <input type='text'>your text</input> you need use before creates your text <input type='text'/> see jsfiddle you can this, adds text first item parent of input. $('input').keypress(function(e) { if(e.keycode == 13) { console.log($(this)); $(this).parent().prepend("<p>fasf</p>"); alert('you pressed enter!'); } });

How to fetch deep associations with CakePHP's find operations? -

i building website has 3 models: store , storereview , , user . website lists stores, , users can review stores. therefore, store model can have many storereview rows, , each storereview row belongs user row. my question is: when fetching store rows, how can fetch relevant user along storereview rows? i'm using: <?php class storescontroller extends appcontroller { public function view($slug) { $stores = $this->store->find('all'); } } but returns 'storereview' rows. because user row level deeper, i'm unsure how fetch this; i've checked cakephp's documentation , googled, cakephp have re-jigged documentation site, , samples on websites google search didn't work. thank in advance. there 2 ways. can increase recursive attribute: $stores = $this->store->find('all', array('recursive' => 2)); or use containable behavior (i prefer since can make more 2 levels): $this->s

android - Strange Eclipse Error with XML files -

when try view xml's grahpic layout, eclipse strange things: buttons above layouts vibrating. everyting become slow , if open task killer see eclipse useing 1.000.000 k memory, yes million. its happens @ xml views, not @ java code. then everyhing become slow must kill eclipse via task killer. any ideas ? turn of lint when thing happens. see answer on topic: eclipse "java heap space" error, eclipse not responding

max - function in opencv that can give the minimum value of a 2d or 3d matrix along a specific dimension -

is there function in opencv, can compute minimum value of 2d or 3d matrix along specific dimension. , give me index of minimum value. minimizing in 1 dimension mean, if have 3d matrix result should 2d matrix, , if have 2d matrix result should 1d matrix(array) of indices min/max value stored. minmaxidx , minmaxloc gives global minimum index/value along dimensions. cv::reduce give row or column wise minimum or maximum. don't think give index. "find()" function lacks in opencv.

c# - Regarding program that calculates time through keypad -

a mobile phone has 12 keys input, (‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘0’, ‘*’ , ‘#’). in standard text input mode each key can used input letters of alphabet , space character. example, access letter ‘b’ user press ‘2’ key twice. it takes user minimum of 100 ms press key. if user has use same key input consecutive characters there must @ least 0.5 second pause phone accept next key press represents new character. i want write console application accepts string can entered using key assignments in grid using c#. application should accept input user , calculate minimum time required user input string using key pad , sequence of keys required. if know can me write program. this should give idea: class mobilegrid { const int min_duration = 100; const int wait_duration = 500; private static dictionary<char, tuple<char, int>> grid; static mobilegrid() { grid = new dictionary<char, tuple<char, int>>();

xcode - Removing interface elements from an xib file -

Image
i have added items, such pictured "round rect button" in interface builder .xib file, not able remove them. if click on 'x', disappears, it's not removed interface. how delete it? highlight items shown below , hit delete key if can't see menu can expanded clicking arrow in image