Posts

Showing posts from May, 2013

eclipse - android app project error -

i keep getting unable open trace error in eclipse android project reason. syntax error free. here log text below. 05-20 19:57:02.330: d/androidruntime(30377): shutting down vm 05-20 19:57:02.330: w/dalvikvm(30377): threadid=1: thread exiting uncaught exception (group=0x4001e578) 05-20 19:57:02.340: e/androidruntime(30377): fatal exception: main 05-20 19:57:02.340: e/androidruntime(30377): java.lang.runtimeexception: unable instantiate activity componentinfo{com.example.sudoku/com.example.sudoku.sudoku}: java.lang.classnotfoundexception: com.example.sudoku.sudoku in loader dalvik.system.pathclassloader[/data/app/com.example.sudoku-2.apk] 05-20 19:57:02.340: e/androidruntime(30377): @ android.app.activitythread.performlaunchactivity(activitythread.java:1573) 05-20 19:57:02.340: e/androidruntime(30377): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1667) 05-20 19:57:02.340: e/androidruntime(30377): @ android.app.activitythread.access$1500(activityt...

PHP referencing nested array values -

i'm having trouble returning value out of nested array... the array dump looks this object(myobj)#1 (3) { ["thing1"]=> string(5) "abcde" ["thing2"]=> string(2) "ab" ["data"]=> array(3) { [0]=> string(3) "370" ["id"]=> string(3) "370" [1]=> string(26) "" ["name"]=> string(26) "abcdefghijklmnopqrstuvwxyz" [2]=> string(0) "" ["address"]=> string(0) "" [3]=> string(4) "wxyz" ["email"]=> string(4) "wxyz" } i want "name" inside "data" array.... i've tried echo $myobj['data']['name']; also echo $myobj -> $data -> $name; they come undefined. use $myobj -> data['name']; it sure confusing. let me explain. the var_dump result saw has 2 parts on them, 1 object d...

php - Symfony2 Firewall not preventing access -

i think don't understand concept of firewall , access control of symfony here's understanding. i have fosuserbundle installed , configured properly. i created roles: role_hierarchy: role_coach: [role_user] role_editor: [role_user] role_premium_coach : [role_user, role_coach] role_admin: [role_user, role_sonata_admin, role_coach, role_editor, role_premium_coach] role_super_admin: [role_admin, role_allowed_to_switch] i want prevent people accessing url /dashboard if not logged in, therefore if don't have role role_user. here's firewall: firewalls: # -> custom firewall admin area of url admin: pattern: /admin(.*) form_login: provider: fos_userbundle login_path: /admin/login use_forward: false check_path: /admin/login_check failure_path: null logout: path: /admin/log...

google drive sdk - Transfer ownership with Java client -

i using java client of google drive sdk. application goal: transfer ownership of files parent owner. this, mean there number of accounts large storage amounts eg. storageacct1, storageacct2, etc. if user moves files account, still retain ownership , incur storage penalty. application run in background , transfer ownership storage accounts. i have created drive service object storageacct1 , authenticated domain. can authenticate storageacct1 , list files add/remove writer , viewer permissions. however, cannot transfer ownership. this, if appsuser1 owns document1, storageacct1 cannot obtain ownership if account set super admin or drive admin. i have noticed if create new service object owner can transfer ownership. (create service account appsuser1@domain.com transfer ownership of document1 storageacct1). since permissions api calls not return owner's emails , names, cannot programatically go through list of files , transfer ownership. prefer not have add in database look...

android - How to put a Spinner beside a RadioButton -

i have layout: (since reputation not yet 10 sincerely ask view image link) http://tinypic.com/r/2q9f80z/5 i want put spinner beside last radiobutton can see in picture. here's code: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <!-- linearlayout containing search/find customer --> <!-- textview search/find customer --> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="search/find customer" /> </li...

python - improving Numpy dot performance by removing arrays copy -

given matrix qt: % ipython python 2.7.3 in [3]: qt.dtype out[3]: dtype('float64') in [4]: qt.__class__ out[4]: numpy.ndarray in [5]: qt.flags out[5]: c_contiguous : true f_contiguous : false owndata : true writeable : true aligned : true updateifcopy : false i need results of: qt.t * qt problem: whenever try compute these matrices multiplication, memory overflows , code stop running. happen because of matrix copy numpy doing behind. tried solutions: first: q = numpy.array(qt.t, order='c') numpy.dot(q, qt) second: qt = numpy.array(qt, order='f') q = numpy.array(qt.t, order='f') numpy.dot(q, qt) third: qt = numpy.matrix(qt) qt = qt.copy('f') q = numpy.matrix(qt.t) q = q.copy('f') q.dot(qt) however, none of them solving. question how can operate qt.t * qt without having memory explode? references http://numpy-discussion.10968.n7.nabble.com/inplace-matrix-multiplicatio...

javascript - What does brackets and parentheses after jquery selector mean? -

i ran line of code , can't figure out means: $("#theappcontainer")[s > u ? "addclass" : "removeclass"]("something"); i understand first part selecting element called theappcontainer , second part evaluates "addclass" if s > u, can't figure out line of code overall. the bracket syntax gets value of property name , , parentheses call function value of property. it’s equivalent to: var container = $('#theappcontainer'); if(s > u) { container.addclass('something'); } else { container.removeclass('something'); } also, please never write code that. =) also also, toggleclass takes second switch argument can use instead: $('#theappcontainer').toggleclass('something', s > u);

