Posts

Showing posts from January, 2012

iphone - Receiving memory leak -

i new iphone development. displaying lots of images on view.also put button named load more more images.i downloading images on load more event. here code:` -(void)btnloadmorepressed { [appdelegate showloader:mbprogresshudmodeindeterminate]; requestresponsemanager *requestmanager=[requestresponsemanager sharedinstance]; [requestmanager setrequestpropery:self extrainfo:nil]; album *album=[appdelegate.currentuser.albumlistarray objectatindex:indexnum-1]; nsarray *obj_keys = [nsarray arraywithobjects:@"userid",@"albumid",@"sessionid",@"pageno",@"modmethod", nil]; nsarray *objects = [nsarray arraywithobjects:appdelegate.currentuser.userid,album.albumid,appdelegate.sessionid,[nsstring stringwithformat:@"%d",currentpage],@"getphotolistbyalbumid",nil]; nsdictionary *jsondictionary = [nsdictionary dictionarywithobjects:objects forkeys:obj_keys]; nsstring *jsonstring = [jsondictionary...

php - Tracking user actions on vote website -

i need information (php 5.3) tracking user has been delivered our website vote website (topofgames) , once user click 'yes' (successful vote) vote site has redirected user index page (by vote site). way reward user points spend in our shop after did successful vote. found method allows track users last url visited not sure how far can take us. not asking free code, appreciate hint of or keep in mind. thanks! edit: how our current system works. step 1: user log in. once logged in, he's redirected secured page vote buttons links vote sites (like topofgames). system record steps , needs log in reward points since it's user id bound not ip. step 1 note: our buttons have timer, because in many of sites can vote once every 24hs, if user clicked our button , entered vote site, can't click vote button again untill 24hs later (he need pass through button since our system records every step avouid fraud, can't go site). however found exploit here , it's users ab...

.net - ASP.Net MVC3: Hide item from _Layout file only in one view -

in layout file, displaying text, , want hide text in 1 view. how tell view loaded inside view? you can set id text container , in specific view can hide id jquery write code in view can hide text $(function() { $("#id").hide(); }

c# - Pass datas from Page to Page in Windows phone? -

i want pass datas page1 page2. can achieve through code behind in windows phone... is there anyway achieve in 0% c# code , 100 % xaml code .. 1 guide me ?.. helpful... you can achieve using hyperlinkbutton <hyperlinkbutton navigateuri="/page2.xaml?data=somedata" content="click" />

php - Codeigniter MY_Model class -

i'm trying write own my_model base class i'm facing weird problem: /core/my_model.php function __construct() { if ( !empty($this->table)) { // query db, etc. } else { // though set $this->table value // in child class, ended here // it's empty!!!! log_message('error', 'some error message'); } // ... } } /models/test_model.php function __construct() { parent::__construct(); } // ... } even though set $this->table value in child class, ended finding $table value empty in my_model class, it's empty!!!! hint please?! unless need specific/special - should use jamie rumbelows "my_model" - better write (or me) - , allows focus writing other code. no need re-invent wheel. you can code github here and here awesome tutorial shows how use my_model in application. honestly - giv...

asp.net - save current page of gridview when page dropdownlist selected index change -

i using multi page gridview display bunch of data. here code of gridview. <asp:gridview id="unverifiedlist" runat="server" autogeneratecolumns="false" allowsorting="true" allowpaging="true" onrowdatabound="unverifiedlist_rowdatabound" style="font-size:12px" > <columns><asp:boundfield headertext="surname" datafield="surname" readonly="true"/></columns> <columns><asp:boundfield headertext="firstname" datafield="givenname" readonly="true"/></columns> ...... <columns><asp:templatefield headertext="options" > <itemtemplate> <asp:dropdownlist id="options" runat="server" autopostback="true...

xaml - DataBinding to a context menu in wpf? -

i have usercontrol , defined so: <usercontrol x:name=usercontrolname> <usercontrol.resources> <style targettype="{x:type mycontrol}"> <setter property="contextmenu"> <setter.value> <contextmenu > <menuitem header="item" command="{binding elementname=usercontrolname, path=deletecommand"> </menuitem> </contextmenu> </setter.value> </setter> <setter property="template"> <setter.value> <controltemplate targettype="{x:type controltype}"> <grid> <!--mycontenthere--...

c - MPI_Isend request parameter -

when using mpi_isend , can mpi_request parameter null pointer (when sender doesn't care message after sent)? short answer no - request handle parameter cannot null . mpi_isend() initiates asynchronous send operation. asynchronous operations given request handle has acted on later in 1 of following ways: block , wait operation finish mpi_wait() , friends test operation completion mpi_test() , friends until test turns out positive free handle mpi_request_free() both waiting , testing functions free request once has completed. can free after returned mpi_isend() . not cancel operation rather mark request deletion finished. won't able status of send operation though. if don't care outcome of asynchronous operation (e.g. completion status, message receive status, error code, etc.), right thing follows: mpi_request req; ... mpi_isend(..., &req); mpi_request_free(&req); ... caveat: works asynchronous sends since 1 can devise method verify s...

qt - Get path of file in external library -

i have 2 qt projects i've made. 1 builds library other builds gui uses library. project library includes bunch of shaders i've made. within gui want reference path these shaders. approach have static function in library called getlibrarypath() returns qstring referencing path on file system library. i've tried using qdir::currentpath() , qapplication::applicationfilepath() , other similar functions return paths return paths referencing gui's path, not library's path though function path located inside library. within gui try reference shader doing: shader->addshaderfromsourcefile(qglshader::vertex, myexternallib::getlibrarypath() + "/shaders/myvertexshader.vs"); a library bunch of code. has no notion of having own path. normal way of doing intend is: if library separately installed product -- set registry entry in installer, , check @ runtime. platform specific, unless library written in qt -- can use qsettings, make sure set...

c# - Do we really need to hard code DLLs -

let's want write small program can give .cs file , can compile , if there compilation erors or not. used codedom this. when want use codedom have add dll names can load them @ run time. this: compilerparameters parameters = new compilerparameters(); parameters.referencedassemblies.add("system.dll"); parameters.referencedassemblies.add("system.windows.forms.dll"); but there problems approach: how can make sure have imcluded necessary dlls? way? there better ways instead of adding these dlls this? thanks. you don't need hard-code anything. imagine calling add() in loop, using dll names read text file -- or found in directory @ runtime, matter. have tools need write flexible.

Java & Eclipse: Resources in JAR? -

how can add resources (images) directly jar file? example, if open minecraft.jar (of minecraft) can see few classes , folders resources. if try put resources in /src folder, eclipse show them in package explorer annoying. when decompile minecraft (minecraft coder pack) there no resources in /src folder. how can add resources minecraft does? thanks in advance!! you can create new folder , mark source folder (rightclick on folder in eclipse -> build path -> use source folder). should able use ressources without them being in /src folder.

sql - String Concatenation with comma -

i trying build string comma space. how can remove space between zipcode , country_name? here string. thank suggestion. select (coalesce(address + ', ', '') + coalesce(city + ', ', '') + coalesce(state_code + ' ', '') + coalesce(zipcode + ' ', '') + coalesce(country_name + '', '')) address table1 a_id = 2 here result: tewt, test ct, de 4444 united states you can use rtrim function remove white space right side of variable. check ltrim left cases.

android - linkyfy some text in TextView -

i have string in textview , want linkify substring string. example: click here know more. i'm getting string dynamically. have search if has click here , convert link .how can linkify "click here". to find pattern inside text , replace it, use this: pattern p = pattern.compile("click here"); matcher m = p.matcher("for more info, click here"); stringbuffer sb = new stringbuffer(); boolean result = m.find(); while(result) { m.appendreplacement(sb, "<a href=\"www.mywebsite.com\">click here</a>"); result = m.find(); } m.appendtail(sb); string strwithlink = sb.tostring(); yourtextview.settext(html.fromhtml(strwithlink)); yourtextview.setmovementmethod(linkmovementmethod.getinstance()) this code search inside string , replaces "click here" link. and @ end, not add android:autolink="web" xml resource (section textview), otherwise a-tags not rendered correctly , not clickable...

java - How does WEKA code the value of an instance as a double value -

when want read particular value of instance use following method: public double value(int attindex) now, how original value double value? possible know datatype particular value, , if know if of type string, how can string value? thanks abhishek s if wanto string value can use public double stringvalue(int attindex)

Use different SD Cards for Android app -

i building app might have read content 2 or more different sd cards. have app on device content on different cards. user has plug in different card see content , 1 see another. how code ? sdcards have identifiers? cant read external storage or /mnt/sdcard since though ll work wont know card reading from. on related topic way design or better have different apps on different cards cards whole on own? the main rationale here have lot of data 1 version of app. have 32 gb data , have 16gb sd card device. ll need 2 sd cards single version. agree @rajesh, can tell more why you'd want on separate sd cards? and think benjamin right too, way have implement , enforce yourself, putting specific (unique) file can check each card

c# - Opening Url with Credentials -

we have knowledge base want link our desktop application help. i've tried open default web browser have .htaccess credentials setup being prompted. don't want them have type in username , password since setting 1 application. this causes them prompted everytime: dim url = "http://mysite.com/index.php?/category/40/0/10/" process.start(url) i cannot put username , password in url anymore since ie9 doesn't support it: http://username:pass@url.com <-- not supported newer browsers i've tried use webbrowser control using ie4 instead of current. causing display incorrectly. dim hdr = "authorization: basic " + convert.tobase64string(encoding.ascii.getbytes("myuser" + ":" + "password")) + system.environment.newline webbrowser1.navigate(url, nothing, nothing, hdr) i've tried make registry setting force ie9 wasn't able work. besides, i've read, if don't have ie9 won't matter. any sugg...

jquery - Phonegap Android application infinite pop up error in Android 2.2 but not in Android 4.0.3 -

i'm working on html5 + jquery app android using phonegap. when test on android 4.0.3 device works fine, in android 2.2 infinite gap_poll pop messages. anyone knows how solve this? i came around this. had put domain of remote server app calling located on whitelist on cordova.xml file.

Rails route for nested model -

i have rails model nested: # app/models/frontend/item.rb class frontend::item < item end when call form_for(@frontend_item) it tries go '/frontend/items' path. is there way make go '/items' instead (without inherited '/frontend') you might have done tried rake routes

How to do a conditional statement in makefile -

i'm trying use commandline var choose toolkit use compile. when in command line use line like: make all-arm our_toolkit=1 and, in every makefile implied, put include include arm_compiler.inc then, in every makefile, all: settoolkit $(otheroperations) and contents of arm_compiler logic choose compiler: settoolkit: ifdef our_toolkit toolkit=1 endif ifdef customer_toolkit toolkit=2 endif ifeq ($(toolkit), 1) $(info "=========our toolkit selected======================") rm=/bin/rm -f cc= arm-linux-c++ -fpic cxx= arm-linux-c++ -fpic link= arm-linux-c++ -shared -wl ar= ar cq ranlib= ranlib strip=arm-linux-strip # para que se utilicen las herramientas y librerias del cross compiler path:=$(path):/path/to/our/toolkit ld_libray_path:=$(ld_libray_path):/path/to/our/toolkit endif ifeq ($(toolkit), 2) $(info "================customer toolkit selected====================") rm=/bin/rm...

java - Manipulate photo in a ImageView(?) and then return that picture -

Image
i'm trying figure out how make happen. in touchnote, when start postcard select picture camera/gallery/facebook , displays in imageview(i think?) , can pinch zoom , rotate, etc. pinch2zoom also, after picture edited user, want use image in imageview. how's achievable? if wish using native android apis, can implement imageview , android's native pinch zoom capability. there can follow link have provided on stackoverflow grab drawingcache (essentially screenshot) of imageview place imageview android screenshot?

How to use personalized icon with jquery-ui-map -

using jquery-ui-map , try use personnalized icon. works fine way : $("#gmap_" + parent).gmap('addmarker', { "id": "marker-"+m.id, 'position': new google.maps.latlng(m.lat, m.lon), 'bounds':true, 'icon': '/images/'+m.icon }) as icon url. want put icons in sprite, have set other option : $("#gmap_" + parent).gmap('addmarker', { "id": "marker-"+m.id, 'position': new google.maps.latlng(m.lat, m.lon), 'bounds':true, 'icon': new google.maps.markerimage( { 'url' : "http://crm.brunet.pro/images/markers.png", 'origin': new google.maps.point(m.pos, 0), 'size' : new google.maps.size(20, 34) }) }) i error : get http://mysite.com/[object%20object] 400 (bad request) so looks icon option accepts string. can see in api should accept markerimage object. what...

svn - How do I commit my local files to subversion repo when the repo has changed? -

i use tortoise svn. added folder , commit subversion repo. then, coworker did stuff, made mistake, , delete entire folder , asks me re submit working files. but now, when click tortoise svn-> commit, says "no files changed or added". files in server repo no longer entire folder gone. if click update, remove local folder , don't want that. want recommit whatever have on local folder repo. how do that? thanks. well, copy local folder somewhere else, update, move folder add subversion , commit (and hit co-worker stick)

internationalization - htmlencode causes lockup asp.net -

i had text displaying html , had filtered content htmlencode. when changed control textbox, left htmlencode code alone , worked. however, when there international characters, e.g. éúáó, ajax calls on page stopped working. page displayed , there no errors - javascript or otherwise, page stopped working. i removed htmlencode , works correctly. app defined utf-8. i'm curious if understands happened. my guess ajax calls use http method , using html encoding instead of url encoding. perhaps urls got built ajax calls contained characters such &acute; (the html encoding é ) when included accented characters, , these broke url scheme caused request never make server-side controller. url encoding é %e9 . url encoding , html encoding different. when removed htmlencode call, guess fixed issue & breaking url scheme. if i'm correct far may idea change ajax calls use http post instead of http get, sure eliminate other url issue.

spring - web-app backend architecture -

i starting new web app hobby , had difficulty architecture. frond end html , javascript requests. , backend ,will implemented in java , using spring framework. lets example library page user can view books , personal information. personal info ------------- book 1 book 2 book 3 i want implement features 2 rest services ,one personal information ,and books person has. ex . www.mybib.org/users/123/ www.mybib.org/users/123/books/ the thing ,when user first request home page view books , personal information ,how compose page. use servlet / controller replicate code of 2 rest services , redirect jsp format html , javascript. once first load done, each update on page use rest services . i think bad design. from servler / controller call rest services , call jsp in order compose html , javascript output.then each update call rest services. from servlet / controller return html layout , make javascript make 2 ajax request when loading page. ...or else. as can see pre...

PHP / MYSQL Retry wehn duplicate happens -

$new_acct_id = 'acc'.strtoupper( substr(md5(uniqid(rand())),0,5) ); mysql_query("insert `accounts` (id, market_unit_id, account_type_id, is_inactive,inactive_notes,is_special,dealer_id, is_premium) values ('".$new_acct_id."', '".$mu_id."', '".$atype['0']."', '".$is_inactive."','','','', '".$is_premium."')") or die("load2 -" . mysql_error()); load2 -duplicate entry 'acc96e38' key 'primary' is there anyway can have generate number if first creates error? this should it. do{ $error=''; $new_acct_id = 'acc'.strtoupper( substr(md5(uniqid(rand())),0,5) ); $res=mysql_query("insert `accounts` (id, market_unit_id, account_type_id, is_inactive,inactive_notes,is_special,dealer_id, is_premium) values ('".$new_acct_id."', '".$mu_id."', '...

java - Href and tag cloud in JSP -

i create tag cloud.in cloud display values. <c:foreach items="${alltags}" var="search"> <a href='${tags.display}'/> </c:foreach> now.i have jsp,where perfom searching.i have input field , user can give value , perform search when click's on button. in specific occasion i'm trying, when user click @ link of value (on cloud) send automatically value of tag (tags.display) in input box , make search. the searching jsp <form:form method="post" commandname="search"> <tr> <td><spring:message code="blah"/></td> <td><form:input path="apath" /></td> </tr> </form> <input type="submit"/> what propose me do? well, first of all, search form should use rather post: search idempotent operation, doesn't modify @ server side. if switch method , submit form, you'll notice url invoked ...

iphone - href tel usage in ios 5 safari makes browser go 1 page back in history -

so trying initiate call webpage, , part works fine. when call link called , note pops if want call. safari @ same time steps 1 page in browsing history! i trying 2 syntaxs of now <a>click phone number initiate call: </a><a href="tel:+12345" class="call">call</a><br> <a href="tel:0123412345" target="_blank" rel="external" data-role="button">phone me</a> so if knows how avoid browser going on press of tel link great.

asp.net - Constant in global.asax -

is using constant in global.asax idea? it's go to, what holding in such variable? i keep main settings ( read only ) variables in web.config file in <appsettings> area, example: <appsettings> <add key="amazons3:calendarpath" value="http://mycloud.s3-eu-west-1.amazonaws.com/calendar/" /> </appsettings> and access such values string calpath = system.configuration.configurationmanager.appsettings["amazons3:calendarpath"]; either in views or controllers. this lovely place hold read-only variables as, no mater if web application built or not, compiled or showing source files, can change variable need, without opening compiled file, change , compile project again... saves lot of trouble , gives dynamic hole application settings. if other hand want read/write way of saving variables across application, have 3 ways, pros , cons use session state save variables used, it's terrible on c...

objective c - how to get the emitter position of an animated CAEmitterLayer/Cell? -

i have animated caemitterlayer caemittercell , animation runs with fireemitter = (caemitterlayer*)self.layer; fireemitter.emitterposition = cgpointmake(50, 50); fireemitter.emittersize = cgsizemake(10, 10); caemittercell* fire = [caemittercell emittercell]; ... [fire setname:@"fire"]; cakeyframeanimation *anim = [cakeyframeanimation animationwithkeypath:@"emitterposition"]; anim.path = thebezierpath.cgpath; anim.calculationmode = kcaanimationcubicpaced; anim.repeatcount = huge_valf; anim.duration = 12.0; [self.layer addanimation:anim forkey:@"fire"]; my bezier path closed , forms "8" out of 4 position points. timerfunction try position of caemitterlayer every second. use -(cgpoint)getemitterposition { return fireemitter.emitterposition; } in emitter class , cgpoint emitterposition = [self.particleemitterview getemitterposition]; nslog(@"%f / %f", emitterposition.y, emitterpos...

android: disable action bar home button -

we have file manager-like application use action bar home button "go in folder structure" action. if user @ top of folder structure, button should disabled. we set home button when user within sub folder. when reach top folder, disable showing up. // update home actionbar.setdisplayhomeasupenabled(hasparent); the problem button still "enabled" in user can press can see visual feedback pressed. want action bar home button disabled in case, when there no parent folder. i tried calling setdisplayshowhomeenabled() , not disable button in stead removes home button completely. any ideas? thanks. did try sethomebuttonenabled() ? new api level 14, have skip honeycomb tablets.

jquery - autocomplete json data - how can I use it in MVC3 Razor -

when jquery autocomplete function gets json data items, how can take selected item , assign them other textboxes in dom? do wire event in textbox? my js: $(document).ready(function () { $("#custbyname").autocomplete( { source: function (request, response) { $.ajax( { url: "/cases/findbyname", type: "get", datatype: "json", data: { searchtext: request.term, maxresults: 10 }, contenttype: "application/json; charset=utf-8", success: function (data) { response($.map(data, function (item) { return { label: item.customername, value: item.customername, id: item.customerid } }) ); } }); }, minlength: 3 ...

c# - Can anyone explain the major features of a VDPROJ file? -

i'm sure there must documentation on msdn somewhere, couldn't find it. looks subset/variation of json. really, question grew out of has bugged me: 8: s , 3: s mean? version number of kind? maybe typing scheme? every vdproj excerpt i've ever seen filled these "eight-colon" , "three-colon" prefixes, not sort of question search engines for. "deployproject" { "vsversion" = "3:800" "projecttype" = "8:{978c614f-708e-4e1a-b201-565925725dba}" "iswebtype" = "8:false" "projectname" = "8:projectnameredacted" "languageid" = "3:1033" "codepage" = "3:1252" "uilanguageid" = "3:1033" "sccprojectname" = "8:" "scclocalpath" = "8:" "sccauxpath" = "8:" "sccprovider" = "8:" "hierarchy" { "entry" ...

css - Fade-in and fade-out an image when mousing over another one -

i have 2 images. second image fade-in when 'mouseover' on first image , fade-out when 'mouseout' first image. how can acomplish using css3? i thank in advance replies. actually don't know how using css3, using jquery: $('#image1').mouseover(function() { $('#image2').fadein(); }); $('#image1').mouseout(function() { $('#image2').fadeout(); }); this basic solution few images, can dynamically depending on needs.

asp.net mvc - Jquery Mobile / Telerik Globalization Error -

i have asp.net mvc 3 project using telerik mvc , jquerymobile. enable globalization work items such mvc grid enable globalization using following in master layout page: @(html.telerik().scriptregistrar().globalization(true).defaultgroup(group => group.combined(true).compress(true))) this works fine if call page mvc grid directly e.g. mycontroller/gridpage , if try call same action via jquerymobile dialog following message: 0x800a01b6 - javascript runtime error: object doesn't support property or method 'load' the link use call via jquerymobile is: @html.actionlink("my grid", "gridpage ", "mycontroller", new { data_rel = "dialog", data_theme = "b", data_transition = "flip" }) removing globalization attribute stops error, stops globalization can advise how can past error? thanks mark alright, figured out work around, although not it. think when dynamically add html dom this, wip...

PHP: foreach loop inside a foreach loop for nested arrays -

i'm reporting form errors user nested arrays, because there different groups form , want show errors such: echo "<ul>\n"; foreach ($errors $error) { if (is_array($error)) { echo "item ".$i." error(s):\n"; echo "<ul>\n"; foreach ($error $itemerror) { echo "<li>".$itemerror."</li>\n"; } echo "</ul>\n"; } else { echo "<li>".$error."</li>\n"; } $i++; } echo "</ul>"; the nested arrays recognized items in nested arrays don't show up, empty sub list echoed. check case of variable: $itemerror / $itemerror

php - Change Form Submission to a PDF or Image File -

i have html/php form needs converted pdf or image file , stored sql database on submission. how go doing this? you can send php script via 'action' attribute on form , generate pdf file on server. can either save pdf location on database, or save whole pdf blob type. some reference: http://php.net/manual/en/book.pdf.php http://dev.mysql.com/doc/refman/5.5/en/blob.html

c# - Get the relative path of RegistryKey -

i have system.win32.registrykey object points to, example, "hkcu\software\test". .name property populated absolute path. there way current (relative) key name? in example above, looking "test" part of path. looking registry equivelent system.io.path.getdirectoryname without having parse path manually. you can call system.io.path.getdirectoryname . the path.* functions (except getfullpath() ) purely string manipulation functions , work fine non-filesystem paths.

c# - How do I one element align to the left, and another align to the right? -

in windows phone 7 app, have textblock followed checkbox . left right. i doing programmatically , , can following code: stackpanel controlstackpanel = new stackpanel(); controlstackpanel.orientation = system.windows.controls.orientation.horizontal; textblock controltextblock = new textblock(); controltextblock.text = @"controlnamegoeshere"; checkbox controlcheckbox = new checkbox(); controlcheckbox.margin = new thickness(0, 0, 0, 0); controlcheckbox.horizontalalignment = system.windows.horizontalalignment.right; controlstackpanel.children.add(controltextblock); controlstackpanel.children.add(controlcheckbox); however, i textblock element align left side of screen, , checkbox element align right side of screen. how can this? do need add grid programmatically? reason don't want in xaml adding these stackpanels going iterative process, , works better code if programmatically. i've googled heck of lot, haven't had luck. many thanks! brett ...

Python 3.2 using a subprocess module -

i using python 3.2 , eclipse classic ide. m trying add users in rawinput existing group north_americas using command shown below. tested cmd , job. users in rawinput, want add them group using python script. below code , error msg. can please let me know missing? thanks. # coding=utf-8 import subprocess def addusers(): rawinput = ('corp\\arrigh', 'corp\\banjar', 'corp\\bicknk', 'corp\\bindem') user in rawinput: rs = subprocess.call("c:/dicfg -remote admin:admin@myserver:2130 add user -user "+user+" -groups north_americas") print(user) addusers() error: traceback (most recent call last): file "c:\eclipse\eclipse\eclipse\plugins\org.python.pydev.debug_2.5.0.2012040618\pysrc\pydev_runfiles.py", line 307, in __get_module_from_str mod = __import__(modname) file "c:/documents , settings/user21/shworkspace/python test\pytest.py", line 5, in <module> user in rawinput: nameerror: name 'raw...

php - How to transform this Regex -

i'm trying figure out does, , how change it. preg_replace('/[^\w\s]/','',$var); i think replaces symbols nothing (deletes them basically). if want allow specific symbols, change here? for example want replace except: / numbers letters spaces thanks. ^ means this, replaces word characters ( \w ) , whitespace ( \s ). to replace except characters mention, use this: preg_replace('/[^\w\s\/]/', '', $var); \/ escaped version of / .

c# - Why I can't add .NET DLLs at run time -

Image
using codedom have this: compilerparameters parameters = new compilerparameters(); parameters.referencedassemblies.add("system.dll"); parameters.referencedassemblies.add("system.windows.forms.dll"); parameters.referencedassemblies.add("system.data.linq.dll"); parameters.referencedassemblies.add("system.xml.linq.dll"); parameters.referencedassemblies.add("system.core.dll"); and when run program, the error last 3 dlls, first 2 (system.dll , system.windows.forms.dll ) have no problem , error add last 3 lines load dlls too, errors 1 in picture. weird , annoying , couldn't find way fix it. thanks. oh wow! tricky! it doesn't care target platform visual studio set on, looks @ own codeprovider class. using default constructor . has constructor takes dictionary parameter. in parameter specifying version of .net should used. instead of creating new codeprovider object should this: dictionary<string, strin...

osx - Change max memory heap for Java on Mac OS X -

i trying change max memory size "heap" java on mac os x. have read many places change "-xx:maxpermsize", can't find file , don't know change setting. you can set memory available java vm using parameters: -xms64m -xmx200m -xms specifies minimum memory; -xmx maximum one. you have specify them when run app. example, if jar named app.jar, can run typing java -xms64m -xmx512m -jar app.jar i think on 32 bit machine can't give jvm more 1gb.

c# - jqgrid functionality to allow adding two columns using add-form but to allow editing of only one column by inline-edit option -

i using jqgrid display database table , loading jqgrid using dataset asp.net code behind file. columns generated code behind file @ runtime. have 2 columns (primarykey column[which not auto-increment field], text field column) , want provide add functionality both columns using add-form edit functionality 1 column i.e text field column using inline editing. this similar question reported here , answer pretty close want. found other solutions of solutions use data in json format , loaded javascript. i having hard time figuring out above functionality because data loaded database , wish modify editable property. default have primary field not-editable , text field - editable. i appreciate help. the answer reference oriented on inline editing mode. in case of usage of form editing can recommend follow this . can combine both force inside of beforeshowform both columns editable in add form , making 1 column editable in case of edit form or inline editing. updated : ...

winapi - C# Sockets vs Pipes -

currently working on multi-process desktop application on windows. application shrink wrapped application deployed on client machines across world. while can have broad specifications machines - e.g. windows xp sp3 .net 4.0 cf, wont have control on them , cant specific on configuration - e.g. cannot specify machine must have cuda 1.4 capable graphic processor etc. some of these processes managed (.net 4.0) , others unmanaged (c++ win32). processes need share data. options have evaluated date tcp sockets named pipes pipes seem perform little better, our needs - performance both acceptable. , sockets give flexibility of crossing machine (and operating systems - support non-microsoft oses eventually) boundaries in future hence our preference going sockets. however - major concern - if use tcp sockets - run issues firewalls? has else deployed desktop applications / programs use tcp ipc , experienced issues? if - kind? i know open ended question , glad rephrase. know kind o...

http put - When should I use HttpDelete or HttpPut in an asp.net mvc application -

i use httpget or httppost when action executing delete method on database. for should use httpdelete/httpput ? if build odata service. http delete - deletes entity data specified resource represents. payload not present in request or response messages. http put - replaces existing entity data @ requested resource new data supplied in payload of request message. ( msdn ) there's a presentation scott hanselman might interesting. (i haven't seen yet.) there's a couple of lectures on pluralsight on odata if have subscription there.

iphone - facebook login give me already authorized this app without automatic returning to the app -

Image
my app should implement login facebook have noticed every time want login facebook tell me authorize app , question if authorized app facebook should return automatically without pressing okey button saw in other applications ? see attached image i fixed problem doing following steps : 1- login facebook admin app. 2- go https://developers.facebook.com/apps/your_facebook_app_id/summary . 3- go settings > basic > native ios app 4- set configured ios sso: enabled

exception - Converting Object to Double in Java -

i'm trying deal lot of classcastexceptions in code originating single critical point. i'll start providing background information question i'm reading different types of values csv file. following snapshot of class holds them. public class row { private object[] data; public object getatindex(int i) { return data[i]; } } for holding different rows of file, i'm using a arraylist<row> rows; the problem lies in function supposed return double[] containing values of particular column stored in arraylist . current function looks this public double[] getbyindex(int i) { double[] result = new double[rows.size()]; string temp; for(int j=0;j<rows.size();j++) { temp =(string)rows.get(j).getatindex(i); //java.lang.classcastexception: java.lang.double cannot cast java.lang.string result[j]=double.parsedouble(temp); } return result; } this getbyindex() throwing classcaste...

javascript - Ways of setting/getting a textNode's value -

this question has answer here: how retrieve text of dom text node? 3 answers there many ways retrieve/change value of text node: it's not textnode.value , xul -only thing textcontent [ mdn ] not supported until ie9 data , inherited text characterdata interface nodevalue [ mdn ] node interface i tend use .data . of them recommended - return same? if have text_node [type 3] textcontent return nodevalue ( mdn ): if node cdata section, comment, processing instruction, or text node, textcontent returns text inside node (the nodevalue). characterdata same nodevalue text nodes ( mdn ). text, comment, , cdatasection implement characterdata, in turn implements node. for text nodes same. jquery (sizzle) uses nodevalue: /** * utility function retreiving text value of array of dom nodes * @param {array|element} elem */ var...

WCF 5.0 and oData 3.0 API not work with azure table storage -

Image
after migrated wcf5.0 application integrate azure can not use odata 3 api azure table storage. got error- the type 'system.data.services.client.dataserviceresponse' defined in assembly not referenced. must add reference assembly 'system.data.services.client, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089'. the type 'system.data.services.client.dataservicecontext' defined in assembly not referenced. must add reference assembly 'system.data.services.client, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089'. after add system.data.services.client.dll in project problems goes away can not use odata 3.0. this second time question has asked recently. microsoft.windowsazure.storageclient.dll has direct reference dependency on system.data.service.client.dll shown below if going use azure storage client api have reference system.data.service.client.dll in application , sure can not use...

XNA/DirectX 10/11 - Can VertexBuffer be reused? -

i use vertexbuffers in xna. question can reused? mean is: 1. put data in vertexbuffer 2. after time data becomes obsolete 3. put new data sam vertexbuffer (without disposing) in code this var verts = new ... vertexbuffer vb = new ... vb.setdata(verts); ...some time passes vb becomes obsolete... var verts2 = new ... vb.setdata(verts2); yes... although you'll want declare vertex buffer type dynamicvertexbuffer (instead of plain old vertexbuffer) , subscribe contentlost event repopulate buffer in case it's lost (due memory pressure on graphics card example).

Is Python static typed? -

i know python dynamic typed, duck typed , strong. in cases, have make sure declare list or dictionary beforehand in order use them... can python statically typed language? no, python not statically typed. in static typing names bound both type , object (or value), in python names bound objects. @ time can reassign name object of different type, cannot in statically typed languages. i'm not sure mean needing declaring variables beforehand, guess creating empty list or dictionary , assigning name.

Rails uses incorrect version of ruby -

when run rails application, running older version of ruby: [2012-06-04 16:34:29] info ruby 1.8.7 (2010-08-16) [x86_64-linux] i want run ruby 1.9.2. have rvm installed ruby version selected. here output of rvm list: rvm rubies =* ruby-1.9.2-p318 [ x86_64 ] ruby-1.9.3-p125 [ x86_64 ] it's not working, though. here path: /usr/local/bin:/usr/bin:/bin:/home/charlie/.rvm/bin:/var/lib/gems/1.8/bin/:/usr/local/bin/:/usr/local/rvm/lib/:/vendor/bundle/ here .bashrc: path=$path:$home/.rvm/bin # add rvm path scripting path="${path}:/var/lib/gems/1.8/bin/" path="${path}:/usr/local/bin/" path="${path}:/usr/local/rvm/lib/" path="${path}:/vendor/bundle/" i'm assuming you're trying run development server, right? can create .rvmrc inside rails app root folder: rvm use 1.9.2-p318 this way, everytime cd rails app, you'll have right environment loaded. may consider creating gemset project.

How can I do bookmarking in GWT with user search queries -

i newbie gwt, did enough search understand can use history mechanism bookmarking in gwt. but still confused how can bookmarking when need apply them user search queries. e.g. main page may have several tabs ( can use history mechanism here bookmark tab). after user navigates particular tab , performs search query. if wish bookmark search result url, how can gwt. some options tried: gwt hyperlinks widgets , anchors, urlbuilder not sure convenient one. any inputs appreciated. you should read docs on gwt history here . as example case, let's want remember tab user on (parameter t) , query user has searched (parameter q). put in url t=2&q=hello then when gwt module loading. check url see if these parameters here. if yes, parse them load correct tab , search. if not, load scratch. sample theoretical code : private int selectedtab; private string query; public void onmoduleload() { string token = history.gettoken(); if (!strings.isnullorempty(t...

datetime - Converting date/time and generating offsets in bash script -

i need script date/time conversion. should take input particular time. should generates series of offsets, in both hour:minute form , number of milliseconds elapsed. for 03:00, example, should give 04:02:07 (3727000ms*) 05:04:14 (7454000ms), 06:06:21 etc... how go doing bash script? ideally work on both mac os x , linux (ubuntu or debian). (1hr * 60 minutes/hr *60 seconds/minute *1000ms/sec )+(2min*60 sec/min * 1000ms/sec)+(7sec*1000ms/sec) = (60*60*1000)+(2*60*1000)+(7*1000) = 3727000 time2ms () { local time=$1 hour minute second hour=${time%%:*} minute=${time#$hour:} minute=${minute%:*} second=${time#$hour:$minute} second=${second/:} echo "$(( ( (10#${hour} * 60 * 60) + (10#${minute} * 60) + 10#${second} ) * 1000 ))" } ms2time () { local ms=$1 hour minute second ((second = ms / 1000 % 60)) ((minute = ms / 1000 / 60 % 60)) ((hour = ms / 1000 / 60 / 60)) printf '%02d:%02d:%02d\n' "$hour" ...

python - subprocess.call() interacting with GUI (Tkinter) -

is there way use subprocess.call() or subprocess.popen() , interact stdin via tkinter's entry widget, , output stdout text widget? im not sure how approach this, new using subprocess module. think i've got basics of using entry stdin subprocess. may have jiggle own needs (re: output text widget). this example calls test script: # test.py: #!/usr/bin/env python = raw_input('type something!: \n') #the '\n' flushes prompt print that requires input (from sys.stdin ) , prints it. calling , interacting via gui done with: from tkinter import * import subprocess root = tk() e = entry(root) e.grid() b = button(root,text='quit',command=root.quit) b.grid() def entryreturn(event): proc.stdin.write(e.get()+'\n') # '\n' important flush stdin e.delete(0,end) # when press return in entry, use stdin # , remove e.bind("<return>", entryreturn) proc = subprocess.popen('./test.py',stdin=...

php - Query that pulls results from tables A and B, then uses results to get rows from table A -

someone gave me query below previous question asked on stack overflow. it's supposed pull "submissionid" 2 tables, called submission , addresses , zip = '$zip' . (both "submissionid" , "zip" appear in 2 tables.) then, field "title" corresponded of these "submissionid"s. field "title appears in table submission . then, query generate list of of resulting "title"s. how modify query this? query below seems omit results submission . $sqlstr = "select s.title, s.points, s.submissionid submission s inner join addresses ad on ad.submissionid = s.submissionid ad.zip = '$zip' order s.points desc, s.title asc"; just add or s.zip = '$zip' where clause. little additional tidying, query becomes: select submission.title, submission.points, submission.submissionid submission join addresses using (submissionid) submi...

ubuntu - Advice for running IAR Embedded Workbench for Arm with Dongle in Linux -

i running ubuntu 10.04 , wine 1.2. able install iar software unable locate dongle license. there anyway use dongle license in wine ubuntu or have use pc license? thanks in advance.. iar doesn't support running it's software on linux, have read somewhere able launch iar embedded workbench msp430 using wine. regarding license, far remember, need enter serial number , code goes it.

ruby on rails - How can I make RABL render an attribute only if it exists in the object? -

i have restful user model , trying filter attributes included in show json response when user object being sought not current user. logic: if params[:id]==current_user json => {:name: <name value>, :birthdate: <birthdate>} else json => {:name: <name value>} end when filter attributes in controller, missingattribuiteerror following code: userscontroller def show if params[:id]==current_user.id.to_s @user=user.find(params[:id]) else @user=user.find(params[:id], :select => [:name]) end respond_with(@user) end users/show.json.rabl object @user attributes :name, :birthdate how can make rabl render attribute if exists in object? apparently easy things should easy. works. [not sure if filtering on view level better or worse filtering in controller, though.] userscontroller def show @user=user.find(params[:id]) respond_with(@user) end users/show.json.rabl if @user==current_user attributes :birthdat...

c# - Convert utf-8 XML document to utf-16 for inserting into SQL -

i have xml document has been created using utf-8 encoding. want store document in sql 2008 xml column understand need convert utf-16 in order that. i've tried using xdocument i'm not getting valid xml result after conversion. here i've tried conversion on (utf8stringwriter small class inherits stringwriter , overloads encoding): xdocument xdoc = xdocument.parse(utf8xml); stringwriter writer = new stringwriter(); xmlwriter xml = xmlwriter.create(writer, new xmlwritersettings() { encoding = writer.encoding, indent = true }); xdoc.writeto(xml); string utf16xml = writer.tostring(); the data in utf16xml invalid , when trying insert database error: {"xml parsing: line 1, character 38, unable switch encoding"} however initial utf8xml data valid , contains info need. update: initial xml obtained using xmlserializer (with utf8stringwriter class) create xml string existing object model ( engine ). code is: public static void serialise...

android - Why doesn't a PopupWindow whose layout is inflated from XML accept touch events? -

given popupwindow defined this: public class mywindow extends popupwindow implements view.ontouchlistener { mywindow(view view) { super(view); setheight(view.getmeasuredheight()); setfocusable(true); settouchable(true); settouchinterceptor(this); } public boolean ontouch(view v, motionevent event) { system.out.println("ontouch()"); return true; } } for reason, ontouch() never called. what doing wrong? how can popupwindow accept touch events? as discussed in this answer different question, popupwindow needs have background drawable explicitly set, when has been inflated xml , doesn't visually need background set. i fixed adding line: setbackgrounddrawable(new shapedrawable()); to constructor.

javascript - Class members in Backbone/Parse using each other -

var user = parse.user.extend({ // instance members }, { // types type_trainer : 1, type_athlete : 2, types: { type_trainer : 'trainer', type_athlete : 'athlete' } }); i want have type_trainer , type_athlete maintain values of 1 , 2 defined prior types object can use types object in template. if don't know parse, parse.user extension of backbone.model . thanks! what you're asking not directly possible in javascript object literals. object literals literal value on left hand / key side. the closest use type_trainer , type_athlete keys variables assign values via square bracket syntax accessing object key/value pairs: var = 1; var b = 2; var obj = {}; obj[a] = "a"; obj[b] = "b"; this result in obj object looking this: { 1: "a", 2: "b" } so this, want in code: var usermethods = { // types type_trainer : 1, type_athlete : 2 }; u...

python - GTK Application .exe wont run on Windows XP machine -

edit: windows 7 machine 64bit , windows xp 32bit i have made windows application using pygtk, xlrd, xlwt & xlutils. have converted python script .exe using py2exe , .exe exceutes , operates correctly on windows 7 laptop. my problem: when port application(and dlls) on computer running windowsxp .exe fails open. cause of .exe not working? myapp.exe.log error output: c:\users\windowsxpuser\myapp.exe:11: gtkwarning: `c:\users\windows7user\email contact manipulation\dist\lib\gtk-2.0\2.10.0\engines\libwimp.dll': %1 not valid win32 application. traceback (most recent call last): file "myapp.py", line 5, in file "gtk__init__.pyc", line 40, in file "gtk_gtk.pyc", line 12, in file "gtk_gtk.pyc", line 10, in __load importerror: dll load failed: specified procedure not found. relevant information: i use python 2.7, gtk version 2.0 the .exe generated using py2exe , perform on windows 7 laptop i have copi...

