Posts

Showing posts from September, 2013

c++ - About conversion operator and operator() -

in following code: template <class t> class mval { protected: t max; public: template <class iter> mval (iter begin, iter end):max(*begin) { while(begin != end) { (*this)(*begin); ++begin; } } void operator()(const t &t) { if (t > max) max = t; } void print() { cout << max; } }; int main() { int arr[3] = { 10,20,5 }; (mval<int>(arr, arr + 3)).print(); } why (*this)(*begin); leads operator() ? shouldn't go operator when have mval x; x(t); ? behaves it's conversion operator, how? how mval x; x(t); different (*this)(*begin); ? in both cases see object of type mval followed parentheses 1 argument inside. did expect happen? (*this) not type, it's lvalue of type mval , don't see how "behaves it's conversion operator" either.

ruby on rails - Paperclip::AdapterRegistry::NoHandlerError when use krajee bootstrap file input -

i using krajee bootstrap file input uploading multi files in rails. got paperclip::adapterregistry::nohandlererror after click upload button. can me. thanks class workfile < activerecord::base has_attached_file :attachment, :styles => { :small => "150x150#"}, :url => "/assets/work_files/:id/:style/:basename.:extension", :path => ":rails_root/app/assets/images/work_files/:id/:style/:basename.:extension" validates_attachment_content_type :attachment, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif"] validates_attachment_size :attachment, :less_than => 1.megabytes end class workfilescontroller < applicationcontroller def upload @wf = workfile.new @wf.attachment = params[:pm_file_upload] @wf.save end end started post "/work_files/upload" 192.168.0.5 @ 2016-02-02 21:51:17 +0000 processing workfilescontroller#upload json paramet

php - phpstorm 10 portable error -

in office, there's restrictions on installing programs thought of searching , see if there's portable phpstorm (even though love sublime) still use phpstorm instead , went through few sites of them talking webstorm , few talked phpstorm mentioned downloading zip , modify idea.properties file should work after editing files tried opening phpstorm.exe , error message comes up internal error. please report http://jb.gg/ide/critical-startup-errors java.lang.illegalstateexception: failed create child event loop @ io.netty.util.concurrent.multithreadeventexecutorgroup.<init>(multithreadeventexecutorgroup.java:81) @ io.netty.util.concurrent.multithreadeventexecutorgroup.<init>(multithreadeventexecutorgroup.java:48) @ io.netty.channel.multithreadeventloopgroup.<init>(multithreadeventloopgroup.java:57) @ io.netty.channel.nio.nioeventloopgroup.<init>(nioeventloopgroup.java:67) @ io.netty.channel.nio.nioeventloopgroup.<init>(nioeve

c# - Extracting image from a slide of a .pptx -

any program can use extract images , text slides of .pptx , put in database? i tried doing manually converting .pptx .rar , code extract text each slide.xml (between <a:t></a:t> tag) , detect if there image , if there next 1 ppt\media folder don't see tag picture. i looked @ interop ddl c# can't find giving me image , text. whole slide screenshot. pptpresentation.slides[1].export("c:\\temp\\slide.png", "png", 320, 240); 1) may try http://www.aspose.com/.net/powerpoint-component.aspx or 2) 3rd party library or 3) try parse openxml info yourself. actually pptx - zip-archive subfolders , files... maybe try open xml getting images .pptx file

c++ - Creating and using AABB for collision detection 3d (OpenGL) -

