Posts

Showing posts from January, 2014

datareader - oracle reader returning System.Data.OracleClient.OracleCommand as value -

i'm stumped thing. i'm using simple following code: con.connectionstring = @"data source=(description=(address_list=(address=(protocol=tcp)(host=myhost)(port=1521)))(connect_data=(server=dedicated)(service_name=myservice)));user id=myuser;password=mypassword"; con.open(); oraclecommand command = con.createcommand(); command.commandtext = "select srvid mytable used=0 , rownum = 1"; oracledatareader reader = command.executereader(); while (reader.read()) { readercheck = reader.getstring(0); } for whatever reason, reader.getstring(0) won't work because value it's trying access object of type system.data.oracleclient.oraclecommand. if use reader.tostring() actualy returns "system.data.oracleclient.oraclecommand" string! help appreciated!! i found while searching solution same problem. getstring(0) won't work because you

javascript - Handle Pop-Up While Navigating with IE -

i have excel vba macro opens ie, navigates medicare website, logs me in, compares claims listed on website in workbook alerts me differences it during log-in step have problem, i've reproduced portion of code below. .click line executed pop-up window appears asking user click ok button in order proceed. macro execution suspended until manually click ok button on pop-up. the source code behind http://www.mymedicare.gov web page has information relative pop-up, haven't been able figure out how use can programmatically click pop-up ok button. any in terms of figuring out how programmatically click pop-up's ok button appreciated. note: purpose of question, user id , password can used. if handle pop-up you'll passed page says incorrect user id / password. that indicate you've been successful in handling pop-up. sub medicare_claims()' ' update status bar application.statusbar = "running medicare claims subroutine&q

c# - Need some help in getting the CPU Frequency -

i'm trying make c# software reads information cpu , displays them user (just cpu-z). current problem i've failed find way display cpu frequency. at first tried easy way using win32_processor class . proved efficient, except if cpu overclocked (or underclocked). then, discovered registry contain @ hklm\hardware\description\system\centralprocessor\0 "standard" clock of cpu (even if overclocked). problem in modern cpus, core multiplier decreasing when cpu not need it's full power, cpu frequency changing, value in registry remains same. my next step trying use rdtsc calculate cpu frequency. used c++ because can embed in c# project if method working. found next code @ http://www.codeproject.com/articles/7340/get-the-processor-speed-in-two-simple-ways problem same: program gives me maximum frequency (like in registry value, 1-2 mhz difference) , looks loads cpu more should (i had cpu load spikes). #include "stdafx.h" #include <windows.h>

needs some help on using font-face on mobile webs -

i have been seeking way implement external font in mobile webpages , came across website. http://www.google.com/fonts/earlyaccess after testings, have found out android web browser downloads 3 "woff" fonts on 1m each including: regular, bold, , extrabold. although after first download caches, still handle since downloads fonts in beginning. i needing korean font. (some font files includ many different languages) there api select korean font , download specific language need? i came across project... https://code.google.com/p/sfntly/ if has dealt similar or knows it, appreciate help. thank you! i don't know if understand problem fonts on web try converter: http://www.fontsquirrel.com/tools/webfont-generator

ios - Restkit - NSArray property is always null -

