Posts

Showing posts from September, 2012

hashmap - Nested Map in Haskell -

what trying when have rec1 = [("name", "obj-1"), ("status", "up"), ("region", "us")] then have [( "us", [("up", [("name", "obj-1"), ("status", "up"), ("region", "us")])])] this code have come in haskell. rec1 = [("name", "obj-1"), ("status", "up"), ("region", "us")] convertto rec = prelude.foldl (\map (k, v) -> data.map.insert k v map) data.map.empty rec justfold = prelude.foldr (\key val -> data.map.insert key val data.map.empty) (convertto rec1) ["us","up"] in third line above, in lambda function definition, compiler not agreeing type of val. saying expects char , getting string or not able match map string list type. i not haskell, looking if give me pointers it. thanks. edit: corrected output type. mistyped @ first. there few

ios - How do I get the "old value" from a ReactiveCocoa signal? -

if i'm using racable this: [racablewithstart(self.myprop) subscribenext:^(id x) { // stuff }]; how can can access old value of myprop (before change caused signal fire)? can access this: [racablewithstart(self.myprop) subscribenext:^(id x) { // stuff id newvalue = x; id oldvalue = rac_oldvalue; }]; i have used snippet success: [[object rac_valuesandchangesforkeypath:@"property" options:nskeyvalueobservingoptionold observer:self] subscribenext:^(ractuple *tuple) { id newobject = tuple.first; nsdictionary *change = tuple.second; id oldobject = change[nskeyvaluechangeoldkey]; }]; source: reactivecocoa documentation

Eco repeatable field with image in Wordpress -

im trying echo repeatable feilds in wordpress have images in repeatable field. want echo images in repeatable feild template. fields in custom meta box in admin panel. how can output/echo these. this came with: <?php $custom_repeatable = unserialize($post_meta_data['custom_repeatable'] [0]); ?> <?php echo '<ul class="custom_repeatable">'; foreach ($custom_repeatable $string) { echo '&ltli>'.$string.'</li>'; } </ul>'; ?>

sql - Using select query for between where clause -

i have find out date falls between 2 other dates selected different table in microsoft sql server i.e. want like select a.* ( select member.key, case when effective_date between (select month_start , month_end sales_month month=2 , year=2013) bucket_1 1 else 0 member ) a.bucket_1 != 0 i have duplicate case statement different months. ideas / help? thanks shankar. use variables hold information. declare @startdate datetime, @enddate datetime select @startdate = month_start , @enddate = month_end sales_month [month] = 2 , [year] = 2013 select * member effective_date between @startdate , @enddate

php - Rewrite rule doesn't use matches -

a client's wordpress based web site has employee pages urls this: /bio/john-doe/ /bio/nim-rod/ etc... but on printed brochures , business cards want urls like: /nim.rod , have site show /bio/nim-rod/ page. according client used work. there php file in plugins folder has looks rewrite rules capability (see below), can't work. i researched problem , found this post on wordpress' support site suggested fix doesn't work: trying troubleshoot issue added test rules code, example rule redirect /any.name /bio/nim-rod/ page, $newrules['([a-za-z]+)\.([a-za-z]+)'] = 'index.php?pagename=nim-rod'; so rewriting module finding custom rule , showing /bio/nim-rod/ page, existing rule using regex matches ends showing site's 404 page. there seems wrong substituting matched values regex pattern, can't find wrong syntax , don't know how troubleshoot further. existing pattern looks should work, shouldn't it? around 6 months ago s

jquery - Get the current value of a span -

