Posts

Showing posts from June, 2012

matlab - How can I calculate curvature of each point on a surface? -

Image
i have point cloud , first draw surface of these points using matlab(by centering of points). points have 3d coordinates including (x,y,z). original of points same: 32512035.2100000 5401399.57000000 346.880000000000 32512044.0300000 5401399.54000000 346.850000000000 32512046.8900000 5401399.55000000 346.780000000000 32512049.7800000 5401399.53000000 346.860000000000 32512052.6900000 5401399.53000000 346.700000000000 32512054.0300000 5401399.53000000 346.780000000000 32512055.6900000 5401399.57000000 346.810000000000 32512063.1200000 5401399.54000000 347.800000000000 32512074.2300000 5401399.55000000 346.440000000000 32512093.1200000 5401399.54000000 346.660000000000 and centering of them are: -28.7291900003911 -3.97948997747153 -0.700859999999409 -19.9091900000931 -4.00948997773230 -0.730859999999382 -17.0491900006891 -3.99948997795582 -0.800859999999432 -14.1591900000931 -4.01948997750878 -0.7208

python - django frontend inline form for ManyToMany displayed as table with add option -

i need way add (and edit) elements (connected m2m) in frontend (not admin) form. my models: class ingredientname(models.model): name = models.charfield(_('name of ingredient'), max_length=255) class unit(models.model): name = models.charfield(_('unit name'), unique=true, max_length=255) class ingredient(models.model): name = models.foreignkey(ingredientname) unit = models.foreignkey(unit) value = models.floatfield() class recipe(models.model): title = models.charfield(_('title'), max_length=250) portions = models.positiveintegerfield(_('portions')) ingredients = models.manytomanyfield(ingredient) description = models.textfield(_('description')) forms: class recipeform(modelform): class meta: model = recipe views: class addrecipe(createview): form_class = recipeform in first step i've tried use ingredientformset = inlineforms

jquery - knockout click event is canceled by focusout event -

i have form input tag , "x" button clean input value. button should hidden when input doesn't have focus, have focusout event hide when input out of focus. when user clicks on "x" button - goes first focusout event , click event of button not called. here html: <input type="text" id="entityname" data-bind="value: name" maxlength="100" name="name" /> <span class="cleartexticon" data-bind="click:$root.cleartext"></span> here code this.cleartext = function (o, e){ $(e.target).prev().val(''); }; $('body').on('focusout', 'input', function(e){ $(this).siblings('.cleartexticon').hide(); }); you don't need jquery stuff @ all. use visible binding handler: html: <input type="text" data-bind="value: name,

java - Imports from org.apache -

i unable find jar files need download these: import org.apache.commons.net.ntp.ntpudpclient; import org.apache.commons.net.ntp.timeinfo; sorry may sound stupid you, not find download @ time question asked. go http://commons.apache.org/proper/commons-net/download_net.cgi , download jars , import them in library in java program.

java - Get buttons in frame -

i need add listener each button this: for(i = 0; < 10; i++) buttons[i].addactionlistener(actionlistener); the buttons exist, , need list of buttons in frame. you use getcomponents() method jbuttons in frame. a working example: frame = new jframe(); frame.setvisible(true); frame.setsize(250, 250); frame.setdefaultcloseoperation(windowconstants.exit_on_close); gridlayout layout = new gridlayout(); frame.setlayout(layout); (int = 0; < 10; ++i) frame.getcontentpane().add(new jbutton("a")); component[] components = frame.getcontentpane().getcomponents(); actionlistener actionlistener = new actionlistener() { @override public void actionperformed(actionevent e) { system.out.println("hello"); } }; (component component : components) { if (component instanceof jbutton) { ((jbutton) component).addactionlistener(actionlistener); } } it adds 10 buttons , add listener. hint : don't in w

android - Map View not working -

