Posts

Showing posts from July, 2011

c# - A dependent property in a ReferentialConstraint is mapped to a store-generated column. Column: 'ID' -

c# - A dependent property in a ReferentialConstraint is mapped to a store-generated column. Column: 'ID' - i can't figure out why error when seek add together venue object , phone call savechanges(). difference in model venue objects 1 1..0 relation city. city city = processcitycache(ev, country, db); // after call, 'city' persisted. venue = new venue { ticketmasterurl = ev.venueseolink, name = capitalize(ev.venuename), city = city }; db.venues.addobject(venue); db.savechanges(); // exception thrown here. any insight appreciated! (open image in own tab/window see total size) i found problem. fault. had fk_venue_city relationship set city.id -> venue.id wanted city.id -> venue.cityid . made alter in database updated model. c# .net entity-framework entity-framework-4

php - Upload three versions of an image, full size, thumbnail and resized -

php - Upload three versions of an image, full size, thumbnail and resized - so far, i've been uploading 1 image hand (ftp server when live, locally moving file), , resizing them on fly using img tag's width , height properties resize them. well, images don't good, because need square, cropped 100px version thumbnail, , 800px wide version view image page, , full-size original image hd viewing, need apply watermark, total res version. , need help image upload script. sort of file upload, really. i've looked @ tutorials, , don't seem create much sense. furthermore, need drop 3 versions database row (which think can figure out). know need utilize $_file it, i'm confused actual usage , cropping/resizing/watermarking part has me stumped. solutions, anyone? file uploading upload using simple html form , utilize php manipulate image. example read images stored in directory , convert them in batch. example image re-sizing use imagemagick or gd l...

Cant access PHP generated files via FTP -

Cant access PHP generated files via FTP - i have form uploads files , stores them in uploads folder in httpdocs folder. however, if seek delete or rename 1 of files via ftp, wont allow me. why? the user web server runs ( apache , or perhaps www-data or httpd apache) owns php-created files. permissions on them may prevent ftp user writing them. php ftp

objective c - creating an object and setting a retaining property -

