Posts

Showing posts from July, 2014

playframework - How to prefill a dropdown using scala template and play framework -

i using scala template , play 2.0 framework project. let's have user form fields name (textfield), age (dropdown). while creating user filled name dave , selected age 25. now on edit screen, want values prefilled, know how textfield (i.e. set value userform('name')) dropdown? how it. thanks shawn downs , biesior. well, can use @select scala helper class show pre-filled result. like. @select(userform("age"),models.age.values().tolist.map(v => (v.getdisplayname(), v.getdisplayname())),'id->"age") to show other options have used enum of possible values of age.

c++ - Try to understand std::enable_shared_from_this<T> but cause a bad_weak_ptr using it -

i try understand behavior of std::enable_shared_from_this class, cant understand it. i've write simple program test different situations. question can explain me behavior of following code, because can't explain observed result. thanks help. code #include <iostream> #include <memory> struct c : std::enable_shared_from_this<c> { }; int main () { {//test 1 std::shared_ptr<c> foo, bar; foo = std::make_shared<c>(); bar = foo->shared_from_this(); //ok std::cout<<"shared_ptr : ok"<<std::endl; } {//test 2 std::shared_ptr<c> foo = std::shared_ptr<c>(new c); std::shared_ptr<c> bar; bar = foo->shared_from_this(); //ok std::cout<<"shared_ptr + new : ok"<<std::endl; } {//test 3 c* foo = new c; std::shared_ptr<c> bar; bar = foo->shared_from_this(); //throw std::bad_weak_ptr std::cout<<"new

asp.net - Call server side dropdown list onchange function from javascript -

is there way call server side drowndown list on change event call javascript.. <script> // change value of asp.net dropdown list // call onchange event of dropdown list </script> you can try adding web methods in code behind can called through javascript or jquery ajax.

r - How to code a multiplicative ARIMA (non-consecutive lags) -

i'm working weekly data , based on form of typical seasonal multiplicative arima, want fit following process time series: y_t = phi* y_t-1 + phi* y_t-52 + phi* phi* y_t-53 + e_t i want obtain coefficients phi, phi, , residuals (e's). i unaware of packages or functions , have been trying use arima() while shutting off ma , differencing components keep restricted ar. isn't capturing process above. in advance!

oracle - Procedure calling gone bad - Statement Ignored -