hi newbie android development trying integrate map view in application , giving error.i have obtained api key , have double checked it. have pasted code along layout file , log file.can please.? thanks. mainactivity.java package com.vitarkasolutions.tracker; import android.os.bundle; import com.google.android.gms.maps.mapview; import com.google.android.maps.mapactivity; public class mainactivity extends mapactivity { mapview mapview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mapview=(mapview)findviewbyid(r.id.mymapview); } @override protected boolean isroutedisplayed() { // todo auto-generated method stub return false; } } activity_main.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"

c++11 - C++ lambda expressions - How does the compiler interpret them? -

i starter learning new features in c++ 11. reading lambdas in c++ primer (stanley lippman) , experimenting them. i tried following pieces of code: auto func() -> int (*) (){ //int c=0; return []()-> int {return 0;}; } int main(){ auto p = func(); } this code compiled fine. guess lambdas without captures generated normal functions compiler , can use normal function pointer them. now changed code use captures: auto func() -> int (*) (){ int c=0; return [=]()-> int {return c;}; } int main(){ auto p = func(); } but failed compile. got following compilation error while using g++: main.cpp: in function ‘int (* func())()’: main.cpp:6:31: error: cannot convert ‘func()::__lambda0’ ‘int (*)()’ in return return [=]()-> int {return c;}; from error can understand not normal function generated , might class overloaded call-operator. or else? my questions : how compiler handle lambdas internally? how should pass around lambdas use capture

manifest - when open the android application, happen "Didn't find class "com.example.hello.hello" on path " -

i have error "didn't find class "com.example.hello.hello" on path". hello/androidmanifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.hello" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="hello" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </

Kendo-UI and Angularjs Multiselect selections disappear -

i'm using angularjs , kendo-ui. when use kendo-ui multiselect , have other elements on same view, selections have made in multi-select list disappear when type text . i added simple plunker demo @ link below. use it, select 1 or more states multi-select states list first before entering text in textboxes. after selecting states list, enter text text boxes , selected states disappear multi-select list. http://plnkr.co/edit/sticoott4jzpfcwtoeve?p=info thanks help! just remove "k-" "k-ng-model" in select element. here's working version: http://plnkr.co/edit/hivbnytyytyhxdljgf0i?p=preview

java - JCaptcha4Struts2 plugin, image not loading -

i'm pretty new struts , i'm developing application uses captcha validatation. after research pre-built captcha plugins, decided go jcaptcha4struts2 . soon ran series of troubles. resolved of them i'm bot able resolve one. i did given in demo application in application, image not showing properly. infact, black rectangle appearing. these set of libraries i'm using: commons-collection-3.1 commons-io-2.2 commons-lang3-3.1 commons-logging-1.1.3 commons-logging-api-1.1 freemarker-2.3.19 ognl-3.0.6 struts2-core-2.3.16.1 xwork-core-2.3.16.1 javax.mail-1.5.1 odbc7 javassist-3.11.10.ga commons-fileupload-1.3.1 jcaptcha4struts2-2.0.2 struts2-jquery-plugin-3.7.0 jcaptcha-1.0 jcaptcha-api-1.0 imaging-01012005 antlr-2.7.2 the development environemt i'm using is: netbeans 8.0, jdk 1.8, java ee 7 kindly or suggest other captcha option struts2 ( considering i'm new struts , project deadline not far). edit: read struts 2.3.16 has issues imaging

Creating User Specific Participation Pages in Rails 4 -

i have 3 models; examinations, participation , user. connected has many through relationship - , participation model joint model. i can list participations or show specific participation (see controller below) - goal create page named "my participations" - users can see participations. participation model has "user_id" field purpose don't know how create kind of page or method in controller. thanks in advance. here model structure: examination.rb => class examination < activerecord::base has_many :participations has_many :users, :through => :participations has_many :bookings has_many :exam_centers, :through => :bookings end participation.rb => class participation < activerecord::base belongs_to :user belongs_to :examination end user.rb => class user < activerecord::base has_many :participations has_many :examinations, :through => :participations end as can see i'm having "participation&

capicom - How do I use the activex dll in PHP? -

i want load activex dll in php page , load functions. for example: capicom.dll don't. capicom has been discontinued — not available windows 7 or later. for list of alternatives capicom, please see: http://msdn.microsoft.com/en-us/library/cc778518.aspx

python 2.7 - NameError: global name 'e' is not defined(pyjamas) -

i installed pyjamas yum install pyjamas on fedora19 the following file executed hello.py from pyjamas.ui.rootpanel import rootpanel pyjamas.ui.label import label l = label('hello pyjs') rootpanel().add(l) when building js file pyjsbuild hello.py i getting following error building: hello pyjspath: ['/home/iton/desktop/night', '/usr/lib/python2.7/site-packages/pyjs-0.8.2-py2.7.egg/pyjswidgets', '/usr/lib/python2.7/site-packages/pyjs-0.8.2-py2.7.egg/pyjswaddons', '/usr/share/pyjamas/library', '/usr/share/pyjamas/addons'] traceback (most recent call last): file "/usr/bin/pyjsbuild", line 21, in <module> pyjs.browser.build_script() file "/usr/lib/python2.7/site-packages/pyjs-0.8.2-py2.7.egg/pyjs/browser.py", line 524, in build_script runtime_options, args) file "/usr/lib/python2.7/site-packages/pyjs-0.8.2-py2.7.egg/pyjs/browser.py", line 448, in build l() file "/usr/lib/python2.7/