suppose have square have created in following way: glbegin(gl_quads); glcolor3f(0.0f,1.0f,0.0f); glvertex3f( 1.0f, 1.0f,-1.0f); glvertex3f(-1.0f, 1.0f,-1.0f); glvertex3f(-1.0f, 1.0f, 1.0f); glvertex3f( 1.0f, 1.0f, 1.0f); glcolor3f(1.0f,0.5f,0.0f); glvertex3f( 1.0f,-1.0f, 1.0f); glvertex3f(-1.0f,-1.0f, 1.0f); glvertex3f(-1.0f,-1.0f,-1.0f); glvertex3f( 1.0f,-1.0f,-1.0f); glcolor3f(1.0f,1.0f,0.0f); glvertex3f( 1.0f,-1.0f,-1.0f); glvertex3f(-1.0f,-1.0f,-1.0f); glvertex3f(-1.0f, 1.0f,-1.0f); glvertex3f( 1.0f, 1.0f,-1.0f); glcolor3f(0.0f,0.0f,1.0f); glvertex3f(-1.0f, 1.0f, 1.0f); glvertex3f(-1.0f, 1.0f,-1.0f); glvertex3f(-1.0f,-1.0f,-1.0f); glvertex3f(-1.0f,-1.0f, 1.0f); glcolor3f(1.0f,0.0f,1.0f); glvertex3f( 1.0f, 1.0f,-1.0f); glvertex3f( 1.0f, 1.0f, 1.0f); glvertex3f( 1.0f,-1.0f, 1.0f); glvertex3f( 1.0f,-1.0f,-1.0f); glend(); now suppose want use aabb structure detect when sphere collides sides of cube (not top nor bottom of

iphone - Connecting to Oracle from iOS App -

i know has been asked few times, there seems no clear answer ... searching on past 3 days or more. there seem 2 ways connect oracle database ios app : odbc client need compile odbc (which odbc?) using gcj arm. think hard way, wrought errors, possible quite effort. using web service connect app webservice , web service oracle db. are these 2 methods available or other? few questions on 2 methods: a. more secure? b. company's security department oppose of above? c. more performant? d. of above 1 use? webservices answer, not want people connecting directly database mobile device. webserver add 1 layer of security ability handle simultaneous request without stressing database directly a. more secure? webservices explained above b. company's security department oppose of above? yes, security department insist not open oracle port connect directly, unless have open. c. more performant? webservices, setting right cache policies in webserver can save re

android - A bit of guidance on making an application for a website -

i starting develop application uses same facilities of webpage, in android mobile application. using java on eclipse android sdk , wondering smartest way go this. the website contains login , has facility access web drive (like google drive). q1) should use jsoup load webpages in webview on app? , if how go controlling login , sessions? if not, way go doing this? q2) possible include web drive in webview? i've tried searching around answer couldn't find much. want user able access after logging in can download files phone. usually wouldn't post question without code i've got many mixed answers i'm not sure do. thanks q1) forget jsoup. webview able directly load website remote url local version (stored under assets/ ). q2) "include drive in webview "? webview browser. can "include" whatever want, meaning loading url chrome if have not experience android, easiest approach develop website in server usual (targeting mobil

Android Widget does not show in list untill second run -

i trying run widget , have seen problem has been discussed in many questions here , every 1 suggest activity should started app can shown. have started activity when finish activity , still widget not shown. here manifest . appreciated. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mamlambo.imageswidget" android:installlocation="internalonly" android:versioncode="2" android:versionname="1.0.2" > <application android:debuggable="true" android:icon="@drawable/icon" android:label="@string/app_name" > <receiver android:name=".imageswidgetprovider" > <intent-filter> <action android:name="android.appwidget.action.appwidget_update" /> </intent-filter> <meta-data android:name="andro

c# - What's the best way to keep access to the ApplicationUserManager after the controller has been disposed? -