objective c - creating an object and setting a retaining property - how should set retained property when creating object using alloc , init? (without using autorelease) with line in header (and corresponding @synthesize line in implementation): @property(retain)uiwebview *webview; these 3 options have (i think): uiwebview *tempwebview = [[uiwebview alloc] init]; [tempwebview setdelegate:self]; tempwebview.hidden = yes; self.webview = tempwebview; [tempwebview release]; (this 1 seems best concerning memory management it's more lines of code , involves stupid variable name, decrease in readability) self.webview = [[uiwebview alloc] init]; [self.webview release]; [self.webview setdelegate:self]; self.webview.hidden = yes; (this 1 it's more obvious whats happening memory management doesn't seem great, xcode's analyser doesn't it) webview = [[uiwebview alloc] init]; [self.webview setdelegate:self]; self.webview.hidden = yes; (this 1 ...

objective c - releasing a NSMutableArray is causing EXC_BAD_ACCESS error -

objective c - releasing a NSMutableArray is causing EXC_BAD_ACCESS error - so when seek run next code, end exc_bad_access error. happens when seek release nsmutablearray retrievedanalysisdatalist. array list of retrievedanalysisdata objects. if seek either release info list or if set init autorelease, same result. i'm kinda guessing has sorting section of code since don't have issue retrievedanalysisidarray. any ideas? if (tempdict != null) { nsmutablearray *retrievedanalysisdatalist = [[nsmutablearray alloc] init]; nsmutablearray *retrievedanalysisidarray = [[nsmutablearray alloc] init]; (id key in tempdict) { retrievedanalysisdata = [[retrievedanalysisdata alloc] init]; retrievedanalysisdata.createdate = [[tempdict objectforkey:key] objectforkey:@"createdate"]; retrievedanalysisdata.id = [[tempdict objectforkey:key] objectforkey:@"id"]; retrievedanalysisd...

php - Drupal 7 date string block not translated to Arabic -

php - Drupal 7 date string block not translated to Arabic - i have custom block standard arabic content using php input format, , tested below no avail @ windows: setlocale(lc_all,'ar'); echo iconv('iso-8859-1', 'utf-8', strftime('%b', time())); // output july setlocale(lc_all,'ar'); echo date(t('f')); // output july, can not find string @ admin/config/regional/translate/translate setlocale(lc_all,'ar'); echo utf8_encode(strftime('%b')); // output july i expected يوليو or equivalent @ arabic. does have hint standard arabic date? i ended using http://api.drupal.org/api/drupal/includes--common.inc/function/format_date/7, , resolved problem. no need screw set_locale. don't have translate string, either. love drupal. php drupal

python - Subclass-safe class variable -

python - Subclass-safe class variable - i can do: class t(object): = 5 # utilize value somewhere in function def p(self): print id(i), t.i .. but, if happen subclass t .. class n(t): pass .. n.i in fact t.i . found way deal this: class t(object): = 5 def p(self): print self.__class__.i .. right , sure work? or can produce unexpected behavior in situations (which unaware of)? self.__class__.i right , sure work (although i poor naming choice). if method access i not utilize self, can create class method, in case first parameter class , not instance: class t(object): = 5 @classmethod def p(cls): print cls.i to read attribute, can utilize self.i safely too. alter value, using self.i = value alter attribute of instance, masking class attribute instance. python

html - Text larger that rest in php code -

html - Text larger that rest in php code - i have php code display items database. works fine , have styled how need within code word 'comments' displayed larger rest. ive played around code ir either displays error message or adds more text larger text <div class='entry'> <span class='link'> <?php echo $row['title']; ?><br/> <?php echo $row['message']; ?><br/> <?php echo $row['author']; ?><br/> <?php $row['posted'] = date("js m y h:i",$row['posted']); echo $row['posted']; ?><br/> <?php echo "<a href='msg.php?id=$row[id]'/> comments $row[replies]</a>" ?><br/> <?php echo "likes: " . $row['votes_up'] . " "; echo "dislikes: " . $row['votes_down'] . "<br />"; ?> </span> it displayed in row 5 'co...

Setting Order Status and adding custom carriers in Magento 1.5.1.0 -

Setting Order Status and adding custom carriers in Magento 1.5.1.0 - i trying create order , assign shipping no order when order placed. see when have invoice created , shipment added , magento sets order status 'complete' automatically. tried alter status manually wouldn work. $order = mage::getmodel('sales/order'); $order->loadbyincrementid($orderid); $order->setstate(mage_sales_model_order::state_processing, true); $order->save(); could 1 suggest me how on come this? also, how add together custom carrier ? default ones dhl, fedex , ups.. want add together 1 similar them. how doing it: $carrier = "dhl"; $title = "dhl"; $tracknumber = '538099'; if (1) { $itemsqty = $order->getitemscollection()->count(); $shipment =mage::getmodel('sales/service_order',$order)->prepareshipment($itemsqty); $shi...

php - preg_replace first match pattern include slash -

php - preg_replace first match pattern include slash - how remove first pattern match when string content "/" $a = "abc/def"; $b = "abc/def/ghi/abc/def"; $result = "/ghi/abc/def"; when replace "abc/def" fist match seek not work. $x = preg_replace('/'.$a.'/', '', $b, 1); you have maintain in mind first argument of preg_replace regex pattern, can't pass string it. first need escape regex characters function preg_quote try: $a = "abc/def"; $b = "abc/def/ghi/abc/def"; $pattern = preg_quote($a, '/'); // sec argument allows escape delimiter chars, $x = preg_replace("/$pattern/", '', $b, 1); php regex

jquery - Using Uploadify with Spring MVC -

jquery - Using Uploadify with Spring MVC - i trying utilize uploadify plugin spring mvc in order upload bunch of files. authenticated request keeps getting denied because when flash based plugin makes request, lacking session id. there bunch of examples on how create work php.. couldn't find help case in forum. ideas? $('#uploadify_upload').uploadify({ 'uploader' : '../js/uploadify.swf', 'script' : '/myproj/fileuploader/upload, 'cancelimg' : '../images/uploadify-cancel.png', 'auto' : false, 'multi' : true, 'scriptaccess' : 'always', 'checkexisting': false, 'oncomplete' : function(event,id,fileobj,response,data) { alert("complete"); }, 'onerror' : function(event,id,fileobj,errorobj){ alert("error"); } }); }); function handle(){ $('#uploadify_upload...

php - Converting to and from CENTS -

php - Converting to and from CENTS - so know there have been multiple questions regarding money , converting , cents. heck have asked one, want create different question hope there no duplicates out there. so have created function takes dollar value , sends cents. think have slight problem code , hoping can tweaked little. $money4 = "10.0001"; // converted cents, can see it's off. $money41 = "1001"; // when "1001", get's set in database, , homecoming money variable. // get, "$10.01"... have leak in amounts... rounded sec point. so have done, have used functions made this. // gets dollar figure, or cent's figure if requested. function stripmoney($value, $position = 0, $returnas = "") { // have decimal? if(isset($value) && strstr($value, ".")) { // strip out numbers, decimals , negative $value = preg_replace("/([^0-9\.\-])/i","",...

java - why the following program can work under JLS spec on JVM memory model -

java - why the following program can work under JLS spec on JVM memory model - on jls 3, 17.5 final field semantics's sec give-and-take part: http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.5 it said mys can equals "/tmp", can not understand this. 1 can give more explain? point illustration tells, mean if want share global.s between multi thread, need create final(if final, can not alter after construction) or need sync when read , write? or declare string array length 1 , final can changed , shared?? the original contents in jls: consider next example. 1 thread (which shall refer thread 1) executes global.s = "/tmp/usr".substring(4); while thread (thread 2) executes string mys = global.s; if (mys.equals("/tmp"))system.out.println(mys); the explain in jls: string objects intended immutable , string operations not perform synchronization. while string implementation not have info races, other ...

continuous integration - help setting up a CI environment using jenkins, rvm and cucumber -

continuous integration - help setting up a CI environment using jenkins, rvm and cucumber - i new ci , thoughts , input on how go problem. first start off have been wrestling 2 days(and don't have much background in sys ad) please play nice?(i front-end web dev) :) basically plan install jenkins create ci env these steps: poll changes github if there are, run build script: a. migrate development , test dbs?(does mean have set config/database.yml in repo?) b. run cucumber c. if tests pass go 3, else fail run rake setup stuff run server(deploy) i have done of stuff cheating: in local, switch rvm right 1 need(rvm utilize 1.8.7-p174@mygemset) run jenkins(java -jar jenkins.war) gets rvm ruby default run spork in separate terminal(because reason cucumbers don't run without spork - that's problem) build project manually clicking build so basically, want automate these stuff. maybe need set of steps follow(general or specific, depending on taste) can setup ci ,...

java - AsyncTask thread still there after execute, is that normal? -

java - AsyncTask thread still there after execute, is that normal? - when utilize asynctasks checking in ddms, thread persist in memory waiting thread after onpostexecute() method, normal?. here simplified activity reproduces problem: package com.example.async; import android.app.activity; import android.content.intent; import android.os.asynctask; import android.os.bundle; import android.util.log; public class asynctaskexampleactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); new exampleasynctask().execute(); } private class exampleasynctask extends asynctask<void, void, void> { @override protected void doinbackground(void... params) { (int =0; i<50000;i++){ int j=i*2; } homecoming null; } protected void onpostexecute(void result) { log.d("...

php - Retrieve multiple checkboxes stored as an array -

php - Retrieve multiple checkboxes stored as an array - i working on form contains multiple checkboxes (each own value). lastly checkbox marked "other" and, when checked, text input should appear allow user write his/her own value. <input name="pvital[]" type="checkbox" id="pvital[]" value="i &amp; o" />i &amp; o<br/> <input name="pvital[]" type="checkbox" id="pvital[]" value="daily weight" />daily weight<br/> <input name="pvital[]" type="checkbox" id="pvital[]" value="foley catheter" />foley catheter<br/> <input name="pvital[]" type="checkbox" id="pvital[]" onclick="showhide(whatever);" value="" />other<br/> <input name="pvital[]" type="text" id="whatever" style="visibility: hidden;" /> i insert...

linux - BASH: Global variables aren't updateable in a function only when that function is piped (simple example) -

linux - BASH: Global variables aren't updateable in a function only when that function is piped (simple example) - this smells buggy, probably, can explain it: the next script doesn't work, output below: #!/bin/bash global_var="old" myfunc() { echo "func before set> $global_var" global_var="new" echo "func after set> $global_var" } myfunc | cat echo "final value> $global_var" output: func before set> old func after set> new final value> old now, take off | cat , works! #!/bin/bash global_var="old" myfunc() { echo "func before set> $global_var" global_var="new" echo "func after set> $global_var" } myfunc echo "final value> $global_var" output: func before set> old func after set> new final value> new a pipe creates subshell. it's said in bash manual subsh...

ajax - Ajaxify hyperlink so on success will load content otherwise redirect as default -

ajax - Ajaxify hyperlink so on success will load content otherwise redirect as default - i have <a href> hyperlink. used jquery clicking link load contents div in current page (i.e. remain in same page), , works now. however want that, if request fails, link deed , go href url. i tried e.preventdefault(); , homecoming false; in success: callback function, not in right scope. if place e.preventdefault() in calling function, can't reverse effect later. here code: $('a.more-link').click(function(e){ var postid=$(this).closest('div.post').attr("id").replace(/^post-(.*)$/,'$1'); var postcontent=$(this).parent(); $.ajax({ url:"?action=ajax_load_post&id="+postid, success:function(data){ postcontent.html(data); // can't access e.preventdefault, nor homecoming false; }, error:function(data){ } }); e.preventdefault(); }); d...

debugging - Android Development: Writing a for loop inside onClick with Intent -

debugging - Android Development: Writing a for loop inside onClick with Intent - i trying application run 5 times after user presses designated button, runs 1 time , prints out debugging statement (log.v) 5 times. what right format this? this tried: button btnstart = (button) findviewbyid(r.id.startservice); btnstart.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { (int = 0; < 5; i++) { intent intent = new intent(currentclass.this, different.class); intent.addflags(intent.flag_activity_new_task); startservice(intent); finish(); log.v(tag, "testing"); } } }); edit: i tried create service task 5 times, after first time, java.io.ioexception: invalid preview surface. when mmediarecorder.prepare() called, , startrecording() called again. your service has not yet had chance finish when for() loop runs 5 times. need implement communication between ui , service - allow service send message when it's done can phon...

