Posts

Showing posts from August, 2012

scroll - Android Horizontal scrollview with [10][10] -

scroll - Android Horizontal scrollview with [10][10] - i looking android horizontal scrollview of [10][10]array means 10 textviews should display vertically , each respective vertical textview there 9 more textview s in horizontal scrollview .. not able create grid of [10][10] horizontal , vertical scorllview you can utilize layout job <scrollview> <horizontalscrollview> <tablelayout> <!-- add together 10 rows --> <tablerow> <!-- add together 10 textview columns --> <textview /> </tablerow> </tablelayout> </horizontalscrollview> </scrollview> android scroll horizontal-scrolling android-4.4-kitkat horizontalscrollview

android - Strange app memory management -

android - Strange app memory management - i developing android application , think performing pretty uncommon behaviour. when start app, move away pressing button , check cached background processes section of android's application manager shows me app's cached background process consuming ~10 mb of ram. well, seems totally normal, but, however, everytime open 1 time again , close pressing button , check app's memory consuption increases ~800 kb, means if open app 10 times , check memory consuption see consuming 10 mb + 10 * 800 kb = 18 mb. memory consuption rises every recreation of app's main activity (it means when rotate screen too) until reaches ~28 mb, goes downwards ~23 mb , stays between 23 , 28 mb independently how many times more open it. normal or should suspect memory leak? i suggest read article how analyze apps memory consumption using mat. http://android-developers.blogspot.com/2011/03/memory-analysis-for-android.html?m=1 has helped me find

ios - how to make iCarousel items sorting order fixed? -

ios - how to make iCarousel items sorting order fixed? - i'm using icarousel scroll between images type "icarouseltypetimemachine". has ugly effect. images come in front end of each other when scrolling ends, briefly views sorting order not fixed! caused lot of other problems. ios icarousel

c++ - system() not executed when compiled with arm-none-linux-gnueabi-g++ -

c++ - system() not executed when compiled with arm-none-linux-gnueabi-g++ - #include <stdio.h> #include <stdlib.h> int main() { printf("hello\n"); system("echo nikhil"); printf("hello\n"); getchar(); homecoming 0; } when code compiled arm-none-linux-gnueabi-g++ scheme phone call getting skipped, other instructions getting executed except system("echo nikhil") why happening , how avoid problem? system() not, in fact, work programs set-user-id or set-group-id privileges on systems on /bin/sh bash version 2, since bash 2 drops privileges on startup... http://linux.die.net/man/3/system you can seek exec command http://linux.die.net/man/3/exec c++ linux unix

iis - How to access Azure Storage Emulator (Local) over wifi? -

iis - How to access Azure Storage Emulator (Local) over wifi? - i next info in documentation access azure storage emulator (locally) http://msdn.microsoft.com/en-us/library/azure/hh403989.aspx in storage emulator, because local computer not perform domain name resolution, business relationship name part of uri path. uri scheme resource running in storage emulator follows format: http://<local-machine-address>:<port>/<account-name>/<resource-path> the next format used addressing resources running in storage emulator: blob service: http://127.0.0.1:10000/<account-name>/<resource-path> queue service: http://127.0.0.1:10001/<account-name>/<resource-path> table service: http://127.0.0.1:10002/<account-name>/<resource-path> for example, next address might used accessing blob in storage emulator: http://127.0.0.1:10000/myaccount/mycontainer/myblob.txt i

Error spring 3.2 and OSGi -

Error spring 3.2 and OSGi - i want utilize spring 3.0 , osgi. spring file is: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"> <osgi:reference id="com.test.miprueba" interface="com.test.miprueba"/> </beans> the dependencies of pom are: <dependencies> <dependency> <groupid>commons-lang</groupid>

LinkedIn Omniauth OAuth 2 in Rails - Authentication failure for bad redirect -

This summary is not available. Please click here to view the post.

html - Set text to dd element in javascript -

html - Set text to dd element in javascript - i'd set text dd element. i've tried google question, found nothing. could please tell me, how can set(replace) text within dd tag? i've tried: $('#dd_di').innerhtml = my_var; $('#dd_di').innertext = my_var; $('#dd_di').innertext = "3500"; but nil changed. console.log($('#dd_di')); [<dd id="dd_di"></dd>] you're trying utilize dom properties on jquery object. in jquery, utilize .text() or .html() set text , raw html of element respectively. $('#dd_di').text(my_var); $('#dd_di').html(my_var); // or if need set raw html innerhtml , innertext can used, need access dom element: $('#dd_di').get(0).innerhtml = my_var; // or no jquery: document.getelementbyid("dd_di").innerhtml = my_var; javascript html