iphone - nested NavigationController causing uiview resize -

Image
i have nested navigation controller inside , causing uiview inside nested navigationcontroller resized weirdly. here few screen shots show whats going on. this both navigation bars showing, can see bottom extends further physical screen can allow. this 1 shows sub navbar main nav bar hidden.. can see there weird space above subbar looks height of status bar. i'm not sure is. lastly shows mainnavbar being shown , subbar being hidden.. the last view use, however.. if @ bottom of view got portion of a's displaying.. if view in interfacebuilder on left see interface there should more letters there strangely view not resizing fit in bound of physical view... i wondering detail supplied if can tell me how view resize correctly , fit in properly.. appreciated. i think set autoresizemask property = uiviewautoresizingflexiblebottommargin these uilabel objects, you'll last uilabel aligned bottom of uiview.

What's the standard way of swapping between UI elements in an activity in Android? -

i have activity has several views. of views remain constant, there's 1 area has different views based on actions of user. in other words, might start out 3 buttons , switch countdown timer when 1 clicked. don't think makes sense create different activities, since of ui (and logic) shared. what's standard approach in android? i'm new platform. use viewflipper or viewswitcher these best methods switch between ui elements in android. can put animation animate ui switching. user : // viewflipper private viewflipper flipview; // set flipper flipview = (viewflipper) findviewbyid(r.id.flipview); //to show next ui element flipview.shownext();

