Posts

Showing posts from February, 2011

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

asp.net - <%# Bind([ReqPo!ItemId])%> doesnt work -

in dynamics ax enterprise portal have created templatefield in axgridview. seems ok, when try enter value textbox (manually or through lookup), doesnt bind reqpo!itemid field. checked info(strfmt("%1", reqpo.itemid))); in validatewrite method on reqpo dataset - prints nothing; i'm missing? <asp:templatefield convertemptystringtonull="false" headertext="<%$ axlabel:@sys12836 %>" visible="true"> <edititemtemplate> <asp:textbox runat="server" id="textboxfilteritemid" cssclass="axinputfield" columns="<%$ axdataset:reqtranspo.reqtrans.reqpo!itemid.displaylength %>" enabled="<%$ axdataset:reqtranspo.reqtrans.reqpo!itemid.allowedit %>" maxlength="<%$ axdataset:reqtranspo.reqtrans.reqpo!itemid.stringsize %>" text='<%# bind("[reqpo!itemid]") %&g

Problem with defining variables in python -

i'm trying write xml piece of code docs = xmlreportgenerator() docs.addmatchrow('fc barcelona','madryt','5:0') docs.save() and wrote own method: from lxml import etree class xmlreportgenerator: """""" root = etree.element('results') doc = etree.elementtree(root) #---------------------------------------------------------------------- def __init__(self): """""" def addmatchrow(self,teama,teamb, score): pageelement = etree.subelement(root,'flight',teama, teamb, score) """""" def save(self,path = none): outfile = open('matches.xml', 'w') doc.write(outfile) nameerror: global name 'root' not defined process terminated exit code of 1 done nameerror: global name 'doc' not defined process terminated exit code of 1 done am missing something?

How to get data from a json-rpc webservice : iPad /iPhone / Objective C -

i'am working on ipad project , project needs talk json-rpc webservices. webservices based on drupal module : cck , views 1)i need push json object webservice 2)i need callback data webservice i have implemented sbjson api , https://github.com/samuraisam/deferredkit/ api ipad project. the sbjson api works fine , understand 1 samuriaisam defferedkit new me my question how data out of json-rpc webservice, has sample code? or places can find objective c - json-rpc webservice documentation. kind regards, bart schoon ---------update-------- i use code now: nsstring *jsonstring = @"{\"method\":\"views.get\",\"params\":{\"view_name\":\"client_list\",\"sessid\":\"xxxxxx\"},\"id\":1}"; nsstring *requeststring = [nsstring stringwithformat:@"%@",jsonstring,nil]; nslog(@"input: %@",jsonstring); nsdata *requestdata = [nsdata datawithbytes: [jsonstrin

java - Removing top of PriorityQueue? -

assume using priorityqueue class java.util. want remove largest number priorityqueue pq, assume @ head of queue. will following work? // 1 int head = pq.peek(); pq.dequeue(head); // 2 int head = pq.dequeue(pq.peek()); would work same non-primitives well? queue#peek , queue#element return head value of queue, queue#poll , queue#remove return and remove it. it looks like int head = pq.poll(); is want. and: only work non-primitive values because queue store objects only. trick is, (i guess) queue stores integer values , java 1.5+ can automatically convert results int primitives (outboxing). feels queue stored int values.

c++ - The left parenthesis '(' found at 'foo.cpp' was not matched correctly -

location of error indicated in comment below. please fix this. #include<iostream.h> #include<string.h> #include<stdlib.h> class string { private: enum{sz=80}; char str[sz]; public: string() { strcpy(str,""); } string (char s[]) { strcpy(str,s); } void display() const { cout<<str; } string operator +(string ss) const { string temp; if(strlen(str) + (strlen(ss.str) < sz) { strcpy(temp.str,str); strcat(temp.str , ss.str); } // error reported here! else { cout<<"\nstring overflow"; exit(1); } return temp; } }; int main() { string s1="\nmerry christmas"; string s2="happy new year"; string s3; s1.display(); s2.display(); s3.display(); s3=s1+s2; s3.display(); cout<<endl; retur

SqLite database on device storage for BlackBerry -