Image
i have following procedure insert users in table: create or replace procedure elr_add_user (i_name in varchar2, i_morada in varchar2, i_birthdate in date, i_country in varchar2, o_id out number, o_error_msg out varchar2) error_null exception; begin if i_name null or i_morada null or i_birthdate null or i_country null raise error_null; end if; o_id := elr_seq_user_id.nextval; if o_id null raise error_null; end if; insert elr_users values (o_id, i_nome, i_morada, i_birthdate, i_country); exception when error_null o_error_msg := 'null fields'; when others o_error_msg := 'unexpected error: '|| sqlerrm; end; / i think procedure , it's syntax correct. when i'm trying call with: declare p_name varchar2(50); p_morada varchar2(

Android custom keyboard popup keyboard on long press -

Image
i have custom android keyboard: public class customkeyboard extends keyboard{...} public class customkeyboardview extends keyboardview{...} public class customkeyboardime extends inputmethodservice implements keyboardview.onkeyboardactionlistener{...} on keys, have popupkeyboard , popupcharacters : <key android:codes="144" android:keylabel="0" android:popupkeyboard="@xml/key_popup" android:popupcharacters=")" android:keyedgeflags="right"/> xml/key_popup.xml: <keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keywidth="10%p" android:horizontalgap="0px" android:verticalgap="0px" android:keyheight="@dimen/key_height" > </keyboard> but when longpress on "0" key popup ")" shows, stays there until press "x" button or ")" character. looks this: and wa

woocommerce variation/add to cart not showing -

Image
so, have coded wordpress theme , integrated woocommerce it. has used simple products time, , using simple product test codes, works fine. added variation product , then, add cart button gone ( variation select dropdown there, values not bonded drop down. if can give me hint, showing have done wrong, big favor. i got same issue , solved when manually entered price variable products. unfortunately didn't find out yet why have enter it, same value. fixed it. hope helps !

node.js how to repreduce PHP MD5 encryption -

i'm converting existing php based website node.js app, , need reproduce encryption method php js. private static $_passwordsalt = 'd2g6iop(u(&§)%u§vuipu(hn%v/§Â§urerjh0ürfqw4zoöqe54gß0äq"lou$3wer'; public static function getcryptedpassword($password = 'password') { return sha1(md5(self::$_passwordsalt.$password)); } so far i've tried not return same results: userschema.methods.hashpassword = function(password) { var salt = 'd2g6iop(u(&§)%u§vuipu(hn%v/§Â§urerjh0ürfqw4zoöqe54gß0äq"lou$3wer' var md5hash = md5(password + salt); var hash = sha1(md5hash); return hash; }; please try these: var crypto = require('crypto'); var salt = 'd2g6iop(u(&§)%u§vuipu(hn%v/§Â§urerjh0ürfqw4zoöqe54gß0äq"lou$3wer' var password = 'pass'; var hashmd5 = crypto.createhash('md5').update(salt + password).digest("hex"); var hassha1 = c

node.js - How to check socket is alive (connected) in socket.io with multiple nodes and socket.io-redis -

i using socket.io multiple nodes, socket.io-redis , nginx. follow guide: http://socket.io/docs/using-multiple-nodes/ i trying do: @ function (server site), want query socketid socket connected or disconnect i tried io.of('namespace').connected[socketid] , work current process ( mean can check current process only). anyone can me? advance. how can check socket alive (connected) socketid tried namespace.connected[socketid], work current process. as said, separate process means sockets registered on process first connected to. need use socket.io-redis connect nodes together, , can broadcast event each time client connects/disconnects, each node has updated real-time list of clients.

Looking for info on how to use Spring boot as a server -

so looking around net have not found documentation on how create server spring boot accessible programs telnet etc. is still done in classical way creating new serversocket , listening or there nice way configure such server in spring? would happy atleast links reference materials. if want create sort of remote shell server i'd start looking spring integration , use tcp inbound gateway documented in section 29.7 in spring integration documentation .

apache - Hosts - Access local website with external device -

after hours of searching , googling i've still not found decided ask here. i've set virtual host called test.dev. means can have access 1 of local xampp projects typing address bar. set following: <virtualhost *:80> documentroot "c:/xampp/htdocs/test" servername test.dev <directory "c:/xampp/htdocs/test"> options indexes followsymlinks execcgi includes order allow,deny allow </directory> </virtualhost> it works fine on local computer if want access using external device connected same network, doesn't. the question how should set hosts - file in order have access project external devices? i've tried following: 192.168.0.10 test.dev # ip address 127.0.0.1 test.dev # local address but works on local computer. possible target same server name twice on different ip's? e: figured out! of wondering same was, here's answer work on devices connected same

java - I want to insert a special character of SQL in JDBC -

i want translate access sql query java jdbc select * books lcase(title) lcase('*jdbc*') , lcase(title) lcase('*programming*') i use preparedstatement this string sql1="select * books lcase(title) lcase(%?%) , lcase(title) lcase(%?%)"; preparedstatement ps1=con.preparestatement(sql1); ps1.setstring(1, "jdbc"); ps1.setstring(2, "programming"); resultset rs1=ps1.executequery(); but syntax error if want insert % value used lcase , have 2 choices: add % s in code, or use concatenation in query. the first approach this: string sql1="select * books lcase(title) lcase(?) , lcase(title) lcase(?)"; preparedstatement ps1=con.preparestatement(sql1); ps1.setstring(1, "%jdbc%"); ps1.setstring(2, "%programming%"); the second approach this: string sql1="select * books lcase(title) lcase('%' & ? & '%') , lcase(title) lcase('%' & ? & '%')&quo

python - Tkinter widget not filling grid -

i seem struggling grid in tkinter, new , have trawled forum , web not found answer. i 2 buttons , label fill grid has fixed size of 320 x 240. had trouble sticky , having read net written in 3 different ways, none of them throw error none of them work. here code: import tkinter tk class application(tk.frame): def __init__(self, master=none): self.setlounge = 21.0 tk.frame.__init__(self, master) self.grid() self.createwidgets() def createwidgets(self): self.lou_dec = tk.button(self) self.lou_dec["text"] = "<" self.lou_dec["command"] = self.loudec self.lou_dec.grid(row=1, column=1, sticky=("n", "s", "e", "w")) self.lblloutemp = tk.label(self) self.lblloutemp["text"] = self.setlounge self.lblloutemp.grid(row=1, column=2, sticky=(tk.n + tk.s + tk.e + tk.w)) self.lou_inc = tk.button(self)

ibm mobilefirst - i got this exception java.io.IOException: Expected chunk of type 0x11c0200, read 0x1200200 -

i got exception r @ com.ibm.ws.util.threadpool$worker.run(threadpool.java:1604) r java.io.ioexception: expected chunk of type 0x11c0200, read 0x1200200. r @ com.ibm.puremeap.util.android.readutil.readchecktype(readutil.java:32) r @ com.ibm.puremeap.util.android.androidresourceparser.readpackage(androidresourceparser.java:80) r @ com.ibm.puremeap.util.android.androidresourceparser.read(androidresourceparser.java:62) r @ com.ibm.puremeap.util.android.androidapkresolver.resolve(androidapkresolver.java:138) r @ com.ibm.puremeap.util.android.aapt.getmetadata(aapt.java:362) r @ com.ibm.puremeap.services.uploadservice.fileuploaded(uploadservice.java:153) r @ com.ibm.puremeap.services.uploadservice.__fileuploadedjson__(uploadservice.java:106) r @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) r @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:60) r @ sun.reflect.delegatingmethoda

python - Google App Engine: Correctly configuring a static site with advanced routing -

i've spent several shameful hours trying solve no avail... problem: i have static website developing 100% pre-processed via grunt & assemble (if familiar jekyll, same concept). has simple static blog component houses category directories of various names. such, need catch-all in app.yaml route them appropriately. however, also have custom error page show in place of standard gae page status. it seems cannot accomplish accounting both scenarios in app.yaml alone because can use catch-all target once. here logic in current app.yaml - url: (.*)/ static_files: dist\1/index.html upload: dist/index.html expiration: "15m" - url: /(.*) static_files: dist/\1/index.html upload: dist/(.*)/index.html expiration: "15m" this perfect use case because routes path index file if exists in current directory. however, because uses catch-all, cannot again use following - url: /(.*) static_files: custom_error.html or depend on error_handlers

android - Cardview - white border around card -

i using cardview root of custom view writing. using v7 support library. xml looks this: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.cardview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginright="6dp" card_view:cardelevation="0dp"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <!-- other views --> </linearlayout> </android.support.v7.widget.cardview> my problem getting white border around card view. looks there indicate elevation thicker on right side. i've tried adjusting card

F#: Using a F# indexed property from C# -

i have written class in f# implementing interface in order build c#-friendly interface f#-assembly. i have written of properties indexed properties. however, when try use type c#, synthetic get_propertyname methods in intellisense , compiler likewise complains in case want use indexed properties c# ones. code reference: type imyinterfacetype = abstract myproperty : mytype1 abstract myindexedproperty : mytype2 -> mytype3 abstract mytwodimensionalindexedproperty : (mytype4 * mytype5) -> mytype6 type myinterfacetype = new () = { } interface imyinterfacetype member this.myproperty () = new mytype1 () member this.myindexedproperty parameter = new mytype3 () member this.mytwodimensionalindexedproperty pair = new mytype6 () when trying access class c#, methods get_myindexedproperty(mytype2 parameter) get_mytwodimensionalindexedproperty(tuple<mytype4, mytype5>) instead of indexed properties had hoped for. am doi

How to override default attributes in Chef using roles -

i can't work, been @ hours. there's duplicate of question here, never adequately answered. i've tried strip problem down minimum. here's trivial recipe: "my_recipe.rb" file "/tmp/my_target_file" content node.default['my_file_content'] action :create end ...and attributes file in attributes subdirectory: "my_attribute.rb" default['my_file_content'] = 'from my_attribute.rb' i create role in roles subdirectory: "my_role.rb" name 'my_role' description 'my role' run_list 'recipe[my_cookbook::my_recipe]' default_attributes['my_file_content'] = 'from my_role.rb' i upload both cookbook , role chef server , run knife command chef workstation: knife bootstrap xxx.xxx.xxx.xxx -x myusername -p mysudopassword --sudo -r role[my_role] -n my_node_name it runs fine , target file gets created, contents of /tmp/my_target_file not expected. i'm getting $ c

apache - redirect wordpress child pages to their parent page -

i have glossary page in site child pages this: http://my-domain.com/glossay/a/ http://my-domain.com/glossay/b/ http://my-domain.com/glossay/c/ ... & every item in glossary has it's own child page based on alphabet this: http://my-domain.com/glossay/a/abandon/ http://my-domain.com/glossay/a/art/ http://my-domain.com/glossay/b/bee/ ... i need redirection rule redirect users items child page, parent page based on first word. example: http://my-domain.com/glossay/a/abandon/ redirects to: http://my-domain.com/glossay/a/ http://my-domain.com/glossay/b/bee/ redirect to: http://my-domain.com/glossay/b/ thanks. the following .htaccess rule should trick: rewriterule ^glossay/([a-za-z])/.+$ /glossay/$1 [l,r=302] basically that's after letter gets truncated , user redirected parent letter. note rule redirect children of children, if (e.g. /glossay/a/another/children redirected /glossay/a)

C++ linker error combining c and cpp code: 'unsupported file format' -

i'm trying combine c , c++ code, when try link unexpected error: ld: warning: ignoring file edmonds.o, file built unsupported file format ( 0x43 0x50 0x43 0x48 0x01 0x0c 0x00 0x00 0x64 0x08 0x00 0x00 0x0b 0x02 0x68 0x42 ) not architecture being linked (x86_64) here's setup: dummy.c void edmonds(int n, double* weights, int* heads); int main() { int = 1; edmonds(1234,0,&a); return 0; } edmonds.hpp: extern "c" void edmonds(int n, double* weights, int* heads); void edmonds(int n, double* weights, int* heads) { heads[0]=n*4; return; } i compile manually using following sequence of commands: clang -c dummy.c -o dummy.o clang++ -c edmonds.hpp -o edmonds.o clang++ edmonds.o dummy.o -o main.o with above mentioned result ld: warning: ignoring file edmonds.o, file built unsupported file format ( 0x43 0x50 0x43 0x48 0x01 0x0c 0x00 0x00 0x64 0x08 0x00 0x00 0x0b 0x02 0x68 0x42 ) not architecture being linked (x86_64): edmonds.o

php - Laravel 5 - paginate Eloquent collection -

model: class category extends model { public function trainings() { return $this->hasmany('app\training'); } } controller: return view('category', [ 'trainings' => category::find(1)->trainings->paginate(10) ]); i'm getting call undefined method illuminate\database\eloquent\collection::paginate() error. how can paginate eloquent collection in laravel 5? you have call trainings method: category::find(1)->trainings()->paginate(10) // ^^

wordpress - Link to archive post type on the specific post -

i have code in loop on post : <div class="retour"><a href="<?php echo get_post_type_archive_link( 'projets' ); ?>">projets</a></div> when goes post_type_archive page, i'd browser go directly on specific post. can add anchor tag function ? how can manage ? thank ! just add anchor tag end this: <div class="retour"><a href="<?php echo get_post_type_archive_link( 'projets' ); ?>#youranchor">projets</a></div>

rest - Understanding OAuth2 flow -

i'm developing android app consumes rest service uses oauth protocol. in first activity, app shows login screen. flow: 1) user puts username , password. 2) app makes request rest service, providing username , password. 3) rest service check credentials , if correct, ask access_token oauth2 provider server. 4) rest service answers app providing access_token , refresh_token 5) in next requests rest server (to data people, articles...) app provide access_token , refresh_token . 6) when rest service process request, validate access_token (using token info endpoint of oauth server). 7) if access_token correct , has not expired, rest service return data app asking for. when rest service detects access_token has expired, asks using refresh_roken . now, questions: when rest service retrieve new access_token after old 1 expires, has rest service send app in response? if so, has app check, in each request/response, if new new access_token has been sent rest s

Java Swing UI elements not updating all the time -

i trying make simple gui few tools have cli interface. figured having 1 window multiple tabs best way go this. problem running of ui elements not being updated when filling in information/making selections. in particular combo boxes have been biggest pain. it displays options , can select different options, after selecting gui not update combo box show new selection. example starts off "1" selected change "3", event trigger sees "3" has been selected combo box still shows "1". i have tried adding in repaints , validates frames tabs , combo box no luck of forcing update. appreciated. as note happens text fields have display file paths after selecting file/folder file chooser, not anywhere near often package com.test.javaswing; import java.awt.borderlayout; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.util.arraylist; import java.util.list; import javax.swing.jcombobox

Quit MPMoviePlayer on entering background in iOS Objective-C -

mpmovieplayer presented on rootviewcontroller.on entering background, have popped mpmovieplayercontroller. on entering foreground,the movie player screen splashed second , disappears. what need not show movie player view on entering foreground. there way achieve ? it's because system takes snapshot of application’s main window when application moves on background, presented when enter foreground. hope understand things better. prevent ios taking screen capture of app before going background the exact moment ios takes view snapshot when entering background?

Does SQL Server 2012 have a function or other way to convert a varchar column that contains ASCII to plain text? -

i've inherited database table has nvarchar(max) column containing ascii numbers. need convert , replace them plain text. possible using sql function? from: 034 067 111 110 118 101 114 116 032 077 101 044 032 068 097 114 110 032 105 116 033 033 034 to: "convert me, darn it!!" thanks all test data declare @table table (ascii_col varchar(1000)) insert @table values ('034 067 111 110 118 101 114 116 032 077 101 044 032 068 097 114 110 032 105 116 033 033 034') query ;with cte as( select char(split.a.value('.', 'varchar(100)')) char_vals (select cast ('<m>' + replace(ascii_col, ' ', '</m><m>') + '</m>' xml) data @table) cross apply data.nodes ('/m') split(a) ) select (select '' + char_vals cte xml path(''),type).value('.','nvarchar(max)') result "convert

mongodb - Moongose - how to customize a field in a scheme ? string and array in the same field -

i know how can customize field can use array , string eg: var postingschema = new schema({ created: { type: date, default: date.now }, title: { type: string, required: true, trim: true }, images: array, categorie: array, ubication:[{ type: number, ref: 'place'}], agg:[{ agg :{ type: string, ref: 'agg' }, value : string, make :[{ type: number, ref: 'make'}] }] }); in field agg value, have problem can of type string , can of type array , should of array type populate scheme. how can that? i made field called "value ->string" , "make->array" if there better way?

Map System.Drawing.Image to proper PdfName.COLORSPACE and PdfName.FILTER in iTextSharp -

i'm using itextsharp update image object in pdf modified system.drawing.image. how set pdfname.colorspace , pdfname.filter based on system.drawing.image? i'm not sure system.drawing.image properties can used mappings. private void setimagedata(pdfimageobject pdfimage, system.drawing.image image, byte[] imagedata) { prstream imgstream = (prstream)pdfimage.getdictionary(); imgstream.clear(); imgstream.setdata(imagedata, false, prstream.no_compression); imgstream.put(pdfname.type, pdfname.xobject); imgstream.put(pdfname.subtype, pdfname.image); imgstream.put(pdfname.width, new pdfnumber(image.width)); imgstream.put(pdfname.height, new pdfnumber(image.height)); imgstream.put(pdfname.length, new pdfnumber(imagedata.longlength)); // not sure how set these entries based on image properties imgstream.put(pdfname.bitspercomponent, 8); imgstream.put(pdfname.colorspace, pdfname.devicergb); imgstream.put(pdfname.filter, pdfname.dctdeco

uiimageview - iOS UIImage Passes Old Image -

in app, im using api images server. using below code, gets images in order of size replace better quality. dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ nsurl *imageurl = [nsurl urlwithstring: [nsstring stringwithformat:@"%@", [[[self.information objectforkey:@"images"]objectforkey:@"normal"] description]]]; nsdata *imagedata = [nsdata datawithcontentsofurl:imageurl]; self.shotimage = [uiimage imagewithdata:imagedata]; self.image.image = self.shotimage; }); dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ nsurl *imageurl = [nsurl urlwithstring: [nsstring stringwithformat:@"%@", [[[self.information objectforkey:@"images"]objectforkey:@"hidpi"] description]]]; nsdata *imagedata = [nsdata datawithcontentsofurl:imageurl]; uiimage *image = [uiimage imagewithdata:imagedata]; self.image.image = self.shotimage; }); also, if pres

c++ - Storing intermediate results in a class's attribute -

assume have class containing 3 methods , attribute. class supposed encode values in array called result. 3 functions run in order last encoded result stored in result. class a{ public: int size; int* result; a(int si){ size=si; result=new int[size]; for(int i=0;i<size;i++) result[i]=5; } void func_1(){ for(int i=0;i<size;i++) result[i]=i+1; } void func_2(){ for(int j=0;j<size;j++) result[j]=j+10; } void func_3(){ for(int k=0;k<size;k++) result[k]=k+4; } }; int main(){ a(10); a.func_1(); // consider each method encoding function (e.g. encryption, randomization, etc) a.func_2(); a.func_3(); return 0; } here stored intermediate results in data member array called result. my question whether storing intermediate results in c

arrays - Delete the content of a int * in C -

if have array one: int * array = ... and if want delete it's content, fastest , efficient way in c ? if "deleting content" mean zeroing out array, using memset should work: size_t element_count = ... // defines how many elements array has memset(array, 0, sizeof(int) * element_count); note having pointer array , no additional information insufficient: need provide number of array elements well, because not possible derive information pointer itself.

java - How to findAll entires(posts) which contain at least one specified tag. Spring Data -

i`m trying retrieve entries(posts) possess specific tag. 1 entry can have many tags, use list of objects. don't know how construct proper command in controller class, i'm afraid i’m lost here. entry entity looks this: @entity public class blogentry { @id @generatedvalue private integer id; private string title; @column(name = "published_date") private date publisheddate; @manytomany @jointable private list<tagblog> blogtags; /* multiple tags 1 entry */ and tag entity: @entity public class tagblog { @id @generatedvalue private integer id; private string tag; @manytomany(mappedby="blogtags") private list<blogentry> entries; in entryservice class wanted perform kind of sort "findbytagblogin" wish return list of posts possess specific tag. public list<blogentry> findallbytags(list<tagblog> tag){ list<blogentry> blogentry = entryrepository.findbytagblogin(tag); re

javascript - add click event to auto complete -

this autocomplete code : <link href="jostejufile/css/jquery.autocomplete.css" rel="stylesheet" type="text/css" /> <script src="jostejufile/scripts/jquery-1.4.1.min.js"></script> <script src="jostejufile/scripts/jquery.autocomplete.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $("#<%=txtsearch.clientid%>").autocomplete("handler/search_cs.ashx", { width: 200, formatitem: function (data, i, n, value) { return "<img style = 'width:50px;height:50px' src='prupload/" + value.split("-")[1] + "'/>" + value.split("-")[0]; }, formatresult: function (data, value) { return value.split("-")[0]; } }); }); </script> <asp:textbox id="txtsear

toggle wrapInner with jquery -

i can't seem find toggle method jquery's wrap. simply want toggle wrap of span when .toggle_comments clicked. $( document ).on('click', '.toggle_comments', function( event ){ $( ).closest( "p" ).wrapinner( $( "<span class='inline-comments-highlight-text'></span>" ) ); }); you don't find because such method doesn't exist. like: var spanhtml = "<span class='inline-comments-highlight-text'></span>", spansel = "span.inline-comments-highlight-text" ; $( document ).on('click', '.toggle_comments', function( event ) { var $p = $(this).closest("p"), $span = $p.children(spansel); if ( $span.length ) { $span.children().unwrap(); } else { $p.wrapinner(spanhtml); } });

More addresses per customer from admin panel is not getting saved in Magento -

i trying add more 50 addresses 1 customer after 55 addresses not getting saved. page getting crashed, after time page gets load shows success message customer saving address not getting saved. tried way not luck. 1 please suggest on ? thanks, jen

Installing LPSolve for Matlab on Windows -

i'm stuck , need help. i'm trying install lpsolve use matlab. i've tried following instructions on lpsolve webpage don't find them helpful. i've downloaded: lp_solve_5.5.2.0_matlab_exe_win64 lp_solve_5.5.3.0_dev_win64 i'm running 64bit windows 7 , using matlab 2014b. i've unzipped both downloads. contents of lp_solve_5.5.3.0_dev_win64 in folder has been added matlabs path. lp_solve_5.5.2.0_matlab_exe_win64 has been extracted folder in system 32 folder. folder has been added matlabs path also. when type mxlpsolve in matlab, get: mxlpsolve driver not found !!! check if mxlpsolve.dll on system , in directory known matlab. press enter see paths matlab looks driver. the file lpsolve55.dll in lp_solve_5.5.2.0_matlab_exe_win64 not mxlpsolve.dll. i'm confused. any give me appreciated. many thanks.

java - create method not available in ArrayListMultimap -

Image
i trying use guava library's implementation of multimap. according guava api docs has static create() method, eclipse ide thinks doesn't though have imported required jar. it suggests the method create() undefined type arraylistmultimap screen shot same: so google collections not same guava, although share many of same classes. create method available if use guava jar rather google-collections-0.8.jar you can download guava jar (of version) http://mvnrepository.com/artifact/com.google.guava/guava , or alternatively maven/gradle config same place.

reporting services - Capture the print statement "Messages" in SSRS report in SQL Server -

i have sql server sp (it runs on sql server 2000, 2005, 2008, 2012) returns html code using print statement "messages" not "results" the html code used build html web page , cannot use select statement due length of characters returned. i need capture print statement "messages" in ssrs report build web page. if not possible, there way capture in sql server , insert "messages" in temp table? you can try this: (at end of proc) create table #msgs (line1 varchar(2000)) insert #msgs select 'this long msg'+col1 table25 select line1 #msgs

FORTRAN - Correct values are calculated in simple precision, but erroneous solutions in double precision? -

i have following code, regarding newton's method calculating zeros in multivariable vectorial functions: program newton_method_r_n_r_n_1_numeric use inverse_matrices implicit none integer :: i, j !index real (kind = 8) :: x(0:501,3) !vectors in newton method real (kind = 8) :: a(3,3) !jacobi's matrix each vector integer , parameter :: n = 3 !dimension of jacobi's matriz real (kind = 8) :: inv(3,3) !inverse jacobi's matrix real (kind = 8), parameter :: eps = 1d-8 !near-zero value real (kind = 8) :: det !determinant x(0,:) = (/2.d0,2.d0,2.d0/) = 0, 500 = h(x(i,:)) call lu_factorization (n, a) call determinant (n, a, det) if (abs(det)<eps) exit end if call inverse_matrix (n, a, inv) x(i + 1,:) = x(i,:) - matmul(inv,g(x(i,:))) end write(*,*) ' 0 of function is: ', x(i,:) read(*,*) contains fun

javascript - Pass addl parameter to angularjs promise -

var dologin = function(username, password) { var request = $http({ method: "get", url: 'api/login', params: {}, data: {} }); return request.then(success, error); } function success(response, username) { ... } if remove username parameter success() method, response gets passed success(), , works fine. specific instance, need pass username (passed dologin) http success callback function. however, promise takes reference function. how pass username fn success()? you can pass anonymous function success callback: return request.then(function(data) { success(data, username); }, error);

spring - nullpointerexception while using if condition -

im using hibernate criteria spring(both annotation) im having nullpointerexception service class : public list<voiture> rechercher_voiture(string type, string couleur, string lieulocation) { list<voiture> v = new arraylist<voiture>(); criteria crit; session session = dao.getsessionfactory().getcurrentsession(); crit = session.createcriteria(voiture.class) .add(restrictions.eq("type", type)) .add(restrictions.eq("lieulocation", lieulocation)) .add(restrictions.eq("statut", (long) 0)); if(couleur.isempty()==false) { crit.add(restrictions.eq("couleur", couleur)); } v = crit.list(); return v; } the nullpointerexception caused if condition suggestion? it happens if couleur = null . change if(couleur!=null && couleur.isempty()==false)

c# - Default foreground color of ProgressBar -

Image
i've been changing foreground color of progressbar control c# code using brush , brushes classes system.windows.media library. however, i'm wondering if .net provides access original default foreground color of progressbar when want revert back. example: right i'm referencing answer provided @beauty on this question uses systemcolors class. systemcolors seems .net class provides default brush colors of controls, don't see brush foreground of progressbar . color obtainable in systemcolors , or there other way of getting it? an example of how changing colors: xaml: <progressbar name="progress" foreground="{binding loadscreenmodel.barcolor}" /> c#: private brush _barcolor = brushes.red; public brush barcolor { { return _barcolor; } set { _barcolor = value; notifypropertychange(() => barcolor); } } the default style progressbar control (found on question , can on msdn ) reve

sql - How to reduce scan count on table with a composite index? -

we have table (t) ~3 million rows , 2 int columns (id1 , id2), set composite clustered key. early in stored procedure create table variable (@a) consists of list of ints. the slow query following select t.id1, t.id2 t inner join @a on a.id = t.id1 @a have few hundred rows, , t contains few million rows. problem t gets scan count of several hundred. don't know how make go away. i have tried create index on t column id1 , id2 included, not (the execution planner shows new index used). what can done reduce scan count on table t? (we using sql server 2014, web edition) try creating included (covering index): create index idx_t_id1 on t(id1) include id2 this allow query find needs in index pages , not have search in main table. way there clustered index on table t?

Overloading in same class Java -

this question has answer here: function override-overload in java 6 answers i trying understand overloading @ moment , bit confused. understand when calling same method, cannot have exact same arguments. instance method called 2 int variables , 2 different int variables. if use int , float, okay. know return type not matter, being public or private method. matter? for instance, call public int name(int x) able call private int name(int x) ? am correct in assuming public double name(string x) cause overloading in class? public int name(int x, string y) valid? passing string argument int function? cause overloading or error? edit: not believe question duplicate, main question difference between public , private, method or different , cause overloading. did not see addressed in other question. from oracle tutorial : overloaded methods differentiat

c# - How to "extend" query in Lightswitch? -

i need present data 2 tables in same view. when use calculated property performance penalty not acceptable. if have done using sql possible using join. know how using linq , entity framework. the problem lightswitch lets me execute queries results in list of existing entities. i'm creating desktop client. if correct relationships have been set up, possible data items multiple entities displayed concurrently solely using built in queries. question doesn't have enough detail know whether work here, it's best way go if can keep benefit of other automagical lightswitch features. if it's not possible using built in queries or want change shape of data , not return lightswitch entities, use wcf-ria service. sounds approach here leverage linq knowledge too. http://lightswitchhelpwebsite.com/blog/tabid/61/entryid/2226/creating-a-wcf-ria-service-for-visual-studio-2013.aspx covers how in vs2013. it's 1 of things sounds complicated @ first ok if follow

php - Laravel multiple many to many relationships? -

so using laravel , running issue, have relational model adsale, have setup hasone relationship adimpressions. example grab adsale records userid = 1. 5 different rows back, each of 5 rows have 5 adimpression rows match , have info clicks , impressions. end goal adimpression rows. when run has 1 impressions() method undefined method. if foreach on adsale records individually , run impresssions() method works. here code class adsale extends eloquent{ protected $table = 'adsale'; public function impressions() { return $this->hasone('adimpression','adsaleid','id'); } } here connecting adsale respective adimpression via adsaleid in adimpression table. this running in controller. $sales= adsale::where('userid','=', 1)->get(); $impressions = $sales->impressions(); now expect $impressions variable have adimpressions entry correlates adsaleid, getting undefined function since there multiple val

count - Python guessing game, counting number of guesses -

my intro computer science teacher gave dice guessing game challenge, , while i've managed figure out of components, final piece return correct number (once they've guessed it) , number of tries took them figure out. code returns of that, doesn't account if person guessing guesses same number twice. there way tell them how many guesses took them find number while disregarding repeated numbers? this code have far: import random give_number = input("we roll 6 sided dice. think number be?\n ") guess_number = 1 dice = random.randint(1,6) while give_number != dice: if give_number > dice: give_number = input("sorry, answer high! try again!\n ") guess_number = guess_number +1 if give_number < dice: give_number = input("sorry, answer low! try again!\n ") guess_number = guess_number +1 print "congratulations, right, answer {}! took {} tries.".format(dice, guess_number) to detect

java - Searching and sorting through an Arraylist -

i new java programmer , working on project requires me read text file has movie reviews. once i've read file, asked search , sort through array of movies , return total number of reviews each movie average rate each movie. the portion stuck on iterating through array list. i using inner , outer loop , seem getting infinite loop. i appreciate second set of eyes. have been staring @ project few days , starting not see mistakes. here code: import java.io.*; import java.util.*; import java.lang.*; public class moviereviewapp { public static void main(string[] args) { string strline = ""; string[] result = null; final string delimit = "\\s+\\|\\s+"; string title =""; //int rating = (integer.valueof(- 1)); arraylist<moviereview> movies = new arraylist<moviereview>(); //arraylist<string> titles = new arraylist<string>(); //arraylist<integer> ratings = new arraylist<integer>

java - Mocking a local object inside a method of SUT using Mockito or PowerMocktio -

i've class method below creates local object , calls method on local object. public class myclass { public somereturn mymethod(){ myotherclass otherclassobject = new myotherclass(); boolean retbool = otherclassobject.otherclassmethod(); if(retbool){ // } } } public class myclasstest { @test public testmymethod(){ myclass myclassobj = new myclass(); myclassobj.mymethod(); // please me here.. } } when i'm testing mymethod , want mock otherclassobject.otherclassmethod return of choice. otherclassmethod class message queues , don't want in unit test. want return true when otherclassobj.otherclassmethod(). know must have used factory myotherclass instantiation in case it's legacy code , don't want change code now. see mockito doesn't provide facility mock myotherclass in case possible powermockito. however, not find example above scenario found static class. how shoul

c++ - QtCreator doesn't show messages in application output -

i'm writing console application in qtc, , has lot of "cout << " outputs of project configurations unit tests (catch utest framework) , nothing of has shown in application output window. on projects tab - run in console has been switched off. , don't plan use qdebug() because project doesn't use qt library how can fixed? output cout should not in application output, should in separate console window console projects (if have config += console in pro file). make sure have system("pause"); at end of program able see console window, can closed before can see output.

c - How to memcpy() a struct sockaddr_in -

i'm programming server-client program. on server manage clients through array of data structure: struct client { struct sockaddr_in addr; /*...*/ }; struct client clients[max_cli]; when receive first packet client through udp socket struct sockaddr_in addr_cli; memset(&addr_cli,0,sizeof(struct sockaddr_in)); b=recvfrom(sock_udp_father, &pdu, sizeof(pdu), msg_dontwait, (struct sockaddr *)&addr_cli, (socklen_t *)&laddr_cli); i want copy address struct. do: memcpy(&clients[client].addr,(struct sockaddr*)&addr_cli, sizeof(struct sockaddr_in)); printf("ip client: %s",inet_ntoa(clients[client].addr.sin_addr); the strange thing first try of communication fails, printing 0.0.0.0 . next try client does, successful , goes fine. why happens? the addr_cli not filled call recvfrom . last 2 arguments of recvfrom little bit tricky. are struct sockaddr *src_addr, socklen_t *addrlen if src_addr not null, recvfrom

c# - Disabling required SSL ciphers? -

i have posted web service client. going through pci dss (i dont know is) , have had disable medium strength ssl sslv3. they asking if can modify service doesn't require ciphers. i don't know talking about. can give me direction? pci dss 3.0 requires mandate tls 1.2. ssl v3 removed organization not pci compliant if they're using ssl v3. pci dss compliance needed organization deals card related information ( credit card / debit card etc ). it's mandatory have pci dss compliance organizations. so basically, they're asking whether service can support tls 1.2 instead of older ciphers in ssl v3.

java - Design pattern for modular application (how to reuse entities) -

i have following scenario: a jax-rs webservice responsable business logic , database interactions. a webapp used end users. a webapp used administrators. my problem want reuse entities webservice on other apps, highly wrapped frameworks jpa, jax-rs, cdi, among others... having hard time isolate them. want know best workaround , why should use instead of others. maybe dto way go (with support object mapper library dozer ) please take @ following article more details: http://zezutom.blogspot.com/2012/02/thoughts-on-data-transfer-objects.html

asp.net mvc - ASP .Net MVC - Injecting Session with StructureMap -

i trying inject asp .net mvc session controller providing in interface using structuremap. structuremap complaints while trying httpcontext.current not initialized @ time of registry initialization. sure there way around have yet find. if can please point me right direction here, great :) here code more information: defaultregistry.cs: using system.web; using company.o365web.infrastructure; using structuremap.configuration.dsl; using structuremap.graph; namespace company.o365web.dependencyresolution { public class defaultregistry : registry { #region constructors , destructors public defaultregistry() { scan(scan => { scan.thecallingassembly(); scan.withdefaultconventions(); scan.with(new controllerconvention()); }); for<isessionstate>() .singleton() .use(new sessionstateprovider(new httpsessionstatewrappe

php - Find interception of two arrays and then merge the two -

i have large array of hostnames , corresponding location. array ( [abc01] => array ( [hostid] => 12345 [lat] => 123 [lon] => 123 [adr] => 126 foo street [city] => rocky hill [state] => connecticut [country] => usa ) [abc02] => array ( [hostid] => 12346 [lat] => 345 [lon] => 345 [adr] => 123 foo street [city] => boston [state] => massachusetts [country] => usa ) [abc03] => array ( [hostid] => 12346 [lat] => 345 [lon] => 345 [adr] => 123 foo street [ci