Posts

Showing posts from January, 2013

python - how to write regex for a price expression? -

expression : "price(might contain comma) eg" examples: 40 eg or 4,657 eg or 4,352,345 eg i want 1 string regex should use of these cases. you try one: ^\d{1,3}(,\d{3})*\seg$ if want decimals well... ^\d{1,3}(,\d{3})*(\.\d\d?)?\seg$ now, if can have numbers (more 999) without commas @ , possible decimal... ^\d{1,3}(,?\d{3})*(\.\d\d?)?\seg$ more details: ^ @ start means price must start next character (here \d meaning numeric character) \d{1,3} means 1 3 numeric characters. (,\d{3})* group, appearing 0 times or more, consisting of comma , 3 numeric characters. assuming price 'clean', things ,34 in price 3,34 eg won't allowed through. (\.\d\d?)? group, appearing 0 or 1 time, consisting of period . , digit , second possible digit. things .2 or .54 allowed. .564 not, however. \s means 1 space character, , no more, no less. if price data given 'clean', there should no issue , identify not 'clean

Map a Map<Long, List<POJO>> through JPA eclipselink -

i have similar requirement of problem statement defined in i want map map<long, list<pojo>> through jpa i using eclipselink, had create separate class itemattributes , in class atleast have use primarykey table item_attribute. configuration able fetch results in map, while creating new record eclipselink tries consider itemattributes entity & hence ends in inserting value primarykey(which null) in table item_attribute don't want , want list of - list attributes inserted. surprisingly cannot make primary key read declared in itemattributes class. any idea how avoid this? further cannot make descriptor class itemattributes read skip creation part of entire table item_attribute using eclipselink workbench configuration. you need create entity class represent relationship in answer other post. what exact model/data model. your intermediate class need id, can use @generatedvalue if have no logical one.

ios - how to add a custom view in the selected row in UITableView? -

i new @ programming , struggling in this. how add custom view in selected row in uitableview? all other rows should not affected. new view should appear in place of row clicked. view can have bigger size. thanks. you can add new view in rowdidselect delegate method, - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; uiview *myview = [[uiview alloc] initwithframe:cgrectmake(10.0f, 10.0f, 100.0f, 30.0f)]; [myview settag:-1]; [cell addsubview:myview]; } implement diddeselectrowatindexpath given - (void)tableview:(uitableview *)tableview diddeselectrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; uiview *myview = [cell viewwithtag:-1]; [myview removefromsuperview]; }

c# - GroupingView in Ext.Net V2.X show error -

i new ext.net v1.x tool , old project woking fine, when update ext.net dll set v2.x. number of control generate errors. error :58 type or namespace name 'groupingview' not exist in namespace 'ext.net' (are missing assembly reference?) <view> <ext:groupingview id="gridview" hidegroupedcolumn="true" forcefit="true" > <listeners> <refresh handler="uncheckcheckheader(#{checkselectionmodel});" /> </listeners> <getrowclass fn="getrowclass" /> </ext:groupingview> </view> the groupingview has been removed in v2. please use grouping feature, see #23 in breaking_changes file. here best thoughts regarding migrating v2 v1.

php - Is it possible to Generate a Pdf Design by using Fpdf -

Image
i want generate pdf in php using fdpf. can draw table in fpdf. want design table in image given using fpdf.is possible. new fpdf please me. want above table design. in advance you should download addon called pdf_mc_table or copy here: http://www.fpdf.de/downloads/addons/3/ $pdf = new pdf_mc_table(); $pdf->row(array("this\nis test","with multi\ncell")); $pdf->output();

extjs - Move an element to next line using CSS, if it doesn't fit in the available area width -

Image
i have view created using extjs, composed of autocompleting textbox (bound store) , custom templated dataview (again, bound store). , view looks below. here's how works. user searches tag in searchbox, , selects matching tag dropdown. once selected, automatically added dataview right below, appears tag cloud (though not exactly). tag item added dataview custom styled, , has "remove" link next label remove dataview. now, here's problem: the available width of dataview fixed, if tag item text longer, can see gets broken , remaining part of tag appears on next line. what want this: as can see if tag item not small enough fit available area, gets next line, if space available, on same line. any way attain css? or need write js logic this? note css solution, i'm bound support evil ie7/8. yes can similar in css, have sample code can post online somewhere? can give advice on actual code? but achieve this, each input field needs ha

ios - Preventing iPhone app for inactive state -