i'm beginner restkit (i have ios experience) , i'm having problems nsarray not being populated rkmappingresult. populates in actual 'block' if call access in viewdidload(), prints out null. could please advise or provide tips/links articles? thanks lot! here code - -(void) loaddata { rkobjectmapping *mapping = [rkobjectmapping mappingforclass:[venue class]]; [mapping addattributemappingsfromdictionary:@{ @"name": @"name", @"location.address" : @"address", @"location.city" : @"city"}]; nsstring *urlstring = [nsstring stringwithformat:@"https://api.foursquare.com/v2/venues/search?ll=55.903324,-3.171383&categoryid=4bf58dd8d48988d18f941735&client_id=%s&client_secret=%s&v=20130717", kclientid, kclientsecret]; nsurl *baseurl = [nsurl urlwithstring:urlstring]; rkresponsedescriptor *responsedescriptor = [rkresponsedescriptor responsedescriptorwithmapp

javascript - Integrate POST method into dynamically created form -

i'm creating gui form insert object div apply classes animate across screen. way have set up, whenever select class , apply , hit submit button, seems refreshing whole page. know has using post method i'm not sure how. here js: ////////////////////////////////////////////////////////////////////////////////////////////////////////add sprite var spriteid = 1; $(".add_sprite").click(function() { $("<div />", { "class":"sprite_container", id:"sprite_container"+spriteid }) .append($("<div />", { "class":"sprite" , id:"sprite"+spriteid })) .appendto("#divmain"); spriteid++; }); ////////////////////////////////////////////////////////////////////////////////////////////////////////add sprite controls var controlsid = 1; $(".add_sprite").click(function() { $("<form />", { "class":"sprite_controls", id:&

c++ - Correct way to declare/define custom cout-like object -

i created own std::cout -like object writes both std::cout , log file. i'm defining in header file, i'm getting unused variable warnings. header file <mylib/log.h> static lout { }; static lout lo; template<typename t> inline lout& operator<<(lout& mlout, const t& mvalue) { std::string str{tostr(mvalue)}; std::cout << str; getlogstream() << str; return mlout; } usage: #include <mylib/log.h> ... lo << "hello!" << std::endl; should lo static ? should lo extern ? kudos explaining correct way of declaring cout -like object , showing how main standard library implementations it. edit: cout -like object, mean global variable available after including corresponding header. std::cout declared follows: namespace std { extern ostream cout; } it regular global variable; can same thing yourself. put extern declaration of variable in header; define same variable

javascript - How can I make a Combine.js file load async -

i have created combined.js file page inline , other scripts 1 file... how can load these scripts asynchronously page? - have done because google , yahoo recommends speed-up website loading. i have placed file in footer.php (i using wordpress using wp_enqueue_script) without async or defer tags, seem have hardcode these files? in html5 can use 'async' attribute can see here support it: <script async src="myjavascript.js"></script> the old way it, this: <script> var res = document.createelement('script'); res.src = "myjavascript.js"; var script = document.getelementsbytagname('script')[0]; script.parentnode.insertbefore(res, script); </script> this way has more support ever need.

javascript - Use AJAX to find element's text -

i'm trying find way use ajax (doesn't have ajax if there better way please so) in chrome extension download few pages contents of each < > tag stored in array. every page has similar - varied inner text -: <html> <body> <a href="#">computer</a> <br /> <a href="#">monitor</a> <br /> <a href="#">mouse</a> <br /> <a href="#">keyboard</a> <br /> </body> </html> i'm able use/prefer jquery. thanks, don't have code me. i'll figure out myself if pointed in right direction. edit: i'm trying retrieve data other pages , store them in array. myarr being array want put them in...: var myarr = []; $.ajax({ type: "get", url: "myurl.html", datatype: "html", success: function (data){ $(data).find("a").each(function(){ myarr.push($(this).tex

javascript - Unique Mix of hoverIntent and timeout -

i have situation if hovering on #main-nav li item show subnav . need delay allow user reach ( subnav ). i've tried solutions this if hover on item, doesn't hide previous hovered item until delay over. tried adding if statements within handlerout determine if hovering on another nav item or mouseout #main-nav section allowing timer run (but doesn't run since within handlerout). here's code below , here on jsfiddle . var $mainlist = $('#main-nav li'); var $subnav = $('#main-nav li ul'); $(function () { $mainlist.hoverintent( function () { $(this).addclass('active'); }, function () { if ($('#main-nav li').hover() && $('#main-nav li').not($(this))) { $(this).removeclass('active'); } else if ($('#main-nav').add($subnav).mouseleave()) { timer = settimeout(function () { $('#main-nav').find('li.active').r

twitter - Custom iOS Tweet Sheet -

i looking have custom looking tweet sheet use in application. obviously can build own , use twitter api posting; however, seem (maybe not work, can't say) take lot of work build, in features autocomplete user twitter followers etc. is there anyway customize tweet sheet used apple's frameworks? looks god awful, compared design of app. if not, can implement displaying friend results while typing in @user? any thoughts, idea's, links, suggestions great. in advance! you can use social.framework signing requests data accounts, in system. second step - make own view tweeting. third - acaccount. this: acaccountstore *store = [[acaccountstore alloc] init]; acaccounttype *accounttypetwitter = [store accounttypewithaccounttypeidentifier:acaccounttypeidentifiertwitter]; [store requestaccesstoaccountswithtype:accounttypetwitter options:nil completion:^(bool granted, nserror *error) { if(granted) {

php - How to iterate through an XML element node with dynamic children -

i have following xml structure: <root> <maininfo> <node> <tournament_id>3100423</tournament_id> <games> <a_0> <id>23523636</id> <type> <choice_4> <choice_id>345</choice_id> <choice_4> <choice_9> <choice_id>345</choice_id> <choice_9> ... etc </type> </a_0> <a_1></a_1> <a_2></a_2> ...etc </games> </info> </node> </root> i can id of first node element "a_0" doing: maininfo[0]->a_3130432[0]->games[0]->a_1[0]->id; my issue is: how automatically iterate (with foreach) through a_0 , a_1 , a_2 , values of each of these node elements , of children "345" in <choice_id>345</choice_id> ? t

C# Multiplying two variables of value int.MaxValue does not result in OverflowException -

i've got integer array contains 2 values, each maximum value of int32: int[] factors = new int[] { 2147483647, 2147483647 }; i'm trying product of these 2 numbers create overflowexception: try { int product = factors[0] * factors [1]; } catch(exception ex) { } much surprise (and dismay), product returns value of 1. why this, , how go throwing exception when product of 2 integers exceeds int.maxvalue? because default behavior of c# not check overflow int. however, can force overflow checking using checked keyword. try { checked { int product = factors[0] * factors [1]; } } catch(exception ex) { }

c - Where is the old EBP and return address? -

i'm having trouble understanding find ebp , return addresses. understanding, call sub made reserve space local variables within function. i'm bit confused on code in particular.. void countlines(file* f){ char buf[0x400];//should big enough int lines=0; fread(buf,readsize,1,f); for(int i=0;i<0x400;i++) if(buf[i] == '\n') lines++; printf("the number of lines in file %d\n",lines); return; } after disassembling function gdb, get: 0x08048484 <+0>: push %ebp 0x08048485 <+1>: mov %esp,%ebp 0x08048487 <+3>: sub $0x428,%esp why 0x428? adding local variable lengths, 0x408 (char[400], lines, , i). furthermore, ebp , return address found following reserved space? after function prologue has executed, stack looks this: ***** ***** return address old ebp <---- ebp ..... ..f.. ..r.. ..e.. (0x428 bytes) ..e.. ..... <--- esp to return function, restore esp value held in ebp, p

database - Pagination in CakePHP omits fields existing in model, coincident with Datatable Component? -

there behavior don't understand. $test1 = $this->post->find('all'); debug($test1); it delivers expected array of posts fields of model each post in array: id, field 1, field 2, field 3 ... if i´m using following syntax: $test2 = $this->paginate('post'); debug($test2); it shows expected array of posts fields of model each post in array: id, field 2, field 5, field 14 why output occur when using paginate()-method ? how same output paginate()-method find()-method ? if further code needed, please tell me. any appreciated. update 1: i found out datatable-component loaded here: https://github.com/cnizzdotcom/cakephp-datatable have influence on weird behaviour. didn´t find out how yet ... i got solution. assumed problem datatable-component. in controller multiple paginate() calls , last 1 field-assignments saved in ´$this->paginate´ variable. when run cakes normal pagination without setting fields, variable used , sets fie

android - building a prebuilt static library with ndk-build all -

i have problem ndk-build script builds static library. the problem script gets included our application's larger build script, gets called ndk-build all the build script static library looks this: # loadbalancing-cpp local_path := $(call my-dir) all_static_libraries = common-cpp-static-prebuilt \ photon-cpp-static-prebuilt lib_suffix := ${app_optim}_android_${app_abi} lib_loadbalancing_cpp_static_name := loadbalancing-cpp-prebuilt-static_${lib_suffix} include $(clear_vars) local_module := loadbalancing-cpp-static-prebuilt local_src_files := lib$(lib_loadbalancing_cpp_static_name).a local_static_libraries := $(all_static_libraries) include $(prebuilt_static_library) $(call import-module,common-cpp-prebuilt) $(call import-module,photon-cpp-prebuilt) the problem is, building static library requires local_src_files point single value (the path library), when called ndk-build all in case, contain multiple values (since lib_su

java - Try/catch block with a while statement, used to handle socket data, does not continue. No obvious errors (I think) -

this main class - main.java. used control requester added completeness. import java.io.ioexception; import htmlrequester.requester; public class main { public static void main(string[] args) { requester rq = new requester("www.google.co.za", 80); try { rq.htmlrequest(); } catch (ioexception e) { e.printstacktrace(); system.err.println("connection failed."); system.exit(-1); } } } this requester.java, edited shortness. package htmlrequester; import java.net.*; import java.io.*; public class requester{ socket httpsocket = null; printwriter out = null; bufferedreader in = null; string server; int port; public void setattributes(string server, int port){ this.server = server; this.port = port; } public string htmlrequest(string server, int port) throws ioexception{ try { httpsocket = new socket(inetaddress.getbyname(server), port); out = new printwriter(http

python - How to remove a value but keep the corresponding key in a dictionary? -

suppose have dictionary: d1 = {'a1' : [2, 3], 'b1': [3, 3], 'c1' : [4, 5]} and wanted remove 3 s d1 get: d1 = {'a1' : [2], 'b1': [], 'c1' : [4, 5]} something works, assuming 3 appears in value, not in key >>> v in d1.values(): ... if 3 in v: ... v.remove(3) ... >>> d1 {'a1': [2], 'c1': [4, 5], 'b1': [3]} edit: realized can multiple occurence, try one >>> d1 = {'a1' : [2, 3], 'b1': [3, 3], 'c1' : [4, 5]} >>> k, v in d1.items(): ... d1[k] = filter(lambda x: x!=3, v) ... >>> d1 {'a1': [2], 'c1': [4, 5], 'b1': []}

Is there a text editor or ide that will do this things? -

is there text editor let me shade code blocks specific colors can find them later? bookmarks great, wanted shade same color code blocks somehow related each other. and when current text editors autocreate curly braces or parentheses me , type want in between them, there let me either jump end of line put semicolon there, or "return" type next line, or have use arrow key out of curly braces? perhaps there shortcut i'm missing? i think every code editor, including notepad++ , has bookmarks. if you're looking more complete ide, depends on language you're using. .net languages visual studio, have known that. php, javascript , html/css, can use netbeans php. netbeans available java. rich editor, , think 1 of best free general purpose ide's available. marking pieces of code in colors unknown me. i've never seen editor supports this. need project in store start , end points of these blocks, unless save them comments or in file itself. visual

python - Upload Video to GAE Blobstore and Get Input While Uploading -

i am using google app engine in python , want users able upload video, functioning following basic example want able user add additional information video, title , category , summary while uploading. there way can make upload asynchronous user doesn't have wait whole time video uploading? i know create_upload_url_async() method doesn't trying. right have following uploads , serves want make intermediate step user can add info preferably on same screen uploadhandler while uploading. class videohandler(bloghandler): def get(self): user = self.get_user() upload_url = blobstore.create_upload_url('/uploadingvideo') self.render('videohandler.html', user=user, upload_url=upload_url) class uploadhandler(blobstore_handlers.blobstoreuploadhandler): def post(self): upload_files = self.get_uploads('file') # 'file' file upload field in form blob_info = upload_files[0] self.redirect('/serve/%s&#

My Java Array program that is suppose to have a bubble sort -

so new programming. take online course , understand code have inputted but, doesn't work properly. "index out of bounds" error, doesn't make sense since kept 5 values 0-4. can identify problem? thanks! public class leggo { public static void main(string args[]) { int j, i, l, m; int this[] = new int[5]; this[0] = 8; this[1] = 4; this[2] = 24; this[3] = 14; this[4] = 56; (j=1; j<5; j++) { for(l=0; l<5-j; l++) { if (this[l]<this[l+1]) { i=this[l]; this[l]=this[l+1]; this[l+1]=i; } } } for(m=0; m<5; m++); system.out.print(this[m]); } } your stack trace tell line causing exception. edit: problem semicolon @ end of loop , lack of '{'. when perform m++, increment m 5, , used in println. you can avoid these types of problems through reduced variable scope. if initialize m ins

mixing pixels of an image manually using python -

Image
i trying create algorithm blends pixels of image , can bring image before, not know this. i'm using python , pil, can use other libraries. exemple: , thank you. this should it. there's no error handling, doesn't follow pep8 standards, uses slow pil operations , doesn't use argument parsing library. i'm sure there other bad things also. it works seeding python's random number generator invariant of image under scrambling. hash of size used. since size doesn't changed, random sequence built on same images share same size. sequence used one-to-one mapping, therefore it's reversible. the script may invoked twice shell create 2 images, "scrambled.png" , "unscrambled.png". "qfhe3.png" source image. python scramble.py scramble "./qfhe3.png" python scramble.py unscramble "./scrambled.png" - #scramble.py pil import image import sys import os import random def openimage():

jQuery Event propagation, when using different event types -

i have set jsfiddle show issue have. http://jsfiddle.net/fy8tk/3/ in simple terms, have child element has both single click , double click trigger. both handled within click event using timeout. the parent term has double click event. defined using dblclick however. event.stoppropagation() not working, , i'm wondering if because different event types? basically, need parent dblclick event not fire if clicking on child element. $('.parent').bind('dblclick', function (e) { if (e.target !== 'div.child') { alert('double click parent'); } }); $('.child').bind('click', function(e) { alert('single click child'); }); jsfiddle from jquery documentation on 'dblclick' : it inadvisable bind handlers both click , dblclick events same element. sequence of events triggered varies browser browser, receiving 2 click events before dblclick , others one. double-click sensitivity (maximum t

javascript - Ember.js external json for Store -

i have json file lives on on server hosting ember.js app. want use json "store" app (it reading). i'm not sure best way this. need use restadapter hit file, or somehow use external fixtureadapter, or there other way accomplish this? your best bet use fixture adapter described here . if file static, can add page script tag , done it. if file changes per user, you'll have write server-side logic generate it. if that's case, append html file self executing function or something. either way, if data isn't changing, fixtureadapter best bet. don't want have mess restadapter or trying write own.

vb.net - Sequential procedures inside DoWork BackgroundWorker -

i'm looking run sequential sub procedures in background thread. , wondering if permissible such creating background worker , calling each procedure separately so... private sub bgw_dowork(byval sender system.object, byval e doworkeventargs) _handles bgw.dowork procedure1() procedure2() procedure3() end sub will run each procedure in background thread? also, reading other posts suggested use list<svncommand> , pass them runworkerasync in c#, while others suggested using tasks method, both of have no knowledge of. of these 2 work , they? no, not necessary put each subroutine in own backgroundworker. regularly call multiple subroutines dowork handler. subroutines called handler execute in background thread.

python - List Highest Correlation Pairs from a Large Correlation Matrix in Pandas? -

how find top correlations in correlation matrix pandas? there many answers on how r ( show correlations ordered list, not large matrix or efficient way highly correlated pairs large data set in python or r ), wondering how pandas? in case matrix 4460x4460, can't visually. you can use dataframe.values numpy array of data , use numpy functions such argsort() correlated pairs. but if want in pandas, can unstack , order dataframe: import pandas pd import numpy np shape = (50, 4460) data = np.random.normal(size=shape) data[:, 1000] += data[:, 2000] df = pd.dataframe(data) c = df.corr().abs() s = c.unstack() = s.order(kind="quicksort") print so[-4470:-4460] here output: 2192 1522 0.636198 1522 2192 0.636198 3677 2027 0.641817 2027 3677 0.641817 242 130 0.646760 130 242 0.646760 1171 2733 0.670048 2733 1171 0.670048 1000 2000 0.742340 2000 1000 0.742340 dtype: float64

php - I have the error of parsing a JSON object to String in Android -

i wanted learn android in connection php , found code in web: demo web so, code works fine, when want select says there error when parsing json object string. give 3 parts of code. can see code in website adobe. here have 2 codes: public class jsonparser { static inputstream = null; static jsonobject jobj = null; static string json = ""; // constructor public jsonparser() { } public jsonobject getjsonfromurl(final string url) { // making http request try { // construct client , http request. defaulthttpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); // execute post request , store response locally. httpresponse httpresponse = httpclient.execute(httppost); // extract data response. httpentity httpentity = httpresponse.getentity(); // open inputstream data content. = httpentity

html - Why is text not positioned properly within list element? -

Image
this problem looks like: here mark up: <nav class="padding_bottom"> <ul> <li><a class="selected" href="#">home</a></li> <li><a href="#">music</a></li> <li><a href="#">contact</a></li> </ul> </nav> and styling: nav { height: 100%; } nav li { font-size: 3em; letter-spacing: -4.5px; text-transform: uppercase; } nav li:nth-child(2), nav li:nth-child(3) { margin-left: .25em; } nav { color: #dddddd; } nav a:hover, .selected { color: black; } i can;t figure out why happening. i've played around wiht lot of styling elements see if changed, problem persisted. @michaelpitluk: it's caused -ve letter-spacing , if remo

java - Is there any way to get a openbravo developer's copy that I can edit other that using mecurial? -

first of if question somehow related or duplicate copy of existing question sorry please direct me right direction, though have search within site , no hits whatsoever... so problem , edit openbravo erp system , 1 way i've seen possible use mecurial , copy instruction can take 1 2 days copy. download speed think take 3 4 days not sure if based on that, when want edit code possible. if im missing here instructions mecurial giving i've said earlier please direct me right direction.. hope positive response thanx cares. lastly sorry english if happens unreadable, ask clarity thnx.... you can download latest sources (or previous version) in zip file @ following location: http://sourceforge.net/projects/openbravo/files/02-openbravo-sources/ this "lighter" cloning/downloading our whole repository. however, keep in mind openbravo adheres modular development approach opposed changing core code directly advised against.

c++ - Who is responsible for deleting the facet? -

i have function uses boost.datetime library generating current gmt/utc date , time string ( live example ). std::string get_curr_date() { auto date = boost::date_time::second_clock<boost::posix_time::ptime>::universal_time(); boost::posix_time::time_facet* facet = new boost::posix_time::time_facet("%a, %d %b %y %h:%m:%s gmt"); std::ostringstream os; os.imbue(std::locale(os.getloc(), facet)); os << date; return os.str(); } this based on boost.datetime's example : //example customize output "longweekday longmonthname day, year" // "%a %b %d, %y" date d(2005,jun,25); date_facet* facet(new date_facet("%a %b %d, %y")); std::cout.imbue(std::locale(std::cout.getloc(), facet)); std::cout << d << std::endl; // "saturday june 25, 2005" my code worked nicely, i'm feeling uneasy because of these particular lines containing new : boost::posix_t

CSS Styling Not Taking Effect, Not sure why? -

i know noob question of you, here im trying have like: http://cssdesk.com/6rzk2 (keep link preview please) however showing plain text. thanks as far can see, have 2 style sheets being loaded on site - style.css , large.css. neither 1 has #sumtitle. add style.css , work - #sumtitle { color: #0d2f87; border-bottom: 1px #3a6cc5 solid; padding: 20px 0px 3px 0px; margin: 0px 0px 5px 0px; font-weight: bold; font-family: verdana, arial, sans-serif; font-size: 18px }

Kernel panic - not syncing: Vfs unable to mount root - (0,0) on Beagleboard-xm -

i facing problem on beagleboard-xm after update kernel image on board when booted board got stuck @ point showing kernel message.... kernel panic - not syncing: vfs unable mount root - (0,0) can please explain solution or share experience me if have faced same problem mine , got solution this. the kernel cannot find root device , boot fails. pair @ end of message explains reason of such failure , should have following meaning: if first number 0 kernel didn't find suitable device. if second number 0 kernel found suitable device didn't manage mount filesystem. in case seems kernel misses driver access device. try tips suggested here in section "unable mount root-fs" http://swift.siphos.be/linux_sea/kernelbuilding.html#idm2877662600400

angularjs - It it possible to order an array of objects by an array element? -

if have array this: [ {names: [ {firstname: "bob", lastname: "jones"}, {firstname: "martha", lastname: "jones"} ] }, {names: [ {firstname: "jim", lastname: "franklin"}, {firstname: "jill", lastname: "franklin"} ] } ] what expression use in ng-repeat order first lastname of each record (e.g. names[0].lastname)? use: ng-repeat="e in entries | orderby:'names[0].lastname'" or: ng-repeat="e in entries | orderby:'-names[0].lastname'" for reverse order.

Will Foo(Foo x){ } ever be called in C++? -

i have query regarding c++ syntax/construct : in scenario can following foo(foo x){} called? understand wont called initialization like, call copy constructor foo a; foo x = a; or foo x(a); not conversion of type argument passed of same type class can't think of scenario on foo(foo x){} called, or dead code. class foo { public : foo(foo x){ // notice not not copy constructor!!, intented make ordinary ctor taking same class object } foo(int x) : m_data(x){} private : int m_data; }; have tried compile code? error 1 error c2652: 'foo' : illegal copy constructor: first parameter must not 'foo' main.cpp 5 1 nativeconsolesketchbook c++11 standard, 12.8.6: a declaration of constructor class x ill-formed if first parameter of type (optionally cv-qualified) x , either there no other parameters or else other parameters have default arguments.

firefox addon - why can't I create file in the folder with xpcom -

i haved created folder , code that var file = components.classes["@mozilla.org/file/local;1"] .createinstance(components.interfaces.nsilocalfile); var fostream = components.classes["@mozilla.org/network/file-output-stream;1"] .createinstance(components.interfaces.nsifileoutputstream); filepath = path; file.initwithpath(filepath); if(file.exists() == false ) { file.create(0x01, 0644); } but when create file in folder , there error show that error: uncaught exception: [exception... "component returned failure code: 0x80520015 (ns_error_file_access_denied) [nsilocalfile.create]" nsresult: "0x80520015 (ns_error_file_access_denied)" anyone can me please? change directory permissions 0755

java - Export rmi on virtual machine -

i want export java.rmi on virtual machine, <bean id="entityrmiserviceexporter" class="org.springframework.remoting.rmi.rmiserviceexporter"> <property name="servicename" value="entityservice"/> <property name="service" ref="entityserviceimpl"/> <property name="serviceinterface" value="ientityservice"/> <property name="registryport" value="1099"/> <property name="registryhost" value="127.0.0.1"/> i connection refused 127.0.0.1 hosts file : 127.0.0.1 localhost.localdomain localhost 10.0.2.15 compname is problem vm ? change networking mode of virtual machine "bridged" in same network host. java rmi not designed work nat, you'll have trouble default networking mode. after that, change registryhost ip address of vm, 127.0.0.1 can accessed within machine. (there other ways make work ea

php - Image resize not working -

i using following code unable resize image $this->image_lib->resize() returning true, don't know going wrong: if(file_exists($_server['document_root']."/uploads/avatars/".str_replace('_','-',$image))) { $config['source_image'] = $_server['document_root']."/uploads/avatars/".str_replace('_','-',$image); } else if (!file_exists("./uploads/avatars/".$image) || $image=="") { $config['source_image'] = $_server['document_root'].'/uploads/avatars/photo.jpg'; } else { $config['source_image'] = $_server['document_root']."/uploads/avatars/".$image; } $config['image_library'] = 'gd2'; $config['create_thumb'] = true; $config['maintain_ratio'] = true; $config['dynamic_output'] = true; $config['width'] = $width; $config['height

big o - Why is multiplication n^2 time? -

i've read operations such addition/subtraction linear time, , multiplication n^2 time. why true? isn't addition floor(log n) times, when n smaller operand? same argument goes subtraction, , multiplication, if make program long multiplication instead of adding integers together, shouldn't complexity floor(log a) * floor(log b) , b operands? the answer depends on "n." when addition o(n) , multiplication (with naïve algorithm) o(n^2), n length of number, either in bits or other unit. definition used because arbitrary precision arithmetic implemented operations on lists of "digits" (not base 10). if n number being added or multiplied, complexities log n , (log n)^2 positive n, long numbers stored in log n space.

java - How to add or change API in openmeeting? -

i using ubuntu 12.04 o.s.i have install openmeetings in system , try add few api of openmeetings don't know in file should change it. kindly me.i use jdk 1.7 in system. kindly me change api setting in openmeetings. in advance. you should concentrate on using rest , soap api if want integrate openmeetings somewhere. other sorry question general impossible answer. maybe can on mailing list further: http://openmeetings.apache.org/mail-lists.html

Rails: How to retrieve an attribute from a related model? -

i seem stuck problem should more obvious me: how can attributes related model show in view. in application there these 2 models: products product_images i'm writing while i'm on go , don't have exact code available. created necessary associations, product has_many product_images , product_image belongs_to product. image model has url, default (boolean) flag , of course product_id. in product index view i'd display default image product. sake of simplicity though let's assume i'm fine showing first picture - conditions should easy introduce once works. so in products index view there's (again, memory): @products.each |p| <h3><%= p.name %></h3> <%= image_tag p.product_images.first.url %> <p><%= p.description %></p> end while description , name of product alone display fine include image_tag view breaks nomethoderror stating url undefined method in class nil. keep simpler got rid of imag

vb6 - How to pass value to SQL Query in Data Environment's Command Object at run-time in Visual Basic 6.0? -

in dataenvironment have command object in have given following sql query: select * userdetails date = todays_date here todays_date public variable in module. variable accepts value @ run-time. how call variable in dataenvironment's sql query? the vb6 manuals cover in closing , reopening recordset under heading data environment programming guidelines . example given there looks like: option explicit private sub command1_click() ' must close recordset before changing parameter. if dataenvironment1.rscommandquery.state = adstateopen dataenvironment1.rscommandquery.close end if ' reopen recordset input parameter supplied ' textbox control. dataenvironment1.commandquery text1.text text2 .datafield = "au_lname" .datamember = "commandquery" set .datasource = dataenvironment1 end end sub private sub form_load() ' supply default value. text1.text = "172-

java - null pointer exception in string array with assigning null during initialization -

i beginner in java.now i'm facing problem during pratice.actually want string tokens stringtokenizer class , wanna assign these tokens array of string.but i'm getting null pointer exception.my code here. public class token { public static void main(string str[]) { string str1="this first page"; stringtokenizer str2=new stringtokenizer(str1); int i=0; string d[]=null; while(str2.hasmoretokens()) { d[i]=str2.nexttoken(); } system.out.println(d); } } arrays in java must initialized. this: string d[] = null; essentially creates reference array, null. hence nullpointerexception . what more, if initialized, size fixed , array cannot resized . cannot do: string[] d = new string[]; // won't compile: size not specified continuing on, do: d[i] = "whatever"; and i 0. use list<string> instead: list<string> list = new arraylist<>(

How to print out error messages into terminal screen while doing pipes (linux bash) -

in linux bash terminal, command want run of form: cmd | cmd2 > somefile.txt . however, want error message in cmd shown in terminal screen. different redirecting stderr stdout. way this? error messages written standard error not sent piped command. mean if command is: cmd | cmd2 then stdout messages cmd piped cmd2 , not stderr messages. here example used. tried cat ing non-existing file , tried grep ing text: $ cat non-existing-file.txt | grep > grepped-text.txt cat: non-existing-file.txt: no such file or directory

php - How to Use Stristr in array Variable -

i need check words in array variable, need this: $banned = array('word1','word2','word3','word4'); if (stristr($title, $banned) !== false) { //$title contains banned word }else{ //$title not contains word of $banned variable array } <?php $banned = array('word1','word2','word3','word4'); $hit = false; foreach ($banned $banned_item) { if (strpos($title, $banned_item) !== false) { $hit = true; break; } } if ($hit) { // $title contains banned word } else { //$title not contains word of $banned variable array } _ ************** update1 ************** the code above case-sensitive, if want code case-insensitive, change: if (strpos($title, $banned_item) !== false) to: if (stristr($title, $banned_item) !== false)

c++ - Transparent widget with QtQuick 2.0 -

Image
i'am trying create transparent window qtquick 2.0. i can create transparent widget that: class transparentwidget : public qwidget { public: transparentwidget(qwidget* parent) : qwidget(parent) { resize(qsize(500, 500)); setattribute(qt::wa_translucentbackground); setwindowflags(qt::framelesswindowhint); } void paintevent(qpaintevent * event) { qpainter painter; qbrush brush(qt::cyan); painter.begin(this); painter.setrenderhint(qpainter::antialiasing); painter.setbrush(brush); painter.drawrect(0,0,100,100); painter.end(); } }; now want same thing qquickview, first create it: qquickview view; view.setsource(qurl::fromlocalfile("test.qml")); view.setresizemode(qquickview::sizerootobjecttoview); and here "test.qml" file: rectangle { width: 300; height: 300; color: "transparent"; rectangle { anchors.top:

php - How to use chekbox with Jquery ajax -

i trying use checkbox ajax. without ajax have handle it. here jquery code $("#skillcat").click(function(e) { var submit_val = new array(); e.preventdefault(); var ids = $('check_subjects input:checked') .map(function(){ return this.value; }).get(); $.ajax( { type : "post", datatype : "json", url : "./wp-admin/admin-ajax.php", data : { action : 'each_category', check_subjects : ids }, success : function(data) { alert(data); $('#accordion').html(data); } }); }); here php code button , checkbox generated in serverside foreach($subjects $key=> $data){ echo '<input type="checkbox" id="'. $data->id .'" value="'. $data->id .'" name="check_subjects[]">&nbsp;&nbsp; '. $data->subject .'<br>'; }

regex - Solr RegexTransformer only delviers first match to multivalued field -

i want find hashtags in comment coming db. use regextransformer of solr multivalued field. problem is, transformer delivers first match of string , not matches. boards.xml: <field column="hashtag" sourcecolname="comment" regex="(#[^.!\s]+)" /> schema.xml: <field name="hashtag" type="string" multivalued="true" /> so e.g. "this #good #comment" input should save #good , #comment in multivalued field, #good arrives. i know not best when comes regex, according http://www.regexplanet.com should work intended. ok, found out, behaviour purpose. returns 1 match. solved problem using scripttransformer function commentpieces(row){ var reg = new regexp(/(#[^.!\s]+)/g); var arr = new java.util.arraylist(); while((result = reg.exec(row.get('comment'))) !== null) { if(!arr.contains(result[0])){ arr.add(result[0]); }

php - How to find double transactions in MT940 -

at moment i'm working on import script imports bank account data mysql database using php. found mt940 pharser didn't wanted or didn't meet current mt940 standard. wrote own simple class parses me data need. the problem no is, , might not mt940 issue, must filter double transaction. , in basic, simple, if exact same transaction exists in database, don't import again. that's have done. but fun part: transactions might happen twice @ same day. example same transaction twice @ same day [someone might me , send me money twice ;)]. while importing first time, there no problem. in 1 file each transaction transaction. but problem: because transaction not unique (mt940 doesn't send unique's transaction), hard filter out double transaction unique transaction. if have downloaded 2 mt940 files bank account. , 1 of 2 transactions in first file, , 1 in second file. when importing second file, tel me transaction double transaction. so.. i'm struggling th

windows 8 - WinJS - Adding 'selected' style to first item in listview on load -

i'm trying @ present use listview drive content of separate div in windows store app (html/js). i have simple function call inside 'oniteminvoked' handler listview. method call myapp.util.addclassbyid(q(".item"), item.itemid, "selected"); (where item.itemid of newly selected item , 'q' alias winjs.utilities.query) method declaration function addclassbyid(elements, selectedid, classname) { elements.foreach(function (el) { var id = parseint(el.attributes['data-id'].value, 10); if (id === selectedid) { util.addclass(el, classname); } else { util.removeclass(el, classname); } }); } this works expected after listview loaded , i'm selecting new items. doesn't load when try call during ready function page in question. when go through in debug, seems query items in list doesn't return during pages ready function, i'm assuming list hasn