right upon selection of checkboxes, adds assigned price, doesn't subtract upon de-selection. how check amount of $('.amount') , proper math? i made fiddle here display i'm working with. $(':checkbox').change(function(){ var amount = $('.amount').html(); sum = number(amount.replace(/[^0-9\.]+/g,"")); var names = $(':checked').map(function(){ sum += (this.value - 0); return this.name; }).get().join(','); $('span.amount').text('$' + sum); spans[1].innerhtml = sum; }); how keeping track of original amount , starting that, this: var originalamount = number($('.amount').html().replace(/[^0-9\.]+/g,"")); $(':checkbox').change(function(){ var sum = originalamount; // rest of code stays same. updated jsfiddle edit: forgot point out added "var" in front of "sum", local variable.

c++ - Unexpected garbage value -

for reason getting unexpected garbage values on variable has assigned initialization. #include <curses.h> #include <sys/time.h> #include <time.h> #include "fmttime.h" // include formattime interface #include <strstream> #include <iostream> #include <iomanip> static int monthindex; // lookup table index static const int milli = 1000; // constant value ms conversion static const int epochyear = 1970; // epoch year 1970 static const int leapy = 4; // number of years leapyear using namespace std; struct monthpairs // fields month & day lookup table { const char* mon; // months int day; // days }; monthpairs months[] = // lookup table months & days { {"jan", 31}, {"feb", 28}, {"mar", 31}, {"apr", 30}, {"may"

c# - Resizing / caching JPEG images on Azure -

i have website written in .net 4.5 / mvc 4 allows users upload images, among other things. these images can displayed throughout site in variety of sizes. currently, way works follows: the image uploaded , re-sized in memory max width of 640px (the largest site display). the resized image saved disk @ /assets/photos/source/{id}-{timestamphash}.jpg. when request image in various sizes comes through, filename combining {id}-{hash} {hash} hash of combination of ids, height, width , other information need image. if image exists in /assets/photos/cache, return it, otherwise create in memory using source image , save cache directory. i approach because happens , happens in-memory or via disk retrieval. i'd move site azure. how workflow happen in azure given of images stored blobs? still efficient use re-sizing/caching strategy or there other alternatives? wouldn't incur network latency image uploaded azure server today, gets saved disk lot faster? just looking direct

java - Is there a safe way to differentiate types of SendFailedExceptions from JavaMail -

i getting sendfailedexception because sendmail instance has email addresses blacklisted (to filter out emails non-developers during testing). sendfailedexception indicate failure connect smtp server or else. when exception occurs because email blacklisted, need ignore message , continue, other exception should allowed propagate out of method. when @ javamail api, appears sendfailedexception lowest level of exception can (the last 1 in javax.mail package). need is underlying smtpsendfailedexception , in com.sun.mail package, and, far understand, means implementation specific , should not used. however, class has getreturncode() method used differentiate between sendfailedexception s. there better way this? safe use com.sun.mail classes? suggestions? you can use com.sun.mail classes described in javadocs. unlike standard javax.mail classes, try hard keep stable , compatible, there's small chance com.sun.mail classes evolve incompatibly in future releases.

android - how to detect new contacts added to the contact database -

how detect new contacts added contact database i find lot of code on internet not work or contain errors..... is there idea not code detect new contacts add i know questions difficult, idea or simple answer ::) i tested code returns errors contentresolver cr = ctx.getcontentresolver(); string[] projection = new string[] { contactscontract.contacts._id, contactscontract.contacts.display_name }; cursor cur = cr.query(contactscontract.contacts.content_uri, projection, null, null, contactscontract.contacts.display_name + " collate localized asc"); if (cur.getcount() > 0) { while (cur.movetonext()) { toast.maketext(this,cur.getstring(cur.getcolumnindex(contactscontract.data._id)), toast.length_short).show(); toast.maketext(this,cur.getstring(cur.getcolumnindex(contactscontract.data.display_name)), toast.length_short).show(); // system.out.println(cur.getstring(cur.getcolumnindex(contactscontract

perl - TokyoCabinet Write speed too slow -

i have perl script (in ubuntu 12.04 lts) writing 26 tch files. keys equally distributed. writes become slow after 3 million inserts (equally distributed files) , speed comes down 240,000 inserts/min @ beginning 14,000 inserts/min after 3 mm inserts . individually shard files no more 150 mb , overall size comes around 2.7 gb. i run optimize on every tch file after every 100k inserts file bnum 4*num_records_then , options set tlarge , make sure xmsiz matches size of bnum (as mentioned in why tokyo tyrant slow down exponentially after adjusting bnum? ) even after this, inserts start @ high speed decrease 14k inserts/min 240k inserts/min. due holding multiple tch connections (26) in single script? or there configuration setting, i'm missing (would disabling journaling help, above thread says journaling affects performance after tch file becomes bigger 3-4gb, shards <150mb files..)? i turn off journaling , measure changes. cited thread talks 2-3 gb tch file, i

java - How to specify width of custom view? -

i'm having trouble trying set specific size width of custom view. know can hard-code value in layout_width field in xml file i'm trying not result hard-coding values. need view half size of screen. so, within class find half screen size: windowmanager wm = (windowmanager) context.getsystemservice(context.window_service); display display = wm.getdefaultdisplay(); try{ point size = new point(); display.getsize(size); screenwidth = size.x; }catch(nosuchmethoderror e){ screenwidth = display.getwidth(); } then, call: measure(width|measurespec.exactly, layoutparams.wrap_content|measurespec.exactly); //where width equal half screen width but not seem working case. so, sum up, how specify particular size custom view ? useful , appreciated! thanks! override onmeasure() method in custom view: @override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) { int width = getresources().ge

c - Creating a thread and passing input through the parent -

i'm trying use mutex make thread wait user input parent thread. current problem i'm facing child doesn't wait, though have mutex lock , unlock, join in parent thread. also, unsure if struct being used correctly? main() , *chthread() using same instance of "lock"? understand when user input before thread creation works, requirements of exercise states meant pass information after thread created. #define _gnu_source #include <stdio.h> #include <pthread.h> #include <errno.h> #include <string.h> #include <stdlib.h> #include <readline/readline.h> #include <readline/history.h> # define buffer_size 256 void *chthread(void *arg); struct { pthread_t pth; pthread_mutex_t lock; int ret; void* ex; } muinfo; int main(int argc, char *argv[]) { //struct mutex args; char line[buffer_size]; char *temp = null; pthread_mutex_init(&muinfo.lock, null); if((pthread_create(&muinfo.pth, null, chthread, line)) != 0) {

How to mass edit and replace MySQL database row, replacing all using a list? -

so have list of 230 countries in database table called "countrylist" inside "country" row. besides "country" row, have "code" row, has country code of country in it. the countries in english , since need country names in 3 other languages well, duplicated table 3 other languages too. programmed php code choose right table based on language. i have list of country names in other 3 languages ready , have same ordering. but... leaves me 230 countries replace in 3 languages, , that's lot of wasted time know should simpler basic copy pasting. although don't have slight clue of how or if can done... i want know if there way preserve "code" row in tables , replace of countries in "country" row query/command? thanks, appreciated insert countries_fr (code) select countries_en.code countries_en assuming have tables countries_fr , countries_en, , both have code column. insert code countries_en table cod

Powershell script gci accesses weird folders -

i have following script runs ok, looks unzipped file, zip it, , deletes it. [string]$pathtozipexe = "c:\program files\7-zip\7z.exe"; $items= gci -exclude *.zip e:\backup\myfolder | {!$_.psiscontainer} # loop through files foreach ($file in $items) { # run if there file in directory if ($items.count) { [array]$arguments = "a", "$file.zip", $file; # zip file &$pathtozipexe $arguments; # delete file if compression succeeds if($?){ remove-item -force $file; } else { # later should changed send email write-host "error: file not deleted." }; }; }; usually runs ok , returns output following: .. .. 7-zip [64] 4.65 copyright (c) 1999-2009 igor pavlov 2009-02-03 scanning creating archive e:\backup\myfolder\arc_t813021320_s536_p1_c1.zip compressing arc_t813021320_s536_p1_c1 ok 7-zip [64] 4.65 copyright (c) 1999-2009 igor pavlov 2009-02-03 scanning cre

c++ - Object of abstract class type "Rectangle" is not allowed -

//quizshape.h #ifndef quizshape_h #define quizhape_h #include <iostream> #include <iomanip> #include <string> using namespace std; class quizshape { protected: //outer , inner symbols, , label char border, inner; string quizlabel; public: //base class constructor defaults quizshape(char out = '*', char in = '+', string name = "3x3 square") { border = out; inner = in; quizlabel = name; cout << "base class constructor, values set" << endl << endl; }; //getters char getborder() const { return border; } char getinner() const { return inner; } string getquizlabel() const { return quizlabel; } //virtual functions defined later virtual void draw( ) = 0; virtual int getarea( ) = 0; virtual int getperimeter( ) = 0; }; class rectangle : public quizshape { protected: //height , of rectangle drawn int heig

pixel - C++ & Allegro 4.2 - I need graphics to stretch in windowed mode -

i using c++ allegro 4.2 build windows game. i want stretchable graphics in windowed mode. i'm 1 likes giving users of programs lots of options; hate when i'm playing game in windowed mode , i'm either not allowed stretch window or content inside window doesn't stretch (this sucks lot 640x480 size games played on high resolution screens don't allow fullscreen; requiring magnify tool play properly). i'm wondering if there way in allegro or perhaps if there programming library allows graphics stretch shape of window itself. know how have allegro applications switch fullscreen mode; i'm trying improve windowed mode. a big reason because artstyle low-resolution art (i call "bitmap brothers" style); it's games since it's organized , easy edit. don't want have go higher 640x480 increase size because it's far high low-resolution art, window remains small during windowed mode. i noticed allegro 5.0.8 has line of code: al_set_new_

c# - App-wide Context Menu -

i have created context menu text-box in .net application, , works great. use same context-menu text-boxes in application. currently, using code following work existing functionality: private void contextmenustrip1_opening(object sender, system.componentmodel.canceleventargs e) { // disable undo if canundo property returns false if (maintextbox.canundo) { contextmenustrip1.items["undo"].enabled = true; } else { contextmenustrip1.items["undo"].enabled = false; } } my question how go converting code text-boxes can use same code, rather rewriting on , on again text-box instances. have assigned same contextmenu of text boxes, more specifically, how pass name of calling text-box function? hoping simple perhaps: // disable undo if canundo property returns false if (this.canundo) { contextmenustrip1.items["undo"].enabled = true; } else { contextmenustrip1.items[&quo

http status code 404 - application URL gives 404 error after deployment -

i using tomcat v.6.0 . have deployed .war file manager. can see exploded folder in webapps directory of tomcat. can access http://localhost:8080 . when try access /myapp, getting 404 error. when checked console on eclipse (which handling tomcat , myapp from) , see following : apr 17, 2013 10:56:05 pm org.apache.catalina.startup.contextconfig applicationwebconfig severe: parse error in application web.xml file @ jndi:/localhost/submitserver/web-inf/web.xml org.xml.sax.saxparseexception; systemid: jndi:/localhost/submitserver/web-inf/web.xml; linenumber: 466; columnnumber: 19; error @ (466, 19: filter mapping specifies unknown filter name sourcetextfilter i checked line 466 in web.xml file , fine 463 <filter-mapping> 464 <filter-name>sourcetextfilter</filter-name> 465 <url-pattern>/view/project.jsp</url-pattern> 466 </filter-mapping> 467 <filter-mapping> 468 <filter-name>sourcetextfilter</fil

python - Querying for Multiple ManyToMany Fields -

i have model, entry , manytomany field: tags = models.manytomanyfield(tag) the tag model simple: class tag(models.model): name = models.charfield(max_length=25) def __unicode__(self): return self.name i want create function, getentrybytags takes list of tag names , returns entry has tags. if knew number of tags , names of each, trivial: entry.objects.filter(tags__name="tech").filter(tags__name="music").filter(tags__name="other") but since going based on user input , tags number variable, i'm not sure how proceed. how iterate on multiple item list object contains each of manytomany objects names represented in list? you can try, from django.db.models.query_utils import q tag_name_list = xxx # dynamic tag name list based on user input query_list = [q(tags__name=tag_name) tag_name in tag_name_list] query_set = entry.objects query in query_list: query_set = query_set.filter(query) return query_set

excel - Subscript Out of Range for Looping Through Folder Code -

i trying loop through folder following code. however, keep getting subscript out of range error. explain fix issue? sub loopthroughfolder() const filespec string = "*.xls" dim y integer dim myfolder string dim myfile string dim idot integer dim fileroot string dim fileext string dim arraydata() variant y = 2009 2030 redim preserve arraydata(y, 12) myfolder = activeworkbook.path & "\" & y & "\" = 1 myfile = dir(myfolder & filespec) while len(myfile) > 0 idot = instrrev(myfile, ".") if idot = 0 fileroot = myfile fileext = "" else fileroot = left(myfile, idot - 1) fileext = mid(myfile, idot - 1) end if myfile = dir arraydata(y, i) = fileroot msgbox arraydata(y, i) = + 1

codeigniter - How to get data from controller to view -

i have function in controller function test() { $data['lang'] = read_file(apppath . "language/bahasa/english.php"); $this->load->view('test', $data); } english.php <?php if ( ! defined('basepath')) exit('no direct script access allowed'); $lang['content.home'] = 'home'; $lang['content.about_us'] = 'about us'; $lang['content.team'] = 'team'; $lang['content.contact'] = 'contact us'; how data $lang['content.home'] = 'home' in view why writing own method retrieving language files? there language class handle you. using $this->load->view('test', $data) right way properties of $data view. said, if read_file() usage working, data in view in $lang['content.home'] , etc.

javascript - How can I remove visible HTML syntax from text in a browser? -

we pulling in editorial review amazon api, , includes inline html syntax should not displayed. how can remove html syntax displayed viewer? potentially javascript? you can see example of if @ review after click 'view details' on bulb on bulbtrip.com . thanks! adam try using this var actualstring = "<span>some text</span> other text <br/> sfahgukasfg <p > "; removedhtmltagsstring = actualstring .replace(/<[^>]+>/ig,""); alert(removedhtmltagsstring );

Delete a relationship in neo4j 1.6 using cypher -

i think simple question not able find answer. have tried various ways delete relationship in neo4j 1.6 using cypher, getting error. start n = node(1) match n-[r:knows]-m delete r; i want delete relationships of type knows , getting error - ==> syntaxexception: expected return clause ==> "start n = node(1) match n-[r:knows]-m delete r; " even if give start n = node(1) match n-[r:knows]-m delete r return count(r); it doesnt work. note : above issue not seen on neo4j 1.8, have somehow run query on neo4j 1.6. you won't able via cypher @ least using 1.6 mutating cypher available 1.8. might have use api delete.

android - Blocking/Synchronous function call in AIDL -

i working on android service, service provided aidl interface applications, application calls function getdata() using aidl interface, function implemented in service , network operation, connect server , fetch data, network transaction happen in background thread, problem want function getdata() should not return until network operation complete, result comes server , want return getdata(), getdata function returns , network operation in background thread keep on running in parallel, how avoid this, cannot call network operation in main thread. read countdownlatch, possible solution? service main thread getdata getdatafromserver-----------> in background thread /*this problem */ getdata returns; | | |

SDLC phase Testing initiated and why? -

Image
at phase of sdlc testing activities can initiated , mention why should initiated @ phase starting of testing depends on module using project development process. long term project should use v-model of sdlc. in model start testing first phase. as see in picture bug interduce in first stage of sdlc makes entire process worng, avoid situation testing should start first phase of sdlc . and resion cots of debugging low in starting stage, have statr testing in first stage of sdlc .

How do I download a specific version of source code from android.googlesourcecode.com using Git? -

i want download source code shown in tags android.googlesourcecode . example, want download calendar code https://android.googlesource.com/platform/packages/apps/calendar i want download code of android specific version tag. example, android-4.0.3_r1.1 following link https://android.googlesource.com/platform/packages/apps/calendar/+/android-4.0.3_r1.1 . when browse code git repositories doesn't show tag's version of code. how do this? all tags listed in calendar page under all tags . page contains android-4.0.3_r1.1 . if clone repo , tag, find well. example: c:\prog\git>git clone https://android.googlesource.com/platform/packages/apps/calendar cloning 'calendar'... remote: counting objects: 80, done remote: finding sources: 100% (80/80) remote: total 30504 (delta 15730), reused 30504 (delta 15730) receiving objects: 100% (30504/30504), 11.16 mib | 4.61 mib/s, done. resolving deltas: 100% (15730/15730), done. c:\prog\git>cd calendar c

string - What is the recommended way to flatten a std::vector<CString> to a multi_sz using C++ / STL -

i want write list of strings (atl::cstring) stored in std::vector reg_multi_sz value in windows registry. know how in plain c (iterate once total length, allocate buffer, copy strings buffer separated "\0"). know tried following using stl (sorry have use vs2010 "for each"): std::vector<tchar> multiline_sz; each ( cstring entry in mystringlist ) { tchar* buf = entry.getbuffer(); multiline_sz.insert(multiline_sz.end(), &buf[0], &buf[entry.getlength()]); multiline_sz.push_back(l'\0'); } multiline_sz.push_back(l'\0'); this works, wonder if there more elegant or faster way using stl. cstring::getbuffer() zero-terminated, it's valid do for each ( cstring entry in mystringlist ) { tchar const* buf = entry.getbuffer(); multiline_sz.insert(multiline_sz.end(), &buf[0], &buf[entry.getlength()+1]); }

java - Does not show accurate output for android apps -

i new android. create apps followed tutorial. create restaurant info page. when type name , address , types , should show details , instead of shows in emulator com.example.lunchlist.restaurant@40ad8sd com.example.lunchlist.restaurant@40fhyu5 here xml code: activity_lunch_list.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchcolumns="1" > <tablelayout android:id="@+id/details" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:stretchcolumns="1" > <tablerow > <textview android:text="@string/namee" /> <edittext android:id="@+id/name" andr

xcode - Use multiple targets for same project to load different resource images -

i have project storyboard , resource images. i want create app have same interactions etc except different set of resource images added project in different folder. tried adding new target when try debug it, cannot run original storyboard. any ideas? steps: right click on target , choose duplicate change name of target choice rename duplicated .plist file name name chose in step 2 click on control chose start application debug , select manage schemes delete duplicated scheme (it have "copy" in name likely) click on "auto create schemes now" updated name select scheme want debug in control mentioned in step 4.

Android-Magento- How to add product to cart using ksop2 -

i building android application using soap api in magento has ability sell products on mobile. using ksoap2 library file. but problem not able add product cart using function shoppingcartproductadd . gives error product’s data not valid so please me if have better methode add product cart here code add product cart soapobject request; method_name = "shoppingcartcreate"; soap_action = "urn:magento/shoppingcartcreate"; try { soapserializationenvelope env = new soapserializationenvelope( soapenvelope.ver11); env.dotnet = false; env.xsd = soapserializationenvelope.xsd; env.enc = soapserializationenvelope.enc; httptransportse androidhttptransport = new httptransportse(url); androidhttptransport.debug = true; request = new soapobject(namespace, method_name); request.addproperty("sessionid", sessionid); env.setoutputsoapobject(request); andro

text/string issue in jquery with html controls -

i have formatted text saved in database.there spaces,bold text,line break etc etc in text.when database , alert it,it ok,all same.but when assign html control <textarea id="description"></textarea> and alert it,it loses html tags space,line breaks bold etc etc...whole text shows 1 paragraph. <textarea name="description" cols="200" rows="50" id="description"></textarea> alert(json.description_demo);//this ok $("#description").val(json.description_demo); alert($("#description").val());//now give me issue what can issue?here text brand new!!! huge size of 3 bedroom apartment located in dubai marina orra tower rent situated on high floor, overlooking gorgeous view of marina recreation , sports amenities - temperature controlled swimming pools, jacuzzi, separate wet areas his/hers, state of art gymnasium, tennis & basketball courts , dedicated indoor children play a

php - Omitting redundant months and years in date range list -

Image
i have got strange issue dates of events , have tried hard fixed unable it. i attaching screenshot of how want display dates on page : in picture first event deine energie in aktion! combination of 5 events each event having start date , end date. the first part of event 1 day event starts on 4th april , ends on 4th april. second part on 7th april, 3rd part on 9th april , 4th part on 20th april the last part starts on 5th may , ends on 10th may. the dates stored in database in format : showing dates last part of event. event start date : 2013-05-05 00:00:00 event end date : 2013-05-10 00:00:00 so want display dates in format shown in picture. there multiple cases: first if dates coming within single month display month name @ end once. second if months changed month name shown after date when month changed. i getting events dates in while loop, how compare current event date coming event date in loop. this code have used far dates database.. $nid = $row-&g

masm - How can I reverse and modify my string in assembly? -

i have project want enter number , enter 3, gives output of, zyx**xyz zy****yz z******z and 5 give you zyxwv**vwxyz zyxw****wxyz zyx******xyz zy********yz z**********z in project don't think instructor allow me use array, or @ least not yet here idea. i thinking of making string number 3. produce zyx* , reverse other half of triangle. thing is, don't know how change letters 1 @ time stars. i'm thinking of using loops not sure how it. know next string zy** , reverse it. don't me wrong, i'm not asking me maybe give me pointers or tips on how approach it. thank you. so far, all, have been able come this. title masm template (main.asm) ; description: ; ; revision date: include irvine32.inc .data x dword ? msg byte "please input number: " ,0dh,0ah,0 .code ;crlf main proc call clrscr mov edx, offset msg ; moves message input number register call writestring ;

ios - limit UIImagePicker Camera View to a small part of screen -

i developing app uses uiimagepicker capture , save screen. following code launch camera. uiimagepickercontroller *imgpickcontroller = [[uiimagepickercontroller alloc] init]; imgpickcontroller.sourcetype = uiimagepickercontrollersourcetypecamera; imgpickcontroller.delegate =self; imgpickcontroller.allowsediting=yes; [self presentmodalviewcontroller:imgpickcontroller animated:yes]; this launches camera in whole screen. is there way show camera-view inside small subview on app-screen?? hope clear. thanks.

Groovy: How to get Type on which a static method is called? -

when static method defined on base class called using child class, how find called on child class type?: class base { static def method(){ println "class on method called? ${this}" } } class child extends base {} child.method() in code above, this rightly points base class. i don't think can done actual static methods, nice alternative use groovy expandometaclass add static closure method. inside said closure, can access calling class delegate . i.e. base.metaclass.static.anothermethod = { println "class on method called? ${delegate}" } calling base.anothermethod() have delegate referring base , calling child.anothermethod have pointing child.

php - Get time value only from timestamp values -

i fetching datelocal variable "2013-04-18t12:25:00.000" how can retrieve 12:25:00.000 in ? i calling value in below code echo $flightstatus->arrivaldate->datelocal,"<br>"; you can use date , strtotime function achieve this echo date('h:i:s',strtotime($flightstatus->arrivaldate->datelocal)); this output 12:25:00

python - How to get total workers by button? -

Image
my requirement when adding workers in select workers tree view, need add total of them right side bottom total workers field.its ok show when i'm going save or when clicked (update) button. refer purchase module can't find function exaclty called when button clicked. my whole code uploaded here@github refer line 397 in bpl_view.xml , line 335 in bpl.py as per purchase module wrote function.but have return statement.thats confused me. def button_total(self, cr, uid, ids, context=none): return true please advice me on issue & please tell me why when clicked button records save automatically.?its have return true statement. ? ? write code: def button_total(self, cr, uid, ids, context=none): tea_worker_line_ids = self.browse(cr, uid, ids[0], context=context).selected_tea_workers_line_ids or [] total_tea_worker = len(tea_worker_line_ids) self.write(cr, uid, ids, {'total_workers': total_tea_worker}, context=context) return t

php - Cannot figure out this wildcard subdomain mishap -

i've been trying accomplish hours , reason not want work. all want username.domain.com internally go domain.com/users/username i set-up dns wildcard subdomain points towards public_html/wild folder , placed index.html file in there , seems work well. the problem when use .htaccess file: rewritecond %{http_host} !^www\.domain\.com$ [nc] rewritecond %{http_host} ^(www\.)?([a-z0-9-]+)\.domain\.com$ [nc] rewriterule !^index\.php($|/) index.php/users/%2%{request_uri} [pt,l] it shows 404 page not found error. checked logs , says still looks in /wild folder, script 1 level in public_html folder. how can fix problem? thank you! you you've pointed wildcard subdomain public_html/wild , means when requests http://user.domain.com/ / request mapped public_html/wild . means request wildcard subdomain never able mapped in parent directory public_html (that's why it's called document root ). one of things can point document root of wildcard subdomains same

database - Oracle SQL foreign key not working -

table #1: create table department( dept_id char(02) primary key, dept_name varchar(20) , manager_id char(03), location_id char(04) ) table #2: create table employee ( employee_id char(03) primary key, first_name varchar(10), dept_id char(02) foreign key references department(dept_id), email varchar(10), tel_no char(10), hire_date date ) when try create foreign key in table #2. following error. ora-00907: missing right parenthesis please kind enough advice me whats wrong in code , how can fix this? just remove foreign key : create table employee ( employee_id char(03) primary key, first_name varchar(10), dept_id char(02) references department(dept_id), email varchar(10), tel_no char(10), hire_date date ) because foreign keys reference primary key default, create table employee ( employee_id char(03) primary key, first_name varchar(10), dept_id char(02) references department, email varchar(1

c# - How to get file type in file upload control? -

i used in file upload control. got file name createdatabase.docx . want filetype docx i have createdatabase.docx .i want file type or want remove createdatabase i have lot of file xml,pdf,docx,etc . .so i want file type or next characters of dot(.) you can use system.io.path.getextension(fileupload1.filename) or can perform string[] segments= fileupload1.filename.split("."); string fileext = segments[segments.length-1]

linux - How to automate a vnc+ssh solution -

i run application (call firefox) on work machine. problem need complicated ssh tunelling access access machine blocked outside , ports blocked internally. following. ssh -v -l 1200:serverc:22 user@serverb (locally) ssh -v -l 5900:127.0.0.1:5900 -p 1200 user_from_serverc@127.0.0.1 (locally) x11vnc -safer -localhost -nopw -once -display :0 (on serverc) vinagre localhost::5900 (locally) i run firefox (say) in vnc window opens , works. however have bash script me. how can automate it? there 2 problems. i need stay logged in after each ssh above tunelling work simple bash script stops after first step. i don't know how application run automatically in vnc window. ideally type "./remote-firefox" (for example) locally happen. try: x11vnc -safer -localhost -nopw -once -display :0 #run manually on system_c & on local system, ssh -t -l 5902:localhost:5901 user_b@server_b 'ssh -t -l 5901:localhost:5900 user_c@server_c' & #note: ena

symfony - Ordered Many-to-many -

is there elegant way in symfony modelize many-to-many relation additionnal field for total order ? understand why 1 needs create additionnal entity relations attributes, here 'position' included in classic arraycollection of classic many-to-many relation, position in array corresponding position attribute. thanks it's more of doctrine question symfony question answer can found here . in short, have add @orderby mapping field, so: class foo { /** * @orm\manytomany(targetentity="bar") * @orm\orderby({"position" = "asc"}) */ protected $bar; }

cakephp - Cake PHP validation error not shown although existing in array -

after having trouble calling validation functions in model, tried validating controller. works fine except 1 field value wrong not shown red , doesn´t show error-message. the "validationerrors"-array passed view looks this: array( 'city' => array( (int) 0 => 'bitte eine stadt angeben' ), 'cart' => array( (int) 0 => 'bitte etwas eingeben' ), 'date' => array( (int) 0 => 'bitte das datum eingeben' ), 'time' => array( (int) 0 => 'bitte die zeit eingeben' ), 'income' => array( (int) 0 => 'bitte das trinkgeld in euro angeben' ), 'deliveryarea' => array( (int) 0 => 'postleitzahl existiert nicht!' ) ) the "deliveryarea" built in dynamically code: //form errors formatieren für plz-validierung $this->post->set($this->request->data['post']); $this->post->validate

Can't access to a file in Prolog, always read the end_of_file atom -

i studying prolog using swi prolog , finding difficulties related operation of reading , writing on file. i have simple program read standard input (the keyboard) , write on file: processfile(file) :- see(file), processfile, seen. processfile :- read(query), process(query). process(end_of_file) :- !. process(query) :- query, write(query), nl, processfile. i trying execute under linux. in bash go folder located prolog source file , myfile file and, after have consult program, execute following statment: ?- processfile(myfile). true. as can see probem give me true can't insert keyboard, write myfile file. if try trace happen obtain following informations: [trace] ?- processfile(myfile). call: (6) processfile(myfile) ? creep call: (7) see(myfile) ? creep exit: (7) see(myfile) ? creep call: (7) processfile ? creep call: (8) read(_g697) ? creep exit: (

internet explorer - Silverlight application not funcitoning -

i have made silverlight application drag , drop uploading. now, application works fine when deploy local server. whenever deploy qa server (machine on same lan has global ip associated it), nothing. shows white background screen (default parameter). there no error couldn't find xap file or such, neither other console errors well. can't seem figure out error for. as suggested other blogs , posts, have tried change extension xap dll, still same thing. please help. to access silverlight app on remote server, need put on root folder of server clientaccesspolicy.xml file. a basic one, allowing use domain: <?xml version="1.0" encoding="utf-8" ?> <access-policy> <cross-domain-access> <policy> <allow-from> <domain uri="*"/> </allow-from> <grant-to> <resource include-subpaths="true" path="/"/> </grant-to> <

logging - Umbraco DB log error: Couldn't find any page with the nodeId = 0 -

i have been getting error in umbraco, has caused crash on server , database. i'm not sure causing error not give information, there no node id, each time page accessed on server these lines written on , on in umbracolog table: couldn't find page nodeid = 0. caused page isn't published! parameter name: nodeid does have idea causing this? using umbraco v 4.7.1.1 have tried republishing site? got same error , fixed it.

android - how/where to call notifyDataSetChanged from another fragment -

i have fragment listview show content of list. update , delete items in list through fragment - dialog fragment (using content provider's delete , update methods) , works fine except "live" refresh of list view. i know should calling notifydatasetchanged on adapter somewhere have no idea where. since user delete/update through different fragment i'm guessing should calling notifydatasetchanged on adapter through fragment somehow. investigated little , understand should run on ui thread. i tried several things no success. please have @ code. this fragment holds listview: public class shiftsfragment extends android.app.fragment implements loadercallbacks<cursor> { private typeface tf, roboto; private contentresolver cr; public shiftsadapter sa = null; public static shiftsdialog sd = null; public static shiftsfragment newinstance(string title) { shiftsfragment pagefragment = new shiftsfragment(); return p

unmarshalling - Out of memory when unmarshaling the xml in camel dsl -

i m facing oom issue in below code from("file://" + getdumpdirlocation() + "?maxmessagesperpoll=1&buffersize=8192") .unmarshal().string("utf-8") the xml file gets dumped @ directory location huge (sometimes 1g). i tried adding custom processor - no success, from("file://" + getdumpdirlocation() + "?maxmessagesperpoll=1&buffersize=8192") .process(this.getremoveinvalidxmlcharacterprocessor()) is there way avoid out of memory exception? so exchange.getin().getbody(string.class) in processor throws oom object structure huge considering size of dumped xml file. thanks. its not idea read in 1gb of file memory. instead read file in "chunks" using streaming. and if want process big xml files read of these articles, can find here: http://camel.apache.org/articles splitting big xml files. search on page xml, , can find links.