workflow - Hadoop Oozie Like Projects -

oozie workflow/coordination engine orchestrate hadoop jobs oozie workflow jobs directed acyclical graphs (dags) of actions. what other oozile workflow engines manage job chains on cluster? is there generic oozile workflow engine capable of orchestrating jobs cluster through plug-in or something? although prefer oozie checkout azkaban .

playframework 2.0 - What is Play 2.0 FakeApplication's url address -

in functional test, actual address fakeapplication()? @test public void findbyid() { running(fakeapplication(), new runnable() { public void run() { computer macintosh = computer.find.byid(21l); assertthat(macintosh.name).isequalto("macintosh"); assertthat(formatted(macintosh.introduced)).isequalto("1984-01-24"); } }); } edit andy's answers works me. @test public void findbyid() { running(testserver(3333, fakeapplication(inmemorydatabase())), new runnable() { public void run() { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://localhost:3333/endpoint"); } }); } afaict, if need url should use fakeserver instead of fakeapplication

c++ - Need a map but only need to know if contained? -

i'm wondering if there more appropriate structure needs. i need have dictionary or strings (words). need know if given word in dictionary. it seems waste of memory make map of string,string. there better way? thanks use std::set<string> . can use std::set::find check whether word exists or not.

ios - Confused on Document Based iPhone App Guide -

