Posts

Showing posts from January, 2014

PHP show if with different categories array or variable? -

having problems here, think overlooking simple... i have cms have multiple categories. how create variable or array has included categories groups want use in show if statement ?? so example: <?php $catsrow = array( 'cat_1' => '41','46','62', 'cat_2' => '41','45','63', 'cat_3' => '41','43','65' ); ?> <?php if (catsrow[0] || catsrow[1] || catsrow[2]) == ($row_detailrs1['category']) { echo 'do work' } else { ?> thanks in advance!! i guess asking is, how compare array multiple groups inside. need compare different grouped categories.. like $catsarray = array(cat_1 => '2,3,4' , cat_2 => '5,6,7' , cat_3 => '8,9,10') if $row['cat_from_page'] == $catsarray (any of groups) show { } ???? you may need explode parts of array kinda $parts = explode(&

python - Redirect to a Page on 404 Error -

is possible redirect page on 404 , 500 instead of constructing custom response? tried- class notfoundpagehandler(webapp.requesthandler): def get(self): #if 400 self.redirect('error/notfound.html') #if 500 how check def main(): application = webapp.wsgiapplication( [ ('/', mainpage), ('/index.html', mainpage), ('.*', notfoundpagehandler) ], debug=true) but doesn't work. you don't want redirect. want custom error page. http://code.google.com/appengine/docs/python/config/appconfig.html#custom_error_responses error_handlers: - file: default_error.html - error_code: over_quota file: over_quota.html - error_code: 404 or - error_code: 500 should work too. read link carefully, sounds

javascript - Class not being added in method when using $(this) selector -

can explain why code works: $('#fonykerusernameregister').blur(function(){ if($(this).val().length > 2) { $.ajax({ url: '<?php echo $html->url('/fonykers/validate_username',true); ?>' + '/' + $(this).val(), datatype: 'json', type: 'post', success: function(response) { if(!response.ok) { $('#fonykerusernameregister').addclass('error'); error.html(response.msg); error.fadein(); } else { if($('#fonykerusernameregister').is('.error')) { $('#fonykerusernameregister').removeclass('error'); } $('#fonykerusernameregister').a

Daemon to monitor query and send mail conditionally in SQL Server -

i've been melting brains on peculiar request: execute every 2 minutes query , if returns rows, send e-mail these. done , delivered, so far good . result set of query this: +----+---------------------+ | id | last_update | +----+---------------------| | 21 | 2011-07-20 13:03:21 | | 32 | 2011-07-20 13:04:31 | | 43 | 2011-07-20 13:05:27 | | 54 | 2011-07-20 13:06:41 | +----+---------------------| the trouble starts when user asks me modify solution that, e.g. , first time id 21 caught being more 5 minutes old, e-mail sent particular set of recipients; second time, when id 21 between 5 , 10 minutes old set of recipients chosen. far it's ok. gotcha me third time onwards: e-mails sent each half-hour, instead of every 5 minutes. how should keep track of status of mr. id = 43 ? how know if has received e-mail, 2 or three? , how ensure third e-mail onwards, mails sent each half-hour, instead of usual 5 minutes? i impression think can solved simple mathematical

flash - actionscript 3 return -

i new in actionscript 3 , have code doesn't work. can check it? want label1.text got input "hello world" <?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minwidth="955" minheight="600"> <fx:script> <![cdata[ function onbutton1click():void { label1.text = login('irakli', 'password1'); } function login(username:string, password:string){ var loader:urlloader = new urlloader(); var request:urlrequest = new urlrequest('http://localhost/hosting/index.php'); request.method = urlrequestmethod.post; var variables:urlvariables = new urlvariables(); variables.

android - Error in doBackground AsyncTask? -

i keep getting error in doinbackground() 07-20 21:05:20.859: error/androidruntime(3289): java.lang.runtimeexception: error occured while executing doinbackground() 07-20 21:05:20.859: error/androidruntime(3289): caused by: android.view.viewroot$calledfromwrongthreadexception: original thread created view hierarchy can touch views. here asynctask method. private class mytask extends asynctask<void, void, void>{ @override protected void doinbackground(void... arg0) {try { getimages(); log.v("mytask", "image 1 retreived"); getimage2(); log.v("mytask", "image 2 retreived"); getimage3(); log.v("mytask", "image 3 retreived"); getimage4(); log.v(&

mysql - Selecting X oldest date from the database -

good afternoon please can me, i’m total noob. have simple db has thousands of rows , few columns. have id, name, image, information, , date added. basic! now i’m trying display single row of data @ time there no need loops , things in request. sounds simple in theory?. i can display row in date order, , recent or oldest, ascending or descending. want able display example: = 6th newest entry. , perhaps somewhere else on sites 16 recent entry , on. 1232 recent entry. sounds me common task can’t find answer anywhere. can provide me short command doing this? missing daft , fundamental. thanks leah the limit clause can used constrain number of rows returned select statement. limit takes 1 or 2 numeric arguments, must both nonnegative integer constants (except when using prepared statements). with 2 arguments, first argument specifies offset of first row return, , second specifies maximum number of rows return. offset of in

rails 3 json not rending user id -

i have simple @user = user.all user has firstname, lastname, email , devics stuff. but when render json, don't user.id. other info. format.json { render :json => @users, :except => [:encrypted_password, :last_sign_in_at, :last_sign_in_ip, :reset_password_sent_at, :reset_password_token, :remember_created_at, :sign_in_count], :include => [:profile, :authentications] } use @users.to_json(:except....) , not @users, except see api reference

c++ - Should I have to create a thread if I want to make distributed mutex library? -

i trying write simple lock/unlock algorithm behaves mutex in distributed systems c++. it implemented library , users able use using interface file. assume there 3 processes {a,b,c}. each processors knows other processes' addresses , ports , on. if a wants lock on object, has permission other processes, in case b , c . i believe sending , waiting replies b, , c won't problem, because user call function. but, how should b , , c receive message? it guaranteed processes alive. should there separate thread each processor running listening(polling) sockets? does mean if create thread in constructor, , use while process running, , destroying @ destructor fine? should there separate thread each processor running listening(polling) sockets? you should use library inter-process communication , unless intend build scratch excercise. if want build yourself, read wikipedia article , maybe chapters books on operating systems (like tanenbaum or silbe

string - str_replace problem in php -

i want strip spaces not between 2 words? script says all:) $string = " bah bah bah "; $string = str_replace("/w /w", "+", $string); // want string this: $string = "bah+bah+bah"; the idea want rid of unnecessary spaces(not @ beginning , end) can not trim whitespace , use urlencode() convert interior spaces + ? if have other characters cannot tolerate being url encoded, not work. don't know full requirements. urlencode(trim($string)); $string = " bah bah"; echo urlencode(trim($string)); // bah+bah

internet explorer - Why does enter submit a form differently than clicking submit in IE 7? -

in ie 7 zip code search form on page reacts differently when clicks submit vs pressing enter. works correctly when sumbmit clicked , incorrectly when enter pressed. http://getridofit.com <form name="zip" action="<?php bloginfo('url'); ?>" method="get"> <input type="text" id="zipper" name="locations" size="5" maxlength="5" class="junk-input" onsubmit="return checkform()" /> <input type="submit" value="" name="schedule" src="/wp-content/uploads/remove-my-junk.png" align="center" class="junk-button" style="background: #f67a3e url(/wp-content/uploads/remove-my-junk.png); border: none; width: 201px; height: 45px;"/> </form> the correct result zip search of 85718 looks this: http://getridofit.com/l/85718/?schedule pressing enter produces result this: http://getridofit.com/l/8

.net - Vb.Net - Having Problems Extracting Wildcard Value -

i've been having problems extracting value of regex in string. have string several regex expressions , need value of each expression's match. thing though, it's not returning last match correctly. example: regex pattern: i play (\s+.*?) , (\s+.*?) string: play guitar , bass the program returning value of first expression "the guitar" it's returning value of second expression "the" instead of "the bass". there way fix this? try: i play (\s+.*) , (\s+.*) .

matlab - Rounding to a power of 10 -

i have variable, taumax , want round up nearest power of ten(1, 10, 100, 1000...). using below expression find closest integer max value in tau array. finding max value because trying calculate power of ten should x axis cutoff. in cause, taumax equal 756, want have expression outputs either 1000, or 3(for 10^3). taumax = round(max(tau)); i'd appreciate help! since you're talking base 10, use log10 number of digits. how about: >> ceil(log10(756)) ans = 3

jquery - Dynamically add equal select form fields with data taken from php -

i have form select fields dynamically generated , options taken php (same selects). need every <select>...</select> must shown in different line. can done having every <select>...</select> inside <div>...</div> . this code have, it´s working select fields not within div: <script type="text/javascript"> //<![cdata[ $(function(){ var counter = 1; $("#addbutton").click(function () { if(counter>10){ alert("only 10 textboxes allow"); return false; } var select = $('<select>').attr({id:'select'+counter,name:'select'+counter}); $.ajax({ url: 'selects.php', datatype: "html", success: function(data) { select.html(data); } }); select.appendto("#textboxesgroup"); counter++; }); $("#removebutton").click(function () { if(counter==1){ alert("no more textbox remove"); return false; } counter--;

java - Passing FileWriter as a parameter to a method -

i'm sure there simple answer question, here go. i'm trying use filewriter write text file. program reads text in existing file, specified user , asks whether print text console or new file, named user. i believe problem passing filewriter "fileorconsole" method. not passing or declaring filewriter in "fileorconsole" method correctly? file created nothing written it. here code: import java.io.*; import java.util.*; public class reader { public static void main(string[] args) throws ioexception { scanner s = null, input = new scanner(system.in); bufferedwriter out = null; try { system.out.println("would read file?"); string answer = input.nextline(); while (answer.startswith("y")) { system.out.println("what file read from?"); string file = input.nextline(); s = new scanner(new bufferedreader(new filereader(file))); system.out

python - Scoping rules and threads -

this program works (i able hear text speech in action): import pyttsx import threading def saythread(location, text): engine = pyttsx.init() engine.say(text) engine.runandwait() e = (1, "please work, oh god") t = threading.thread(target=saythread,args=e,name='sayitthread') t.start() if program changed import pyttsx import threading def saythread(location, text): global engine #(changed) added global engine.say(text) engine.runandwait() e = (1, "please work, oh god") engine = pyttsx.init() #(changed) added variable t = threading.thread(target=saythread,args=e,name='sayitthread') t.start() then gets 'stuck' @ line "engine.runandwait()" , text speech doesn't work. guessing problem lies rules of scoping threads. right? want a.. 'handle' engine variable in main thread. can call engine.stop() main thread. hope made sense thanks

Rails Google Data List API AuthSub Token Invalid -

i created authentication using documents list api. have authenticated , can token allows me see documents user has, cannot upload new document. i suspect may because using secure = false gdata4ruby authsub, have changed api querying http://docs.google.com/feeds/documents/private/full . https: version doesn't work either, because requested insecure token. does know how fix this? exact error: gdata4ruby::httprequestfailed (<html> <head> <title>token invalid</title> </head> <body bgcolor="#ffffff" text="#000000"> <h1>token invalid</h1> <h2>error 401</h2> </body> </html> ): nevermind, figured out. had problem using gdocs4ruby, in source gem, authenticating google auth token, received token through authsub. therefore, have change post request not pass token label header "authsub" rather "google auth"

sample Rails Application that includes email support page with captcha -

what's quickest / easiest starting point simple rails application has main page, , email "contact us" page, captcha support? there popular base rails app download have functionality starting point? (e.g. basic informational type web site, abily user send support requests support, via web page captcha) thanks imho shouldn't use rails, nor other framework task that. simple contact form put standalone php page plus static html pages on server , you're done. if doesn't know rails yet (or other web framework written in language) pain setup such structure display contact form. take gun kill fly. btw come question, don't know project you're asking for, maybe want try yourself, it's pretty simple, need actionmailer , captcha plugin just 2 cents.

canvas - Android draw image when clicking button -

basically, have button when clicked, image appear in random coordinate.. here's code : public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); //mdrawable = getresources().getdrawable(r.drawable.icon); log.i("info", "resource got !!"); mbitmap = bitmapfactory.decoderesource(getresources(), r.drawable.icon); mcanvas = new canvas(); invoker = (button) findviewbyid (r.id.invoke); invoker.setonclicklistener(this); } public void onclick(view v) { if (v.getid() == r.id.invoke) { log.i("info", "button clicked !!"); display d = getwindowmanager().getdefaultdisplay(); log.i("info", "returning window info !!"); // todo auto-generated method stub xpos = randint.nextint(d.getwidth()); ypos = randint.nextint(d.getheight

configuring Quartz CMT jobStore using Spring datasource -

i'm trying confugre quartz jobstorecmt , use spring's datasource managed datasource. here spring's config file datasource definition: <bean id="datasource" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close"> <property name="driverclassname" value="${database.driverclassname}" /> <property name="url" value="${database.url}" /> <property name="username" value="${database.username}" /> <property name="password" value="${database.password}" /> </bean> here quartz.properties: org.quartz.jobstore.class: org.quartz.impl.jdbcjobstore.jobstorecmt org.quartz.jobstore.driverdelegateclass: org.quartz.impl.jdbcjobstore.stdjdbcdelegate org.quartz.jobstore.useproperties: false org.quartz.jobstore.datasource = managedtxds org.quartz.jobstore.nonmanagedtxdatasource = qzds org.quartz.jobstore.tablep

android - Yes/No dialog and the lifecycle -

i'm sure fundamental question, research yields nothing useful. new application needs use yes/no dialog under few circumstances, , i'm not getting how dialogs fit application lifecycle. example, create method support type of construct: if (yesnoalert("title", "do want try again?") == true) { action1(); } else { action2(); } the method this: private boolean yesnoalert(string title, string message) { final boolean returnvalue; dialoginterface.onclicklistener dialogclicklistener = new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { switch (which){ case dialoginterface.button_positive: returnvalue = true; break; case dialoginterface.button_negative: returnvalue=false; break; } } }; alertbox = new alertdialog.builder(

java - Is it possible for an Android app to modify the screen at all times? -

to give ridiculous example, have water app/service stayed on display @ times (or perhaps when not actively using application) , caused ripples occur when touched screen? not want app this, it's example. i know there live wallpaper this, in background. if wanted affect on top of icons , widgets , ui well? is possible? is possible? if write own firmware, yes. android sdk applications cannot this.

java - Adding parameters using deployjava.js from old applet -

i using deployjava.js deploy applet <script src="http://java.com/js/deployjava.js"></script><script> var attributes = {codebase: '/devel/app/webroot/jpainter/applet',code: 'painter.class', archive:'painter.jar', width:640, height:480} ; var parameters = {jnlp_href: 'plugin2.jnlp'} ; deployjava.runapplet(attributes, parameters, '1.6'); </script> the api applet says pass these params (specifically canvas) i tried this <script src="http://java.com/js/deployjava.js"></script> <script> var attributes = {codebase: '/devel/app/webroot/jpainter/applet',code: 'painter.class', archive:'painter.jar', width:640, height:480} ; var parameters = {jnlp_href: 'plugin2.jnlp', gui:'canvas.gui'} ; deployjava.runapplet(attributes, parameters, '1.6'); </script> and not correct. correct

c - Problem with select when closing socket -

i'm doing multiclient server accepts connection, forks, , gives connection child can handle it. it's multiclient server, has multiple children. the main process in infinite while makes select find out if there new incoming connection or if child trying communicate. the problem arises when close client (which connected son of main server): randomly happens client connection closed, , select gets unblocked because supposedly internal socket (which handles incoming connection between children , main server) modified, far concerned not true. happened client closed connection , child died. can give me clue of it's going on here? i'm quite lost. this code of infinite loop in main server: while (1) { /*inicializo variables para el select*/ sflag = 0; fd_zero(&readfds); fd_set(sockfd, &readfds); fd_set(sockifd,&readfds); max = (sockfd > sockifd) ? sockfd : sockifd; for(aux = isockets; aux != null; aux = aux -> next){

backwards compatibility - How to find out if CPU is ARM v5 cpu instructions compatible -

i know how identify whether or not cpu compatible arm v5 instruction set. and correct assume arm v7 instructions compatible arm v5? you can read cpuid base register partno. can use value map type of processor , instruction set implements.

iphone - How to Deselect tab when application is loaded -

i working on tabbar application. when application started, default first tab selected. what want when start application, tab bar should displayed without selected tab. say, if have 4 tabs non them selected when application launched. default first 1 selected. i want display views not part of of tabs. is possible ? thanks... yes, possible. you need create view programmatically , add view in window superview , when don't need remove form superview . [superviewname removefromsuperview]; code snippet: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // override point customization after application launch. // add tab bar controller's view window , display. [self.window addsubview:tabbarcontroller.view]; [self.window makekeyandvisible]; **additionalview** //======================= loginview ================================================ loginview=[[uiview allo

jquery to fetch the contents from a selected row in php -

here source code , not able fetch selected content when check checbox rather taking contents table ... can spot mistake in code... ur time for(k=0;k<=9000;k++) { //each change $("#status"+k).click(function() { for(j=0;j<=numoflimit;j++) { var product_name = encodeuricomponent($('#product_name'+j).val()); alert(product_name); var barcode = encodeuricomponent($('#barcode'+j).val()); var quantity = encodeuricomponent($('#quantity'+j).val()); var cart=product_name + barcode + quantity; alert(cart); $('#cart1').val(cart); } }); }); you have 2 loops here. outer 1 seems attach click handler rows (or checkboxes of each row). inner 1 makes no sense. it's result no matter checkbox click, iterate on rows , collect values.

curl - php: get content of a protected page? -

i trying html code of protected page. aiming restyle page css, need tho html code first !!! i have valid username , password. i have tried use curl, end message: "the stub received bad data" the url of page is: http://student.guc.edu.eg do have code already? need use code such this, utilising curlopt_httpauth , curlopt_userpwd specifically. $username = 'studentid'; $password = 'studentpassword'; $ch = curl_init("http://student.guc.edu.eg/"); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_httpauth, curlauth_basic); curl_setopt($ch, curlopt_userpwd, $username . ":" . $password); $html = curl_exec($ch); curl_close($ch); curlopt_httpauth the http authentication method(s) use. options are: curlauth_basic, curlauth_digest, curlauth_gssnegotiate, curlauth_ntlm, curlauth_any, , curlauth_anysafe. the bitwise | (or) operator can used combine more 1 method. if

windows phone 7 - WP7 Tombstoning and Querystring -

i running basic xml reader , pass data details page using: private void haberlerlistbox_selectionchanged(object sender, selectionchangedeventargs e) { if (e.addeditems.count > 0) { navigationservice.navigate(new uri("/news.xaml", urikind.relative)); frameworkelement root = application.current.rootvisual frameworkelement; root.datacontext = (haberitem)e.addeditems[0]; ((listbox)sender).selectedindex = -1; } } for week trying read , understand how deal tombstoning failed. managed use tombstone helper couldn't save images , webbrowser content. in earlier question: wp7 - resume page assigned . heard can save navigation url when user clicks wp7 navigate same url before. (for records:i don't use viewmodel) i view on how save url damned :) application can tombstone , can rest while :d. thanks in advance. the page uri, including querystring, restored when applicati

SQL Injection MySql in php -

i've make small demonstration how make mysql injection , how protect against them. know how protect our application then, i've question sql injection. a created simple dummy website demonstration, on i've added search field. search field isn't protected subject sql injection. i made example, how retrieve global info on database(version, current user, database name), inserting " 'union select [myinteresstingfields] [mytable]; --" , question is: what next step? possible alter database? how? don't see, because mysql_query(it's php website using cakephp) runs 1 request, how alter select request make change in database?(e.g. insert, edit or else, doesn't matter, it's show them can result). usually use injection collect admin passwords (or token emailed via password reset page), login admin part , stuff there.

Android OSM droid - set Max Zoom level -

i implementing app vith usage of osmdroid mapview. have maps max 16 zoom level, android allow have 18 zoom levels. know how set maximum zoom level 16 instead of default 18? thanks hmyzak update - have added simple setmin/maxzoomlevel() methods mapview in trunk. should included in 3.0.10. see https://code.google.com/p/osmdroid/issues/detail?id=418 additional info. original answer: create own tilesource class , use that. can piggyback on 1 of concrete tile source classes, like: public static final onlinetilesourcebase mymaptilesource = new xytilesource("my tile source",resourceproxy.string.mapnik, 0, 16, 256, ".png", ""); note "16" - specify max zoom level. but really, should create own concrete class , extend bitmaptilesourcebase. sounds using static imagery , not online imagery xytilesource for.

iphone - How to remove navigation bar from splash screen? -

i have problem in code create splash screen time interval. when execute on top of view navigation bar appeared. want hide navigation bar. how remove splash screen? - (void)loadview { // init view //cgrect appframe = [[uiscreen mainscreen] applicationframe]; cgrect appframe = cgrectmake(0, 0, 320, 480); uiview *view = [[uiview alloc] initwithframe:appframe]; view.autoresizingmask = uiviewautoresizingflexibleheight|uiviewautoresizingflexiblewidth; self.view = view; [view release]; splashimageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"ls.jpg"]]; splashimageview.frame = cgrectmake(0, 44, 320, 460); [self.view addsubview:splashimageview]; viewcontroller = [[menu alloc] init]; uinavigationcontroller *nc = [[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller]; viewcontroller.view.alpha = 0.0; [self.view addsubview:nc.view]; timer = [nstimer scheduledtimerwithtimeinterval:2.0 target:self selector:@selector(fadescreen) userinfo:nil r

xhtml - HTML/CSS: IE6, Input field expands width for hidden characters -

i have input field contained in table cell/column has fixed width, lets wide enough show 20 characters. when enter lot of text field(60 characters) width of input field stays same, width still looks expected, text entered field seems cause kind of invisible overflow brakes layout. browser expands container of input box fit text entered input field although text not shown , width of input field constant. is there plausible explanation this. how can characters never shown create overflow? happens in ie6.

asp.net - Unable to load the native components of SQL Server Compact -

i've installed sql server compact edition 4.0 on win7 x64 , runs both asp.net , desktop applications. pc have visual studio 2010 sp1 installed. server 2008 r2 produces following error asp.net applications, although can run desktop applications: unable load native components of sql server compact corresponding ado.net provider of version 8482. install correct version of sql server compact. refer kb article 974247 more details. i've tried both sqldatasource , sqlceconnection. same error. web.config below: <?xml version="1.0"?> <configuration> <connectionstrings> <add name="sqlce" connectionstring="data source=|datadirectory|\a.sdf" providername="system.data.sqlserverce.4.0" /> </connectionstrings> <system.web> <compilation debug="true" targetframework="4.0"> <assemblies> <add assembly="system.d

wcf - What is the current state of REST frameworks for .Net -

their doesn't seem canonical answer on stackoverflow listing current state of rest frameworks in .net. what current frameworks in use? wcf webhttp services in .net 4 part of official .net 4.0 framework release. wcf webhttp services flavor of wcf appropriate developers need complete control on uri, format, , protocol when building non-soap http services— services may or may not subscribe restful architectural constraints. documentation http://msdn.microsoft.com/en-us/library/bb412169.aspx example introducing wcf webhttp services in .net 4: http://blogs.msdn.com/b/endpoint/archive/2010/01/06/introducing-wcf-webhttp-services-in-net-4.aspx wcf webapi this project focuses on allowing developers expose apis programmatic access on http browsers , devices. essentially continuation of work done on wcf rest starter kit, , considered preview of wcf http services .net 5.0? wcf rest starter kit (depreciated) the new wcf web api's announced @

Can someone explain me the iphone certificate stuff, how the steps look like? -

can explain me iphone certificate stuff, how steps like? im confused... regards, mirza complete steps given deployment of app on iphone device using certificates. http://mobile.tutsplus.com/tutorials/iphone/iphone-sdk-install-apps-on-iphone-devices-for-development/ try out.

delphi 7. How to check whether the unit file exists and add it with (directives?) to compile with the project -

i have unit part of several modules(dll, applications). in of them need use in module classes. is possible use compiler directives (or other methods) include unit file in case included in project? thanks! if understood correctly, answer yes. can use conditional define in uses clause: uses {$ifdef use_mystuff} myunit, {$endif} classes, windows; and define (or not) conditional define use_mystuff in project options. see $ifdef , $define , $include directives , conditional compilation .

iphone - UITextField responder line is overlapping with border, How to position responder? -

Image
blue colored text positioning line overlapping border in uitextfield. please me out. thanks in advance. naveen. create padding , add uitextfield follows: uiview *paddingview = [[uiview alloc] initwithframe:cgrectmake(0, 0, 5, 20)]; yourtextfield.leftview = unpaddingview; yourtextfield.leftviewmode = uitextfieldviewmodealways; release padding view

Create read-only column in SharePoint 2010 -

how create read-only column in sharepoint2010 use sp designer or sp portal? i have seen nothing ui or designer make read field in list. there couple of ways through code. you can create field in list definition in sharepoint project , set read value true. article shows how works. you can set in code in feature activated method example. spfield f = new spfield(tasklist.fields, "myreadonlyfield"); f.readonlyfield = true; f.update();

shell - ulimit returns 0 as exit status... how to get 1 if process killed? -

i'm writing shell script called programs can use resources , kill machine. must prevent happening. my idea use ulimit set resource limits (first time i've ever needed use ulimit in practice) little surprised exit status of killed process 0. how can shell scripts limit resources , detect process being killed shell because exceeded limit? i'm using bash comments worth reading. a program exceeding 1 of ulimits either terminate due error (e.g. out of file descriptors, processes) or catch signal (memory, cpu time). means test exit status of program in question. ulimit ... program xs=$? case $xs in 0) ;; # fine *) if [ $xs -gt 127 ]; echo caught signal... else echo error... fi esac

ScheduledThreadPoolExecutor, how stop runnable class JAVA -

i have written following code: import java.util.calendar; import java.util.concurrent.scheduledthreadpoolexecutor; import java.util.concurrent.timeunit; class voter { public static void main(string[] args) { scheduledthreadpoolexecutor stpe = new scheduledthreadpoolexecutor(2); stpe.scheduleatfixedrate(new shoot(), 0, 1, timeunit.seconds); } } class shoot implements runnable { calendar deadline; long endtime,currenttime; public shoot() { deadline = calendar.getinstance(); deadline.set(2011,6,21,12,18,00); endtime = deadline.gettime().gettime(); } public void work() { currenttime = system.currenttimemillis(); if (currenttime >= endtime) { system.out.println("got it!"); func(); } } public void run() { work(); } public void func() { // function called when time matches } } i stop scheduledthreadpoolexecutor when func() called. there no need work futher! think should put function func() inside voter cla

Rails 3.1 asset pipeline: Ignore backup files from Emacs and other editors -

in rails 3.1 project, if edit app/assets/javascripts/users.js.coffee using emacs, emacs creates backup file named app/assets/javascripts/users.js.coffee~ (note trailing "~"). unfortunately, new rails 3.1 asset pipeline sees .coffee~ file, , injects directly generated application.js , in turn causes javascript errors in browser. i could turn off backups in emacs writing: (setq backup-directory-alist nil) ...or use: (setq backup-directory-alist `(("." . "~/.emacs-backups"))) ...to move them directory. but require every emacs user on project reconfigure emacs, undesirable. prefer configure rails 3.1 ignore files ending in .coffee~ . there easy way this? i thought defect in require_tree method; , sort of is, seems few issues filed on this: https://github.com/rails/rails/issues/1863#issuecomment-1543809 (rails) https://github.com/sstephenson/sprockets/pull/119 (sprockets) https://github.com/sstephenson/hike/issues/9 (hike, fi

SQL Server single query memory usage -

i find out or @ least estimate how memory single query (a specific query) eats while executing. there no point in posting query here on multiple queries , see if there change on different databases. there way info? using sql server 2008 r2 thanks gilad. you might want take dmv (dynamic management views) , sys.dm_exec_query_memory_grants . see example query (taken here ): declare @mgcounter int set @mgcounter = 1 while @mgcounter <= 5 -- return data dmv 5 times when there data begin if (select count(*) sys.dm_exec_query_memory_grants) > 0 begin select * sys.dm_exec_query_memory_grants mg cross apply sys.dm_exec_sql_text(mg.sql_handle) -- shows query text -- waitfor delay '00:00:01' -- add delay if see exact same query in results set @mgcounter = @mgcounter + 1 end end while issuing above query wait until query running , collect memory data. use it, run abov

ASP.NET MVC3 CSS framework -

i'm wondering, css framework best suitable asp.net mvc 3? i've tried yaml , has several drawbacks in opinion, @ least using asp.net mvc 3: uses inputs buttons default (so, not compatible jquery ui, because jquery ui uses buttons in dialogs example). you need adjust css asp.net mvc 3 validation. i don't how describe forms (well may subjective opinion regarding this, anyway need use custom editors if wish stick yaml css style). some css class names not intuitive. nothing, show stoppers, maybe there's better alternative - something, adapted asp.net mvc specifics, or may asp.net mvc project stub, adapted yaml css framework. update: oocss looking good, lightweight , structured, worth checking out. update 2: twitterbootstrap getting popular too, can asp.net mvc here http://nuget.org/packages/twitter.bootstrap i have used both blueprint ( http://www.blueprintcss.org/ ) , 960grid ( http://960.gs/ ) quite mvc. but more leaning towards "b

visual sourcesafe - VSS is not getting the correct version for asp.net -

i using vss asp.net (vs 2008) project used multiple users in multiple systems. worked first few days without issue, later showing issues listed below. showing files checked out, if user checked in. while getting latest, showing error like, file system4\vss\data\popdaaa.a not found at end, showing error message like, version not completed. my questions are if issue vss file corruption, how can fix issue. is there other version controls (for free) integrate on visual studio. tried tortoisesvn, didn't find options correctly visual studio projects. should delete vss folder , create once again. did 3 times before, still same issue. is there known issues vss or issue our systems. the vss version 8.xx here issues generating when analyse vss the project dialogs references child physical file (dpdaaaaa) missing or corrupted. project images references child physical file (spdaaaaa) missing or corrupted. project tabletools references child physical file (frdaaaaa)

Adding People or Look-up type Column to SharePoint 2010 List Breaks MS Access Linked Table -

so have custom list in sharepoint 2010 10 or columns. link list within ms access 2007. works fine until try adding look-up or people-type column list, next time refresh ms access table link following message: error: "the microsoft datbase engine cannot find object 'tmp%.mau@'. make sure object exists..." blah, blah, blah then of course, data inaccessible through ms access after point. if go sharepoint , delete new column, starts working again in ms access. i can add other kind of columns, , works fine. what gives? there s limit number of people columns can have in ms access linked sharepoint list? ======== new information so deleted of data sharepoint list, , error went away, no matter how many people columns added. add single record in, error returns... :( found solution. the error stems "hidden" threshold limit set within sharepoint central administration limits number of lookup columns returned within given query. me

c# - Obtain USB device hub and port location property -

when looking under device manager @ network adapter settings, general tab displays location property such port_#0004.hub_#0005 . how go retreiving property in either c# or c++? you can use setupdigetdeviceregistryproperty function spdrp_location_information property.

css3 - CSS 3 background-size not working on IE9 -

background-image:url(yellow.jpg); background-size:180px 180px; background-repeat:no-repeat; the above mentioned css works perfect on chrome ie9 unable scale images + display images correctly are sure ie runs in ie9 mode? code works image tried. (f12 open developer window)

Django - Model graphic representation (ERD) -

i'm searching way represent django project model graphically. is there application kind of erd (diagram) ? update following @etienne instructions here example of how view pdf representing models of django project $ python manage.py graph_models app1 app2 ... | dot -tpdf | evince it generates dot data applications (app1, app2, ...) passes result dot output pdf format opens output evince if want extract uml diagram django models can use graph models command of django-extensions . 1 same thing: django-graphviz . if want create django models uml: uml-to-django . and create uml diagrams, there's dia , yed , argouml you can check list of tools.

jsp - Is it really the case that Eclipse prevents packaging of an entire web directory if any file in that directory has warnings? -

i had collection of jsp files in subfolder of tomcat 7 app created using eclipse wtp 3.3.0. i including these using standard <jsp:include page="foo/bar/baz.jsp" /> directives. this worked until 1 of files ended dodgy bit of html upset eclipse's html validator: <div class="clear" /> instead of: <div class="clear"></div> this caused both foo , bar have warning symbols in project explorer view and, more worryingly, cause tomcat no longer able find baz.jsp or other files inside bar . properly closing div off fixed problem , allowed tomcat find files during include execution. i find hard believe eclipse refuses package folders warnings associated, seems case. it? , there way disable behaviour (preferably without disabling warnings themselves)?

adobe - Flex 4.5: States vs Components -

can suggest me when use states , when use custom components? advantages , disadvantages of using these methods? one problem see using states in flex 4.5 is, includein property cumbersome if there many states , needs set individual container/controllers. thanks anji doesn't use of states groups solve problem , clarify combersome mess?

android - How to hide some controls in LIstview -

i have listview controls inside it. situation want hide few controls on particular "listview item" .. you can either in getview() or iterate through listview items , in particular item, use parent view operations on child views. if iteration make use of asynctask . something this: private class ui extends asynctask <view, string, view> { public view viewitem=null; public ui(view v) { this.viewitem=v; } @override protected view doinbackground(view... arg0) { return viewitem; } @override protected void onpreexecute() { for(int = 0; <= listview.getlastvisibleposition(); i++) { if(listview.getchildat(i)!= null) { (listview.getchildat(i).findviewbyid(r.id.go)).setvisibility(view.gone); (listview.getchildat(i).findviewbyid(r.id.remove)).setvisibility

c# - How can you (programmatically) add a label to an Excel outlining group? -

i'm looking means of adding label excel outlining group. by mean: can group rows or columns in excel. left '+' or '-' icon allowing expand or contract group. problem when group contracted, there no way of knowing in group. looking way of adding label group users know expanding reveal.

Insert row to MySQL Table using PHP Form -

i user able insert "bid" mysql table using php form - demo, not live purpose. following error message, error: have error in sql syntax; check manual corresponds mysql server version right syntax use near ''90','2011-07-13'' @ line 3 (line 3 refers tag?) figure doesnt form inputs being "text" type, no idea how fix - advice welcome, form & php code below; <form action="insert.php" method="post"> <div><label for="commodity">commodity</label><input type="text" name="commodity"/></div> <div><label for="region">region</label><input type="text" name="region"/></div> <div><label for="member">member</label><input type="text" name="member" /></div> <div><label for="size">size</label><input type="int

iphone - How to rebrand an App in xCode -

apple forwarded me nice legal letter them-who-must-not-be-named , wondering best way rebrand app: 1) without loosing previous users == i.e. old no-no app should become updated new rebranded one 2) getting rid of references name bug them-who-must-not-be-named my steps taken far: changed graphics went plist file , changed bundle display name now questions: what happens if change bundle identifier? can leave old problematic name in there? or problems? what happens if change bundle name? will have effect on old user's data structure, i.e. app crash if app looks in folder old name of app? changing bundle display name , graphics should enough, bundle identifier isn't exposed user , must remain same because otherwise treated new app (and application loader complain bundle identifier doesn't match).

multithreading - WP7 App Updating observable collections from service & updating UI -

hi im making app trackers other users movements , uploads own i'm downloading collections service repeatably i want assigning data collections on phone doing stuff these collections(such triangulation of proximity) , calling these locations update map.. whats best way go doing this, avoid conflicts access observable collections ? by avoiding conflicts presume mean threading issues? if case, make sure use dispatcher move work updates ui onto ui thread: dispatcher.begininvoke(() => { myobservablecollection.add(mydataitem); }); you can obtain reference dispatcher ui control

cocoa - Documented Methods of Retrieving System Information -

i looking allowed or documented apis let me gather basic system , hardware information (cpu speed, ram, etc..) os x application, information available in system profiler, rather programmatically retrieve data in way apple ok with. i have searched around , not found anything, wondering if knows different. use command-line tool system_profiler comes every mac. system_profiler -xml will dump same info standard gui system profiler app in nice xml format.

wcf ria services - Custom sort in domaincollectionview -

i'm using dcv property in view model. works fine custom sort? have string property in model should sorted alphanumerically. how can achieve such thing? upd: model: public class mymodel { ///... public someproperty {get;set;} } xaml: <data:datatextcolumn binding={binding path=someproperty}, canusersort=true /> when sorting within datagrid, property gets sorted disregard alphanumeric order, i.e. in regular string way. i'd apply custom sort, e.g. introducing own icomparer. no api available @ least know of it. clues? the domaincollectioview has special collection: sortdescriptions you add next code in viewmodel: dcv.sortdescriptions.add(new sortdescription("someproperty ", listsortdirection.ascending));

c# - Common.Logging config exception -

i'm getting following exception when try call var log = logmanager.getlogger(this.gettype()); a first chance exception of type 'common.logging.configurationexception' occurred in common.logging.dll an unhanded exception of type 'common.logging.configurationexception' occurred in common.logging.dll additional information: failed obtaining configuration common.logging configuration section 'common/logging'. this .net 4 application references log4net.dll common.logging.dll common.logging.log4net.dll my app.config has following: <?xml version="1.0"?> <configuration> <startup> <supportedruntime version="v4.0" sku=".netframework,version=v4.0"/> </startup> <configsections> <sectiongroup name="common"> <section name="logging" type="common.logging.configurationsectionhandler, common.logging&qu

How to compare values within an array in Python - find out whether 2 values are the same -

i have array of 50 integers, , need find out whether of 50 integers equal, , if are, need carry out action. how go doing this? far know there isn't function in python there? if mean have list , want know if there duplicate values, make set list , see if it's shorter list: if len(set(my_list)) < len(my_list): print "there's dupe!" this won't tell duplicate value is, though.