i trying create database in device storage of blackberry simulator. in 9500 simulator, database created creating table results in "file system error" message. on 9700 simulator, database fails @ creation step. is there single code sequence create database simulators? i have written following code: uri = uri.create("file:///store/home/user/databases/xtc.db"); xtcdb = databasefactory.open(uri); createtblqurey.append("create table messenger_users"); createtblqurey.append("("); createtblqurey.append("userid integer primary key,"); createtblqurey.append("username text not null,"); createtblqurey.append("displayname text not null,"); createtblqurey.append("isregistered character default 'n'"); createtblqurey.append(")"); stmt = xtcdb.createstatement(createtblqurey.tostring()); stmt.prepare(); stmt.execute(); debugger.debug(urlinfo.workflow_file,"messenger_users table created suc

Exception/MessageBox in Calibur.Micro -

i start learning caliburn.micro , little confuse of handling exception/messange box in view model class. i found blogs about, example: http://frankmao.com/2010/11/18/handling-messagebox-in-caliburn-micro/ for example method in view model class can produce exception. public void methodwichcanproduceex(string arg1, string arg2 ) { if(arg1==null) throw new argumentnullexception("arg1 null"); if (arg2 == null) throw new argumentnullexception("arg2 null"); try { } catch (exception exception) { throw exception; //? show message box messagebox.shox(exception.message) } } what correct handling , showing these exception in view ? exist kind of pattern caliburn.micro? it possible trace exception in .net in text, xml file ? for example trace exception in xml, text file , in view show message.box or message. thank advance, maybe ques

How to handle nulls in ASP.NET MVC -

i have user registration form. has field date of birth. not compulsory in database not on ui. while create when goiing assign objects property, have convert in date format. if have not selected it, become null in formcollection object. like user.dob=convert.todatetime(collection["dob"]); now issue if collection["dob"]is null throws exception. can not assign default value here. how can handle situation? you'll better off using datetime.tryparse this. this way can check whether you're working valid date or not. datetime dateofbirth; bool isvaliddateofbirth = datetime.tryparse(collection["dob"], out dateofbirth); if(isvaliddateofbirth) { // stuff } else { // other stuff }

How to create customized Android System Images from the AOSP? -

i have created default android system images (like userdata.img , system.img , ramdisk.img ) following instructions @ android page . what create customized android system images aosp(by removing apps & code-dependencies, unnecessary target board, e-mail, browser) & run on target board reduce foot-print of resulting system images & speed-up boot-up time of target board. any pointers above mentioned customizations welcome. edit makefile: build/target/product/generic.mk , remove packages list. won't bother going how compile, etc. please note doing not remove code dependencies of packages (you'll have modify api in dalvik/ or frameworks/ hairy), eliminate packages incorporated in system image.

R: using hatched fill in plots -

i using r make plots report. see plots don't seem smooth. new r don't know much. how smooth plots? also default plots filled solid colors want have hatched fills in pie charts , bar plots. there way in r, couldn't find through basic google search put question here. did try help(pie)? density: density of shading lines, in lines per inch. default value of ‘null’ means no shading lines drawn. non-positive values of ‘density’ inhibit drawing of shading lines. pie(c(1,2,3),density=c(1,2,20)) hist(runif(200),density=c(10,20,30))

android - Multiple timerTask -

in app want operations on every 3mins, 5mins, 10 mins. in android there api in single timer/thread. best way ? the proper way create timers in android use handler, suggested here . create 1 handler task every interval need. one thing notice if need long intervals (like 3 or 5 minutes you've mentioned), application may not running long. in case can use , alarmmanager .

Computer Vision: Detecting Parabolas using the Hough Transform -

papers have been written describing how hough transform can generalised detect shapes circles , parabolas. i'm new computer vision though , find these papers pretty tough going. there code out there detection more want. wondering if briefly describe in bullet points or pseudo-code how hough transforms used detect parabolas in images. amazing. or if knows basic explanations online haven't come across enough :). thanks :). interesting question. looks great resource . included summary (loosely quoted). see source mathworks @ bottom of answer - matlab has houghlines , houghpeaks functions useful you. hope helps. run edge detection algorithm, such canny edge detector, on subject image input edge/boundary points hough transform (line detecting) generate curve in polar space (radius, angle) each point in cartesian space (also called accumulator array) extract local maxima accumulator array, example using relative threshold in other

Why use RDF instead of XML for the semantic web -