i need screen on/off callbacks , voice call callbacks. receiving callbacks when app in foreground. unable delegate callbacks when app in background. how possible block or delegate callbacks while app in background? i read through apple document http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/managingyourapplicationsflow/managingyourapplicationsflow.html and found "backgound execution , multitasking" http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/managingyourapplicationsflow/managingyourapplicationsflow.html#//apple_ref/doc/uid/tp40007072-ch4-sw20 but nothing helps me issue. please help. try use uilocalenotification. can register notification in system, , can implement @ specified time. -(void) viewdidload{ [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(enteredbackground:) name:@"didenterbackground" object:nil]; [[

Tycho: Maven build on CLI works, but when running in Eclipse Application modules cannot be resolved -

situation i have rcp application gets built maven (using tycho). when run reactor build (the master pom, see below) command line using mvn clean build builds smoothly , resulting executable works fine . works after cleaning local maven repository first. however, when include projects eclipse , try run project product file, error . problem when starting application splash screen appears, following error given: !session 2013-05-14 11:53:07.109 ----------------------------------------------- eclipse.buildid=unknown java.version=1.7.0_07 java.vendor=oracle corporation bootloader constants: os=linux, arch=x86_64, ws=gtk, nl=en_us framework arguments: <irrelevant> !entry org.eclipse.osgi 2 0 2013-05-14 11:53:09.521 !message 1 or more bundles not resolved because following root constraints not resolved: !subentry 1 org.eclipse.osgi 2 0 2013-05-14 11:53:09.522 !message bundle reference:file:/home/debacker/software/jeclipse/plugins/org.apache.lucene_3.5.0.v20120319-2

javascript - Have navigation slide down on document load just for the homepage -

i'm new javascript/jquery , wanting have menu animate in when landing on homepage , have menu show , not animate other pages. the code below have been playing with. $(document).ready(function(){ if (document.location.href.indexof('localhost:8888') > -1 ) { //slide down menu } else { //static menu } }); you can use css3 animations accomplish this jsfiddle demo set <body> of homepage have class homepage <body class="homepage"> <nav> nav (w/ul+li nav items) </nav> <!--...--> </body> then either create own animation or use pre-built set animate.css .homepage nav { -webkit-animation:fadeindown .5s; -moz-animation:fadeindown .5s; animation:fadeindown .5s; } edit: to add class homepage in wordpress: combining answers add custom class name wordpress body tag? , is_home() wordpress function add functions.php (disclaimer:i haven't tested should 99% of way

to Apache 2.4.4 and Tomcat 7.0.33. Accessing the website via HTTPS produces “Object not found” error -

issue: upgraded apache 2.4.4 , tomcat 7.0.33. accessing website via https produces “object not found” error. error logs show no errors (apche, tomcat, or windows). server os: windows 2008 apache: version 2.4.4 tomcat: version 7.033 jre: version 1.6.0_43 httpd.conf loadmodule jk_module modules/mod_jk.so # mod_jk setup <ifmodule mod_jk.c> jkworkersfile conf/workers.properties jklogfile "|bin/rotatelogs.exe logs/mod_jk.log.%y-%m-%d.txt 86400" jkloglevel error jklogstampformat "[%a %b %d %h:%m:%s %y] " jkoptions +forwardkeysize +forwarduricompat -forwarddirectories jkrequestlogformat "%w %v %t" # should mod_jk send ssl information tomcat (default on) jkextractssl on # indicator ssl (default https) jkhttpsindicator https # indicator ssl session (default ssl_session_id) jksessionindicator ssl_session_id # indicator client ssl cipher suit (default ssl_cipher) jkcipherindicator ssl_cipher # indicator client ssl certificated (default ssl_client_cert)

yield keyword - Convert a traversable to another at run time in scala -

i able go through bs of traversable of a. tried following code: object test { class class b extends class c extends var someas: traversable[a] = ... def thebofsomeas: traversable[b] = for(a <- someas) { match { case b:b => yield b case _ => } } } but not compile, because says expression has type unit. how achieve ? compiler thinks return type unit because if go not b case you're returning nothing. use collect, easier read: def thebofsomeas: traversable[b] = someas.collect { case b: b => b }

Android - Google Play like tabs -