java - Playing media asynctask in a service cusses other asynctasks lock -

java - Playing media asynctask in a service cusses other asynctasks lock - i having asynctask play media , using service it. problem when asynctask (in service) running, part of app used asynctask communicate web server not working until playing finishes. (playing media not buffering it). i have tried removing asynctask , using new thread can't update ui in mode. what should prepare it? you don't want both asynctask , service . service s designed long running background tasks. 'asynctask's designed launch new thread, perform long-running task, , send info ui thread. there 1 ui thread, so, if you're updating ui, blocking user interaction. if you're streaming music, want service spawn new thread can downloading songs in background. if, example, user presses button , loads video, might instead want asynctask perform download. generally, 1 might utilize asynctask download media file on user request (or, if you're downloading in bac

c# - Hashcodes - multiply or xor? -

c# - Hashcodes - multiply or xor? - i saw hash function - , triggered alarms: public override int gethashcode() { var result = 0; unchecked { result = anintid.gethashcode(); result *= 397 * (astring != null ? astring.gethashcode() : 0); } homecoming result; } my automated hash-code-smell-fixer-subroutine wants rewrite read: public override int gethashcode() { var result = 0; unchecked { result = anintid.gethashcode() * 397; result = (result * 397) ^ (astring != null ? astring.gethashcode() : 0); } homecoming result; } i can't remember learned pattern, seems of doesn't create sense: the first multiplication 397 looks waste of time [redacted] {in brain minus coffee context, interpreted ^ exponentiation} does seem correct, or making mistakes? c# gethashcode

c# - Can this "assignment in conditional expression" be removed without changing behavior? -

c# - Can this "assignment in conditional expression" be removed without changing behavior? - refactoring legacy app, resharper flagged odd code: if( retval = util.netsendcommand( returnedcommands.command ) ) the "retval = " part grayed out; assume can remove it. perhaps person wrote code meant equality test, working intended as-is, can safely remove "retval =" correct? update here's code in context: public bool pendingcommandsexecute_ccrcommand() { bool retval = false; string themessage = new string( '\x00', 1023 ); string command = "ccrcommand"; seek { if (returnedcommands.key != command) homecoming false; hashresultsadd(command, "started"); if( retval = util.netsendcommand( returnedcommands.command ) ) { util.readfinishedchanged += new util.readfinishedhandler( readfinished_hhtcommand );

html - Media Queries Not Being Triggered -

html - Media Queries Not Being Triggered - i creating responsive site right unfortunately media queries not beingness triggered. have supplied code, copied , pasted as-is document using, below. does know doing wrong preventing media queries beingness called? <!doctype html> <!-- utilize 1 when wp goes <html <?php language_attributes(); ?>>!--> <html> <head> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title><?php wp_title( '|', true, 'right' ); ?></title> <!-- icon !--> <link rel="icon" href="images/favicon.png" type="image/png"> <link rel="shortcut icon" href=&q

templates - Own std::shared_ptr with std::make_shared -

templates - Own std::shared_ptr with std::make_shared - for debug situation need implement own version of shared_ptr class. typical when utilize std::shared_ptr utilize typedef convenience: typedef std::shared_ptr<myclass> myclassptr; in debug situation want extend shared_ptr template, not class myclass, additional debug methods instead of using typedef: class myclassptr : public std::shared_ptr<myclass> { public: // special tracking methodes }; but leave me cast at, not compile: myclassptr mcp=std::make_shared<myclass>(); i encapsulate make_shared in mill funktion like: myclassptr createmyclass() { homecoming std::make_shared<myclass>(); } but how can debug version? give myclassptr constructor (and assignment operator too) accepts std::shared_ptr : class myclassptr : public std::shared_ptr<myclass> { public: // special tracking methodes myclassptr(std::shared_ptr<myclass> arg) : std:

c# - ListView selected items add other ListView -

c# - ListView selected items add other ListView - how add together listview selected items in other listview? example project: exptreelib put form listview2 , add together lv.selecteditems. thanks in advance. you can utilize method add together items listview list = new listview(); listviewitem item = new listviewitem(); // add together them list.items.add(item); this enough, can utilize simple loop each element add together list. foreach (listviewitem item in listview.selecteditems) { // create new list, or utilize nowadays list // add together each item using .add() method. } c#

apache - How to give response to command line using java -

apache - How to give response to command line using java - i executing command using java code. 1 time command start running asking user input. dont know how provide input using java code. please help me. i using apache org.apache.commons.exec.commandline bundle run command. output after running command using java code : [java] ear file archive to: 17 mb in size. [java] sure want build it? [y]ear building cancelled user java code : try { commandline cmdline = new commandline(command); (int = 0; < args.size(); i++) { cmdline.addargument(args.get(i)); } defaultexecutor exec = new defaultexecutor(); exec.setworkingdirectory(new file(dir)); if (timeout > 0) { executewatchdog watchdog = new executewatchdog(timeout); exec.setwatchdog(watchdog); } exitvalue = exec.execute(cmdline); homecoming exitvalu

java - javac default memoryInitialSize and memoryMaximumSize? -

java - javac default memoryInitialSize and memoryMaximumSize? - what default values javac parameters memoryinitialsize , memorymaximumsize? take these values env/os property or setting? <javac srcdir="@{srcdir}" destdir="@{destdir}" includeantruntime="@{includeantruntime}" debug="@{debug}" deprecation="@{deprecation}" target="@{target}" source="@{target}" fork="@{fork}" executable="@{executable}" memoryinitialsize="@{memoryinitialsize}" memorymaximumsize="@{memorymaximumsize}"> <compilerarg compiler="${build.compiler}" line="${build.compiler.args}"/> <javac-elements/> </javac> the documentation says, ant uses standard vm memory settings if javac runs externally. dkatzel points out in comment, vm setting discussed here. java ant compiler-construction javac

python - Parametrize set of tests using PyTest -

python - Parametrize set of tests using PyTest - i have next problem, need execute bunch of tests using pytest each test same, difference parameter. for instance have execute: ./command_line arg1 ./command_line arg2 ... ./command_line argn and need verify executable command returns expected given result. i aware of this, inquire piece of advice best approach problem. i give thanks in advance! edit: found question in stackoverflow adviced take this page found useful in case. i using pytest.mark.parametrize , works this: import pytest @pytest.mark.parametrize('arg, result', [ ('arg1', 'result1'), ('arg2', 'result2'), ('arg3', 'result3'), ('argn', 'resultn'), ]) def test_cmd0(arg, result): out = subprocess.check_output(['cmd', arg]) assert out.rstrip() == out where arg1 , .. argn - arguments, , result1 , .., resultn expected results. in illustratio

ios - Getting the minimum size of a UIView based on its constraints -

ios - Getting the minimum size of a UIView based on its constraints - i have created custom nib , added view hierarchy. view separates subviews using constraint greater or equal to, in other words, giving view minimum size work with. is possible minimum size of uiview constraints system? uiview has method systemlayoutsizefittingsize: homecoming smallest size (or largest size) view. cgsize smallestviewsize = [view systemlayoutsizefittingsize: uilayoutfittingcompressedsize]; the uiview method intrinsiccontentsize returns desired size. size may in middle of 2 sizes returned before. prior ios6, phone call sizethatfits: fitting size may smaller size passed in or default bounds of receiver. ios objective-c uiview nslayoutconstraint

How do I center text in a spinner in Android -

How do I center text in a spinner in Android - i have spinner in linearlayour. i trying center text in spinner: this xml element: <spinner android:id="@+id/project_spinner" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginright="50dp" android:layout_marginleft="50dp" android:padding="1dip" android:prompt="@string/spinner_title" /> the declaration of spinner in activity: // creating adapter spinner arrayadapter<string> dataadapter = new arrayadapter<string>(this, android.r.layout.simple_spinner_item, nomprojets); // drop downwards layout style - list view radio button dataadapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); // attaching info adapter spinner spinner.setadapter(dataadapter); thanks, the component creates items spinner adapter. sho

Converting GridFS file object to File object to upload via carriewave then process with ffmpeg in Rails -

Converting GridFS file object to File object to upload via carriewave then process with ffmpeg in Rails - i have gridfs file object mongoid::gridfs::fs::file _id: 53a277dc700ca7ac146f5797, length: 2237337, chunksize: 261120, uploaddate: 2014-06-19 05:40:44 utc, md5: "390968a8ef198f8537495468366f67b9", filename: "720p_5.mp4", contenttype: "binary/octet-stream", aliases: nil, metadata: nil now need tempfile(or file do) instance that file:/tmp/fileupload20140620-4601-19via7k since file process video file need farther process ffmpeg different versions of video file normally tmp file tempfile size seems quite low video file , ffmpeg gives error, may temp file created not correct. have no thought did wrong. this seems trick me, necessary object (i.e. file object) in tempfile can convert using ffmpeg. <!--language: ruby--> = mongoid::gridfs.get(file_id.to_s) extn = file.extname a.filename name = file.basename a.filename, extn

linux - C program setting port parameters before opening port fails -

linux - C program setting port parameters before opening port fails - i trying write c code on linux system, set serial port parameters open serial port, have found out though code compiles , runs, cannot read , write serial port (so serial port not opened successfully)! code works (not needed): int fd; char *portname; portname = "/dev/ttyusb0"; struct termios tty; fd = open(portname, o_rdwr | o_noctyy | o_sync ); memset(&tty,0,sizeof tty); tty.c_cflag &= ~parenb; tty.c_cflag &= ~cstop; tty.c_cflag &= ~csize; tty.c_cflag |= cs8; tty.c_cflag &= ~crtscts; tcsetattr(fd,tcsanow,&tty); code doesn't work (needed) int fd; char *portname; portname = "/dev/ttyusb0"; struct termios tty; memset(&tty,0,sizeof tty); tty.c_cflag &= ~parenb; tty.c_cflag &= ~cstop; tty.c_cflag &= ~csize; tty.c_cflag |= cs8; tty.c_cflag &= ~crtscts; tcsetattr(fd,tcsanow,&tty); fd = open(portname, o_rdwr | o_noctyy | o_sync );

ios - why CocoasPod increase IPA size? how to reduce the size? -

ios - why CocoasPod increase IPA size? how to reduce the size? - cocoaspod good, it's not. why? because there flag phone call "-objc" in project. pull object files resulting binary. for example, empty project "pod 'afnetworking'" , flag "-objc" on, cause binary 7mb. 7mb empty project, that's suck. some frameworks google map sdk need flag "-objc" on. so, if project "afnetworking pod" , "google map sdk", cause binary 17mb. so question is: how can turn off "-objc" flag special library? example, maintain "-objc" google map sdk, turn off on afnetworking. you should seek reply this question cut down .ipa size. in general, adding static library project in objective-c pull object files resulting binary because cocoa pods installation adds -objc flag linker settings, , stated in linker manual: -objc loads members of static archive libraries implement

c# - GetType() == typeOf(string) or var is string ...? -

c# - GetType() == typeOf(string) or var is string ...? - so when calling console.readline , assigning variable evaluated if statement want know if next code interchangeable , if not how different point should pick 1 on other application. //code omitted var reply = console.readline(); if (answer.gettype() == typeof(string)) { console.writeline("awesome"); } // code omitted just wondering if using over if (answer string) ... is improve choice? the code wrote nonsense, because console.readline always returns string (it homecoming type after all!). to reply question, is operator not equivalent gettype() == typeof() statement. reason is homecoming true if object can cast type. in particular, homecoming true derived types, fail other check. msdn: an look evaluates true if provided look non-null, , provided object can cast provided type without causing exception thrown. note is operator considers reference conversions, boxing conv

javascript - jQuery if condition for radio button name and value -

javascript - jQuery if condition for radio button name and value - i have radio button like <input type="radio" name="user-type" value="store"> <input type="radio" name="user-type" value="brand"> i tried writing jquery script like if($("input[name=user-type]:checked").val()) == "brand"){ $(".showstore").hide(); $(".showbrand").show(); } and tried if($("input[name=user-type]:checked").val()) == "brand").click(function(){ $(".showstore").hide(); $(".showbrand").show(); }); and tried if ( $("input[name=user-type]:radio").val() == "brand"){ $(".showstore").hide(); $(".showbrand").show(); } none of these worked, correction appreciated. thanks. update1 i tried in way , hide both if($("input[name=user-type]:checked").val() == &

javascript - setInterval does not call a functions after the specified time -

javascript - setInterval does not call a functions after the specified time - this question has reply here: why function phone call should scheduled settimeout executed immediately? [duplicate] 3 answers inside 1 js function phone call another,.. want phone call every 30 seconds function showpopup() { $.get("/feedback.aspx", function (data) { if (post_haserror(data)) return; initpopup("popup-common", "feedback", data); }); setinterval(addformtosession(3), 30000); } function addformtosession(form) { alert(1); var url1 = form == 3 ? "feedback.aspx/addformtosession" : "request.aspx/addformtosession"; $.ajax ({ type: "post", async: true, url: url1, data: "{'funcparam':'" + $('#aspnetform').s

rest - Is it wrong to specify action in URL to simplify partial updates? -

rest - Is it wrong to specify action in URL to simplify partial updates? - is totally wrong specify action in url simplify partial update. designing url appointment resource. frequent update of appointment update status. illustration appointment can have of next status: scheduled arrived cancelled done now updating status, looking @ next options: a> set /api/appointments/{id} with appointment details (and new state going through message body. b> set /api/appointments/{id}/{new-state} nothing goes through message body. url used indicate new state of specified appointment. c> set /api/appointments/{id}?state={new-state} nothing goes through message body. the advantage of b & c lite , have minimum info going on n/w. will going totally against rest philosophy? options b , c go against of more pure rest beliefs. rest philosophy argue in favor of updating entire resource put. a improve way utilize patch method partial info in paylo

mysql - CakePHP convert datetime to date and group results -

mysql - CakePHP convert datetime to date and group results - i have table of reports , want grouping them created date. each has created field datetime. i tried doing this: $reports = $this->report->find('all', array( 'recursive' => 0, 'group' => 'date(created)' )); which returned right amount of groups (3 because have many records 3 different dates @ moment), returns 1 record per group. answered @kai sql grouping homecoming 1 unique record. i want display table of results table header separating results each grouped date. best cakephp way of achieving this? i think you're getting concepts of group by , order by in mysql confused. group by group by makes sense in contexts. example, if had table contained products had category , price, , wanted product maximum cost each category. if utilize select max(price) products , you'll single expensive product in table. that's group b

matlab - Calculate Euclidean distance between RGB vectors in a large matrix -

matlab - Calculate Euclidean distance between RGB vectors in a large matrix - i have rgb matrix of set of different pixels. (n pixels => n rows, rgb => 3 columns). have calculate minimum rgb distance between 2 pixels matrix. tried loop approach, because set big (let's n=24000), looks take forever programme finish. there approach? read pdist , rgb euclidean distance cannot used it. k=1; = 1:n j = 1:n if (i~=j) dist_vect(k)=rgb_dist(u(i,1),u(j,1),u(i,2),u(j,2),u(i,3),u(j,3)) k=k+1; end end end euclidean distance between 2 pixels: so, pdist syntax this: d=pdist2(u,u,@calc_distance()); , u obtained this: rgbimage = imread('peppers.png'); rgb_columns = reshape(rgbimage, [], 3) [u, m, n] = unique(rgb_columns, 'rows','stable'); but if pdist2 loops itself, how should come in parameters function? function[distance]=rgb_dist(r1, r2, g1, g2, b1, b2), where r1,g1,b1,r2,g2,b2 components of e

Nginx url GET parameter with proxy_pass -

Nginx url GET parameter with proxy_pass - i url in nginx server: http://mynginx.com/proxy?url=http://target.com and want proxy through nginx server, retrieves http://target.com i using in nginx configuration: location /proxy { proxy_pass $arg_url proxy_set_header host $host; } for reason response "502 bad gateway" can tell appropiate configuration problem? and why nginx response 502 error? thanks in advance. my bad, not using resolver in configuration: location /proxy { resolver 8.8.8.8; proxy_pass $arg_url proxy_set_header host $host; } url nginx proxy get

c# - Sort list where specific character exists within string -

c# - Sort list where specific character exists within string - here's hypothetical you. if have list of strings, possible rank list given character existing within string? consider pseudo-code: list<string> bunchofstrings = new list<string>; bunchofstrings.add("this should not @ top"); bunchofstrings.add("this should not @ top either"); bunchofstrings.add("this should not @ top"); bunchofstrings.add("this *should @ top"); bunchofstrings.add("this should not @ top"); bunchofstrings.add("this should *somewhere close top"); buncofstrings.orderby(x => x.contains("*")); in above code, want re-order list whenever asterisk (*) appears within string, puts string @ top of list. any ideas if possible linq or similar? assuming want prioritise strings based on position of * , do bunchofstrings.orderbydescending(x => x.indexof("*")) use orderbydescending because strin

Amazon EC2: how to convert an existing PV AMI to HVM -

Amazon EC2: how to convert an existing PV AMI to HVM - question: how should utilize new aws ec2 classes (r3, i2) existing ami without recreating whole scheme setup? the new ec2 classes back upwards hvm based virtualization have pvm ami images. answer: start ubuntu hvm linux, version, new start ubuntu / existing ami / pvm linux, , install grub packages on them: apt-get install grub-pc grub-pc-bin grub-legacy-ec2 grub-gfxpayload-lists stop pvm linux detach root (/dev/sda1) partition @ pvm linux attach pvm linux root partition running hvm linux somewhere, e.g.: /dev/sdf on hvm linux: mkdir -p /mnt/xvdf && mount /dev/xvdf /mnt/xvdf rsync -avzxa /boot/ /mnt/xvdf/boot/ mount -o bind /dev /mnt/xvdf/dev && mount -o bind /dev/pts /mnt/xvdf/dev/pts && mount -o bind /proc /mnt/xvdf/proc && mount -o bind /sys /mnt/xvdf/sys chroot /mnt/xvdf grub-install --no-floppy --recheck --force /dev/xvdf update-grub2 exit chroot: ctrl+d stop hv

c# - asp.net how to prevent page post back dev express grid -

c# - asp.net how to prevent page post back dev express grid - i have asp.net page on have dev express grid,when user click on sorting or grouping need show warring message if click ok state lose , on cancel need pervent sorting or grouping. <asp:content id="content1" contentplaceholderid="contentplaceholder1" runat="server"> <div class="legend legend-right"> <div class="legend-item legend-item-normal"> </div> <span>normal</span> <div class="legend-item legend-item-normal" style="background-color: <%=this.skillsetdraftchangedbackgroundcolor%>!important;"> </div> <span>rating items changed</span> </div> <span id="spanhanlder" ></span> <asp:updatepanel id="uprequester" runat="server"> <contenttemplate> <asp:label id="lblresource" runat=&q

c# - ThreadPool.QueueUserWorkItem inside foreach use same dataset -

c# - ThreadPool.QueueUserWorkItem inside foreach use same dataset - in function below same user object passed dorestcall method (i have logging in dorestcall method , has same first info in user object) need utilize parallel.foreach instead of threadpool private void createuser(dataservicecollection<user> epusers) { foreach (user user in epusers) { seek { threadpool.queueuserworkitem(new waitcallback(f => { dorestcall(string.format("message-type=userenrollmentcreate&payload={0}", genaraterequestuserdata(user)), true); })); } grab (exception ex) { _logger.error("error in createuser " + ex.message); } } } the problem how loop variables handled when used in lambda look or anonymous methods. lambda look sees current value of loop variable @ time lambda executed. beli

java - LiferayDispatcherPortlet - what is name of class? -

java - LiferayDispatcherPortlet - what is name of class? - i have in portlet.xml: <portlet-class>org.springframework.web.portlet.dispatcherportlet</portlet-class> and want utilize liferaydispatcherportlet, but <portlet-class>org.springframework.web.portlet.liferaydispatcherportlet</portlet-class> is wrong, how correct? there no dispatcher class in liferay. need pass com.liferay.util.bridges.mvc.mvcportlet class in portlet. or can create controller extend above class, , pass qualified name of class in portlet tag. hope helps you java liferay

java - Apache Common Math's Fraction to Double -

java - Apache Common Math's Fraction to Double - introduction setcomputerizedfractionanswer private void setcomputerizedfractionanswer(double randomdigitone, double randomdigittwo, mathematicaloperator mathematicaloperator) { this.computerizedfractionanswer = fraction(randomdigitone).add( fraction(randomdigittwo)); } getcomputerizedfractionanswer private fraction getcomputerizedfractionanswer() { homecoming computerizedfractionanswer; } a double or fraction reply posted servlet , subsequently next method called: public string validateanswer(double d) { if (getcomputerizedanswer() == d || getcomputerizedfractionanswer() == d) { homecoming "correct"; } homecoming "wrong"; } which causes next issue: incompatible operand types fraction , double . based on this , this info unclear how convert fraction type double. question it possible convert apache mutual math's fraction do

openedge - Progress if statement -

openedge - Progress if statement - i'm progress noob, having problem basic blocks. below issue in if else statement. works fine when if, then, else then, when want set in more 1 statement if portion, have set in block, i'm using if, do: else, do: these aren't working me. obvious errors can see? error message **colon followed white space terminates statement. (199) input "r:\_content\stephen\4gl apps\dpl\output.csv". repeat: assign i_cntr = (i_cntr + 1). myrow = "". import delimiter ',' myrow. if myrow[5] <> "" do: /*change assign 2 rows - 2 creates - 2 sets of four*/ c_fname = myrow[1]. message c_fname skip myrow[2] skip myrow[3] skip myrow[4] skip myrow[5] skip i_cntr view-as alert-box info buttons ok. end./*end of if, do:*/ else if myrow[5] = "" do: message myrow[1] skip myrow[2] skip myrow[3] skip myrow[4] skip

r - Adding column with condition using data.table -

r - Adding column with condition using data.table - suppose have next data.table : date=c("2014-02-06","2014-02-06","2014-03-01","2014-03-01","2014-03-28","2014-04-25","2014-04-25") departure=c("ny", "ny", "doha", "tokyo", "paris", "tokyo", "tokyo") arrival=c("milano", "beijing", "moscow", "moscow", "singapore", "yaounde", "milano") dt<-data.table(date, departure, arrival) giving result: date departure arrival 1: 2014-02-06 ny milano 2: 2014-02-06 ny beijing 3: 2014-03-01 doha moscow 4: 2014-03-01 tokyo moscow 5: 2014-03-28 paris singapore 6: 2014-04-25 tokyo yaounde 7: 2014-04-25 tokyo milano now have date: lawdate="2014-03-17" and want add together column named "law" in

javascript - How do you clear variable values held in a switch function? -

javascript - How do you clear variable values held in a switch function? - i have been working on project school several weeks , have came here several times point me in right direction, give thanks that. issue (and instructor) struggling over. i have create order form (...yep) user must select computer case, monitor, , printer. image must appear next selection , cost must update. if checks order submits, if not alert asking finish form. have alternative reset or clear form. work wonderfully except clear function. fields reset including price, individual values still beingness held. if pick first alternative on sections total $1000, after clear total field shows zero. then, if pick alternative grouping a, values still totaling grouping b , c if nil cleared. hope explained clearly, here's have: <html> <head> <script> function dosubmit() { if (validatetext() == false) { alert("please finish client information"); return;

php - Delete selected files from Basecamp using API or any Script -

php - Delete selected files from Basecamp using API or any Script - i don't seem find way delete files basecamp using api. able file details though. i trying accomplish below: get files of user after authentication - achieved select files want delete delete them is possible. suggestions/help appreciated. you should able delete /projects/1/documents/1.json docs: https://github.com/basecamp/bcx-api/blob/master/sections/documents.md#delete-document php api basecamp

java - JSF: Default selection of all values in -

java - JSF: Default selection of all values in <h:selectManyListbox/> - i working in jsf 2.0. rich:popup based on user selection adding values h:selectmanylistbox using ajax , re-render enclosing outputpanel display values binding list. able successfully. want values nowadays in selectedmanylistbox should selected default user not suppose select again. code selectmanylistbox : <a4j:outputpanel id="grouptablepanel"> <h:selectmanylistbox size="3" style="width:190px; height:100px;" id="table" value="#{usercreatebean.selectedgroups}"> <f:selectitems value="#{usercreatebean.assignedgroups}"></f:selectitems> </h:selectmanylistbox> </a4j:outputpanel> i explored documentation of same, tried writing own javascript code. looking firebug, not able see associated class selected values i

java - Is there a way to find out how long an app is installed? -

java - Is there a way to find out how long an app is installed? - i find out how long app installed on device. the reason : announce new update app users have installed app longtime ago , want prevent announce users, have installed app. hate myself advertising in apps :-) want discreet , show proclamation users have installed app longtime ago. (sorry bad english) what not want utilize following, because allow me observe newer version, implemented it: - using google analytics. - counter counts appstarts in property i looking solution implement in 2014 , detects app installed since 2013. any hints ? the easiest way moving forwards pair of sharedpreferences : sharedpreferences prefs = preferencemanager.getdefaultsharedpreferences(new context()); boolean firstrun = prefs.getboolean("is_first_run", true); long = system.currenttimemillis(); if (firstrun) { sharedpreferences.editor editor = prefs.edit(); editor.putboolean("is_first_run",

CRC16 code from Java to PHP -

CRC16 code from Java to PHP - this question has reply here: how calculate crc16 in php 2 answers how convert java crc16 code php code? php doesn't take byte , >>> public static int crc16(final byte[] buffer) { int crc = 0xffff; (int = 0; < buffer.length; i++) { crc = ((crc >>> 8) | (crc << 8)) & 0xffff; crc ^= (buffer[i] & 0xff); crc ^= ((crc & 0xff) >> 4); crc ^= (crc << 12) & 0xffff; crc ^= ((crc & 0xff) << 5) & 0xffff; } crc &= 0xffff; homecoming crc; } replace crc >>> 8 (crc >> 8) & 0xff . java php crc16

jni - java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() -

jni - java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() - i getting exception when trying phone call non-static method in java class jni.the exception getting is: can't create handler within thread has not called looper.prepare() here jni calling code: jclass mclass = env->findclass("com/secrethq/match3/match3activity"); jmethodid constructor = env->getmethodid( mclass, "<init>", "()v"); cclog("jclass located?"); jobject object = env->newobject(mclass, constructor); mid = env->getmethodid(mclass, "onclickpoststatusupdate", "(i)v"); cclog("mid: %d", mid); if (mid!=0) env->callvoidmethod(mclass, mid, object, score); //----------------------------------------------------------- cclog("finish"); if(isattached) jvm->detachcurrentthread(); and method in java class: private void onclickpoststatusu

angularjs - How do I cache dynamic (JSON) content in Angular on app load? -

angularjs - How do I cache dynamic (JSON) content in Angular on app load? - i trying build demo app dynamic json content needs cached on app load urls (router ui) can accessed immediately. the "view info jack burton" link @ top shows info after it's been loaded (even then, it's screwy): example plunker: http://plnkr.co/edit/xizq8cy4zszc9dz5cbpv?p=preview i need access content "person" other links throughout app, i'm guessing through in-app urls, not sure best practice this. thanks! html index.html <div class="row"> <div class="col-sm-12"> <a ng-href="#/" class="btn-link">home</a> | <a ng-href="#/jack-burton">view info jack burton (only works after it's cached)</a> <div class="well" ui-view></div> </div> </div> home.html <h1>people</h1> <ul class="list-unst

javascript - Draggabilly and Packery highlight drop area -

javascript - Draggabilly and Packery highlight drop area - my question relates first-class javascript library called packery using create masonry style layout. using sis script called draggabilly allow user drag , drop (reorder) items in page. doing similar conventional usage: http://codepen.io/desandro/pen/ckbkw when drag item interface leaves space big plenty element dropped. wanted place div there temporarily indicate element dropped. need way x, y co-ordinates dragged element come rest 1 time released can't seem figure out how information. and using dragmove listener expect display div , provide right co-ordinates: draggie.on( 'dragmove', function(draggieinstance, event, pointer) { //code display , position ghost div }); any assistance much appreciated. javascript jquery draggable packery

Classic asp button click on enter -

Classic asp button click on enter - i new classic asp , trying figure out basic stuff. have form textbox , user enters info in form , press enter, button click should happen. attributes should alter in form tag accomplish functionality?? the button place in form should submit button. in form tag itself, need set id , method , action attributes, similar to: class="lang-html prettyprint-override"> <form id="mainform" method="post" action="mypage.asp"> <input type="text" name="mytextbox" /> <button type="submit" id="submitform" /> </form> your input (text) box , submit button should lie between open , close form tags. note here there no vb or jscript involved @ point. comes 1 time receive post form . asp-classic

sql server - Make a database inaccessible through “sa” user but should be accessible through another user -

sql server - Make a database inaccessible through “sa” user but should be accessible through another user - i have database bugtracker accessible "sa" user. i have created new user adminbugcatcher . have mapped "bugtracker" database user. database should not accessible through "sa" user. how can accomplish same ? i have tried unlink database "sa" user getting error "drop failed user "dbo" ". i don't think it's possible. i'm not expert, have 7 years of experience sql server, , best of knowledge, sa scheme administrator, , can't block user anything. you can disable sa login (although wouldn't recommend it), or improve yet, don't give sa password except scheme administrator. for little bit more information, read this. sql-server sql-server-2008

CDN for SAPUI5 access - or alternate way to get fastest local access -

CDN for SAPUI5 access - or alternate way to get fastest local access - was wondering if had solution (hopefully simple) how alter repository sapui5 app pulls from. i.e. when i'm accessing app (might hosted anywhere, argument's sake lets on hcp in eu) , i'm in eu, makes sense utilize european union repository: https://sapui5.hana.ondemand.com/resources/sap-ui-cachebuster/sap-ui-core.js when in however, i'm going much improve performance if utilize repository: https://sapui5.us1.hana.ondemand.com/resources/sap-ui-cachebuster/sap-ui-core.js but short of having app , european union app, how can accomplish this? don't want pop-up request user allow browser know via using html geo capabilities http://dev.w3.org/geo/api/spec-source.html , seems solutions map ip addresses location charge fee (which don't want have pay) the standard way sort of thing on web (afaik) utilize 1 address , have cdn sort out you. this doesn't seem have happened sap