c++ - Iterating over a vector defined in a struct -

i working on non-binary tree structure, , have struct defined follows has data , it's child in vector called child. struct node{ string data; vector< node* > child; vector<node*>::iterator int count; }; i have function have defined print child in vectors, can't iterator working void printtree(node* &a){ for(a->i = a->child.begin(); a->i !=a->child.end();++i) cout << *(a->i)->data <<endl; } i getting error iterator isn't defined when printtree called. tried defining iterator inside printtree function keep getting error. suggestions on how should change code? please take iterator out of node structure. void printtree(node* &a) { for( vector<node*>::iterator = a->child.begin(); != a->child.end(); i++ ) { cout << (*i)->data << endl; } } [edit] even confused myself when wrote answer. quite save myself ugly , potentially confusin...

php - Saving Filepath Of Uploaded Image To MySQL Database -

i have gone through countless different menus , topics , still having problems. want insert filepath of uploaded image mysql database. have tried passing image on variable , using query push database not working. code below, form on top, php below: <html> <body> <h1>test</h1> <form action="insert.php" method="post" enctype="multipart/form-data"> name <input type="text" name="name" /><br><br> description <input type="text" name="desc" /><br><br> price low<input type="text" name="price_low" /><br><br> price high <input type="text" name="price_high" /><br><br> <input type="hidden" name="max_file_size" value="512000" /> 3.send file: <input name="userfile" type="file" /> 4.<input type="submit" v...

perl - Catalyst not redirecting urls for beta.domain.com -

i'm using catalyst web app i'm building, cannot redirect properly. can redirect fine domains http://www.domain.com/ , if have subdomain http://beta.domain.com/ , not redirect correctly. instance: $c->res->redirect('http://beta.domain.com/account'); will redirect to: http://beta.domain.com/.domain.com/account is i'm doing wrong, or there issue catalyst ? strangest part not have behavior whenever use domains not subdomains. know issue or has run before? thanks! update i believe issue nginx . using nginx load balancer , passing requests catalyst app through it. whenever access catalyst app directly, there no issue. there must doing wrong in nginx configuration screwing redirects. here nginx configuration: server { listen 80; server_name beta.*; location / { proxy_set_header host $host; proxy_pass http://beta; #beta1 proxy_redirect http://beta http://$host/; #change me proxy_set_header x-fo...

c - sizeof(array) / sizeof(int) -

this question has answer here: c sizeof passed array [duplicate] 7 answers within function have declared array: int char_count_array[118] = {0}; later on, pass array function , calculate following: int xx = sizeof(char_count_array); int xy = sizeof(char_count_array)/sizeof(int); however, result is: xx = 4 xy = 1 i thought getting: xx = 472(118 * 4) xy = 118 (472 / 4) . would know doing wrong here? if passing function, it's going in int* instead of int[118] . sizeof returning size of pointer. when pass c arrays functions, it's conventional pass number of elements. my_func( arr, sizeof(arr)/sizeof(arr[0]) );

java - AlarmManager firing Alarm Instantly -