i'm writing 1 of first iphone apps - simple way of remembering things people. i'm following ios document called " document-based app programming guide ios " , i've gotten point query local device , icloud detect , load documents. in guide use custom class , since don't show code class, i'm confused on should like. give description of custom class "filerepresentation": the example application has array (_filelist) of custom model objects encapsulate name , file url of each of application’s documents. (filerepresentation custom class of objects.) can give example of "filerepresentation"'s class implementation like? the parts listing 4-3 , 4-4 on page " managing lifecycle of document ": listing 4-3 -(void)viewdidload { [super viewdidload]; // set add , edit navigation items here.... if (self.documentsincloud) { _query = [[nsmetadataquery alloc] init]; [_query setsearchscopes...

asp.net mvc - Can't acces Html helper classes in intellisense on MVC4 newly added page -

hmm, no mvc expert , can't seem find difference here stuck asking. i added page mvc4 app (in vs11) called test (test.cshtml) , works can't seem access html classes in intellisense. if type, example @html.beginform() shows in red underline error , when type @html. there no intellisense. can see in other pages (about.cshtml example) - use @html.whatever() can't figure out how tell new page want use classes? missing something. i found html helper not working on nested site master page isn't same - mvc4 razor don't think have code behind page? i don't know - hope don't sound dumb, said. not , mvc guy. there issue asp.net mvc 4 , areas in visual studio 2012 (though perhaps qu1). open web.config file located in areas directory, , replace instances of __ version __.0.0 2.0.0.0 system.web.webpages.razor , , 4.0.0.0 system.web.mvc .

android - Getting Facebook credentials -

i got "login facebook" option in app, needs userid, firstname, lastname, email, profile pic, sex facebook account(if logged in) , send server. searched for while not understand solutions. how can achieve this? link examples great may these links android-hackbook friends list

iphone - background app in iOS that detects incoming phone calls -

i need write background application in ios listens incoming phone calls on iphone. is possible? can suggest pointers ? thankyou this against apple's privacy policy , there's no chance app approved. there call recording apps sneak around restriction, though , use third party services , no actual built-in iphone api's.

How Can I Use A Comma Within A System() Shell Script In C++? -

i trying create app let users find processes taking memory. doing following code: system("tasklist /fi "status eq not responding""); my compiler isn't liking put commas in. this cmd command (or shell script, whatever) trying execute: tasklist /fi "status eq not responding". where should put commas? you need quote command line within system call like: system("/bin/echo \"a, b, c\"");

android - Read the status of GPS on pressing home button in oncreate() -

in application on button click i'm making gps "on" or "off" if gps on if press home button, application go background when application comes foreground once again gps should in enabled(on) position something this final locationmanager locationmanager = (locationmanager) getsystemservice(location_service); boolean statusofgps = locationmanager.isproviderenabled(locationmanager.gps_provider); if(statusofgps == true){ keep gps in "on" position } else if(statusofgps == false){ keep gps in "off" position } how can implement in oncreate() , when application starts can set gps on or off reading state help appreciated! thanks you can create new thread, periodically check (for example once every 5 seconds) status , correspondingly update gps.

Are maya referenes the same as namespaces? -

how deal references in maya? have several scripts need update handle file referenced objects. are they same namspace? thanks references pointers other scenes , used creating scene hierchies (parent scene, child scene, grandchild scene). use them aid in level creation process each time asset updated (or created), level designer doesn't have manually load them , position them in scene (a reference target , scene being referenced source). namespaces on other hand bit prefixes. assigned groups of assets, meshes, whatever , yea... nothing naming container, , allow have several items in scene same name.

javascript - Slider Caption issues (Orbit Slider) -

does knows best way make caption 1 http://i.imgur.com/nosf0.png ? i've tried firebug , achieved http://i.imgur.com/cmb3y.png when put code in html page doesn't work. knows how make in picture? thank :) hey checked page nice. here link caption of slider. try this: http://jsfiddle.net/cftee/3/ ask me if have problem.

Passing NULL from PHP to MySQL for auto increment -

so have database setup in mysql 3 columns. first column 'idnum' auto increments users id numbers. second , third first , last names respectfully. problem when go send the names db via query string in php file, couple different errors back... when send query: $sql = "insert namesdb values('null', 'firstname', 'lastname')"; $result = $db->query($sql); i error: "incorrect integer value: 'null' column 'idnum' @ row 1." because column 1 int type. but when send query: $sql = "insert namesdb values(".null.", 'firstname', 'lastname')"; $result = $db->query($sql); i syntax error... any idea on heck i'm doing wrong here?? thank help! it should be: $sql = "insert namesdb values(null, 'firstname', 'lastname')"; $result = $db->query($sql); 'null' string of "null" . though option (the 1 go with) list c...