i've done bit of searching around web why use rdf instead of xml semantic modeling. came across article , it's still not clear me. wondering if give me couple of points on why cannot use xml instead of rdf. limited understanding, xml's extensibility gives way define document not give mechanisms describe meaning of it. examples appreciated. thank much from limited understanding, xml's extensibility gives way define document not give mechanisms describe meaning of it. you're correct. xml describes data not @ describing relationship between different data elements. rdf describes data , data relationships. think of rdf textual meta-database. article calls rdf semantic model. here's rdf example : <?xml version="1.0"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cd="http://www.recshop.fake/cd#"> <rdf:description rdf:about="http://www.recshop.fake/cd

c++ - How to "redefine" one char * to another char *? -

something that: (it task, how this, , not change body of main function) i thought simple... but... don't know how it... #include <iostream> #define "a" "b" int main( int argc,char ** argv) { std::cout << "a"; return 0; } // output: b how it? changing c++ output without changing main() function for example topic: #include <iostream> #include <cstdio> #include <sstream> #define cout printf("a"); std::ostringstream os; os int main() { std::cout << "b"; } a simplier one: #include <iostream> #define cout cout << "a"; return 0; std::cout int main() { std::cout << "b"; }

jquery - How to subtract from list of numbers individually? -

what want subtract list on numbers 1 number. example have in table following numbers , want subtract 4000: <table> <thead> <tr> <td>result</td> <td>start</td> <tr> </thead> <tbody> <tr> <td>0</td> <td>3000</td> </tr> <tr> <td>0</td> <td>3500</td> </tr> <tr> <td>0</td> <td>4000</td> </tr> </tbody> </table> a perfect result this: <table> <thead> <tr> <td>result</td> <td>start</td> <tr> </thead> <tbody> <tr> <td>0</td> <td>3000</td> </tr> <tr> <td>2500</td> <td>3500</td> </tr> <tr> <td>4000</td> <td>4000<

c# - Linq with dot notation - which is better form or what's the difference between these two? -

i've been reading jon skeet's c# in depth: second edition , noticed different in 1 of examples myself. he has similar following: var item = someobject.where(user => user.id == id).single(); whereas i've been doing following: var item = someobject.single(user => user.id == id); is there real difference between two? know jon skeet pretty c# god tend think knowledge in area better mine might misunderstanding here. hope can help. the queries should equal when tree evaluated, depending on target actual execution differ (ie l2s optimization).

ruby - RSpec Active Record Scope -

i want write scope requires start date of products less today. wrote following in rspec it "should not found start date in future" @product.start_date = date.tomorrow @product.save product.active.find(@product.id).should == nil end that test fails, obviously. wrote scope- scope :active, where('start_date <= ?', date.today) then rerun spec , fails with- 2) product should not found start date in future failure/error: product.active.find(@product.id).should_not == true couldn't find product id=1 [where (start_date <= '2010-12-20')] # ./spec/models/product_spec.rb:168:in `block (2 levels) in <top (required)>' i cannot figure out how code pass. not want product found. look @ error: "couldn't find product id=1" , scope working. problem in test, find raises exception usual because no record has been found. either have use find_by_id or assert exception rspec.

php - How can I ensure a specific datatype when saving in mongo? -

i'm using mongodb. i'm saving record long number, don't want save number (a float number) want string. e.g. saved "171829572137423434" , got "1.718295e+16" (just example) need complete number since id, how can force save string in mongodb? by way using php api. $number = 42; // stores number $collection->insert(array('number'=>$number)); // stores string $collection->insert(array('number'=>strval($number)));

php - How can I replace/speed up a text search query which uses LIKE? -

Image
i'm trying speed query... select padid pads (keywords '%$search%' or programname '%$search%' or english45 '%$search%') , removemedate = '2001-01-01 00:00:00' order versionadddate desc i've done work already, have keywords table can add ... padid in (select padid keywords word = '$search') ... however going nightmare split words english45 , programname word table. any ideas ? edit : (also provided actual table names) have tried fulltext indexing? here article it: http://devzone.zend.com/article/1304 also, using soundex functions, might help, might not.

c - Preprocessor output on Qt Creator -