intent myintent = new intent(alarm.this, automaton.class); myintent.putextra("methodname", "mymethod"); myintent.putextra("hour", tp.getcurrenthour().tostring()); myintent.putextra("minute", tp.getcurrentminute().tostring()); hour = tp.getcurrenthour(); minute = tp.getcurrentminute(); pendingintent pendingintent = pendingintent.getactivity(alarm.this, 0, myintent,pendingintent.flag_update_current); alarmmanager alarmmanager = (alarmmanager)getsystemservice(alarm_service); calendar calendar = calendar.getinstance(); calendar.set(calendar.hour_of_day, hour); calendar.set(calendar.minute, minute); calendar.set(calendar.second, 0); alarmmanager.setrepeating(alarmmanager.rtc_wakeup, calendar.gettimeinmillis(),...

python - How can I programmatically interact with a website that uses an AJAX JBoss RichTree component? -

i'm writing python script screen scraping of public website. going fine, until want interact ajax-implemented tree control. evidently, there large amount of javascript controlling ajax requests. seems tree control jboss richfaces richtree component. how should interact component programatically? are there tricks should know about? should try implement subset of richfaces ajax? or better served wrapping code around existing web-browser? if so, there python library can this? phantomjs interesting project letting javascript stuff in headless environment decent api. while doesn't support python natively anymore, there options interacting it. check out discussion here more info. there vanilla webkit (wrapped qt , pyqt). check out example here . hope helps :)

php - How do you count the distinct values for each day using a timestamp column? -

i'm using mysql , i'm having trouble thinking of query count number of users/visitors date range. way i'm doing using php, select date range , process data in loop , count them there. it's pretty easy, problem method not work bigger data of few million rows. alternative count distinct values using mysql , return count , not actual data utilizing index on timestamp column. also, converting column datetime not option. ideas how can achieve this? here's sample result set of need: date | count 5-01-13 14 5-02-13 44 5-03-13 23 5-04-13 13 my problem don't know how group timestamp column day. that should trick: select date('datetimecolumn'), count(*) table group date('datetimecolumn')

How to display a timer in a Cocos2d game? -

i'm trying display timer in cocos2d game shows number of minutes:seconds:milliseconds user has spent on level. i've searched examples , found should not using nstimer. understand should using cctimer class, i'm having tough time finding decent examples. //declare in interface cclabelttf *mtimelbl; float               mtimeinsec; //init in onenter mtimeinsec = 0.0f; [self schedule:@selector(tick:)]; //function used -(void)tick:(cctime)dt { if(self.isgamepaused || self.isgameover) return; mtimeinsec +=dt; float digit_min = mtimeinsec/60.0f; float digit_hour = (digit_min)/60.0f; float digit_sec = ((int)mtimeinsec%60); int min = (int)digit_min; int hours = (int)digit_hour; int sec = (int)digit_sec; [mtimelbl setstring:[nsstring stringwithformat:@"%.2d:%.2d:%.2d",hours, min,sec]]; }

knockout.js - knockout js: range slider - syntax to change attribute -