ran interesting problem yesterday. mvc website identity 1 used iprincipal extension method custom authentication, worked fine across razor views needed. identity 2, need access in extension method applicationusermanager , i've been forced pass httpcontext.current through views. this works fine, apart inside razor @section sections - following call stack, appears these don't rendered until after controller has been disposed, disposes database , user managers etc. what best way around limitation? want keep using sections, let me inject javascript down bottom of html, want keep using razor extensions inside these sections nice, easy way control gets outputted page. at moment i'm being forced create new applicationusermanager , mydbcontext , stuff them in viewbag , pass them along extension, isn't ideal. example of extension method: public static bool haspermission(this iprincipal source, applicationusermanager um, mydbcontext db, string controller, strin

Using Android Volley with ASP .NET Web API -

i trying retrieve resource asp .net restful service android client. have messagescontroller has method getmessages: [authorize] public iqueryable<message> getmessages() { return db.messages; } to access have sent request /token , have obtained key use client application access resource. trouble have client receiving 302 http error when trying access resource. this method in android client: public void setallsendersandallmessages() { string url = "messages/getmessages"; showpdialog(); string url = baseurl + url; jsonarrayrequest req = new jsonarrayrequest(url, new response.listener<jsonarray>() { @override public void onresponse(jsonarray response) { log.d(tag, response.tostring()); try { allsenders = new string[response.length()]; allmessages = new string[response.length()];

ruby on rails - Modding Michael Hartl's railstutorial: Where to place rspec test? -

i playing around michael hartl's railstutorial . want limit access profile pages owner can see his/hers profile. first task write appropriate rspec test, logical location of this: user_pages or authentication_pages ? probably user_pages, though go in authentication. think in situation, you're best write test , keep going. if, later, find sits better in different place, move it.

Meteor Publish-Composite nesting issue -

problem: have number of groups each have members belong different groups. each member has title (role) in each group. i’m trying list groups , display each member in group , title. i’m using reywood:publish-composite, , working except can’t title of each member display. think problem in template.groupmembers.helpers file title: function() { console.log(this.roleid); // shows in console each member return titles.findone({titleid: this.roleid}); // doesn’t work }, collections: groups { "_id" : "xfszahbeps2dskcwm", "name" : "generic group", "logo" : "generic-logo-hi.png" } members { "_id" : "vydtiakkukzyqdfvs", "groupid" : "xfszahbeps2dskcwm", "memberid" : "hrx8gbtyb5x8iqq52", "roleid" : "1" } meteor.users { "_id" : "hrx8gbtyb5x8iqq52", "profile"

php - Count the containing entities with cakephp 3.x -

im stuck while trying count entities , order set of results after that. i have connected models each other: // productstable $this->belongstomany('users', [ 'through' => 'productsusers', 'join_table' => 'products_users' ] ); // userstable $this->hasmany('products', [ 'through' => 'productsusers', ] ); // productsuserstable $this->belongsto('users'); $this->belongsto('products'); by query, products including users: $products = $this->products->find() ->contain([ 'users', 'productcategories' ]); it looks that: products -> product 1 -> user1, user2, user 3 -> product 2 -> user1, user 3 now want sort result. tries fail. i tried this: $products = $this->products->find() ->contain([ 'users', 'pro

database design - Best way to store categories and product type in DB -

i have 3 product types. more later. have product categories. category can't have multiple product type. so, how should keep categories. 1. id | parent_id | name i'll set product types root categories. example: electronic > computer > laptop electronic's parent id 0 , next categories linked due that. id | parent_id | product_type | name i'll electronic product_type , computer's parent_id 0. which way better? for categories: id | name | parent_id (parent id category tree) for products: id | category_id | name | description | other let's category tree like computers [id: 1 | parent: 0] |-laptops [id: 2 | parent: 1] |-desktop [id: 3 | parent: 1] |-printers [id: 4 | parent: 1] | |-brand #1 [id: 5 | parent: 4] | |-brand #2 [id: 6 | parent: 4] |-other stuff [id: 7 | parent: 1] then, if want display products from, example, printers , recursion getting items printers category , subcategories. tl;dr the first

Add one year in current date PYTHON -

i have fetched date database following variable {{ i.operation_date }} with got value april 1, 2013 i need add 1 year above, can april 1, 2014 please suggest, how can this? agsm's answer shows convenient way of solving problem using python-dateutil package. if don't want install package? solve problem in vanilla python this: from datetime import date def add_years(d, years): """return date that's `years` years after date (or datetime) object `d`. return same calendar date (month , day) in destination year, if exists, otherwise use following day (thus changing february 29 march 1). """ try: return d.replace(year = d.year + years) except valueerror: return d + (date(d.year + years, 1, 1) - date(d.year, 1, 1)) if want other possibility (changing february 29 february 28) last line should changed to: return d + (date(d.year + years, 3, 1) - date(d.year, 3, 1))

java - Arraylist with multiple objects -

i supposed include both string , integer in arraylist. made separate class both types of objects , used arraylist on results in errors. class: public class data { private string name; private int age; data(string n,int a) { name = n; age = a; } public string getname() { return(name); } public void setname(string n) { name = n; } public int getage() { return(age); } public void setage(int a) { age = a; } public void print() { system.out.print(("("+getname())); system.out.print(","); system.out.print(getage()); system.out.print(") "); } } another class arraylist: import java.util.arraylist; public class cslab { arraylist<data> arlist = new arraylist<data>(); arlist.add(new data("mark", 31)); arlist.add(new data("joe", 13)); arlist.add(new data("rob", 32)); } i don't think have include main since still results in same errors regardless of inclusion

javascript - Pass variable from jQuery to PHP -

i created script read hash (www.website.com/#hash) , pass hash in php. alert(hash) pops hash value, hash not being echoed out in post variable. idea why? jquery page <script> var hash = location.hash; $.post("community.php", { hash: hash }); alert(hash); </script> community.php page <?php echo $_post['hash']; ?> edits - $_get below $_post above. i have foreach looping through postings (posting ids) in function. need pass hash function , compare posting ids everytime. problem is, $_get['hash'] not show inside function. function something() { echo $_get['hash']; } $.post ajax event. posting data ajax page doesn't go communitypage.php. behaviour want have normal form post , not ajax post. $.post retrive echo on communitypage.php using code. //note 3rd argument callback. var hash = location.hash; $.post('communitypage.php',{hash:hash},function(data){ alert(da

encryption - Password Protection of file in android -

i give kind of protection files either stored in sdcard or in application sandbox. using cipher encrypt or decrypt file. problem using cipher time. takes lots of time if file large. encrypting video file takes more 4 minutes decrypt. want know can apply kind of password protection file without encrypting ? if knows how can that, please let me know. short answer no. not possible. file on sd card stored "array of 1 , 0" each program can access sd card , read data. encryption best way keep data secret.

sql server - How to store passwords in database securely? -

i have read 1 way store passowrds in database following way. have database table columns username, hash , salt. salt never shown. i generate hash password + salt. password send user , not stored in database. if generated hash same stored in database, password correct. but have doubts. if send password, sniffed while transmitted wire, think neccesary encrypt communication too. using hash , salt protect data administrator? mean if store password in database, administrator access information. if store hash, administrators can't access information of users becasue administrator don't have half of information, salt , not password. however, while user need send password, sniff someone, password exposed. how best way protect information of user? thanks. hashed passwords protect data outsiders. imagine, if accessed data using sql injection hash & not pass. can use https secure communication on network & use existing table of hashed passwords security model

javascript - Changing both link and image for a different part of the page onmouseover -

could me figure out? self-taught , have little idea i'm doing. i'm trying onmouseover event change different image on page when hovering on first part...but change url of changed image @ same time. i've found valuable information on changing image, not change out url when image changes. specifically, i'm trying change both image displayed , url "invite_r2_c1" onmouseover. (and where, exactly) missing (it)? code right works, doesn't change url linking. i've done backwards, code i'm working with: <tr> <td><span onmouseover="document.images['invite_r2_c1'].src='images/invite_r2_c1_00b.jpg';" onmouseout="document.images['invite_r2_c1'].src='images/invite_r2_c1_00b.jpg';" onclick="document.images['invite_r2_c1'].src='images/invite_r2_c1_00b.jpg';" ><img name="invite_r1_c1" src="images/invite_r1_c1.gif" width="269"

python - Facebook login with flask-oauthlib not logging in -

i using flask-aouthlib , following code (import , secret key lines omitted) try implement facebook login. on website have link goes domain.com/login, gets redirected nginx script. app = flask(__name__) app.debug = true app.secret_key = 'development' oauth = oauth(app) facebook = oauth.remote_app( 'facebook', consumer_key=facebook_app_id, consumer_secret=facebook_app_secret, request_token_params={'scope': 'email'}, base_url='https://graph.facebook.com', request_token_url=none, access_token_url='/oauth/access_token', access_token_method='get', authorize_url='https://www.facebook.com/dialog/oauth' ) @app.route('/') def index(): return redirect(url_for('login')) @app.route('/login') def login(): callback = url_for( 'facebook_authorized', next=request.args.get('next') or request.referrer or none, _external=true

process - Acumatica Create Shipment Lock Violation Exception Issue -

when creating shipment via api in acumatica, receive error 'another process has updated 'soorder' record. changes lost'. the way create shipment follows: add sales order shipment. save. clear screen. oscreen.so302000clear(); load created shipment. add shipment details such bin locations, ship qtys, batch/serials etc. save. the issue happens if user loads created shipment in acumatica right after has been created. then, when api attempts post shipment details (steps 4 6), api throws error 'px.data.pxlockviolationexception: error #90: process has updated 'soorder' record. changes lost.'. is there anyway can avoid lock violation exception when editing shipment opened in ui? many thanks, jose saving shipment triggers long-running, asynchronous operation. need wait process complete before else, calling getprocessstatus() , retrying until completed. otherwise, you'll run concurrency issues second update call.

cluster computing - Passing variable between python scripts through shell script -

i can't think of way of doing trying , hoping little advice. working data on computing cluster, , process individual files on separate computing nodes. workflow have right following: **file1.py** files, parameters, other info user call: file2.sh **file2.sh** submit file3.py computing node **file3.py** process input file parameters given what trying call file2.sh , pass each input data file 1 @ time there multiple instances of file3.py running, 1 per file. there way this? i suppose root of problem if iterate through list of input files in file1.py don't know how pass information file2.sh , on file3.py. from description, i'd the straightforward way call file2.sh directly python. status, result = commands.getstatusoutput("file2.sh" + arg_string) is enough of start moving? nodes conversant enough 1 launch command directly on another? if not, may want consider looking "interprocess communication" on linux. if they're not on

ios - Swift: Deleting core data, table won't update -

this code seems deleting actual data ok table doesn't update without row unless force close app , reopen. in advance. import uikit import coredata class viewcontroller: uiviewcontroller,uitableviewdatasource,uitableviewdelegate { var lists = [nsmanagedobject]() var deletelistindexpath: nsindexpath? = nil @iboutlet weak var mytableview: uitableview! @ibaction func additem(sender: anyobject) { let alert = uialertcontroller(title: "new list", message: "add new list", preferredstyle: .alert) let saveaction = uialertaction(title: "save", style: .default) { (uialertaction) -> void in let textfield = alert.textfields![0] uitextfield if textfield != "" { self.saveitem(textfield.text!) self.mytableview.reloaddata() } } let cancelaction = uialertaction(title: "cancel", style: .default, handler: nil) alert.addtextfieldwithconfigurationhandler(nil) alert

asp.net - posting form without using javascript in mvc3 using hyperlink -

its not straight question , know, try best explain . i have view : myfullview myfullview have form say: myfullview'sform now have partial view say: myfullview'spartialview partial view invoked in myfullview. now. complex part is: i want post myfullview'sform myfullview'spartialview using hyperlink present on myfullview i dont know whether possible or not . still looking out way , great if possible. initially using jquery submit form. have search way in mvc3 only what i've tried is: @html.partial("_header", new actionlink("reload", "basket,model), new viewdatadictionary { { "key", "backnext" } }) ; passing myfullview's model myfullview'spartial view no success. assuming if pass myfullview's model myfullview'spartial view able use form's value well. but proved wrong. or didn't implemented properly. please let me know in case of clarification hope can me out requirement.

html - Migrating a PHP 5.2 Website -

Image
i'm working on website client, website running php version 5.2.17. can recommend best way tackle this? i've experience in html/css/js/java basic understanding of php. i'm thinking of rebuilding website html5 framework , dumping on top of old php pages, integrating mysql database , passing through links not lose seo, worry may affect site... i've tried running wamp server goes low version 5.3 constant errors , page displays without css , has words overlapping etc. images attached. the errors encountering files being included not being found. check through code , identify files being requested, locate files , correct file paths, if files can not restored remove include statements entirely or comment them out, make sure have been removed evrrywhere.

c# - Comparison of various types -

i'm trying make code comparing 2 object in various types stored system.object . i tried code: object = getvalue(..); object b = getvalue(..); type t = findcommontype(a, b); return < b; the result of getvalue instance in 1 of following types: long, double, string, bool , my own class method findcommontype returns instance of system.type , are: if actual type of passed arguments identical, returns typeof(a) in respect typeof(b) . if types different, converts b typeof(a) , returns typeof(a) . the returning instance of system.type 1 of following: typeof(long) , typeof(int) , typeof(double) , typeof(float) . for example, if a = (long)123 , b = "123" , converts b long , returns typeof(long) , code compares them. but comparison a < b unsuccessful. how can compare 2 objects in various types in respect type t holds?

c - Wrong values stored and other -

i made program: llist: typedef struct linked_list { int val; int n; struct linked_list *next; }llist; addelem function: void addelem(llist *list,int val) { llist *tmp=(llist *)malloc(sizeof(llist)); //create new element tmp->val=val; //assign value tmp tmp->next=null; //set next null // printf("addelem entered\n"); if(list->next!=null) //if not last element { addelem(list->next,val); //recursion } else { tmp->n=list->n + 1; list->next=(llist *)malloc(sizeof(llist)); //allocate memory list->next=tmp; //add list } // printf("addelem exited\n"); free(tmp); } remelem function: void remelem(llist *list) { int f=0; if(list->n==0 && list->next==null) goto dontremove; if(1) { if(list->next!=null) { if(list->next->next==null) { f=1; } remelem

PHP Parse URL-encoded string with embedded JSON -

i having problem parsing following xapi string array. issue both parse_str() , parse_url() parse url within quotes contained in [content] ... kills json format. authorization=basic ymv0b1234xzlddle9ighrxrvc3vhdmvwy999929yza==&content-type=application/json&x-experience-api-version=1.0.0&statementid=ef0ca1d6-1234-4e02-b403-7d4aab0df62c&content={"verb":{"id":"http://adlnet.gov/expapi/verbs/experienced"},"object":{"id":"http://mytest.myfavsite.com/?post_type=gb_xapi_content&amp;p=52&amp;preview=true/6lgix5hxep0","definition":{"name":{"und":"specificstatement"},"description":{"und":"specificstatement"},"type":"http://adlnet.gov/expapi/activities/module"},"objecttype":"activity"},"context":{"contextactivities":{"grouping":{"id":"http://mytest.myfavsit

C# WPF InotifyPropertyChange Confusion -

i converting vbnet winforms project c# wpf. new both trying figure out. i have project 2 wpf windows , viewmodel referenced project. public class sheepviewmodel : inotifypropertychanged { private string _currenteventname; public string currenteventname { { return _currenteventname; } set { _currenteventname = value; onpropertychanged("currenteventname"); } } static sheepviewmodel _details; public static sheepviewmodel getdetails() { if (_details == null) _details = new sheepviewmodel(); return _details; } public event propertychangedeventhandler propertychanged; private void onpropertychanged(string prop) { if (propertychanged != null) propertychanged(this, new propertychangedeventargs(prop)); console.writeline(prop + " has changed"); } } the window display things looks this. <wi

c# Console app | Writeline with 2 colors? -

this question has answer here: how change foreground , background text color in console? 4 answers orange text color in c# console application? 8 answers i learning c# , writing text based game. i know if possible have 1 line of code (console.writeline method) outputs message game players given name different color kinda highlights it. this current simple code message: console.writeline("can survive, {0}?", player.getname(); //player.getname() returns name of user this asks user name: string name = null; string input = null; console.writeline("before can start journey, have enter name."); while(input != "y") { if( input == null || input == "n" ) {

c# - correct P/Invoke function signature -

below declaration of c++ function typedef long (callback* pamsgetmsgw)(char *,char *,q_address *, short *, short *, short *, short *, long *, long *, struct psb *, struct show_buffer *, long *, char *, char *, char * ); i have created following declaration in c# [dllimport(@"c:\program files\oracle\oracle messageq\bin\dmqcl32.dll")] public static extern int pams_get_msgw(byte[] msg_area, ref byte priority, out q_address source, out short clas, out short type, ref short msg_area_len, out short len_data, ref int timeout, ref int sel_filter, out psb psb, out showbuffer show_buffer, ref int show_buffer_len, ref int large_area_len, out int large_size, [marshalas(unmanagedtype.lpstr)] string nullarg_3); am correct ?

Programmatically add column definitions to a DataGrid in Wpf and MVVM? -

Image
i want create pivot table in user interface. note please note number of columns not static. and er diagram here main view model public class mainviewmodel : viewmodelbase { public observablecollection<colorviewmodel> colors { get; set; } } colorviewmodel class public class colorviewmodel : viewmodelbase { public public observablecollection<sizeqtyinformationviewmodel> sizeqtyinformationlist { get; set; } } sizeqtyinformationviewmodel class public sizeqtyinformationviewmodel : viewmodelbase { public size { get; set; } public quantity { get; set; } } so now, wanna bind these datagrid , desired result. i have idea don't know how implement this. the idea is: if can define column definitions programmatically , able bind columns well. is there way implement above idea? or there way solve problem?

javascript - How to comment a JS module pattern class using JSDoc3? -

that's way private methods , propertys not visable after generate documentation. have done wrong? incidentally, else works fine. use first time documentation generator, , i'm impressed. /** * constructor description * @constructor * @class * @classdesc class foo. */ container.foo = function() { this.init(); }; container.foo.prototype = (function() { /** * @private * @name container.foo~foopropertyprivat * @property {boolean} foopropertyprivat description */ var foopropertyprivat = true; /** * description * @private * @name container.foo~dosomethingprivat * @memberof container.foo * @method dosomethingprivat */ function dosomethingprivat() { //... } return { /** * @public * @name container.foo#foopropertypublic * @property {boolean} foopropertypublic description */ foopropertypublic: true, /** * description * @public * @constructs * @name container.foo#in

admin - how to deactivate and activate users from application in ruby on rails -

i implementing dashboard facility in ruby on rails application admin can enter , see users registered application. dashboard, admin can deactivate or activate users( may time of period). have user table has is_active column. know , can done setting flag on column in table. please explain in details. following user table. create_table "users", :force => true |t| t.string "email", :default => "", :null => false t.string "encrypted_password", :default => "", :null => false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" t.integer "sign_in_count", :default => 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" t.boolean "is_adm

node.js - Origin header in Chrome Extension -

i have api running on node js, security reasons, have set middle ware function check origin header, if website, api should go ahead. finding issues chrome extension, not pass origin header in requests, in put requests, sends chrome:// origin header. can help? regards, manik mittal well, that's how chrome sets origin extensions. it's not simple override. it is, however, possible override. you'll need use webrequest api , blocking response onbeforesendheaders , rewrite origin whatever like.

java - How to get phone number of the device in android activity -

is there way phone number of device, using googleapiclient. got email, want phone number. add permission: <uses-permission android:name="android.permission.read_phone_state"/> and later use this: telephonymanager t = (telephonymanager)mappcontext.getsystemservice(context.telephony_service); string mphonenumber = t.getline1number(); note: method - although 1 of ways - not reliable. can return false number, blank string, or null .

Searching and replacing all occurrence of a string in a char array c++ -

i have char array , want find positions of specific substring , replace substring different. for example: char [35] = "the boy stole cup table."; 1. want print out every position "the" is. have found functions find finds first position of want. tried using loop did not work out. i want replace occurence of "the" "that" can show me how achieve this. , working char array , not string class. try function . think work. void find_and_replace(string& source, string const& find, string const& replace) { for(string::size_type = 0; (i = source.find(find, i)) != string::npos;) { source.replace(i, find.length(), replace); += replace.length(); } } content = "this c++ programming"; find_and_replace(content, "c++", "java");

angularjs - How to install an Angular Directive in meanJS -

i've been trying install angular directive in meanjs folderstructure. i'm getting error when trying add directive controller. error: [$injector:unpr] unknown provider: duscrollprovider <- duscroll <- homecontroller http://errors.angularjs.org/1.3.20/ $injector/unpr?p0=duscrollprovider%20%3c-nanuscroll%20%3c-%20homecontroller @ http://localhost:3000/lib/angular/angular.js:63:12 @ http://localhost:3000/lib/angular/angular.js:4031:19 @ object.getservice [as get] ( http://localhost:3000/lib/angular/angular.js:4178:39 ) @ http://localhost:3000/lib/angular/angular.js:4036:45 @ getservice ( http://localhost:3000/lib/angular/angular.js:4178:39 ) @ object.invoke ( http://localhost:3000/lib/angular/angular.js:4210:13 ) @ extend.instance ( http://localhost:3000/lib/angular/angular.js:8516:21 ) @ http://localhost:3000/lib/angular/angular.js:7762:13 @ foreach ( http://localhost:3000/lib/angular/angular.js:334:20 )

how to achieve this in salesforce -

i have 2 object enquery_ c , payment.enquery object have 1 field opportunityorder _c , payment__c object have tow fields po_text__x , po_date. my requirement enter field opportunityorder__c , automatically update object 2 fields po_text__c , po_date__ updated automatically.can please tell me how solve task. thanks, if relation between enquery_c , payment master-detail relationship can did workflow, else trigger on enquery__c after update.

html5 - Capture video/image using user's webcam using GWT -

i developing project using gwt2.5 , need use user’s webcam capture images/video. how possible in gwt? gwt 2.5 comes new library called elemental , thought wrapper of browser api. works chrome, in future support more browsers. if confortable supporting in app chrome feature, can take this example . source code of demo in googlecode . if wanted support other browsers, take elemental classes base , modify them match other browsers. here video introducing elemental during google i/o 2012

javascript - autofocus attribute not working in Firefox on display state change -

i'm trying add auto focus form. have working in chrome cannot working in firefox below code. think reason potentially needs autofocus rather autofocus="autofocus" . correct in assuming this? if there way can add it? i'm using framework called silverstripe , don't have direct access editing input field it's done dynamically need via javascript likely. <input type="text" name="search" class="form-control search-form" id="templatesearchform_searchform_search" placeholder="search..." autofocus="autofocus"> note hiding input box , displaying on click of icon adding class: jquery('.search').click(function () { if(jquery('.search-btn').hasclass('fa-search')){ jquery('.search-open').fadein(500); } else { jquery('.search-open').fadeout(500); } }); i couldn't find in html specification validate autofocus behavior

Isolation level strategy for asp.net and sql server 2008 -

what should ideal isolation level strategy asp.net , sql server 2008. use read-commited still hangs see ex below. table name - customers isolation level - read committed transaction 1: set transaction isolation level read committed begin tran update customers set ordercount = 50 id = 2 waitfor delay '000:00:20' rollback tran transaction 2: set transaction isolation level read committed begin tran select * customers trans commited transaction 2 hangs 20 second!! how handle scenario? regards, chandan

java - How to display data fetched from the database table into listview? -

my function in sqladapter class is public arraylist<airline> getairlinedetails(string bookingdate) { cursor curcalllog =db.rawquery("select * "+ book + " " + date + " between '" + startdate + "' , '" + enddate + "'", null); if (curcalllog != null) { if (curcalllog.movetofirst()) { { a=new airline(); //a.setbookingdate(curcalllog.getstring(1)); a.setpickupadd(curcalllog.getstring(2)); a.setcity(curcalllog.getstring(3)); a.settrip(curcalllog.getstring(4)); a.setfdate(curcalllog.getstring(5)); a.setftime(curcalllog.getstring(6)); a.setcdate(curcalllog.getstring(7)); a.setptime(curcalllog.getstring(8)); a.setseats(curcalllog.getint(9)); a.setamount(curcalllog.getint(10));

c# - Array code Numbers -

this midterm example questions. however, don't know how write code in bash yet properly.. please can explaining me? important me. thank you if have understood question... should work: $ ls /usr/bin | cut -b1 | uniq -c please note count under /usr/bin (files, links,...)

ms access 2007 - data type mismatch on criteria expression -

i have 3 tables exact same data fields , data types. trying create search form using 1 combo box 3 subforms. tried changing string integer end same error: "data type mismatch on criteria expression". doing wrong here. private sub cboalarmsearch_afterupdate() dim spotalarm string dim progressalarm string dim finalalarm string dim stralarmcriteria string if isnull(me.cboalarmsearch) or me.cboalarmsearch = "" msgbox "please choose alarm search.", vbokonly, "alarm required" else stralarmcriteria = me.cboalarmsearch.value 'alarm search spot spotalarm = "select * tblspot ([alarm] = '" & stralarmcriteria & "')" me.frmspotsearchsubform.form.recordsource = spotalarm me.frmspotsearchsubform.form.requery 'alarm search progress progressalarm = "select * tblprogress ([alarm] = '" & stralarmcriteria &

C++ Fibonacci Program -

can tell me why i'm getting 1 number in sequence in advance? can't seem find what's wrong! example, if type in 10, should 34, 55 (one number ahead, i.e 11) #include <iostream> using namespace std; int fibonacci (int n); int main () { int n; cout << "fibonacci number generator" << endl; cout << "which 1 want (0 exist)?"; cin >> n; cout << fibonacci(n); } int fibonacci (int n) { if (n == 0) { return 0; } else if (n == 1) { return 1; } else { return (fibonacci(n - 2) + (fibonacci(n - 1))); } } it depends on how define first number. in code, looks starts 1, there's nothing wrong output 55 10th element. 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 however, think accidentally making right, , guessing you're trying is: #include <iostream> using namespace std; int fibonacci (int n); int main () { int n; cout&l

html editor - ExtJS HTMLEditor toolbar gets disappeared after reaching specified height -

i using extjs htmleditor , set properties follows- { xtype: "htmleditor", width: 500, height: 250} while entering text, after reaching specified height, toolbar gets disappeared. tried removing height , setting autoheight: true in both cases html editor not fit window (htmleditor inside ext.form.formpanel ). anyone having idea solve it. this code ext.onready(function() { ext.create('ext.window.window', { title: 'this title', resizable: false, modal: true, height: 300, width: 500, layout: 'fit', closeaction: 'hide', items: [ new ext.form.formpanel({ border: false, autoheight: true, items: [ { allowblank: false, xtype: "htmleditor", height: 250, width: 600, anchor:'100%'} ] }) ], buttons:

graphics - Image Editing Library for Android -

i have basic requirement simple image editing app android. after displaying image user must able set alpha of image , choose brightness , set contrast. for achieving task have tried following libraries :- 1. jjil 2. android image filtering 3. aviary sdk for jjil facing problem importing projects. android image filtering , there isnt documentation available. using aviary can achieve has aviary logo , using sdk user can choose more features options , navigate aviary app in app store. which better way of doing ? shall use library or should use native android color class ? thanks in advance we @ img.ly have released image editing sdk android part of our photoeditorsdk product suite. includes functions mentions , customizable you can find demo application here . can use library free in open source projects, there license fee commercial applications.

continuous integration - Pre-commit phase using SVN and Bamboo CI server -

there need in company allow qa team asses quality of product before commit done. so, need possibility make build on ci server ( bamboo, in our case) before new code committed repository. local builds not allowed cause compilation environment should remain same. i know there such possibility on team city ci, @ moment looking such possibilities on bamboo. thank in advance update other suggestions, switching svn git allow such workflow welcome. i think you're going have complicated , setup build on new branch merged in after qa team blesses it. this sounds pretty awful.

html - pre-load a webpage before viewing -

i have wordpress site has numerous large images (full screen background image scroller) , when go page goes 'pixel-ly' , looks broken until loaded. what proper procedure load websites images users first @ site isn't broken or glitched? hide until page loaded. show loading screen in meantime if want. <body onload="document.getelementbyid('loading').style.display = 'none';document.getelementbyid('content').style.display = 'block';"> <div id="loading">some loading text or icon goes here...</div> <div id="content" style="display:none;">main content goes here...</div>

mongodb - Mongo DB write operation in shard setting -

i new mongodb while going through tutorial got question in mind that, in sharded environment during reading operation "mongos" first checks config server details shard has query. during write operation first checks shard has perform write operation? thanks in advance, kitty i going answer based on current stable release of mongodb v3.2 . the config servers store cluster's metadata in config database. mongos instances cache data , use route reads and writes shards. mongodb writes data config servers when metadata changes, such as: after chunk migration , or after chunk split . mongodb reads data config server in following cases: a new mongos starts first time, or existing mongos restarts. after change in cluster metadata, such after chunk migration. see also: sharded cluster mechanics .

functional programming - Type Inference in OCaml -

i'm trying wrap head around ocaml's type inference notation. for example: # let f x = x [];; val f : ('a list -> 'b) -> 'b = <fun> makes sense me. val f takes in function x takes in list of 'a type , returns of 'b type. f returns 'b type since calls x. however, once more arguments more confused. # let g b c = b c;; val g : ('a -> 'b -> 'c) -> 'a -> 'b -> 'c = <fun> can assume if function has arguments, first parameters of type inference arguments? , if call b c, order ((a b) c) or (a (b c))? # let rec h m n ls = match ls | [] -> n | x::t -> h m (m n x) t;; val h : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a = <fun> as 1 i'm confused how ('a -> 'b -> 'a) -> 'a derived. can see 'b list corresponds ls variable , last 'a corresponds type of terminal symbol n. can assume if function h