validation - play framework mandatory item -

validation - play framework mandatory item - is possible automatically set * before required field label? in illustration firstname required (@required in model) , hence * should shown after firstname in label. sample code: #{field 'user.firstname'} <div class="field"> <label for="${field.id}">&{'customer.firstname'}${field.}</label> <input id="${field.id}" size="30" type="text" name="${field.name}" value="${field.value}" class="${field.errorclass}" /> <span class="error">${field.error}</span> </div> #{/field} you need edit #{field /} tag recognize field annotations , draw * automatically. or extend jqvalidate module add together via javascript. validation playframework

ruby on rails - RVM remove all rubies and all corresponding gemsets -

ruby on rails - RVM remove all rubies and all corresponding gemsets - how remove rubies , corresponding gemsets. possible source file rubies , gems removed. i tried rvm implode it seems removed rvm also. rvm remove all should you. the alternative reinstall rvm after implode , doesn't take long. ruby-on-rails rvm

algorithm - How to get the number of years, months, days, hours and mins of a certain number of seconds? -

algorithm - How to get the number of years, months, days, hours and mins of a certain number of seconds? - given arbitrary number of seconds, how can number of years, months, days, hours , mins? the algorithm should first compute maximum number of years, number of months , on... what efficient way this? it's downwards plain division. may know... a min has 60 seconds: number_of_minutes := floor(number_of_seconds / 60) an hr has 60 minutes: number_of_hours := floor(number_of_minutes / 60) or number_of_hours := floor(number_of_seconds / (60 * 60)) a day has 24 hours (at to the lowest degree usually... see below.) a month has between 28 31 days. a year has 365 or 366 days, or 365.2425 days on average. the lastly 2 mentioned may require think more stated problem. either define "average" month, allows "x seconds equal y average months"; or don't convert seconds months @ all. (thinking it, if talking astronomer or alike, tell d...

objective c - Execute method when IUScrollView finishes scrolling iPhone/iPad -

objective c - Execute method when IUScrollView finishes scrolling iPhone/iPad - i have uiscrollview command , execute method when user finishes scrolling. alternative utilize touchesended delegate method called when uiscrollview finishes scrolling. if user scrollers fast , allow go it's finger scroller go on scroll , decelerate until no longer moves. when phone call method. how that? you can utilize delegate scrollviewdidenddecelerating: iphone objective-c ipad uiscrollview

c++ - iterator class: compiler error in g++ while doing iterator add or subtract (works in VS2010) -

c++ - iterator class: compiler error in g++ while doing iterator add or subtract (works in VS2010) - i implementing array in c++ (for various reasons, 1 of them know custom iterators). while testing out noticed not compile in g++ 4.4 works fine in visual studio 2010. i have included illustration programme below. in that, print out lastly 1 value of toy array implemented using templates accompanying iterator class. compiler error following: $ g++-4.4 -ansi -wall -std=c++0x mybuffer.cpp -o mybuffer in file included /usr/include/c++/4.4/bits/stl_algobase.h:69, /usr/include/c++/4.4/memory:49, mybuffer.cpp:1: /usr/include/c++/4.4/bits/stl_iterator.h: in fellow member function ‘std::reverse_iterator<_iterator> std::reverse_iterator<_iterator>::operator+(typename std::iterator_traits<_iter>::difference_type) const [with _iterator = cmyitr<cmybuff<double>, double>]’: mybuffer.cpp:205: instantiated here /usr/incl...

strange behaviour of getElementById() and .split() method in Javascript -

strange behaviour of getElementById() and .split() method in Javascript - <html> <script type="text/javascript"> function createcookie(name,value,days) { if (days) { var date = new date(); date.settime(date.gettime()+(days*24*60*60*1000)); var expires = "; expires="+date.togmtstring(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; }; function executefunc() { var cookiedata=document.cookie.split(';'); for(entry in cookiedata) { createcookie(cookiedata[entry],"",-1); //clear cookie first } createcookie("node-1","1",365); createcookie("node-2","1",365); createcookie("node-3","1",365); alert("the cookie contains : " + document.cookie); var cookie=document.cookie.split(';'); for(ele in cookie) ...

c# - Sending Files via Socket -

c# - Sending Files via Socket - i'm writing code can connect remote machine. i'm using sockets. machine runs files *.hex extension. reloads .hex files every 10 seconds. i'm creating loop programme c# sends *.hex files every 10 seconds. the problem is, how can send files using socket? you can utilize beginsendfile method. c# sockets networking file-upload

c# - SQL Server remote connection problem -

c# - SQL Server remote connection problem - i installed sql server 2005, , crated 1 user. i able connect same systen, while connecting other scheme on lan showing error below login failed user xxxx. user not associated trusted sql server connection. i googled issue nil sorted out me. posts on stackoverflow, mention utilize sql server , windows authentication didn't help. maybe there step have accomplish... seek enable tcp/ip trasport on configuration in sql server surface area configuration. this link can help : configure ms sql server 2005 c# sql-server

javascript - Google Maps API delay in loading variable -

javascript - Google Maps API delay in loading variable - i trying utilize google maps api fetch city name zipcode. not strength (i'm more of php person), using sample code found, modifications suggested friend. the problem is, after phone call function global variable city name still @ it's initialized value of null. if, however, alert value, rest of processing has right value loaded! tried putting in time delay see if google slow in returning value, makes no difference. here's function: var geocoder = new google.maps.geocoder(); function getgoogleaddress(zipcode) { //var gcity = "n/a"; switch using global var defined above geocoder.geocode( { 'address': zipcode}, function (result, status) { (var component in result[0]['address_components']) { (var in result[0]['address_components'][component]['types']) { if (result[0]['address_components'][component]['types...

ios4 - iOS 4.2.1 and below shows images but iOS 4.3.3 doesn't -

ios4 - iOS 4.2.1 and below shows images but iOS 4.3.3 doesn't - i have weird problem, have 2 testing devices running same app , each has different outcome. both images loaded straight cms server. images on devices shown below. ios 4.2.1 loads page , image displays clearly ios 4.3.3 loads page image displays black i have no thought why this, using xcode 4.0.1. have set target build ios 4.0. wish upgrade xcode, afraid mess ever configs have , unable work. therefore, advice appreciated *currently images not ready yet, seek create work , update question ios 4.2.1 ios 4.3.3 at first glance sounds target issue. images included in target ios 4.3.3? what kind of page loading? you install latest , greatest xcode in different location, won't mess current install. can have multiple xcode versions installed? image ios4 deployment

php - How to get my session to write to apache -

php - How to get my session to write to apache - i switched servers recently, , home page won't work. gives next text: warning: session_start() [function.session-start]: open(/var/lib/php/session/sess_eqbchncji8kj22f0iqa9g3v7u2, o_rdwr) failed: permission denied (13) in /var/www/vhosts/alt.alternativedc.com/httpdocs/index.php on line 6 warning: unknown: open(/var/lib/php/session/sess_eqbchncji8kj22f0iqa9g3v7u2, o_rdwr) failed: permission denied (13) in unknown on line 0 warning: unknown: failed write session info (files). please verify current setting of session.save_path right (/var/lib/php/session) in unknown on line 0 i assumed meant session folder not writable, ran next command after ssh-ed server: chmod o+rw /var/lib/php/session that didn't seem solve problem. not sure now... try changing session save path in php config file, /tmp location. php.ini session.save_path = /tmp http://www.php.net/manual/en/session.configuration.php#ini.ses...

asp.net mvc - MVC3 maproute where first value of URL is querstring for default controller and action -

asp.net mvc - MVC3 maproute where first value of URL is querstring for default controller and action - i want create route this: routes.maproute( "default", // route name "{s}", // url parameters new { controller = "home", action = "index", s = urlparameter.optional } ); where s parameter default controller , action.. possible? settle like: routes.maproute( "default", // route name "{controller}/{action}/{s}", // url parameters new { controller = "home", action = "index", s = urlparameter.optional } ); routes.maproute( "qmap", // route name "sc/{s}", // url parameters new { controller = "home", action = "index", s = urlparameter.optional } ); but neither work.. suspect because first element/paramater expected...

Why is my plug-in built with Ocean/Petrel 2010.2.2 not working with 2010.2? -

Why is my plug-in built with Ocean/Petrel 2010.2.2 not working with 2010.2? - we have built plug-in latest ocean/petrel hotfix: 2010.2.2. our tests work ok. plug-in crashes when used 2010.2. advice anyone? ocean/petrel releases classified follow: major releases: 2009.1, 2010.1, 2011.1 minor releases, or patches: 2009.2, 2010.2, 2011.2 hot fixes: 2010.2.1, 2010.2.2 major releases not binary compatible: plug-in compiled against 2009.1 needs recompiled work 2010.1. 2 year api stability, should recompilation. might have warnings obsolete apis deprecated in next release, should quick task. minor releases backward binary compatible: petrel 2010.2 able run plug-in compiled 2010.1. forwards binary compatibility not ensured: petrel 2010.1 not run plug-in compiled 2010.2. note minor releases can introduce few, new apis. hot fixes backward binary compatible: petrel 2010.2 can run plug-ins compiled 2010.1, 2010.2, 2010.2.1. forwards binary compatibility not ensured: petre...

java - Add jsp directive from server side -

java - Add jsp directive from server side - i wanna like document dom = new document(); element ele = new element("jsp:include"); dom.setrootelement(ele); but throwing error using jdom getting dom( org.jdom.document , org.jdom.element ) whats wrong in doing namespace ns = namespace.getnamespace("jsp", "http://java.sun.com/jsp/page"); element element = new element("include", ns); document dom = new document(element); java jdom

osx - can't set background color ttk python os x using styles -

osx - can't set background color ttk python os x using styles - with code fragment, expect label have background color red. def createwidgets(self): style = ttk.style() style.configure("red.tlabel", foreground="green", background="red") self.label1 = ttk.label(textvariable=self.numberarray[0][0],style="red.tlabel") self.label1.pack() i greenish foreground color can't alter background color. on os x. i'm using activestate's tcl , python. same problem occurs python 3.2 , 2.7 you'll seek alter alternative supposed exist according element options, have no effect. as example, can't modify background color of button in "aqua" theme used mac os x. while there valid reasons these cases, @ moment not easy find them, can create experimenting frustrating @ times. taken tutorial http://www.tkdocs.com/tutorial/styles.html python osx operating-system tkinter ttk

.htaccess - mod_rewrite deny acces if parameter equals something -

.htaccess - mod_rewrite deny acces if parameter equals something - i have urls like mydomain.com?act=somethingbad mydomain.com?act=somethingworse and mydomain.com?act=somethinggood mydomain.com?act=somethingbetter i need create bad actions forbidden. tried like: rewritecond %{query_string} act=(.*) rewritecond %{query_string} act=[^(somethinggood)] rewriterule ^(.*) - [f] because have more bad actions want exclude de actions rule. above illustration doesn't work. any ideas? use these rules: rewritecond %{query_string} (^|&)act=(.*) rewritecond %{query_string} !(^|&)act=(somethinggood|somethingbetter)(&|$) rewriterule ^(.*) - [f] parameter act can (e.g. http://example.com/?act=somethinggood , http://example.com/?mode=happy&act=somethinggood , http://example.com/?mode=happy&act=somethinggood&extra=yes ok) if have empty value act parameter, rejected (e.g. http://example.com/?act= treated bad parameter) based on url example...

How to return an instance of a class in Objective C? -

How to return an instance of a class in Objective C? - i'm trying homecoming instance of class in function, i'm not sure how it. i have class called generatemoves, , instance of class created: generatemoves *move = [[generatemoves alloc] init]; i have class has utilize variables set in instance of class ("move", above). so created function: -(class)returnclass { homecoming move; } and in other class: generatemoves *move = [otherclass returnclass]; however, throws warning saying incompatible pointer type. how do this? thanks assistance! :d you want this: -(generatemoves*)returnclass { homecoming move; } although phone call returnmove, rather returnclass edit: bit more detail. while way of writing things valid objective c, think it's easier understand if write this: generatemoves* move = [[generatemoves alloc] init]; in other words, you're creating pointer generatemoves instance , assigning variable mo...

facebook - Problem with the redirections of apprequest in php -

facebook - Problem with the redirections of apprequest in php - i using code below send app request someone. it works fine; displays in facebook notification. when click notification, redirects facebook app page. i'm unable create redirect page exists list of facbook app requests. how create redirect there? is there need changes in facebook app setting ? <div id="fb-root"></div> <script> function facebookiframeauthenticator(){ window.fbasyncinit = function() { fb.init({ appid: '123456789', status: true, logging: false, cookie: false, xfbml: true }); fb.canvas.setsize({height: 2000}); fb.canvas.scrollto(0,0); fb.canvas.setautoresize(); }; var e = document.createelement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_us/all.js...

c# - can asp.net run without .net framework -

c# - can asp.net run without .net framework - i new asp.net. inquire can asp.net run without .net framework? in can default.aspx run smoothly without .net framework? asking due next existing code runned on web hosting server , private server. not sure private server details ( going know in 2-3 days)...the code goes as... try { webrequest req = webrequest.create(general.siteurl + "/pages/" + page + ".htm"); webresponse resp = req.getresponse(); stream stream = resp.getresponsestream(); streamreader reader = new streamreader(stream); content = reader.readtoend(); } grab { content = "<html><head></head><body>content not found.</body></html>"; } the web hosting server manage run "try" whereas private 1 shows content not found....any ideas guys? people visit website not need .net framework; they'll need browser. the server runs website ne...

postgresql - Where can I find a description of plan nodes? -

postgresql - Where can I find a description of plan nodes? - i'm working way through postgres query plan first time. i'm having problem because don't seem able find documentation describes each of plan nodes are. in many cases, name provides me reasonable guess, in several name of plan node generic me have confidence in it. where can find list of types of plan nodes, descriptions of each? chapter "56.1. row estimation examples" explaines lot, take look. postgresql

postgresql - Exporting a Postgres Database to an Excel Spreadsheet -

postgresql - Exporting a Postgres Database to an Excel Spreadsheet - i have postgresql database @ work single table of data. theme of info computers - things physical location, mac address, serial number, , computer name. i need info exported excel spreadsheet. have perl dbd::pg loaded on laptop, programmatic solution possible if need be. should process whole thing line-by-line loop, or there easier way cdl? has had experience doing sort of thing before? thanks much. if solution doesn't have programmatic, should help: archives.postgresql.org article excel postgresql csv

python - Scapy get the actual value of a field -

python - Scapy get the actual value of a field - this question related this other one i check value of field in scapy: def compute(fields): print fields print fields[1].name print fields[1].size print fields[1].default homecoming 23 class foo(packet): array=[ bitfield("foo",0x0,2), bitfield("foo1",0x0,2), bitfield("bar",0x0,2), bitfield("blub",none,2) ] def post_build(self, p, pay): print dir(self.array[1]) res = compute(self.array) p = struct.pack(">b", res) homecoming p if __name__ == "__main__": interact(mydict=globals(), mybanner="") the code not entirly working, of import parts are. output is: [<field ().foo>, <field ().foo1>, <field ().bar>, <field ().blub>] foo1 2 0 now, problem when alter value on commandline: >>> a=...

c# - Open source Graph library -

c# - Open source Graph library - i looking open source/free graph(charting) library in c/c++ or c#. free jfreechart in java. know it? i'm big fan of gnuplot... it's open-source , versatile. c# c++ graphics charts

php - query to update record with another random record from another table? -

php - query to update record with another random record from another table? - im having problem little issue within query $update = mysql_query("update earnings set userid = (select id users installid not null order rand() limit 1) userid='0'"); this query update userid within earning table when value of '0' need update userid not found within user table illustration earnings table has 5 entries userid=10 userid 10 not found in users table , users table have ids (1'2'3'4'5) update userid have value 10 of ids found within users table , have installid not nulled i'd imagine client want earnings data, of things, relevant, not completely random (if if info random , don't know which, of info corrupted). said, query gets want with update earnings set userid = (select id users installid not null order rand() limit 1) userid not in (select id users) what i'd instead set foreign key on id , prevent random in...

matrix - whats the fastest way to find eigenvalues/vectors in python? -

matrix - whats the fastest way to find eigenvalues/vectors in python? - currently im using numpy job. but, i'm dealing matrices several thousands of rows/columns , later figure go tens of thousands, wondering if there bundle in existence can perform kind of calculations faster ? **if matrix sparse, instantiate matrix using constructor scipy.sparse utilize analogous eigenvector/eigenvalue methods in spicy.sparse.linalg. performance point of view, has 2 advantages: your matrix, built spicy.sparse constructor, smaller in proportion how sparse is. the eigenvalue/eigenvector methods sparse matrices (eigs, eigsh) take optional argument, k number of eigenvector/eigenvalue pairs want returned. number required business relationship >99% of variance far less number of columns, can verify ex post; in other words, can tell method not calculate , homecoming of eigenvectors/eigenvalue pairs--beyond (usually) little subset required business relationship variance, it...

layout - WPF ComboBox has no baseline snaplines -

layout - WPF ComboBox has no baseline snaplines - the wpf combobox command not seem have text baseline snaplines, how can align baseline of label control? the msdn says has snaplines, when drag command around no snaplines appear (except top , bottom lines). i using vs 2010. thank you! wpf layout alignment

javascript - Searching a content and alert if -

javascript - Searching a content and alert if - i made search script searches "hallow" , alerts. var item = $('td > a:contains("hallow")').text() if(item) { alert(item); } this javascript working html: <html><body><div style="padding:10px;"> <table width="469" cellspacing="0" cellpadding="2" border="0"> <tbody> <tr valign="top"> <td width="313">&nbsp;<img width="11" height="10" src="graphics/default/miscellaneous/weight.gif" alt="yük: 3" title="yük: 3">&nbsp; <a href="characterdetails.asp?action=viewitemdetails&amp;itemtypeid=236&amp;itemid=100084253&amp;characterid=53845">kovboy çizmeleri</a> ...

Android EditText can't handle large file -

Android EditText can't handle large file - i notice if of text within edittext view colorize different colour (e.g. foregroundcolorspan ), edittext becomes slow when number of line large. (>500 lines) i trying utilize edittext typing code , syntax highlighting using spannable object. anyone has solution problem? have write own edittext view? if case how do it? never had problem , have tried temporary disable color when editing , , homecoming color after editing? , possible utilize listview of edittexts ? android android-edittext

ruby on rails 3 - Rails3 activerecord hashset customization -

ruby on rails 3 - Rails3 activerecord hashset customization - i want pass hashset activerecord finder method model_name.where({ :key => value }) . works perfectly, sql composed uses straight comparing =. possible customize , switch comparing usage hashset? the :key => value syntax works = , in , , between conditions (depending on whether value atomic, array, or range). else requires pass sql string: model.where("key ?", value) ruby-on-rails-3 activerecord hashset

Matching a number and everything afterwards up until another number in Regex? -

Matching a number and everything afterwards up until another number in Regex? - i've spent way many minutes on now, thought i'd seek luck here instead. i need regex pattern matches whole number , everything afterwards until whole number appears. in next string: 50 !#!#€test30testtest 20!!!!` it should match: 50 !#!#€test 30testtest 20!!!! is there way that? \d+\d+ does that. \d+ matches 1 or more digits, , \d+ matches 1 or more non-digits. if set each part in parentheses, can access matches separately: (\d+)(\d+) . regex

Where is the right place in Erlang to spawn N processes in production? -

Where is the right place in Erlang to spawn N processes in production? - i'm trying find documentation (book, blog, mailing list etc) on how deploy production scheme erlang. for instance, have application design should launch 3 processes of particular module takes on gen_server behavior. when starting production erlang system, right way of going this? manually start them in erl shell? my_server:start(). %% 3 times? (i hope no.) let supervisor handle it? (seems likely?) let server start 3 times? (i think no.) let tool rebar handle it? (haven't learned tool yet, not sure.) i'm trying find resource(s) explain right way of going in erlang world. supervisors way go. should read on docs supervisor init boot 3 identical children , maintain them running: init([]) -> mychildren = [{list_to_atom(childname), {theworkermodule, start_link, [childname]}, permanent, 1000, worker, [theworkermodule]} || childname <- [c1,c2,c3]], {ok, {{one_for_o...

How to call Clojure Macros from Java? -

How to call Clojure Macros from Java? - is there anyway phone call clojure macros java? here trying do: rt.var("clojure.core", "require").invoke(symbol.create("clojure.contrib.prxml")); var prxml = rt.var("clojure.contrib.prxml", "prxml"); var withoutstr = rt.var("clojure.core", "with-out-str"); string stringxml = (string) withoutstr.invoke((prxml.invoke("[:name \"bob\"]"))); prxml writes *out* default why need wrap macro with-out-str returns string. i getting error: [java] java.lang.illegalargumentexception: wrong number of args (1) passed to: core$with-out-str [java] @ clojure.lang.afn.throwarity(afn.java:437) [java] @ clojure.lang.restfn.invoke(restfn.java:412) [java] @ clojure.lang.var.invoke(var.java:365) [java] @ javaclojure.xml.main(unknown source) you'll have roll own withoutstr. class yourclass { static final var withbindings = rt...

ruby on rails - ActiveRecord Query Union -

ruby on rails - ActiveRecord Query Union - i've written couple of complex queries (at to the lowest degree me) ror's query interface: watched_news_posts = post.joins(:news => :watched).where(:watched => {:user_id => id}) watched_topic_posts = post.joins(:post_topic_relationships => {:topic => :watched}).where(:watched => {:user_id => id}) both of these queries work fine themselves. both homecoming post objects. combine these posts single activerelation. since there hundreds of thousands of posts @ point, needs done @ database level. if mysql query, user union operator. know if can similar ror's query interface? here's quick little module wrote allows union multiple scopes. returns results instance of activerecord::relation. module activerecord::unionscope def self.included(base) base.send :extend, classmethods end module classmethods def union_scope(*scopes) id_column = "#{table_name}.id" ...

continuous integration - Continue running NUnit after failures -

continuous integration - Continue running NUnit after failures - i running nunit-console ci configured in teamcity run tests various assemblies. 1 time 1 of testfixtures has failing test, test execution stop. currently able see first tests failed, unaware if there more testfixtures might fail downwards line. i summary lists failing tests , test fixtures, without details of exceptions thrown. anyone have ideas? thanks. nunit should run of unit tests in specified assembly, regardless of number of test failures. first thing check raw xml output unit test run. may find tests beingness executed, build server failing display of results. if case, there may faulty xslt needs modified. another thing seek running of tests on box using command-line tool, , see if runs of tests. if run on box not server, may have configuration problem on build box. yet possibility failure critical 1 (failure load assembly perhaps) causing nunit error out. nunit continuous-integ...

.net - Remove onblur validation from ASP.net Control -

.net - Remove onblur validation from ASP.net Control - i wanting remove onblur event asp.net validation, , have validation called when button clicked. know how can accomplished? thanks you have provide validationgroup property button click, textbox , validation control. same groupy name all. you have unset onblur event of command right click it, take properties, go in event section click flash button on top of property window. find onblur event , remove calling event value cell. .net asp.net validation

excel - Match 2 cell and do a conditional formatting -

excel - Match 2 cell and do a conditional formatting - excel question: user input value in e3 ex: e3 = 1 // ak11 count values in row b11-aj11 ak11=counta(b11:aj11)-countif(b11:aj11,"*"&"mvr"&"*") ex: q11="i" , af11="r" , makes ak11 = 2 how match cell e3 , cell ak11 ? if match, have cell al11 have conditional formatting: numbers don't match = reddish pattern white font , string "!" numbers match = white pattern white font (basically blank cell) if did test on seperate cell without ak11's counta formula am11=1 / an11=1 / ao11 = if(am11=an11,"y","n") | results = y am11 = 1 / an11 = 2 ao11 = if(am11=an11,"y","n") | results = n but if run counta formula on an11, results says "n". for reason doesn't work counta formula beingness in 1 of matching cell. it's hard understand you're asking exactly, there's much ...

c++ - Qt metaObject linker problem -

c++ - Qt metaObject linker problem - after integrating qt vs , trying compile .pro file i'm getting next errors: error 9 error lnk2001: unresolved external symbol "public: virtual int __thiscall multiplication_dialog::qt_metacall(enum qmetaobject::call,int,void * *)" (?qt_metacall@multiplication_dialog@@uaehw4call@qmetaobject@@hpapax@z) error 7 error lnk2001: unresolved external symbol "public: virtual struct qmetaobject const * __thiscall multiplication_dialog::metaobject(void)const " (?metaobject@multiplication_dialog@@ubepbuqmetaobject@@xz) error 8 error lnk2001: unresolved external symbol "public: virtual void * __thiscall multiplication_dialog::qt_metacast(char const *)" (?qt_metacast@multiplication_dialog@@uaepaxpbd@z) what this? you usally these errors when moc_foo.cpp foo.h (which contains class marked q_object) not compiled / linked in project. to create qt project work in vs either crea...

c# - Transfer of Databound Datagridview Row To Another Datagridview -

c# - Transfer of Databound Datagridview Row To Another Datagridview - i have 2 datagridview datagridview1 datagridview2 datagridview1 has checkbox columns check rowindex , transfer same row datagridview2 datagridview1 databound command , having columns below: checkbox column,name , amount where datagridview2 having same column take checkbox column. i wants transfer info of datagridview1.selected rows datagridview2 click on checkbox column. how do?. you can handling cellcontentclick event of datagridview. check if check box column clicked, current row , import datagridview. here mean: private void datagridview1_cellcontentclick(object sender, datagridviewcelleventargs e) { if (e.columnindex == mycheckboxcolumnname.index) { datagridviewrow row = datagridview1.rows[e.rowindex]; string name = row.cells["name"].value.tostring(); string amount = row.cells["amount"].value.tostrin...

ggplot2 - Extend x-limits using ggplot in R -

ggplot2 - Extend x-limits using ggplot in R - i'm trying plot histogram overlay (given my_fun) using next code. dfr = data.frame(x) ggplot(dfr,aes(x)) + geom_histogram(colour="darkblue", binwidth = 0.1, aes(y =..density..), size=1, fill="blue", freq = true)+ stat_function(fun = my_fun, colour = "red") the x-axis in ggplot 1 2 (which range of data). however, plot have x-axis 0 3, overlay can drawn on range (0, 3). i've tried adding coord_cartesian(xlim=c(0, 3)) not work. please provide me suggestions on changing range? give thanks you. just guessing here since provided little useful info in question, works me: dat <- data.frame(x=rnorm(100)) ggplot(dat,aes(x=x)) + geom_histogram(aes(y=..density..),freq=true) + stat_function(fun = dnorm, colour="red") + xlim(c(-4,4)) using xlim rather coord_cartesian . since haven't provided details on info or function, can't ass...

Extracting the actual in-text title from a PDF -

Extracting the actual in-text title from a PDF - there seems lot of questions extracting title pdf (using metadata). however, big bulk of titles not seem exist in metadata. found out when using http://pybrary.net/pypdf/pythondoc-pypdf.pdf.html . is there anyway retrieve in text title pdf? tried export text file search there no consistent formatting. there way export pdf document formatting, check font size >= 14 ? this question. applications create pdfs don't seem useful available metadata fields. take pdflatex example: when 1 sets \title{...} , \author{...} in preamble, info not reflected in metadata. after quick search, solution appears to introduce block in preamble read pdflatex [1]: \pdfinfo { /title{...} /author{...} ... } ...which placed in the relevant metadata fields of pdf. unusual necessary, though. i cannot speak word processors word or writer. 1 presumes such metadata fields have set manually user. perhaps heuristic approach w...

Why SVN assigned mime type application/octate-stream to sql file? -

Why SVN assigned mime type application/octate-stream to sql file? - svn showing mime type of sql files application/octate-stream. emailing such files create such problem? software makes mistakes too. alter svn:mime-type property other like. sql mime-types mime

java - MigLayout - Need help on how to use the dock parameters (or need an alternative) -

java - MigLayout - Need help on how to use the dock parameters (or need an alternative) - i started using miglayout swing in java , i'm liking far. thing, though, dock parameters don't seem work way thought worked , can't figure out i'm doing wrong. the problem is: i'm trying add together jbutton within jpanel , docking right side using panel.add(button, "east");. while makes rightmost component, still takes same space in flowlayout. i'd stick right side of panel. here's compilable code recreates problem: public class miglayouttest extends jframe { public miglayouttest() { setsize(500,500); jpanel panel = new jpanel(new miglayout()); panel.setbackground(color.yellow); setcontentpane(panel); panel.setsize(500,500); panel.add(new jbutton("dock east"), "east"); panel.add(new jbutton("no dock")); } public static void main(string[] args) { jframe frame = new miglayou...

JQuery Mobile Collapsible header color -

JQuery Mobile Collapsible header color - i need when 2 textboxes having text.. create collapsible header color green.. know how first part.. how alter collapsible header color don't know... http://jquerymobile.com/test/docs/content/content-themes.html here written can customize custom css... tried didn't help.. here code of creation var colldiv = '<div class="added" data-role="collapsible" data-collapsed="true"><h3 style="background: rgba(204,244,204,0.9);" id="results-header">' + hoursfrom + ":" + minsfrom + " - " + hoursto + ":" + minsto + '</h3>' + textprojectname + textprojectdata + '</div>'; $('.spantimetable').append(colldiv); docs: http://jquerymobile.com/demos/1.0b1/docs/content/content-themes.html theming collapsible blocks to set color ...

javascript - How to convert date in format "YYYY-MM-DD hh:mm:ss" to UNIX timestamp -

javascript - How to convert date in format "YYYY-MM-DD hh:mm:ss" to UNIX timestamp - how can convert time in format "yyyy-mm-dd hh:mm:ss" (e.g. "2011-07-15 13:18:52" ) unix timestamp? i tried piece of javascript code: date = new date("2011-07-15").gettime() / 1000 alert(date) and works, results in nan when add together time('2011-07-15 13:18:52') input. var match = '2011-07-15 13:18:52'.match(/^(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)$/) var date = new date(match[1], match[2] - 1, match[3], match[4], match[5], match[6]) // big gotcha -------------------------^^^ // month must between 0 , 11, not 1 , 12 console.log(date); console.log(date.gettime() / 1000); javascript datetime timestamp unix-timestamp

java - Show activity on top of other activity -

java - Show activity on top of other activity - i have app produces notification when process completes. upon clicking on notification, popup created. popup activity isn't total screen. my issue if popup created on top of open application, when screen orientation changes, background application killed. have attempted circumvent forcing portrait mode (in manifest , code) kills background app when closing out of popup. does know how accomplish without killing background app when configuration changes? add these lines in manifest <activity android:name=".activity" android:configchanges="keyboardhidden|orientation" android:label="@string/app_name"> then implement in java code override method public void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig);} with telling application nil when config changes occur (orientation changes le...