i working range slider. slider has attribute slideroptions, 1 of values setting maximum range. cannot figure out if doing right way, syntax access element , change "max" value after user clicks link? trying set value of 'max' after user clicks on product. <a href="#" onclick="setcategory(500)">set option 2</a> | <a href="#" onclick="setcategory(1000)">set option 2</a> the function trying call: function setcategory(maxnum){ /// code stuck on $('#numslider').attr('data-bind).slideroptions("max",maxnum); } the slider element: <div class="slider" data-bind="slider: numberamount, slideroptions: {min: 100, max: maxval, range: 'min', step: 10}" id="numslider"> </div> the code substantiate slider: //slider ko.bindinghandlers.slider = { init: function (element, valueaccessor, allbindingsaccessor) { var opt...

javascript - Recursively call function returned as object -

i have following piece of code: // core zoom logic, independent of event listeners. $.zoom = function(target, source, img) { var outerwidth, outerheight, xratio, yratio, offset, position = $(target).css('position'); // part of code omitted return { init: function() { outerwidth = $(target).outerwidth(); outerheight = $(target).outerheight(); xratio = (img.width - outerwidth) / $(source).outerwidth(); yratio = (img.height - outerheight) / $(source).outerheight(); offset = $(source).offset(); }, move: function (e) { var left = (e.pagex - offset.left), top = (e.pagey - offset.top); top = math.max(math.min(top, outerheight), 0); left = math.max(math.min(left, outerwidth), 0); img.style.left = (left * -xratio) + 'px'; img.style.top = (top * -yratio) + '...

algorithm - ask step by step levenberg-marquardt in java -

i'm trying write levenberg marquardt in java, here's code: while (iter <= 10 || mse < 0.0001) { call.calc_jacobian(ff, trainlm, input, akt1, akt2, w, x, t); double[][] jacobian = trainlm.ret_jacob(); double[][] error = trainlm.ret_err(); mse = trainlm.ret_mse() / 4; mse_all[iter] = mse; test: (int m = 0; m <= 5; m++) { upb.koreksi_w(miu, hidden, jacobian, error, w); double[][] w_new = upb.ret_upw(); call.test_ff(ff, trainlm, input, akt1, akt2, w_new, x, t); double mse2 = trainlm.ret_mse() / 4; if (mse2 < mse || m == 5) { miu = miu / beta; w_skrg = w_baru; iter++; break test; } else { miu = miu * beta; } } } the function calc_jacobian function use compute feed-forward , back-propagate operation calculate value of jacobian. function k...

kendo ui - Why does the KendoUI Grid Transport Create event gets raised multiple times, and even when the action is Update? -

i have put fiddle demonstrates in kendoui 2013.1.319, when editing record in grid , press update button on edit dialogue, raises transport create event, instead of update event, , raises once each record. open following fiddle , press edit button on first record in grid, , press update button on edit dialogue, , have in console window , see have logged event raised , record id passed event. http://jsfiddle.net/codeowl/fakdc/ why happening, , how fix it? regards, scott code keep stackoverflow happy: <div id="testgrid"></div> var _data = [{ "sl_testdata_id": "1", "sl_testdata_number": "1", "sl_testdata_string": "test", "sl_testdata_date": "1971-12-19", "sl_testdata_datetime": "1971-12-19 12:00:00", "sl_testdata_time": "00:30:00", "sl_testdata_boolean": "1" }, { "sl_testdata_id": "2", "...

trigraphs - meaning of `???-` in C++ code -

Image
this question has answer here: what c ??!??! operator do? 4 answers i saw following code legacy codes: size_t = 1 ???- 2 :0; what symbol ???- mean in c++? how should understand it? thank you! it's actually: size_t = 1 ? ~2 :0; ??- trigraph ~ trigraphs old era... before of born. back in days, there characters weren't supported. unknowing programmer try type in such character find doesn't exist on keyboard! image source: http://www.myoldmac.net/cgi-data/forum/phpbb2/viewtopic.php?t=305 so trigraphs added allow programmer access functionality of these characters when didn't exist (either in encoding or keyboard). nowadays, obsolete , more effective in confusing reader in getting around old standards. so either code old, or author being jerk.

c# - Make label multiline -

i know easy solution make label textbox multiline not solve problem since want render anchor tags inside text value. example: <asp:label id='mylabel' runat="server" text=" label etc... go here <a href='destn.aspx'>here</a> update" /> this can't done using textbox since textbox not display anchor tag link instead display plain text <asp:label id='mylabel' runat="server" style="word-wrap:break-word;" width="140px" text=" label etc... go here <a href='destn.aspx'>here</a> update" /> add width property , provide appropriate value whatever want , add 1 css style wrap word

c - Optimized way to handle extremely large number without using external library -

optimized way handle value of n^n (1 ≤ n ≤ 10^9) i used long long int it's not enough value might (1000^1000) searched , found gmp library http://gmplib.org/ , bigint class don't wanna use them. i looking numerical method handle this. i need print first , last k (1 ≤ k ≤ 9) digits of n^n for first k digits getting shown below (it's bit ugly way of doing it) num = pow(n,n); while(num){ arr[i++] = num%10; num /= 10; digit++; } while(digit > 0){ j=digit; j--; if(count<k){ printf("%lld",arr[j]); count++; } digit--; } and last k digits using num % 10^k below. findk=pow(10,k); lastdigits = num % findk; enter code here maximum value of k 9. need 18 digits @ max. think of getting 18 digits without solving complete n^n expression. any idea/suggestion?? finding least significant digits (last k digits) easy because of property of modular arithmetic, says: (n*n)%m == (n%m * n%m)%m , c...

c# - How to display word 2007 document in web browser control using asp.net web application? -

i using vs -2010 asp.net web application.now want display word 2007 document on browser.so, decided use webbrowser control displaying word 2007 document. did not find component in tool box. so, guide me add web browser control , how show word 2007 document in web browser control. otherwise, please suggest other better approach displaying word 2007 document in browser(read mode)? try refer following code: object odocument; private void button1_click(object sender, eventargs e) { string sfilename; openfiledialog1.filename = ""; openfiledialog1.showdialog(); sfilename = openfiledialog1.filename; if (sfilename.length!=0) { odocument = null; webbrowser1.navigate(sfilename); } } private void form1_load(object sender, eventargs e) { openfiledialog1.filter = "office documents " + " " + "(*.doc, *.xls, *.ppt)|*.doc;*.xls;*.ppt"; openfiledialog1.filterindex = 1; } private void webbrowser1_documentcompleted(object send...

java - log4j with tomcat does not log what is logged in mvn test -

i have web application. when run 'mvn test', logs debug messages console, have configured it. when deploy tomcat, don't see the logs of application. absolutely sure got log4j.properties file on right place in war, when change values in deployed /var/lib/tomcat7/webapps/worldmodel/web-inf/classes/log4j.properties root logger or hibernate , touch web.xml, see/chease see debug logs hibernate. cannot application's debug messages logged configuration i've tried. here how logging: import org.apache.log4j.level; import org.apache.log4j.logger; logger = logger.getlogger(baseobject.class); log(level.debug,"message"); here log4j.properties testing: log4j.rootlogger=info, console log4j.appender.console=org.apache.log4j.consoleappender log4j.appender.console.encoding=utf-8 log4j.appender.console.layout = org.apache.log4j.patternlayout log4j.appender.console.layout.conversionpattern = %d [%t] %-5p %c- %m%n log4j.appender.syslog = org.apache.log4j.net.syslo...

Android app - Lite version or paid version -

i developing 1 android app single source library. wish submit app both free , paid version. free version planned disable functionalities , give more functionalities paid one. there way find android app free or paid java code? edit 1: in windows phone " app.xaml.cs " file contains following method identify free or paid version of windows phone app. private void application_launching(object sender, launchingeventargs e) { var license = new microsoft.phone.marketplace.licenseinformation(); istrial = license.istrial(); } here istrail property returns true or false. there method available android detect free or paid version.? google play services doesn't offer api accessing google play metadata in relation running app. application licensing might way forward, user sandy mentioned cannot used in paid app (sounds odd though). i suggest way forward though: unless offer single version of app in-app purchase upgrade free paid version have upload 2 di...

c++ - OpenCv Mat initialization from array not working -

i initializing mat object array this int data[4] = {111,2,3,4}; mat = mat(2, 2, cv_8uc1, data); now when printing value @ (1,1) should 4 cout<<"\n m1 @ 1,1 "<<(int)a.at<uchar>(1,1); it printing- 0 i using vs2008 in windows xp , opencv 2.3. stuck on since yesterday. your matrix holds 8 bit elements (that cv_8uc1 means). passing array of ints. assuming 32 bit ints, first one, 111 , should enough fill array. significant 8 bits of 111 go position 1,1 , , these 0 s. element value 0 . try passing 8 bit unsigned elements: unsigned char data[4] = {111,2,3,4}; mat = mat(2, 2, cv_8uc1, data); alternatively, if need store signed 32 bit elements, use cv_32s .

ios - UITableView not responding anymore after implement UITapGestureRecognizer -

in view controller, have table view , few custom uiview 's. within view controller, uitapgesturerecognizer implemented interactive ui work. now, uitableview not responding uitapgesturerecognizer anymore. debugging, appears goes right uitapgesturerecognizer selector method, , didselectrowatpath never being called. thanks first need add tap gesture on view. , remember <uigesturerecognizerdelegate> add in .h file. uitapgesturerecognizer *doubletap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(doubletap1imgview:)]; doubletap.numberoftapsrequired = 2; doubletap.delegate = self; [self.imgview addgesturerecognizer:doubletap]; self.imgview.userinteractionenabled=yes; - (void)doubletap1imgview:(uitapgesturerecognizer *)gesture { // want here }

c# - Automatic scrolling of textbox choppy -

i redirecting cmd output multi-line textbox, i'm trying auto-scroll down using following code: textbox1.selectionstart = textbox1.text.length; textbox1.scrolltocaret(); textbox1.refresh(); however it's choppy looking, mean, each time line comes in, positions scroll bar @ top of textbox, bottom, it's hard describe made .gif of happening: http://i.imgur.com/mudqrzy.gif is there way fix it? for same purpose use richtextbox: richtextbox1.appendtext(cmdoutputmsg + "\r\n"); richtextbox1.scrolltocaret(); in way new text added @ end of existing text, , scrolltocaret focus remains on last inserted text. i think normal textbox work in same way.

mysql - What kind of indexing are used in MyISAM and InnobDB engines? -

i read innobdb uses b+ tree , clustered indexing on primary key , hash(h) tree , non clustered indexing on multiple keys (unique key). but did not explanation myisam .. and read innobdb correct ? yes correct regarding innodb. myisam see below b-tree indexes yes t-tree indexes no hash indexes no read here more

Powershell - [AllowEmptyString()] not working -

i have parameter follows: [parameter(mandatory = false, valuefrompipelinebypropertyname = true)] [allowemptystring()] [validateset("1", "2", "3", "4", "5", "6", "critical", "important", "high", "medium", "low", "lowest")] public string priority { get; set; } when run command -priority "" , not work i know can skip argument, real problem me when execute command using pipe import-csv if csv not have value, import-csv updates parameter value empty , following error: cannot validate argument on parameter 'priority'. argument "" not belong set "1,2,3,4,5,6,critical,important,high,med ium,low,lowest" specified validateset attribute. supply argument in set , try command again. if extend validation set include "", the command if invoked individually runs successfully, still not work if pipe import-csv i have tr...

array searching vs nested if else in c++ -

what array searching version of loop? same loop below without nested if else. test t; int a; int b; int c; int d; int f; for(int = 0; < gradecount;i++){ if(t.getscore() <= 100 && t.getscore() >= 90) a++; else if(t.getscore() >= 80 && t.getscore() <= 89) b++; else if(t.getscore() >= 70 && t.getscore() < 79) c++; else if(t.getscore() >= 60 && t.getscore() < 69) d++; else if(t.getscore() <= 59) f++; } this program self-explaining. hope helps. #include <iostream> #include <string> using namespace std; int main() { int rank[5]={0}; //rank[0] grade f //rank[1] grade d //rank[2] grade c //rank[3] grade b //rank[4] grade int num=0; cout<< "enter number b/w 0-100, press -1 exit"<<endl; while(num != -1) { cin>>num; int onetenthofnum = num/10; int index = (onetenthofnum<=5)? ...

python - Why does __mro__ not show up in dir(MyClass)? -

class myclass(object): pass print myclass.__mro__ print dir(myclass) output: (<class '__main__.myclass'>, <type 'object'>) ['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__'] why __mro__ not listed dir() ? from python documentation: because dir() supplied convenience use @ interactive prompt, tries supply interesting set of names more tries supply rigorously or consistently defined set of names, , detailed behavior may change across releases. example, metaclass attributes not in result list when argument class. __mro__ read-only attribute that's used determine method reso...

spring - Can Controller layer call directly to Persistence layer? -

Image
i've webapp jsf, spring , mybatis. frameworks utlized in controller, business , dao layers respectively. in dao layer i've methods crud operations. now, in controller layer need use insert operation. use configuration: controller layer i'm using jsf annotations @managedbean public class controller{ @managedproperty("#{business}") private business business; public void insert(){ business.insert(); } } business layer i'm using spring annotations public interface business{ public void insert(); } @service("business") public class businessimpl implements business{ @autowired private daomapper mapper; @override @transactional public void insert(){ mapper.insert(); } } dao layer i'm using mybatis (mybatis-spring library) public interface daomapper{ public void insert(); } but in case business layer call dao layer , don't realize other operation, think use con...

internet explorer - Advantages & Disadvantages of writing IE addons in .NET -

since .net developer, planning write ie addon in .net. here have experience with/in developing ie extensions in .net can share knowledge? specifically know advantages & disadvantages of using .net task in comparison atl com. i'd rather advantages & disadvantages not bound ie addons more programming languages , platforms. .net: it easier , more safe c++ easy create , program ui requires end user machines have specific .net framework installed (you can run addon on compatible frameworks) uses more memory requires declare winapi functions , constants if need them c++ (atl com approach): uses less memory can statically linked not require .net frameworks, visual c++ runtimes, etc (in other words run everywhere) easy call winapi requires more knowledge , more tough .net awful ui editor (at least built-in atl/mfc) so if .net guy pay attention compatibility different .net framework versions. other stuff minor.

database - Write file data directly to a property in my class -

i have class use send file data , database, question is. how write file data directly property in class without first saving data memorystream. there advantage doing this? class rif public property filedata stream end class dim rif = new rif dim buf byte() = new byte(1023) {} using stream stream = myresp.getresponsestream() rif.filedata = stream.read(buf, 0, 1024) dim count integer count = stream.read(buf, 0, 1024) rif.filedata.write(buf, 0, count) loop while stream.canread andalso count > 0 as looks like, have proper method. there may option use pipes, too. perhaps effort , gives no gain in performance. so me looks have used common , , recommended technique. best regards

SQL Server 2008 : TSQL, select same data for different times based on column value -

Image
i using mssql 2008 r2, i have below structure create table #temp ( product int, [order] int, ord_qnty int ) insert #temp select 10 ,3,4 now, if ord_qnty 4 , want select same product,order 4 times in 4 rows thevalue of ord_qnty should 1 , i.e. out put should product order ord_qnty 10 3 1 10 3 1 10 3 1 10 3 1 try 1 - query: declare @temp table ( product int , [order] int , ord_qnty int ) insert @temp(product, [order], ord_qnty) select 10, 3, 4 select t.product , t.[order] , ord_qnty = 1 @temp t join [master].dbo.spt_values sv on t.ord_qnty > sv.number sv.[type] = 'p' select t.product , t.[order] , ord_qnty = 1 @temp t join ( select number = row_number() on (order (select 1)) sys.system_parameters p ) sv on t.ord_qnty >= sv.number output: product order ord_qnty ----------- ----------- --...

c# - how to prevent a deadlock when you need to lock multiple objects -

image code: you have 2 arrays, , need lock both of them in same moment (for reason - need keep locked both of them because somehow depending on each other) - nest lock lock (array1) { lock (array2) { ... code } } but may result in deadlock in case in other part of code do lock (array2) { lock (array1) { ... code } } and array 1 locked - execution context switched - array 2 locked second thread. is there way atomically lock them? such as lock_array(array1, array2) { .... } i know create "lock object" , lock instead of both arrays everywhere in code, doesn't seem correct me... in general should avoid locking on publicly accessible members (the arrays in case). you'd rather have private static object you'd lock on.

Deploying a gradle script from Jenkins using the artifactory plugin -

i'm trying deploy build jenkins using artifactory invocation of gradle plugin , http error 302, going through log looks there's checksum problem cannot skipped: 13:35:41.463 [debug] [org.jfrog.gradle.plugin.artifactory.task.buildinfobasetask] failed checksum deploy of checksum '8d80bb7f1bf2f0457baa3ad7379348c5ecbf2535' statuscode: 302 13:35:41.466 [debug] [org.apache.http.impl.conn.singleclientconnmanager] connection route httproute[{}->http://artifactory.edegem.eu.thmulti.com] .... 13:35:41.470 [debug] [org.apache.http.impl.conn.defaultclientconnectionoperator] connecting 13:35:41.503 [debug] [org.apache.http.impl.conn.defaultclientconnection] receiving response: http/1.1 302 found any clue? thanks lot. 302 status code redirects, means artifactory not located @ ' http://artifactory.edegem.eu.thmulti.com ' in other location. browser follows redirect new place (that's reason can browse artifactory under url), artifactory networking n...

c# - JavaScript critical error at line 135, column 158 in http://localhost:31424/Default.aspx SCRIPT1006: Expected ')' -

scriptmanager.registerstartupscript(page, this.gettype(), "jscript", "alert('this browser not supported on website. please use either latest version of chrome or mozilla firefox. click here download<a href='~/checkbrowser.aspx'>download</a>');", true); alert('this browser not supported on website. please use either latest version of chrome or mozilla firefox. click here download<a href='~/checkbrowser.aspx'>download</a>');(function() {var fn = function() {$get("ctl08_hiddenfield").value = '';sys.application.remove_init(fn);};sys.application.add_init(fn);})();//]]> **javascript critical error @ line 135, column 158 in http://localhost:31424/default.aspx script1006: expected ')'** i getting error can't figure out error is you need escape quote : scriptmanager.registerstartupscript(page, this.gettype(), "jscript", "alert('this browser not s...

Uploading an image and saving multiple sizes to file system using PHP, Laravel, GD -

i'm trying allow users upload image , save image 'original copy' in directory public_html/data/user_images/yyyy/mm/dd/guid.ext next, using gd create multiple copies of image @ different sizes , save dynamic location in file system. public_html/data/user_images/width/yyyy/mm/dd/guid.ext i keep coming across following error leads me believe file needs exist before can save on manipulated image using gd library. imagejpeg(/data/user_images/200/2013/05/21/9714624e10eed645e822babd0acccf69ac421d59.png): failed open stream: no such file or directory i same error both relative , absolute paths. know directory or file doesn't exist. code works expected when saving on original copy of uploaded image, can't create new 1 in dynamic directory. below code image helper. parameters takes original saved image location, array of sizes , file name new images. createdirectories function returns array containing absolute , relative dynamically created paths. pub...

c# - Winform handling -

i have 3 forms. can enter form2 through form1.(then form1 disappear.) when close form2, form1 reappear. can enter form3 through form2.(then form2 disappear.) when close form3, form2 should reappear.(this part fail.) when close form3, form appear form1 instead of form2. (same instances have reappear. 'creating new object of form , make appear' not allowed :) ) please help. code in form1: this.showintaskbar = false; this.visible = false; form2 f2 = new form2(); f2.showdialog(); this.visible = true; this.showintaskbar = true; code in form2: this.visible = false; this.showintaskbar = false; form3 f3 = new form3(); f3.showdialog(); this.visible = true; this.showintaskbar = true; not sure, try make form2's parent form1: form2.parent=form1; or f2.showdialog(form1);

list - Python: What's a fast way to read and split a file? -

i need read file , split lines, , split lines in half tab characters, getting rid of speech marks. @ moment have working function. however, rather slow: temp = [] fp = open(fname, "r") line in fp: temp.append(line.replace("\"","").rstrip("\n").split("\t")) print temp this splits file list of lists. 1 list, pretty easy redivide pairs later long order retained. there must faster way of doing this. put me on right track? thank you! [edit] file i'm working massive, i'll add it. (is there way upload files on stack overflow?) "carmilla" "35" "jonathan r" "aa2" "m" "3" "emma" "350" "old" "aa" should return: ["carmilla", "35", "jonathon r", "aa2", "m", "3", "emma", "350", "old", "aa"] although code retu...

android - Set ImageView on a ListView with ViewBinder depending on RatingBar value -

i have in mainactivity listview shows list of movies i'm populating simplecursoradapter. in activity user able set rating ratingbar , float value saved in database. show on mainactivity next name of movie, rating set in other activity. i tried use ratingbar indicator , set didn't work. tried use 5 insivible imageviews ( stars) became visible depending on float value didn't work. i'm trying use viewbinder, if statements : float value of rating bar database, parse int , set right drawable imageview. there no errors in logcat imageview doesn't change @ all... maybe i'm wrong in refreshing list? i'm principiant please me :) doing wrong?????? //this main activity: public class mainactivity extends listactivity implements onitemclicklistener { public static final int add_manual = 1; private cursor cursor; private movieshandler db; private string [] cols = new string [] {moviesdbconstants.movie_title , moviesdbconstants.movie_uri}; private int []...

Redirect to another page by clicking on a link in modal windows -

**i have modal window displays list of groups create, want clicking on name of group modal window closes , redirects group profile made here link line echo $this->htmllink($link, $group->gettitle()); $link static link domaine/group/4 thank you** you can using javascript: parent.smoothbox.close(); and redirect using javascript (with parent means change location property of parent window).

Windows Batch script tp process flat files -

i want in writing windows batch script. have delimeted text file data shown below: 1|2|3|4|5|6 1|2|3|4|5|6 1|2|3|4|5|6 1|2|3|4|5|6 1|2|3|4|5|6 1|2|3|4|5|6. i want write script can edit text file remove first , last fields of data. output text file containing data : 2|3|4|5 2|3|4|5 2|3|4|5 2|3|4|5 2|3|4|5 2|3|4|5. please me. thanks in advance. regards, vibhor it possible write pure batch solution, write robust solution can handle throw @ quite tricky, , final result slow. it quite easy accomplish task jscript , regular expressions, not knows technologies (although there more know jscript , regex know batch!) i have written hybrid jscript/batch utility called repl.bat called command line or batch file. performs regular expression search , replace on stdin , writes result stdout. works on modern versions of windows, starting xp. your task , efficiently accomplished using repl.bat assuming every line has 6 values (empty values ok, has 5 delimiters): type ...

asp.net mvc - How to use pageList in a view -

i trying use pagedlist obtain paged list of tickets. the model using following : public class ticketindexmodel { public ienumerable<ticket> ticketlist { get; set; } public string tickettitle { get; set; } public string ticketdescription { get; set; } } and in controller sending view : ticketindexmodel indexticketlist = new ticketindexmodel(); indexticketlist.ticketlist = db.tickets.where(r => r.username == currentusername).tolist().orderbydescending(r => r.datecreated); return view(indexticketlist.ticketlist.topagedlist(pagenumber,pagesize)); in view have 2 things, list of tickets , simple form add ticket. here little code : @model pagedlist.ipagedlist<cds.models.ticketindexmodel> @foreach (var row in model) { foreach(var item in row.ticketlist){ // list of tickets } } but problem in form adding new ticket @html.labelfor(model => model.tickettitle) model.tickettitle not available access. how can fix ? or suggest use differen...

double - How to store 3 decimal places with MySQL -

i have field in database table, type of: double how can store value this: 0,001 in it? i've tried, it's truncated 0,00 . you can set number of decimal places part of table definition: colname double(4,3) allows 1 digit before decimal , 3 digits after.