i compiling c code in qt creator , need @ preprocessor output. i added -e flag make, don't see *.i files: mingw32-make.exe -e -w in \qt\qt-build-desktop please help. -e gcc option, not make option, passing make won't anything. also, using -e works fine single file, break build no proper .o file generated (it contains preprocessed source). works fine though adding following .pro file: qmake_cxxflags += -save-temps now if build project, preprocessed source of source file foo.cpp kept foo.ii. (tested make+gcc on os x, i'd assume works mingw, too). edit : learned equivalent flag msvc is qmake_cxxflags += -p

xml - Xpath deepest node whose string content is longer than a given length -

how 1 use xpath find deepest node matches string content length constraint. given chunk of xhtml (or xml) looks this: <html> <body> <div id="page"> <div id="desc"> wool sweater has following features: <ul> <li>4 buttons</li> <li>merino wool</li> </ul> </div> </div> ... </body> </html> an xpath expression like //*[string-length() > 50] would match <html>, <body>, <div id="page"> , <div id="desc"> . how can 1 make xpath pick deepest matching node (ie: < div id="desc"> )? bonus points, how 1 apply constraint space normalized content length? this cannot expressed single xpath 1.0 expression (not using variables) a single xpath 2.0 expression

html - Why position of div is affected by margin-top of its child? -

here markup css body{ background-color:#353535; } #parent{ background-color:#eee; } #child{ background-color:#1b1b1b; margin:60px auto 10px; width:100px; } html <div id="parent"> <div id="child">child</div> </div> result: http://jsfiddle.net/w74tz/ margin collapsing rules . if margin-top reaches top of <body> without conflicting ( padding-top:1px on #parent ) parent "inherit" that. you can avoid setting padding-top:60px on #parent instead.

delphi - When to call SetProcessWorkingSetSize? (Convincing the memory manager to release the memory) -

in previous post ( my program never releases memory back. why? ) show fastmm can cache (read hold itself) pretty large amounts of memory. if application loaded large data set in ram, after releasing data, see impressive amounts of ram not released memory pool. i looked around , seems calling setprocessworkingsetsize api function "flush" cache disk. however, cannot decide when call function. wanted call @ end of onclick event on button performing ram intensive operation. however, people saying may cause av. if used function successfully, please let me (us) know. many thanks. edit: 1. after releasing data set, program still takes large amounts of ram. after calling setprocessworkingsetsize size returns few mb. argue nothing released back. agree. memory foot print small , not increasing after using program (for example when performing normal operation not involves loading large data sets). unfortunately, there no way demonstrate memory swapped disk ever loaded

c++ - STL container leak -

i'm using vector container hold instances of object contain 3 ints , 2 std::string s, created on stack , populated function in class running app through deleaker shows std::string s object leaked. here's code: // populator function: void populatorclass::populate(std::vector<myclass>& list) { // m_mainlist contains list of pointers master objects for( std::vector<myclass*>::iterator = m_mainlist.begin(); != m_mainlist.end(); it++ ) { list.push_back(**it); } } // class definition class myclass { private: std::string m_name; std::string m_description; int m_ntype; int m_ncategory; int m_nsubcategory; }; // code causing problem: std::vector<myclass> list; populatorclass.populate(list); when run through deleaker leaked memory in allocator std::string classes. i'm using visual studio 2010 (crt). is there special need make string s delete when unwinding stack , deleting vector ? thanks, j every

How to avoid java.net.URISyntaxException in URL.toURI() -

in particular program, passed file: url , need convert uri object. using touri method throw java.net.urisyntaxexception if there spaces or other invalid characters in url. for example: url url = platform.getinstallurl(); // file:/applications/program system.out.println(url.touri()); // prints file:/applications/program url url = platform.getconfigurationurl(); // file:/users/andrew eisenberg system.out.println(url.touri()); // throws java.net.urisyntaxexception because of space what best way of performing conversion special characters handled? i guess best way remove deprecated file.tourl() responsible producing these incorrect urls. if can't it, may help: public static uri fixfileurl(url u) { if (!"file".equals(u.getprotocol())) throw new illegalargumentexception(); return new file(u.getfile()).touri(); }

c - Customizing Doxygen html output -

we have function header format have follow. looks this /** * name: blah * * parameters: * int foo * bool bar * * ..... we attempting generate documents doxygen, 1 issue when change code to: /** * name: blah * * parameters: * \param int foo * \param bool bar * * ..... when doxygen generates html comments, adds parameters title. required have line 4, creates documents 2 lines parameters, first line 4 , second doxygen auto inserts. what i'm hoping can either have doxygen ignore line 4 or add have not insert it's own "parameters:" title. know if possible? the simple solution remove "parameters:" text altogether; entirely redundant since doxygen mark-up makes clear parameters! for matter "name:" label entirely redundant too, , forces place name in both comment , code. why need that? it's name right there in code. unnecessary comment maintenance headache, , doxygen use teh name in code not name in comment

Adding logic to a PostgreSQL stored procedure -

i'm using postgresql (8.3+) , have defined enum , table follows: create type "viewer_action" enum ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'); create table "preferences" ( "user_id" integer not null, "item_id" integer not null, "rating" viewer_action not null, "time_created" timestamp not null default current_timestamp, primary key ("user_id","video_id") ); i've created stored procedure upsert new rows preferences table, using example http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#plpgsql-upsert-example : create or replace function add_preference(u int, int, r viewer_action) returns void $add_preference$ begin loop -- first try update key update preferences set rating = r user_id = u , item_id = i; if found

What are the best practices to encrypt passwords stored in MySql using PhP? -

i seeking advice on how securely store passwords in mysql using php. overlooking limitations of php itself, want know more salting, hashing, , encrypting these bad boys. obviously people continue use weak passwords unless forced otherwise, it's how storing them important me. user's passwords far more important me database itself, , such want keep them in such way painstaking , monotonous script kiddie trying reverse. due diligence can defeated, wouldn't mind making particularly bothersome. there 2 scenarios looking at. the kiddie has complete copy of database. the kiddie has complete copy of php used craft password, , database. any , advice on topic graciously appreciated. use bcrypt . if has user table of database, can use brute force/rainbow tables/etc heart's content. salt, if you're using md5 or other fast-hashing algorithm (which aren't designed solve problem, way); it's matter of time before can cracked. any well-known , wi

xamarin.ios - MonoTouch Hello World for iPad -

i have tried following sample hello world monotouch creating ipad solution. reason cannot mainwindow load. followed instructions , app closes before loading view. there missing? need tell solution how load mainwindow.xib or something? please help, seems basic , throw monotouch in garbage. what example trying follow? default new ipad solution in monodevelop should give working (empty) app load mainwindow.xib on startup.

jsp - Using jquery pagination plugin -

i want use this plugin , don't know if it'll meet of requirements. i know have use json fetch data server , use @ client side, right?. now, that's fine, because have few records, when have thousands of ; convenient bring data @ once? know : is there way query database every time press number of specific page? ask cause don't think idea load data in 1 go, it? i used pass id of record going edit this : <td align="center"> <c:url value="edititem.htm" var="url"> <c:param name="id" value="${item.id}"/> </c:url> <a href="<c:out value="${url}"/>"><img src="images/edit.png" width="14" height="14" alt="edit"/></a> </td> but don't know not how it. i hope can me out. thanks in advance. ... i'll give shot. how this? if @ source of demo page, the

java - Better ways to identify objects not getting garbage collected? -

in nutshell i have program gradually using more , more memory on time. using jmap , jhat try , diagnose still not quite there. background the program long-running server backed hbase datastore providing thrift service bunch of other stuff. however, after running few days, hit allocated heap limit, , thrash , forth time spent in garbage collection. seem references getting kept lot of data somewhere what i've done far after fiddling jstat , jconsole ended taking heapdumps jmap of running process, , run through jhat, , numbers simple don't add anywhere near memory utilisation jmap -f -dump:live,format=b,file=heap.dump 12765 jmap -f -dump:format=b,file=heap.all 12765 some stuff off top of histogram class instance count total size class [b 7493 228042570 class java.util.hashmap$entry 2833152 79328256 class [ljava.util.hashmap$entry; 541 33647856 class [ljava.lang.object; 303698 29106440 class java.lang.long 2851889 22815112

asp.net mvc - jQuery Sort and MVC Stopped Working -

i getting following error when jquery sort calls sort action: the parameters dictionary contains invalid entry parameter 'donationids' method 'system.web.mvc.emptyresult sortdonations(system.collections.generic.list 1[system.int32])' in 'vol.web.areas.activityarea.controllers.donationcontroller'. dictionary contains value of type 'system.collections.generic.list 1[vol.models.token]', parameter requires value of type 'system.collections.generic.list`1[system.int32]'. parameter name: parameters jquery: $("#dlist").sortable({ handle: '.sorthandle', update: function () { var order = $('#dlist').sortable('toarray'); $.ajax({ url: '/activity/donation/sortdonations', data: { donationids: order }, type: 'post', traditional: true }); } }); post values: parametersapp

java - google app engine session -

what java app engine,default session time out ? will bad impact if set sesion time out very long time, since google app engine session store in datastore default? (just facebook, each time go page, session still exist forever) ? default session timeout set 30 minutes. (you can verify calling getmaxinactiveinterval method) with limited info app, don't see impact. using setmaxinactiveinterval(-1) indicates session should never timeout. keep in mind need overwrite jsessionid cookie maxage prevent lose session when browser closed.

c++ - Programmatically determine if std::string uses Copy-On-Write (COW) mechanism -

following on discussion question , wondering how 1 using native c++ determine programmatically whether or not std::string implementation using utilizes copy-on-write (cow) i have following function: #include <iostream> #include <string> bool stdstring_supports_cow() { //make sure string longer size of potential //implementation of small-string. std::string s1 = "012345678901234567890123456789" "012345678901234567890123456789" "012345678901234567890123456789" "012345678901234567890123456789" "012345678901234567890123456789"; std::string s2 = s1; std::string s3 = s2; bool result1 = (&s1[0]) == (&s2[0]); bool result2 = (&s1[0]) == (&s3[0]); s2[0] = 'x'; bool result3 = (&s1[0]) != (&s2[0]); bool result4 = (&s1[0]) == (&s3[0]); s3[0] = 'x'; bool result5 =

c# - Create Object using ObjectBuilder -

want create objects using objectbuilder or objectbuilder2. i not want use structuremap i able create object having parameterless constructor using code mentioned below. public class objectfactory : builderbase<builderstage> { public static t buildup<t>() { var builder = new builder(); var locator = new locator { { typeof(ilifetimecontainer), new lifetimecontainer() } }; var buildup = builder.buildup<t>(locator, null, null); return buildup; } for creating object of customer call objectfactory.buildup<customer> however creates object of class has no parameters, need create object having constructor parameters. used createnew attribute class build object , worked fine. used sessionstatebindingstrategry object take session variables parameters in constructor. public static t buildup<t>() { var locator = new locator { { typeof(

javascript - jQuery fade li element and cycle it when mouse hovered -

i'm trying recreate effect in jquery, element ( <li> <img> ) cycled , has fading effect when hovered. ' <li> ' contains ' <img> ' (image screenshots). when mouse on top of element keep cycling in ' <ul> ' fading effect. when mouse away stop cycling list. want add pager can navigate list. my existing code: link text my problem: current code has problem pagination, added images can seen on code. instead of 1-8 only, continued add 1-8 , another. second problem is, start cycling , fading when page loads. cycling , fading should working when mouse on top of element. i don't know if 'cycle plugin' ( plugin home page ) required on approach, wan't minimal as possible. use 'cycle plugin' because it's quick answer problem. thanks , merry xmas! edits remove , added link i wrong, i'm not familiar plugin, seems need id each slideshow have instead of using class are. i've setup

c# - Ghostly outline around image after resize -

Image
i'm working on website sell hand made jewelry , i'm finishing image editor, it's not behaving quite right. basically, user uploads image saved source , resized fit user's screen , saved temp. user go screen allow them crop image , save it's final versions. all of works fine, except, final versions have 3 bugs. first black horizontal line on bottom of image. second outline of sorts follows edges. thought because reducing quality, @ 100% still shows up... , lastly, i've noticed cropped image couple of pixels lower i'm specifying... anyway, i'm hoping got experience in editing images c# can maybe take @ code , see might going off right path. oh, way, in asp.net mvc application. here's code: public class imageprovider { private readonly productprovider productprovider = null; private readonly encoderparameters highqualityencoder = new encoderparameters(); private readonly imagecodecinfo jpegcodecinfo = imagecodecinfo.getima

html - how i can make the drop down menu in jQuery -

today on forum found talking http://educationtechnologysummit.com/sponsors-a-partners.html i need drop down list same in page. how can make own have effect this. if you're referring nice animated drop down menu, website build similar: http://www.queness.com/post/1047/easy-to-style-jquery-drop-down-menu-tutorial this techniques simplest can use , doesn't require plugin it. adjust animation speeds , other things need. unfortunately, site you're referring uses mootools... :) if you're jquery plugins should looking animated menu jquery plugin

paypal express checkout problem -

hi integrating paypal website. want user enter information on site (creditcard information , personal information). i have down loded paypalfunctions.php paypal developer website. my code :- if(isset($_post['submitcard'])) { $firstname =trim($_post['firstname']); $lastname =trim($_post['lastname']); $street =trim($_post['street']); $city =trim($_post['city']); $state =trim($_post['state']); $zip =trim($_post['zip']); $countrycode =$_post['country']; $currencycode ='usd'; $paymenttype ='sale'; $paymentamount =$_post['productprice']; $creditcardtype =$_post['cardtype']; $creditcardnumber=$_post['cardno']; $expdate ='122015'; $cvv2 =$_post['cvv']; $returnresult=directpayment( $paymenttype, $paymentamount, $creditcardtype, $creditcardnumber, $expdate, $cvv2, $firstname, $lastname, $street, $city, $state, $zip, $countr

iphone - UIButton animation view -

Image
i new developer in iphone. i want create uibutton. when wil click button, button flash below. how create flash,when wil click button. please me. thanks. there property of uibutton named showstouchwhenhighlighted . if set property yes, show glow when touch button. it's default value no. [yourbutton setshowstouchwhenhighlighted:yes];

c++ - What is the merit of the "function" type (not "pointer to function") -

reading c++ standard, see there "function" types , "pointer function" types: typedef int func(int); // function typedef int (*pfunc)(int); // pointer function typedef func* pfunc; // same above i have never seen function types used outside of examples (or maybe didn't recognize usage?). examples: func increase, decrease; // declares 2 functions int increase(int), decrease(int); // same above int increase(int x) {return x + 1;} // cannot use typedef when defining functions int decrease(int x) {return x - 1;} // cannot use typedef when defining functions struct mystruct { func add, subtract, multiply; // declares 3 member functions int member; }; int mystruct::add(int x) {return x + member;} // cannot use typedef int mystruct::subtract(int x) {return x - member;} int main() { func k; // syntax correct variable k useless! mystruct myobject; myobject.member = 4; cout << increase(5) << '

bigdata - Text Editor for gigabyte sized files -

possible duplicate: text editor open big (giant, huge, large) text files i saw text editor open big text files question referred megabyte sized files. work 7gb csv files , find vim , gedit take long time open up. what text editor use for gigabyte sized files? appreciate advice can get. don't know others use vim (on windows) editing gb files , works every time. http://vim.sourceforge.net/

drag and drop - javascript mouseover while dragging -

i'm trying implement drag , drop script , have hit wall 1 problem. when take item , start dragging - item directly below cursor , onmouseover event fired on items below. want other items highlight when drag on them. 1 of solutions not drag @ - way mouse events work, ugly. has ever done , know how overcome problem? if you're thinking suggesting jquery plugin or - please don't. don't need completed solution, educational. imo, in order have mouseover event fired binding mouseover event parent element of affected elements, or perhaps document itself, since events bubbled up, elements can fire mouseover events. then further, write hit method in mouseover event , actively check position of mouse cursor, see whether it's going under target element's boundary. tradeoff in usability , performance. choose. my 2cents. or perhaps, can reverse engineer jquery ui see how implement drag element. haven't check thou, think there should wiser way.

java - JNA communication to Native Code -

i have native function , null value in jna when attach device system think have problem in lpvoid maping jna idea appreciated. cp210x_getproductstring( dword devicenum,lpvoid devicestring,dword options) devicenum — index of device product description string, serial number, or full path desired. devicestring — variable of type cp210x_device_string returning null-terminated serial number, device description or full path string. options — flag determines if devicestring contains product description, serial number, or full-path string jna code: public class helloworld { public interface clibrary extends library{ clibrary instance = (clibrary) native.loadlibrary( (platform.iswindows() ? "cp210xmanufacturing.dll" : "c"), clibrary.class); int cp210x_getproductstring(int dn,string [] ds,int op); } public static void main(string[] args) { int dn=0; string dsc = new string[100];

c++ - Is there a difference between int(floatvar) and (int)floatvar? -

possible duplicate: c++: what's difference between function(myvar) , (function)myvar ? i have seen , used both variants of these typecasts: int(floatvar) (int)floatvar is there difference between two? there preferences when use which? there no difference between them. (int)floatvar c way of doing cast int(floatvar) c++ way (although better explicit , use static_cast<> ).

PHP OOP need advice -

i building sms notification system, send 10 times free sms based on occasion web's member, , after member reach 10 times, system send last notification system saying "this last free sms notification", learning php oop , trying use oop aproach on this without further here's code: <?php class smsbonus { //bonus_sms fields = id, member_id, counter, end_status public static function find_member($id=0){ //query find member } public function add_counter($id=0){ //query increment value of counter field } public function status_check($id=0){ //query check whether given member's counter has reach number 10 } public static function send_sms($id, $message){ $found = $this->find_member($id); $status_check = $this->status_check($id); if(!empty($found) && !empty($status_check) && $found->counter == 10){ //send sms notification saying member has reach end of bonus period //update member's end_

.htaccess - Apache subdomain and domain redirections -

i have following situation tackle, have domain , subdomain pointing same resource. www.mydomain.com , sub1 .mydomain.com what i'm trying achieve following: i subdomain redirect root sub-folder of system. sub1 .mydomain.com --> sub1.mydomain.com/ subdomainsrootfolder /sub1/ redirect main domain when uri not below "/ subdomainsrootfolder /sub1/" structure requested. i.e. sub1.mydomain.com/subsrootfolder/sub1/( ) served if sub1.mydomain.com/( ) requested redirect www.mydomain.com/(*) thanks lot insights! ex. case 1. sub1.domain.com --> sub1.domain.com/subrootfolder/sub1/ case 2. sub1.domain.com/subrootfolder/sub1/* --> is case 3. sub1.domain.com/anyotherfolder/ --> www.domain.com/anyotherfolder/ case 4. www.domain.com/subrootfolder/sub1/* --> sub1.domain.com/subrootfolder/sub1/* maybe these examples more explanatory text above... :) rewritecond %{http_host} www\.mydomain\.com rewriterule ^/subrootfolder/sub1/(.*) sub1.do

How can I programatically close an iPad app? -

when press home button doesn't close, resides in memory. restart app scratch , not keep latest state. how can programatically close when home button pressed? to app close when home button pressed need add entry uiapplicationexitsonsuspend info.plist . causes app revert pre-4.0 behaviour describe.

android - OSMDroid and OpenStreetMapViewItemizedOverlay -

i'm using in application osmdroid. works nice, not clear. openstreetmapviewitemizedoverlay or (openstreetmapviewitemizedoverlaywithfocus) used. if user clicks on item overlay, small pop-up occurs item's title , description. does know, how implement click-listener if user clicks on pop-up? i haven't found methods , i'll thankfull suggestion or link. as far know osmdroid uses same api google. google's itemizedoverlay has 2 methods ontap(geopoint p, mapview mapview) , ontap(int index) both "handle "tap" on item" and must overwritten. have here: http://code.google.com/intl/de-de/android/add-ons/google-apis/reference/index.html

php - Create Pages Automatically -

is there method in php can create page automatically based on predefined template. if create new post in blogger automatically creates page post name of post, one: http://learntoflash.blogspot.com/2009/12/exit-button-in-flash.html here exit button in flash name of post have written , automatic page created it. or here on website if ask question automatically creates page question. want know can achieve in php or close ? ...here on website if ask question automatically creates page question. it sounds may believe actual file created when post question. bet page generated via question id in url. the files created cached output, may or may not resemble actual html pages.

java - SimpleJdbcCall: get result of Microsoft/Sybase stored procedure call -

i've microsoft , sybase stored procedures return result "return @value". need read value java via simplejdbccall. is possible? use sqloutputparameters :) here example : simplejdbccall countryprocedure = new simplejdbccall(datasource) .withoutprocedurecolumnmetadataaccess() .withprocedurename(procedurename) .declareparameters(new sqloutparameter("returncode", types.integer)) .declareparameters(new sqloutparameter("returnmsg", types.varchar)); map result = countryprocedure.execute(); system.out.println("returncode: " + result.get("returncode")); system.out.println("returnmsg: " + result.get("returnmsg")); edit : looked @ , there simpler way. use withreturnvalue() on simplejdbccall , return value stored in return map under "return" key.