Java Integer Addition Within a For Loop -

i wrote following code accept integer user through console input. code supposed add positive integers 1 number chosen user yield sum. example, if user enters 5, output should 15 (1+2+3+4+5). reason, code wrote ends outputting square of whatever value user inputs. is, user input of 4 results in 16, etc. wrong. if have insights might me fix this, appreciate it. many thanks! import java.util.scanner; public class onedashsix{ public static void main(string[] args){ //create new scanner object scanner input=new scanner(system.in); //receive user input system.out.print("enter integer find arithmetic sum: "); int mynumber=input.nextint(); int sum = 0; //calculate sum of arithmetic series for(int i=1; i<=mynumber; i=i++) { sum=sum+mynumber; } //display results console system.out.println("the sum of first " + mynumber + " positive in

jquery - Why is this running my separate php file when it shouldnt? -

i have multiple pages sorting out table based on specification. created page each table sort want on 1 page. i have little snippet of code when log onto dashboard first time. session_start(); $user = $_session['user']; if(empty($_session['table'])){ $_session['table'] = "dashboard"; } i have jquery function @ bottom. <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> function changestring() { $.get("changestring.php"); return false; } and have setup when click on image change string conditional , sort out out accordingly. here's table conditional: if($_session['table'] == "dashboard"){ $sql1=mysql_query("select email loggedin session_id='$user'"); $sess=mysql_fetch_array($sql1); $newvalue=$sess['email']; $sql2= mysql_query("select * food owneremai

java - Checking if file exists, if so, dont create new file and append instead -

private void saveformactionperformed(java.awt.event.actionevent evt) { name = nameformtext.gettext(); surname = surnameformtext.gettext(); age = integer.parseint(ageformtext.gettext()); stadium = stadiumformtext.gettext(); venues fix = new venues(); fix.setname(name); fix.setsurname(surname); fix.setage(age); fix.setstadium(stadium); file outfile; fileoutputstream fstream; objectoutputstream ostream; try { outfile = new file("output.data"); fstream = new fileoutputstream(outfile); ostream = new objectoutputstream(fstream); ostream.writeobject(fix); joptionpane.showmessagedialog(null, "file written successfully"); ostream.close(); } catch (ioexception e) { system.out.println(e); } } this have far. ideas on append file if it's created? you have first check if file exists before, if not create new one. learn how append object ob

android - Show and Hide action bar buttons outside onPrepareOptionsMenu -

in overrided public boolean onprepareoptionsmenu(menu menu) can hide or show menu buttons adding true or false in way menu.finditem(r.id.my_action_button).setvisible(true); but need same operation when different method inside activity called, how this? call: activity.invalidateoptionsmenu();

ios - Resizing UITableViewCell contentview width. -

i want make uitableviewcell width 280 , start @ (20,0) meaning there should 20 points insets on x axis cell. however, when change table cell's contentview frame - entire cell behind black square of size want , new cell looks this this code this: in viewdidload of tableviewcontroller [tableview registernib:[uinib nibwithnibname:[self layoutname] bundle:[nsbundle mainbundle]] forcellreuseidentifier:[self cellidentifier]]; initialize of cell -(void)initialize{ // [self setbackgroundcolor:[uicolor clearcolor]]; // [self settintcolor:[uicolor clearcolor]]; self.backgroundview = [[wbchildcellbackground alloc]initwithframe:cgrectinset([self frame], 20, 0)]; [self.backgroundview sethidden:yes]; self.contentview.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleleftmargin | uiviewautoresizingflexiblerightmargin | uiviewautoresizingflexibleheight | uiviewautoresizingflexibletopmargin | uiviewautoresizingflexiblebottommargin;

php - How to create one page wordpress navigation link -

i trying create 1 page wordpress theme. has individual pages such ,single.php, page.php etc. has custom template posts displayed custom post type called "portfolios" . when stay on custom template page shows navigation menu portfolios (custom page type) . but problem , when click on link custom template page displays single post custom post type (portfolios) , link looks "/wordpress/?portfolio=new-portfolio" . need create link "#portfolio" (i have div id portfolio"). need make navigation in single page. i dont want use plugin or custom link appearance -> menu. i can not finding out solution this. please me .

vb.net - On key release handler -

so, i'm trying run piece of code when button pressed (i'll use right-arrow key time being), , keep running in loop until key released. so, current code looks (i've simplified it, because it's using serialports, , not easy understand code): private sub form1_keydown(byval sender system.object, byval e system.windows.forms.keyeventargs) handles mybase.keydown select case e.keycode case keys.right until (code looking right-arrow key release) serialport1.write("right") loop e.handled = true serialport1.close() end sub ultimately, i'm trying control , arduino through serial port function. i've wired cheap rc car (i have few arduino projects on go), , have code allows me control arrow keys in ide itself. however, have limited vb.net knowledge (i've been @ few years), i'm kinda struggling along of google, god end while trying work out how keep serialport open (

c++ - jsoncpp iteraror of members of a Value -

i'm going through json file following code: for (itr = root.begin(); itr != root.end(); itr++){ cout<< "key: "<<itr.key().tostyledstring() << endl;} i found memmbers of object @ end program crash. think iterator try move outside end of object, not sure. found piece of code in many examples think should work fine. error? file i'm tring read: {"lon": [10.6635,10.664510],"lat": [44.144,44.1450101],"range": [0,10.1010101,20.2020202]} this complete code example works fine me: json::value root(json::objectvalue); json::reader reader; reader.parse("{\"lon\": [10.6635,10.664510],\"lat\": [44.144,44.1450101],\"range\": [0,10.1010101,20.2020202]}", root, false); std::string output; (json::valueiterator itr = root.begin(); itr != root.end(); itr++) output += "key: " + itr.key().tostyledstring();

How to Save User ID With Rails & JQuery Tokeninput? -

i following along this railscast jquery tokeninput , working. problem need figure out how save user id category upon creation. how can save within code? model class category < activerecord::base belongs_to :user has_and_belongs_to_many :entries validates :name, :user_id, presence: true def self.tokens(query) categories = where("name ?", "%#{query}%") if categories.empty? [{id: "<<<#{query}>>>", name: "new: \"#{query}\""}] else categories end end def self.ids_from_tokens(tokens) tokens.gsub!(/<<<(.+?)>>>/) { create!(name: $1).id } tokens.split(',') end end controller def index @categories = category.order(:name) respond_to |format| format.html format.json { render json: @categories.tokens(params[:q]) } end end as talked about, earlier. can use http://rails-bestpracti

mystified with javax.sound.sampled.Clip NullPointerException -

mystified javax.sound.sampled.clip nullpointerexception running on eclipse on mac. input wave file exists, constructor works fine. object instance created. can't access instance methods, of them. java 101 issue here, apologize in advance, if so? or eclipses 101, matter... public class audiocliptester { public static void main(string[] args) { // todo auto-generated method stub audioclipplayer moomoo = new audioclipplayer("cow.wav"); moomoo.play(); } } /===== import java.io.file; import java.io.ioexception; import java.net.malformedurlexception; import javax.sound.sampled.audioinputstream; import javax.sound.sampled.audiosystem; import javax.sound.sampled.clip; import javax.sound.sampled.lineunavailableexception; import javax.sound.sampled.unsupportedaudiofileexception; /** * handles play, pause, , looping of sounds game. * @author tyler thomas * */ public class audioclipplayer { private clip myclip; public audioclipplayer(string fi

Implementation Types of Triangle with Java and JUnit? -

i made typeoftriangle.java public class typeoftriangle { public static int triangle(int a, int b, int c) { if (a<b && b<c && (a*a)+(b*b)>(c*c)) { system.out.println("triangular taper"); } else if(a<b && b<c && (a*a)+(b*b)=(c*c)) { system.out.println("right triangle"); } else if (a<b && b<c && (a*a)+(b*b)<(c*c)) { system.out.println("blunt triangle");} } } and made class test typeoftriangletest.java import junit.framework.*; public class typeoftriangletest extends testcase { public typeoftriangletest(string name) { super(name); } public void testsimple() { assertequals("triangular taper", typeoftriangle.triangle(6,8,10)); } } but when run class test, there's 1 error. said java:6: operator && cannot applied boolean,int } else if(a<b && b<c && (

c - The program does not print the data correctly -

hello have program accepts parameters , prints things according, problem program prints parameters instead of need printed. happy if tell me mistake , how fix thanks. code - #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char** argv) { int i; for(i = 0; < argc ; i++) { if("/n") { printf("my name pop\n"); break; } } for(i = 0; < argc ; i++) { if("/b") { printf("my birthday 7.1.1999\n"); break; } } for(i = 0; < argc ; i++) { if("/f") { printf("my favorite food pizza\n"); break; } } for(i = 0; < argc ; i++) { if("/?") { printf("/n = print name\n/b = print birthday\n/f = favorite food\n"); break; } } } horrible mis-use of c syntax. "it's bad, it's not wrong." if("/n") a constant string us

Uncaught reference error with cookies [javascript] -

i'm having trouble plugging in text field create cookie. there appears reference error can't figure out why. seems simplified version compared w3c still won't work. know why? <div id='sandbox'> </div> username: <input type='text' id='form'><br> <button onclick="createcookie">create cookie</button> <button onclick="displaycookie">display cookie</button> <script> var username = document.getelementbyid('form').value function createcookie(username) { document.cookie = "user" + "=" + username; } function displaycookie() { document.getelementbyid('sandbox').innerhtml = document.cookie; } </script> there several issues here, let's break down <node onclick="foo" /> can thought of similar to node.click = function () { foo }; notice how foo not invoked here. either need us

c++ - Qt 4: How implement a "Go" button to the QWebView -

i have 3 objects: qwebview, qpushbutton , qlineedit. my question is: how create connection when click qpushbutton, url address in qlineedit , so, load url page in qwebview. you need connect worker slot clicked signal follows: class myclass : public qwidget { q_object public: explicit myclass(qwidget *parent) : qwidget(parent) , mypushbutton("press me", this) , qlineedit(this) , mywebview(this) { connect(mypushbutton, signal(clicked(bool)), slot(handleclicked(bool)); } public slots: void handleclicked(bool) { mywebview->load(mylineedit->text()); } private: qwebview *mywebview; qlineedit *lineedit; qpushbutton *mypushbutton; }

Adding titles under the thumbnails in my vimeo player using json and javascript and css -

Image
if inspect element on page can see code. <div id="player_carousel_wrap" style="width: 800px; height: 110px; overflow: hidden; position: absolute; left: 60px; top: 20px;"> if edit height 160px or take out overflow: hidden; can titles. the problem code above not on actual page/file, when inspect element. presumably because it's json? i have vimeo carousel player works easy. can view here: http://jsfiddle.net/3hpal/1296/ using json , javascript any appreciated. thank you. add in css: #player_carousel_wrap { height:160px !important } or modify style using javascript after vimeo player initialized. the clean way: after looking through plugin, setting size higher thumbnail height should best way. http://jsfiddle.net/scottux/3hpal/1298/ 'carousel': { size:160, offsetx: 60, offsety: 20, visible: 2, autoplay: true, thumb:{ quality:'large',

nginx - Use sperate pool for sites with HHVM -

i using hhvm 3.0.1(rel) nginx on unix socket. setup pooling in php-fpm , use different pools different sites , allocate resources accurately. possible? currently, no. it's in backlog of things add, or work on adding yourself. the current workaround have multiple instances of hhvm running on different ports , manually set pools way.

search the records using two keys in two tables in rails -

i have models named user , service user model has following columns: user_name , location_name service model has following columns: user_location , service_name now want search users residing in particular location , providing particular service. the main problem user can provide more 1 service. i have achieved functionality in following way: serv1 = services.find_by_service_name(service_name) res = [] serv1.each |s| res.push s if s.user_location == location_name end can suggest better way? user can provide more 1 service that means user associated service model has_many relationship, i.e., models should like: class user < activerecord::base has_many :services ## ... end class service < activerecord::base belongs_to :user ## ... end next, must have foreign_key user_id in services table. now want search users residing in particular location , providing particular service. you can achieve result below mentioned que

MongoDB, Java: accessing cursor opens connection that cannot be closed -

i have problem close connection created after accessing mongodb cursor. i gathering information connections console of running mongod instance. not using mongodb replication nor sharding yet. for example sample code causing opened connection (assume 'myquery' query, coll mapped using setinternalclass class myobject): dbcursor find = coll.find(myquery); list<myobject> myobjects = new arraylist<myobject>(); while(find.hasnext()) { // line opens connection myobject next = (myobject) find.next(); myobjects.add(next); } find.close(); // line not close connection you calling close on find object, dbcursor. mentioned in api documentation close cursor, not underlying connection. close connections should call close on mongo/mongoclient object, either inherits or has close function as per api close connections mongodb server instance.

java - How Apache CAMEL can help in this enterprise integration use case? -

my application needs work middleware has got orders(in form of xml) various customers contains supplier id custmers can send xml 1 of these components 1)jms queue 2)file system 3)http 4)web service request(rest/soap) once gets order, needs send order requests different suppliers in form of xml. somehow spotted http://java.dzone.com/articles/open-source-integration-apache looks provides perfect solution. though have couple of questions. here are:- 1) @ link in figure 3, how can introduce orderservice in between output of marshalling (which pojo here) , order queue output of marshalling -----------> orderservice(instead of order queue)-------------->orderqueue 2) if need convert pojo xml , send xml output orderservice different third part vendor vendor information stored in db can fetch based on item id . can specify endpoints @ exit defined @ entry point in example @ link 3)if need send acknowledgement clients (information lies contained in order). looks need h

ios - How can a comment box like this be achieved? -

Image
i'm not sure whether that's ok ask here worth try. have insight how comment box can achieved. don't mean style wise mean text field , button @ bottom of page , when click on textfield moves keyboard rather keyboard appear on it. i thought custom uitabbar wasn't sure if can add textfield elements it. here example: thanks help. a tablefooterview , containing subviews. animate table view frame when keyboard shows / hides , footer automatically move (as it's @ bottom of table view). if table view can empty , want comment box @ bottom separate view , constraints layout better. keyboard changes animate constraint constant move views & resize.

How can i make C program that scans user's input(text) and save it on a dynamic string -

i want read input user(text) using c program , here code: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ int i=0,x=0; char *c; c[i]=(char*)malloc(sizeof(char)); while(1){ c[i]=getc(stdin); if(c[i]=='\n') break; i++; realloc(c, i+1 ); } c[i]='\0'; //printf("\n%d",strlen(c)); printf("\n\n%s",c); return 0; } this program when compiles there 1 warning @ c[i]=(char*)malloc(sizeof(char)); : warning: assignment makes integer pointer without cast [enabled default] this program works succesfully if remove x=0 code there is: segmentation fault (core dumped) what should change on code can work without warnings or useless random variable x=0 work. thank you! as said @dabo, adjust assignment. c = malloc(sizeof(char)); following additional suggestions: #include <stdio.h> #include <stdlib.h> #i

php - Issue with saving an update information in Codeigniter -

my goal update job_contract. there 2 ways should done. 1. through client's page , 2. through provider's page. what have in job model is: public function update_job_contract($post_obj) { $id = $post_obj['id']; $data = array ( 'client_feedback' => $post_obj['client_feedback'], 'client_notetoself' => $post_obj['client_notetoself'], 'contract_status' => $post_obj['contract_status'], 'client_id' => $this->auth_model->get_user_id() ); $this->db->insert('job', $data); } public function provider_update_job_contract($post_obj) { $id = $post_obj['id']; $data = array ( 'provider_feedback' => $post_obj['provider_feedback'], 'provider_notetoself' => $post_obj['provider_notetoself'], 'provider_id' => $this->auth_model->get_user_id()

c++ - How to handle IO etc outide MPI portion -

writing sorting program mpi. best have code handles io outside mpi scope, e.g. reading in data file before sorting, writing out sorted data file after sorting. so in main function did input before mpi_init , output after mpi_finalize. not seem work way wanted. because trying print out line of "*" before mpi_init , guess what, n_procs times instead of once. best way handle io in mpi code? int main() { read in data; cout << "************************"; mpi_init(); mpi_comm_rank(mpi_comm_world, &my_rank); mpi_comm_rank(mpi_comm_world, &nproc); if(rank == 0) { mergesort_parallel; // recursively } else { mpi_recv subarray parent; mergesort_parallel(subarray); mpi_send subarray after sorting parent; mpi_finalize(); return 0; } mpi_finalize(); output sorted data file; } the processes created mpiexec/mpirun , exist before mpi_init() called. therefore prints ** * lin

html - zurb foundation splitting one row into two columns -

updated <div class="container"> <div class="row"> <div class="main 8 columns" > <div class="row"> <div class="main 4 columns"> <a href="#" class="button" data-dropdown="drop1">has dropdown</a> <ul id="drop1" class="f-dropdown" data-dropdown-content> <li id="halfanhour">half hour</li> <!-- in half hour--> <li><a href="#">this another</a></li> <!-- in 1 hour --> <li><a href="#">yet another</a></li> <!-- in 1.5 hour --> <li><a href="#">yet another</a></li><!--in 2 hours--> <li><a href="#">yet another</a></li&

java - How to remove text between brackets -

i want process articles retrieved wikipedia api, can display plain text. stuff want remove looks like: {{infobox scientist | name = albert einstein | image = einstein 1921 f schmutzer.jpg | caption = albert einstein in 1921 | birth_date = {{birth date|df=yes|1879|3|14}} | birth_place = [[ulm]], [[kingdom of württemberg]], [[german empire]] | death_date = {{death date , age|df=yes|1955|4|18|1879|3|14}} | death_place = {{nowrap|[[princeton, new jersey]], united states}} | children = [[lieserl einstein|"lieserl"]] (1902–1903?)<br />[[hans albert einstein|hans albert]] (1904–1973)<br />[[eduard einstein|eduard "tete"]] (1910–1965) | spouse = [[mileva marić]]&nbsp;(1903–1919)<br />{{nowrap|[[elsa löwenthal]]&nbsp;(1919–1936)}} | residence = germany, italy, switzerland, austria, belgium, united states | citizenship = {{plainlist| * [[kingdom of württe

html - jQuery Star Rating Plugin AND Knockoutjs -

i'm having problem using i'm sure i'm doing wrong. want use star rating system( http://www.fyneworks.com/jquery/star-rating/ ) , knockoutjs. right i'm displaying bunch of business info using foreach binding, want add star rating each business. without star rating stuff business display fine, when add star rating stuff can 1 business display , none of others show up. here have, know little crapastic right i'm new stuff. <div style="float: right; width: 360px; height: 700px; overflow-y: scroll; overflow-x: hidden;" data-bind="foreach: businesses"> <a href="#" data-bind="attr:{href: '/home/businessdetail?name='+ name}" style="text-decoration: none;"> <div> <h5 data-bind="text: name" style="font-size: 14px;"></h5> <div data-bind="if: stars===5"> <div id="star

java - Get a large collection of Nouns from WordNet -

i want retrieve list of around 5000 nouns wordnet randomly.i came across jaws(java api wordnet searching) . couldnt't find efficient way out so. possible jaws? i saw question . uses sql version. want results through api. how can proceed further on problem? please help. you can use rita ( http://www.rednoise.org/rita/wordnet/documentation/ ) this. have getrandomwords(pos, count) method: http://www.rednoise.org/rita/wordnet/documentation/riwordnet_method_getrandomwords.htm just use string[] randomnouns = wordnet.getrandomwords("n", 5000);

java - WSDL Request response format different in Soap UI and WSDL2Java -

i have wsdl file, have generated java files using "java org.apache.axis.wsdl.wsdl2java -o . -d session -s -p org.att handlingrequest2.wsdl" command in linux system create server , client, working fine take tcpdump , request , response format, when process wsdl file using soapui generated different request format not working in server getting error code 500 server, pls suggest. request format tcpdump:- <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <soapenv:body> <requestreceiver xmlns="http://connect.ags.com"><req><extra1 xsi:nil="true"/> <extra2 xsi:nil="true"/> <extra3 xsi:nil="true"/> <mdn>8802649138</mdn> <req_type>102</req_type> <tid xsi:nil="

json - How to populate a jquery grid using Knockout JS in MVC 4 -

i'm new asp.net mvc , knockout js . have project requirement below. i should have list<> in viewmodel data grid . i need pass list's data controller view through $.ajax() method. the data coming controller should in json format. i should use knockout js data-binding in view. please, can me task example or provide me web links demo. about returning json, asp.net webapi should best bet. samples here : http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api ko grid doing on front-end side. there's sample here started : http://knockout-contrib.github.io/kogrid/#/overview i think that's things you'll need started!

android - Send email automatically and append string before sending -

i have android app has ability genereta reports , gives user option email reports. after chooser opens , user picks gmail send email, gmail app opens , user can see message. ideal if user not able see message becouse append little commercial below message , not allow user delete small commercisl. example: email body: "some generated report. this report generated xyz app. download app , create own reports!" the part says app generated report should hidden somehow user can't see , small advertisement send real message. how can accomplish that? thank you! how can accomplish that? send email (javamail, via web server, etc.). if user sending email, via user's own email client , user's own email account, user has right see message , edit desired.

java - Keyboard Shortcut key for run -

Image
i using eclipse ide java programming. there shortcut key run codes or have have click run button? for eclipse it's combination ctrl + f11 . you can see shortcut if click in run item on toolbar:

c++ - Why is std::mutex so slow on OSX? -

i have following benchmark: https://gist.github.com/leifwalsh/10010580 essentially spins k threads , each thread 16 million / k lock/increment/unlock cycles, using spinlock , std::mutex . on osx, std::mutex devastatingly slower spinlock when contended, whereas on linux it's competitive or bit faster. osx: spinlock 1: 334ms spinlock 2: 3537ms spinlock 3: 4815ms spinlock 4: 5653ms std::mutex 1: 813ms std::mutex 2: 38464ms std::mutex 3: 44254ms std::mutex 4: 47418ms linux: spinlock 1: 305ms spinlock 2: 1590ms spinlock 3: 1820ms spinlock 4: 2300ms std::mutex 1: 377ms std::mutex 2: 1124ms std::mutex 3: 1739ms std::mutex 4: 2668ms the processors different, not that different (osx intel(r) core(tm) i7-2677m cpu @ 1.80ghz, linux intel(r) core(tm) i5-2500k cpu @ 3.30ghz), seems library or kernel problem. know source of slowness? to clarify question, understand "there different mutex implementations optimize differe

javascript - Adding a thumb to simplecart js image source undefined -

i'm using simplecart js. i'm having trouble getting image source of product image appear product info in cart. the image source undefined, see demo http://jsfiddle.net/z7xw4/15/ i use following code create columns <div class="simplecart_shelfitem"> <img alt="image" src="http://placehold.it/100x100" class="item-image"/> <a href="javascript:;" class="item_add">add cart</a> cart simplecart({ checkout: { type: "paypal", email: "you@yours.com" }, cartcolumns: [ {view:'image' , attr:'thumb', label: false}, { attr: "price" , label: "price", view: 'currency' } , { attr: "quantity" , label: "qty" } , { attr: "total" , label: "subtotal", view: 'currency' } , { view: "remove" , text: "remove" , label: false } ], cartstyle: &quo

android - Making all Buttons in a vertical LinearLayout the same width -

i trying make buttons in 1 horizontal linearlayout same width, based on 1 button contains longest text. what tried go through buttons in layout , setting there size this. linearlayout layout = (linearlayout) findviewbyid(r.id.buttonlayout); for(int = 0;i < layout.getchildcount();i++){ view v = layout.getchildat(i); if(v instanceof button){ if(!(v.getid() == r.id.widestbutton)){ ((button) v).setwidth(findviewbyid(r.id.widestbutton).getwidth()); } } } this set buttons size, however, size being set not size of widestbutton , 40% of it. how make work? i found answer myself, have found googling. problem is, calling code on activitys oncreate. @ moment, sizes of buttons not calculated yet. so found viewtreeobserver, able add listener called when layout done loading. code using is: final linearlayout layout = (linearlayout) findviewbyid(r.id.buttonlayout); viewtreeobserver vto = layout.g

raw input - Limiting raw_input in python -

how can limit amount of characters user able type raw_input ? there easy solution problem, can't figure out. a simple solution adding significant message , using slicing first 40 characters: some_var = raw_input("input (no longer 40 characters): ")[:40] another check if input length valid or not: some_var = raw_input("input (no longer 40 characters): ") if len(some_var) < 40: # ... which should choose? depends in implementation, if want accept input "truncate" it, use first approach. if want validate first (if input has correct length) use second approach.

java - OWL API: How to assign domain to range on OWLObjectProperty -

in fact want create ontology based in list of concepts(string) , relationships between concepts(map). have 2 types of relation "kind of" , “sub topic of". tried create ontology trough owl api. create relation between 2 owl classes used owlobjectpreportydomain , owlobjectproprertyrange , specified relation through owlobjectproperty. problem when create relation has many domains , many ranges, didn't find manner assign each domain each range. want find solution that. 1 give me idea ? for example have map : map<string, string> relation = new hashmap<string, string>; contains 2 concepts , relation between each other. linkedlist<map<string, string>> listrelation = new likedlist<map<string,string>>; list contains list of relation between concepts. relation("concept1")="authetication"; realtion("relation")="kind of"; relation("concept2")="validation"; listrelation.ad