Image
google has implemented new look tabs in google play. i know can done viewpagerindicator, yet wouldn't use library in application , bump app's size mb or so. i using android.support.v4.view.pagertabstrip (like in old google play), , i'm wondering if new can implemented using android support library. thanks in advance. design support library (current method). the design support library includes tablayout widget allows implement google play-lie tabs: <android.support.design.widget.tablayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" /> and initializing it: tablayout tablayout = (tablayout) findviewbyid(r.id.tabs); tablayout.setupwithviewpager(viewpager); for full example see cheesesquare app pagerslidingtabstrip library this ready-to-use library can find on github .

java melody - Change the CSS of JMX Bean output in Javamelody -

is possible change style of jmx bean output on page? using javamelody show jmx output. refernce official advance guide document: "customizing styles, icons , other resources in html reports" part.

java - Bypass Basic authentication to solr from my website with tomcat -

i have website in same server sorl. solr allow queries website, , not external ips, of course security reasons. webpage 1 can queries like: $.getjson("http://127.0.0.1:8080/solr/select/?q=*:*&wt=json&json.wrf=?&indent=true", function(result){} but since have sorl application configured auth prompting write username , password. <security-constraint> <web-resource-collection> <web-resource-name>solr lockdown</web-resource-name> <url-pattern>/</url-pattern> </web-resource-collection> <auth-constraint> <role-name>solr_admin</role-name> <role-name>admin</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>basic</auth-method> <realm-name>solr</realm-name> </login-config> i checked in here, solution blocking main website , still prompting password when query tomcat : bypass ba

php - ICS file dynamic timezone issue -

this question has answer here: generating icalender vtimezone component php's timezone value 3 answers i trying generate ics file dynamically in php, timezone dynamic according location given. works there daylight time issue i.e shows time difference of 1 hour or so. solve issue have use daylight dynamically. don't know how use dynamically, or can tzoffsetfrom , tzoffsetto offsets related timezone given. for example: $timezone = "america/denver" // dynamically fetched db $ical = "begin:vcalendar\n"; $ical .= "version:2.0\n"; $ical .= "prodid:-//lokalmotion//lokalmotion events v1.0//en\n"; $ical .= "calscale:gregorian\n"; $ical .= "method:publish\n"; $ical .= "x-wr-calname:lokalmotion events\n"; $ical .= "x-ms-olk-forceinspectoropen:

wordpress - php- getting wrong values while looping -

i making opportunity form have provided update , delete functionality in wordpress. question wrong loop .. getting wrong values i. unable print "$opportunity_exp_date[$i]" if delete single opportunity. might tough understand guys problem. here code. for($i=count($contact_opportunity);$i>=0;$i--){ //for listing of won opportunities if($contact_opportunity[$i]!='0' && !empty($contact_opportunity[$i])){ ?> <?php if($opportunity_status[$i]=='won'){?> <div class="won-opp"><h3>won</h3></div> <?php echo "<div class='oname'>"."new opportunity '".$contact_opportunity[$i]."' added"."</div>"; ?> <a href="<?php echo admin_url( "admin.php?page=contact_profile&post=$pid&opnm=$contact_opportunity[$i]&opamt=$opportunity_amount[$i]&opedt=$opportunity_exp_date[$i]&am

c++ - How to call winapi function via pointer to this function? -

i functions ntdll.dll dynamically, using getprocaddress winapi function this: hmodule ntdllh = loadlibrary(l"ntdll.dll"); unsigned char* ptrtontloaddriver = (unsigned char*)getprocaddress(ntdllh, "ntloaddriver"); how can call ntloaddriver function via ptrtontloaddriver ? thought of this: ((ntstatus ntloaddriver(punicode_string driverservicename))ptrtontloaddriver)(foostring) do typedef "x" function type want call (example: "typedef returntype (*x)(argtype);") change "unsigned char* ptrtontloaddriver" "x ptrtontloaddriver" call function "ptrtontloaddriver(argshere)"

javascript - Extjs rowediting change time format after save -

this code { text: "entrance time", dataindex: "entrance_time", id: "cl_absence_entrance_time", editor: { xtype: "timefield", format: "h:i" }, format: "h:i", width: 200 } but result tue jan 01 2008 07:00:00 gmt+0700 (wit) how change become 07:00 ? please me. thank you you can set renderer convert date or use datecolumn: { xtype: 'datecolumn', format : "h:i" // ... }

objective c - iOS returns "null" data from JSON feed -

i downloading , parsing json feed in ios application. parts of data json feed provides shown correctly in ios application, parts of json feed seem return "null" though in actual json feed itself, not contain data "null". here code: nserror *myerror = nil; nsdictionary *res = [nsjsonserialization jsonobjectwithdata:responsedata options:nsjsonreadingmutableleaves error:&myerror]; nsarray *results = [res objectforkey:@"current_observation"]; nsarray *cur = [results valueforkey:@"weather"]; nsarray *loc = [results valueforkey:@"full"]; nsarray *tmp = [results valueforkey:tmptype]; the json feed trying load one: http://api.wunderground.com/api/595007cb79ada1b1/conditions/q/ca/san_francisco.json one part of json feed returns "null" is: "full":"san francisco, ca" the above returns "null".... why? , how go fixing issue? thanks, dan you need nsstring *full= [[results value

jquery - Keep hidden element displayed when hover over it -

i had trouble forming title- please edit if come better. when hovering on span class percent100 , want show div class getseen . however, getseen has link on it, getseen has remain open when user hovers on getseen , not percent100 . how do jquery? html: <span class="percent100"> 100%</span> <div class="getseen">at 100% seen...<a href="#">how?</a></div> jquery attempt: $('.percent100, .getseen').hover( function () { $('.getseen').toggle(); } ); just use query $('.percent100, .getseen').hover( function () { $('.getseen').show(); }, function () { $('.getseen').hide(); } ); see fiddle so need is, make div.getseen visible when .percent100 hovered , when .getseen hovered, , make invisible when hoverout

java - Best practice for objects where not all properties will always be used -

here scenario: i have object 10 properties (e.g. name, birthday, etc.). using object on 2 separate pages in jsf web app. on 1 page ever use 5 of properties, , on other potentially use 10. best practice / efficient way structure object(s)? have 1 object? have 1 object first page, , second extends first object? or have object each page both extending base object? i wouldn't hung on properties, i'd think more class. the class represents atomic thing, right? sounds person. the fact in circumstances you're using of properties, what? it makes no sense have halfaperson class! so key me "atomicity" of class in first place. if if describes single, logical thing, why split further?

html5 - Aligning text objects next to each other - KineticJS -

i have text objects , label objects seperate. need aligned next each other when being drawn. i'm adding x , y co-ordinates objects off pixels , not on same line. here code. have added picture of how text being rendered. ![var extractedsubstring = text.substring(currenttextoffset,value.begin-1) console.log(extractedsubstring) currenttextoffset += value.end var complextext = new kinetic.text({ x:x, y:y, width:3000, text: extractedsubstring, fontsize: 14, fontfamily: 'helvetica', fill: '#555', align: 'left' }); x += complextext.gettextwidth() y += complextext.getheight() group.add(complextext) var simplelabel = new kinetic.label({ opacity: 0.75, x:x, y:y, text: {

ruby on rails - cancan authorization not working -

i trying let users create design can edit designs doesn't work because design.user in block nil think has way model associations setup can :read, :all if !(user.nil?) can :create, design can :manage, design |design| user && design.user == user end can :vote, design can :vote2, design end class design < activerecord::base belongs_to :user end class user < activerecord::base has_many :designs end

How can I fetch data from a web server in an android application? -

i want retrieve data web server in android application, , don't know begin. should use web services? i recommend these tutorials: connect android php , mysql , json in android , php , mysqli i used these tutorials , managed trying working without difficulty. between them describe each step in how attempting @ each stage, android application, database , web server side , has information included can process , use received information the thing add connect android php , mysql tutorial makes use of mysql_ in php deprecated. better use mysqli why included third link. the basic outline of want this: 1) in android app make request server php script using class this: import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import java.io.unsupportedencodingexception; import java.util.list; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.namevaluepair

reporting services - CRM 2011 Activities -

i building ssrs report crm 2011 using fetchxml . i have table show open activities user. want able show account activity related to. i able if regarding field set account if set contact, opportunity, email... unable find account associated to. is there way relations fetch more 1 level deep? any suggestions on how handle this? when go generate fetchxml, via advanced find, scroll down "related" section; it's in same place picking fields. so example, select contacts under "look for:" drop-down, under drop-down, select , scroll-down related section , pick accounts. if there entity not in related list need create relationship. shouldn't done on-the-fly; requires thought since you'll messing database schema. cheers

bash - print character after each line in terminal -

i'd print \ after each line in bash script. example: output of $k is: git-core nano apache2 now want install packages using apt. solution is: sudo apt-get install git-core \ nano \ apache2 how add character? as suggested, may looking @ wrong solution problem. you can replace new line characters $k spaces: k=$(echo "$k" | tr '\n' ' ') better yet, can take advantage of bash word parsing, knowing apt package names don't have spaces in names (and assuming sure $k contains package names, separated newline): sudo apt-get install $k the lack of quoting $k make bash re-parse newlines regular word separators (spaces). if, other reason, really really want add backslash end of each line, can use sed: echo "$k" | sed 's/$/\\/'

sql server 2008 - update using INNER JOIN -

what going wrong in sql statement , can't find wrong update master_adjust inner join [dbo].[master] on master_adjust.empno = [dbo].[master].empno set master_adjust.gratuityytodate = [dbo].[master].gratuityytodate, master_adjust.manualbasicpay = 0, master_adjust.manualtax = 0, master_adjust.manualnapsa = 0, master_adjust.manualpension = 0, manualcharity = 0 error message msg 156, level 15, state 1, line 2 incorrect syntax near keyword 'inner'. looks wrong. try this: update ma set ma.gratuityytodate = [dbo].[master].gratuityytodate, ma.manualbasicpay = 0, ma.manualtax = 0, ma.manualnapsa = 0, ma.manualpension = 0, manualcharity = 0 master_adjust ma inner join [dbo].[master] on ma.empno = [dbo].[master].empno

android layout_weight squeezing an view too thin -

Image
i can't seem figure out how use android's layout_weight attribute. i'm trying create custom listview has 3 textview's. primary textview resides @ top left, have text view resides in top right for, , third 1 lives underneath primary textview. i'd primary , top right 2 on horizontal axis want primary textview take 70% of width, while other textview takes remaining 30%. no matter weight assign primary , right textview, primary textview larger , squeezes right data textview wayyy thin. my code: <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="5dip" android:id="@+id/llayout"> <!-- title--> <textview android:id="@+id/primarytitle" android:layout_width="wrap_content" android:layout_height="wrap_content"

asp.net - How to set a img in my aspx page through javascript? -

maybe sounds stupid, can't figure out how set <img> code in .aspx page throught javascript. my code far: <%@ page language="vb" masterpagefile="~/masterpage.master" autoeventwireup="false" codefile="teste.aspx.vb" inherits="teste" %> <asp:content id="content1" contentplaceholderid="contentplaceholder1" runat="server"> latitude: <asp:textbox id="nr_latitudetextbox" runat="server" maxlength="12" /> <br /> longitude: <asp:textbox id="nr_longitudetextbox" runat="server" maxlength="12" /><br /> <asp:button id="cmb_mapa" runat="server" text="mapa" onclick="cmb_mapa_click"/><br /> <script language="javascript" type="text/javascript"> function fonte(lat, lon) { var src = "

How to delete document types in elasticsearch? -

i create index "myindex" specified document type "mytype". able delete index, appears "mytype" still exists without being tied index. how rid of "mytype"? if deleted index, mapping in index should not exist anymore. have other index in cluster similar type name? to answer question: how delete document types in elasticsearch? , use delete mapping api : curl -xdelete http://localhost:9200/index/type edit : elasticsearch 2.0, won't possible anymore. see mapping changes . have install delete query plugin , run query remove documents mapping still exist. better reindex documents in index without old type. but @mguillemin , @javanna said, when delete index, every mapping attached index deleted well: curl -xdelete http://localhost:9200/index

c# - AutoFixture: how to CreateAnonymous from a System.Type -

i need create object autofixture using nothing more system.type. however, there doesn't appear overload of createanonymous() takes type. expect compile time generic t. there way convert system.type t? edit usage details: i'm using automapper, has hook injecting components support complex mapping scenarios: void constructservicesusing(system.func<type,object> constructor) as can see signature, clients can register func automapper invokes anytime needs injected service (mostly valueresolver implementations). in production builds, method calls structuremap container retrieve component. however, when unit testing mapping code, must provide stub implementations otherwise automapper throws exception. since i'm using autofixture + moq automocking container, seems natural let af new hydrated stub, can concentrate on writing unit test code. it's possible , intentionally hidden, since should very need this: var specimen = new specimencont

The system cannot find the file specified. - error in Chrome on PHP files -

i have particularly frustrating problem. have hosted website has couple of simple php files. files open in safari, , ie; giving me error message on chrome of "the system cannot find file specified." i've tried cleaning out chrome cache , browser history, uninstalled , reinstalled chrome , yet no luck. called hosting service , saying can see fine on systems through chrome. any ideas? any appreciated. thanks, kris i've found workaround. renaming .php .php5, seems work on browsers. wonder whether file binding has been messed on server side. update - found out issue hosting service. fixed on end , things started working find. if have issue, provider fix it. had hell of time convincing support folks problem on end. kept asking me flush browser cache.

Associative Array in php -

i want use associative array, , want key , value key inserted loop. reason because size of array depend on no of keys, chosen user. $i=$y; $totalrows=$x; $values=array(); for($a=0; $a<=$i; $a++){ $values[]= $i=>$totalrows; } fyi $y , $x values generated "for" loop. value of user provided details html script. to set key in associative array, use in variable definition. $array['custom_key'] = 'some value'; to in loop, you'll have somehow unique key want each item in associative array while in loop. for ($a = 0; $a <= $i; $a++) { $key = // key want item. $values[$key] = // set value key. }

c# - How to know pointer to structure by it's array pointer? -

i have structure: public struct mystruct { public int a; public int b; public byte[] mass; } i need: pass poiner "mass" array c++ unmanaged function. , after done work return me pointer "mass". so have list of mystruct. , need know mystruct in list contains returned "mass"(wich pointer have). if know pointer "mass" can reduce pointer 8 bytes , take pointer mystruct? how : 1.get intptr "mass" array? 2.get intptr mystruct structure? 3.get mystruct intptr? but, not using copy procedure, marshal.copy... or there better way need ? can use pointers in c++ or intptr enought, , how can that? assuming memory array allocated managed code: when pass array unmanaged function via p/invoke, default array pinned in memory marshaller memory used array not have copied. you should not need use intptr @ - need declare p/invoke accepting array parameter. however, things different if unmanaged code allocating

jquery - PHP strtotime not being executed at all within Joomla Component -

i building custom component within joomla takes values input input form , wraps them in order sent off in soap request. 1 of input form elements date (date of birth, or it's name in form "dob") needs converted valid date format soap api accept. i having strange issue within function accepts , prepares these form elements sent whereas php function strtotime doesn't seem working @ when attempt change date format valid format soap api handle. here relevant function code deals time formatting post element dob: $postvar['dob'] = date("y-d-m g-i-s", strtotime($_post['dob'])); die(print_r($postvar['dob'])); when die , print variable shown above see result is, strtotime ignored , doesn't die. the form uses jquery datepicker date form element , here variable output $_post['dob'] looks when recieved function. 14/03/2013 can see why strtotime function not having effect here , being ignored? thanks edit: add here j

How to present Users Option in Algorithm or Pseudo Code -

i have software asks user choose different options 3 sets of parameters before running program inputs. however, don't know how show in algorithm or pseudo code in correct way. example step 1: x, choose 5-10-15-20 step 2: y, choose between a,b,c,d step 3: z, choose 10 20 step 4: calculate m=x+2z step 5: print row m of y thanx in advance there no 'correct' ways in pseudo-code. can whatever want, preference terms , syntax used should understandable, thus, syntax, should commonly used elsewhere indicate desired operation. one option comes mind: "let x = user-picked value 1 of these: 5, 10, 15" more brief: "let user pick x ∈ {5, 10, 15}" obviously if algorithm fundamentally includes getting input user, not possible, if user input can separated algorithm without changing anything, think better way value given: "given x ∈ {5, 10, 15}" it make sense me "given" 's should @ start of algorithm. if want user in mi

php - Can't install xdebug using pecl -

this have done: first of installed php5-dev. php.h in /usr/include/php5/main. after that: cd /opt/lampp/bin ./pecl install xdebug result: /tmp/pear/temp/xdebug/xdebug.c:25:17: fatal error: php.h: no such file or directory i think must pecl in include directory must search... how?

jQuery animate() doesn't work in Firefox or Internet Explorer -

i'm working on having 3 boxes animate , display text when clicked. when 1 clicked, others move down allow space display text. when middle clicked, other 2 move down clicked 1 moves left side. my problem while works fine in webkit browsers, in firefox , internet explorer boxes don't animate down , out of way when text appears. seems though i've done that's dependent on way webkit works, far can tell code pretty standard. edit: here jsfiddle http://jsfiddle.net/captainspectacular/zlndm/10/ , reason not recreate problem i'm having on site. here jquery function: function selectbox($box) { switch($box) { case 'brand': $('.brand-identity').animate({top : 0}, 300) .animate({left : 40}, 300) $('.web').animate({top : 270, left : 340}, 300); $('.print-design').animate({top : 270, left : 640}, 300); toggletext('brand'); break; case

c# - count the number of files older that 6 months -

i want write code return number (count) of files older 6 months. i have script below returns files any appreciated code below // check number of file in cps directory on s drive private void btncheck_click(object sender, eventargs e) { { listbox1.items.clear(); { } string[] files = system.io.directory.getfiles(@"s:\cps papers\"); // @"s:\cps papers\" c:\test\ this.listbox1.items.addrange(files); textbox1.text = listbox1.items.count.tostring(); { } } } something this? var files = directory.enumeratefiles(@"s:\cps papers\") .select(f => new fileinfo(f)) .where(info => info.creationtime < datetime.now.addmonths(-6)) .select(info => info.name);

c# - I would like a DateTime to be shown as a proper Date, but in the Gembox options I could not find a option to set the format to Date -

Image
i'm using external component called gembox creating excel reports. when exporting property that's datetime in c# towards excel value in excel shown number (for instance '-693593'). other (basic) property types displayed type represent. in excel datetime shown proper date, in gembox options not find option set format date. alternative option convert datetime .tostring() while setting value in excel, gives desired result there better way of doing so? some simplyfied code example: excelfile excelfile = new excelfile(); excelworksheet excelworksheet = excelfile.worksheets.add("myworksheet"); int rownumber = 0; int columnnumber = 2; datetime datetime = datetime.now; excelworksheet.cells[rownumber, columnnumber].value = datetime; example of output: format excel cell display date time in excel itself, excelfile excelfile = new excelfile(); excelworksheet excelworksheet = excelfile.worksheets.add("myworksheet"); int rownumber

jquery mobile - Validate elements outside a form -

i have elements (input, textarea, controlgroup) , submit button outside of form element... can validate elements (client-side)? instance, check if required , show message error if empty. can use jquery validation plugin that? how? here sample of code until now: <div id="formcontainer"> <div data-role="fieldcontain"> <fieldset data-role="controlgroup"> <legend>user:</legend> <div id="userscontainer"> <input type="radio" name="radio-choice-1" id="radio-choice-1" value="1" /> <label for="radio-choice-1">user1</label> <input type="radio" name="radio-choice-1" id="radio-choice-2" value="2" /> <label for="radio-choice-2">user2</label> </div> </fields

javascript - Custom text selection color in webview -

Image
problem: we want change color of webview textselection shows same color user releases touch. have done highlight part cant find great solution changing selection color. tried mehods: ::selection css : works desktop browser not android webview. manually draw selection area in ondraw: quite troublesome, since have manage coordinates ourself. note: i have seen many ebook reader apps(kindle, ibooks, aldiko, moon+reader) have feature cant find solution this. anyone has solution please advise. thanks it hardly browser-dependant. in lot of browser doesn't work, in others goes different. problem same outline-on-active frame in chrome.

c# - Arranging a picture in Windows Forms? -

Image
i'm trying figure out (like in microsoft word) in visual studio 2010, how "arrange" picture box "send back" of form? put buttons on image below on top of image shown below. @ present, picture covering buttons. there way this? hopefully that's clear enough understand. thanks! select buttons, right click on one, click "bring front". (or, @ point equivalently, right click picture box, click "send back".)

solr4 - Retrieving only highlighted solr field and not the whole content -

i wanted index pdf, word documents using solr. whole content of word / pdf document coming in search response , highlighted fragment. content quite long , wanted avoid in search response because of content length. is possible highlighted fragment of content field ? here search query http://localhost:8080/solr4x/collection1/select?q=scripting&wt=xml&hl=true&hl.fl=content here schema <field name="content" type="text_general" indexed="false" stored="true"multivalued="true"/> <field name="text" type="text_general" indexed="true" stored="false" multivalued="true"/> <copyfield source="content" dest="text"/> i using solr 4.3 you can specify in request url fields want returned: http://localhost:8080/solr4x/collection1/select?q=scripting&wt=xml&hl=true&hl.fl=content&fl=text solr field parameter o

r - Create a factor variable using the quantiles -

i'd create factor variable using quantiles of other variable a. i tried code : > cut(value, breaks=quantile(value, probs=seq(0,1, by=0.25)), include.lowest=true)) but doesn't work because of quantiles same, doesn't know how cut. > 'breaks' not unique example : q1=2 q2=5 q3=5 q4=8 how can in case ? maybe can cut randomly in case this seems work x=c(2,5,5,8,10) qnt <- quantile(x,seq(0,1,.25)) cut(x,unique(qnt),include.lowest=true) # [1] [2,5] [2,5] [2,5] (5,8] (8,10] # levels: [2,5] (5,8] (8,10] alternative answer. if still want 4 bins, when data not justify it, there way! set.seed(1024) x <- sample(1:3,101,replace=true) binx <- rank(x,ties.method="random")%/%(ceiling(length(x)/4)+1) and here can see effects. binx_ranges <- by(x,binx,range) # binx: 0 # [1] 1 1 # ------------------------------------------------------------ # binx: 1 # [1] 1 2 # ------------------------------------------------

wordpress - get_posts() always empty for post_type attachment -

i struggling following while working on wordpress theme: as title suggests, array returned get_posts() empty despite posts holding images. i using following retrieve attachments-array: $attachments = get_posts( array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'post_parent' => $post_id ) ); now, $post_id works fine...if echo right before above snippet shows without fail. can't make out error is. for sake of completeness, heres whole loop, works fine in every regard except attachment retrieval: <?php if (have_posts()) : ?> <?php while (have_posts()) : ?> <?php the_post(); ?> <div class="post" id="post-<?php the_id(); ?>"> <div class="post-border"> <div class="post-date"><?php edit_post_link('edit post', '', &

c# - Unusual code by the decompiler -

i tried decompile .cs file through telerik decompiler , changed event handler's code unusual. private void start_click_1(object sender, routedeventargs e) { windowsruntimemarshal.addeventhandler<eventhandler<object>>(new func<eventhandler<object>, eventregistrationtoken>(dispatchertimer.add_tick), new action<eventregistrationtoken>(dispatchertimer.remove_tick), new eventhandler<object>(this.timer_tick)); } private void timer_tick(object sender, object e) { } i don't know how change normal. can me this? it seems that's new coming along windows runtime. maybe decompiler isn't able cope that. regarding information linked above code should translate into: private void start_click_1(object sender, routedeventargs e) { dispatchertimer.tick += timer_tick; } private void timer_tick(object sender, object e) { }

scheme - Changing a function into CPS style -

we asked write procedure when given list replace first occurrence of given element , first, catch write in cps style. unable turn cps style written procedure given success-cont , fail-cont.. if willing give try appreciate :] the procedure have (graciously provided answers here ): (define (replace-one list old new) (cond ((pair? list) (let ((next (replace-one (car list) old new))) (cons next (if (equal? next (car list)) ; changed? (replace-one (cdr list) old new) ; no, recurse on rest (cdr list))))) ; yes, done ((eq? list old) new) (else list))) edited a big @willness pointing out , fixing bug, lurking in original code. here's corrected implementation based on code (with stepwise derivation) , commented , made idiomatic racket: (define (replace-one lst b) (let loop ([lst lst] ; input list [f #

Trying to send simple messages with zeromq in python between two hosts -

script running on machine 1 import zmq context = zmq.context() socket = context.socket(zmq.sub) socket.bind("tcp://127.0.0.1:5000") print "socket bound" while true: print "waiting message" message = socket.recv() print "message received: " + str(message) this script gets socket.recv() , never returns call. the process sends data runs on machine2 import zmq context = zmq.context() socket = context.socket(zmq.pub) print "socket created" socket.connect("tcp://machine2:5000") print "socket connected" in range(1, 3): print "about send " + str(i) socket.send("hello " + str(i)) print "sent " + str(i) print "about close socket" socket.close() print "socket closed" executes completion, never finishes... $ python bar.py socket created socket connected send 1 sent 1 send 2 sent 2 close socket socket closed i'm doing wrong, how

PHP MySql query not able to execute -

this my main code if (isset($_post)) { include('connection.php'); $query = "call pgetuseridfromemail('" . $_session['email']. "')"; $result = mysqli_query($conn, $query); $row = mysqli_fetch_assoc($result); $userid = $row['idusers']; $query = "select * users"; $result = mysqli_query($conn, $query) or die("query no executed"); while($row = mysqli_fetch_assoc($result)) { echo $row['username']; } } this connection data base session_start(); $user = "root"; $pass = ""; $hostname = "localhost"; $database = "faana final"; //conection database $conn = mysqli_connect($hostname, $user, $pass, $database) or die(mysql_error()); this store procedure begin select idusers users email = email1; end i'm unable execute query echos query not executed table names case sensitive in mysql, depends on o