Posts

Showing posts from June, 2011

javascript - Script to return file as string -

what trying simple, haveing problems make work... text on html page changes according text exists on different html file. main html file: <html> <body> <label for="order2" id="order2"> </label> <script> var order2 = returnedfromthephpfile; document.getelementbyid('order2').innerhtml = order2; </script> </body> </html> here php file: <?php $src = fopen('c:\\order.html', 'r'); return $src; fclose($src); ?> the other html file: <table border="0" cellpadding="0" cellspacing="0"><tr><td width="360" height="190" valign="top">hello</td></tr></table> does knows how can this, or if there easier way it? you want use file_get_contents contents of file string. http://us2.php.net/file_get_contents $src = file_get_contents(&q

if statement - SML - Function calculates incorrectly -

for course @ university have learn sml. learnd java befor , having problems sml now. have function should calculates entryfee zoo. fun calcentryfee (erm:bool,dauer:int,dschungel:bool,gebtag:bool):real= let val c = 7.0 in if erm c + 14.50 else c + 19.50; if dauer < 120 c - 4.0 else c; if dschungel c + 1.5 else c; if gebtag c / 2.0 else c end; the problem function 'returns' 7.0 or 3.5. doesn't seem execute other 3 if-statements. there no statements in ml, expressions. a;b expression, evaluates a , b , result result of b . consequently, result of first 3 if-expressions thrown away. also, variables variables in true math sense, immutable. think of program mathematical formula. what want write following: fun calcentryfee (erm : bool, dauer : int, dschungel : bool, gebtag : bool) : real = let val fee = 7.0 + (if erm 14.50 else 19.50) - (if dauer < 120 4.0 else 0.0) + (if dschungel 1.5 else 0.0

javascript - Get product name from parent element -

here trying product name in alert box when "buy now" button clicked. need maintain onclick event of button have placed code in jquery. <h2 class="product-name"><a href="product1.php" title="sample product name">sample product name</a></h2> http://jsfiddle.net/lkkbz/ the approach did giving me blank alert box might because calling parent element. please help please note here don't want alert when product name or image clicked. want on button change this: var text = $(this).parents(".item").find('.product-name').text();

In gnuplot, how to label each point in the plot with its coordinates? -

Image
i have data file, abc.dat , want plot labeling each coordinate (1,5), (4,6), (2,8) , on .... abc.dat : 1 5 4 6 2 8 4 5 7 8 8 9 3 4 use labels plotting style this. requires 3 using specifiers: x-value, y-value , string placed @ given coordinates. easiest command be: plot 'abc.dat' using 1:2:(sprintf("(%d, %d)", $1, $2)) labels notitle that places respective labels centered @ coordinates. the following command plots point @ respective coordinate , places coordinate label bit shifted near it: set offset 1,1,1,1 plot 'abc.dat' using 1:2:(sprintf("(%d, %d)", $1, $2)) labels point pt 7 offset char 1,1 notitle the result 4.6.4 is:

ios - How to get mail configuration information if allowed? -

hi using smtp server framework send mails. nsarray *arr1 = [testmsg.fromemail componentsseparatedbystring:@"@"]; nsarray *arr2 = [[arr1 objectatindex:1] componentsseparatedbystring:@"."]; if ([arr2 containsobject:@"gmail"]) { testmsg.relayhost = @"smtp.gmail.com"; } else if ([arr2 containsobject:@"yahoo"]) { testmsg.relayhost = @"smtp.mail.yahoo.com"; } else if ([arr2 containsobject:@"hotmail"] || [arr2 containsobject:@"live"]) { testmsg.relayhost = @"smtp.live.com"; } else { nsstring *smtprelay = [[nsstring alloc]init]; smtprelay = [nsstring stringwithformat:@"smtp.%@.com",[arr2 objectatindex:0]]; testmsg.relayhost = smtprelay; } testmsg.requiresauth = yes; testmsg.login = @"mycompanyusername@mycompany.com"; testmsg.password = @"********"; testmsg.subject = @"this email subject line"; testmsg.wantssecure = yes; // smtp.gmail.

Read user input before update in unity3d -

i separate script manage user input in unity3d, character can controlled not user input, , ai. question is: want other logic script read input script named inputmanager inputmanage ipt; ipt.walk ipt.jump . how can guarantee input updated before other update. in general thing (and design) choice, not rely on script execution order. by way it's possible force script update in specific order. can modify in edit->project settings->script execution order .

JSF and cloudControl -

i'm learning java ee , appear me 1 of things know jsf i'm sing cloudcontrol haven't found way deploy jsf applications there. is there way of deploying jsf applications on cloudcontrol ? as mentioned in comment, need provide implementation of jsf dependency embedded jetty or tomcat runner. here can find example apps tomcat , jetty . maybe helpful have on our existing java guides .

c++ - Runtime check failure #2 - Stack around variable was corrupted -

i'm attempting make program transpose (2 x 2) matrix using 2-dimensional array. besides runtime failure i'm having issue in inputting integer value index [0][1], value of [1][0] going index [0][1] [1][0]. value of [0][0] , [1][1] inputted cin keyword when asked during execution. didn't seem receive compilation errors should worry me either. added stdio header well, in case may somehow or anything. #include "iostream" #include "stdio.h" #include "conio.h" using namespace std; class transpose { public: int m[1][1], te; void input(); void process(); void output(); }; void transpose::input() { cout << "matrix format:"<< endl << "[a b]" << endl << "[c d]" << endl; cout << "enter a: "; cin >> m[0][0]; cout << "enter b: "; cin >> m[0][1]; cout << "enter c: ";

c++ - How should I iterate this map according to a given string and then append its value? -

edited why i'm asking... yesterday, started project create morse code translator creates file or appends existing file, translated morse code given string or file text given. mainly,i have no idea in hell how map work string in want return , feel if i've tried can google or read in documentation. additionally... i've left horrendous attempt @ iterating through data structures , time using vectors, having exhausted tries map methods. i'm sure i'm missing simple syntx map structure left last attempt because believe conveys intention quite due baroque nature. so more specific, what's best way access map , return through function. initial design gettranslation() /* @brief: program returns string translation * of rvalue string takes argument * @param text: string of letters, numbers , symbols translated * @return translation: translated string appended map values */ string gettranslation (const string&& text) noexcept(true) { //re

css - 2 div alignment in mobile device -

i have problem in aligning div in mobile device. my code like text text when sink screen rfloatdiv div coming down, want lfloatdiv should go down instead rfloatdiv div.. got point? please me. there stacking order when use float . basically, floated elements stack parent edge, move down next available edge. order appear in html important! if have: <article> <!-- order matter --> <div id="left">this left div</div> <div id="right">this right div</div> </article> and in css: #left { float: left; } #right { float: right; } output small screen be: this left div right div but changing order appear in html modify happens when screen smaller. play fiddle: http://jsfiddle.net/732ly/1/ change float left left or right right in fiddle , see results!. good luck

php - Add another dimension into array cart -

i have shopping cart, works fine, store type of goods (for example color, size, etc.). here function gets items shopping cart public static function getcart() { if((isset($_session['cart'])) && count($_session['cart'])>0) { $ids = ""; foreach($_session['cart'] $id => $quantity) { $ids = $ids . $id . ","; } $ids = rtrim($ids, ','); $dotaz = dibi::fetchall("select * eshop_products idproduct in ({$ids})"); return $dotaz; } else { //do nothing } } and function adds items shopping cart public static function addtocart($data) { $id = $data['id']; $quantity = $data['qty']; $varianta = $data['varianty']; //this need add session array if(!isset($_session['cart'])) { $_session['cart'] = array()

php - display data 3 items in row with pagination 9 items on page from api or array -

i fetching data api. want display data 9 items on page , 3 items in row. have done it's screwing up. array data received api in $items array. $count_items=count($items); echo $count_items; $ptemp="http://".$_server['server_name'].$_server['request_uri']; $pt=explode('&',$ptemp); if (strpos($ptemp,'pageno')) array_pop($pt); $pt=implode('&',$pt); $ptemp=$pt; $array=$items; $page = $_request['pageno']; $currentpage = isset($page) ? (integer)$page : 1; echo 'currentpage='.$currentpage; $numperpage = 1; //number of rows displayed per page $total = ceil((count($array))/3); echo '$total='.$total; $numofpages = ceil($total / $numperpage); //total number of pages echo "numofpages=".$numofpages; if(isset($array)) { if (($currentpage > 0) && ($currentpages <= $numofpages)) { //starting loop array data $start = ($currentpage-1) * $numperpage

doctrine2 - zendframework 2 table gateway And doctrine 2- is it possible to operate both systems at same time -

i using zendframework 2 . wonder if possible use both table gateway , doctrine 2 in same application. below configuration. tried run noticed speed of application slowed down considrable. i wondering if beucase there conflict between both applications or because have not configured properly. global php file return array( 'db' => array( 'driver' => 'pdo', 'dsn' => 'mysql:dbname=thetable;host=localhost', 'driver_options' => array( pdo::mysql_attr_init_command => 'set names \'utf8\'' ), ), 'service_manager' => array( 'factories' => array( 'zend\db\adapter\adapter' => 'zend\db\adapter\adapterservicefactory', ), ), ); local php return array( 'db' => array( 'username' => 'user', 'pas

c++ - Creating properties for Lua -

i wasn't sure how word title, here go. let's made lua function create 2d box appear on screen - example: box = createobject("box") how create properties box subsequently change how box looks or reacts? example may want do box.positionx = 0 box.positiony = 60 how do in c++? just answering direct question itself, things simple: use standard metatable-aware add/set-table-index api. if @ how box should look, things interesting: if createobject "box" returns lua table , don't need react on change, don't special. if createobject "box" returns lua table need react immediately, let act proxy object, aka force using metatable function never adding element table itself. remap index or table saved @ dedicated index or in metatable/metatable function closures. if createobject "box" returns userdata, same 2, maybe saving non-lua-values in c faster access/higher efficiency, using environment table other value

google maps - How to extract the present Latitude and Longitude values from Emulator in android -

what trying do :: i trying log present location( latitude , longitude ) using android emulator testing what have done :: have opened ddms , manually pushed latitude & longitude co-ordinates emulator , pressed send button my question :: how can extract values emulator , print log add following permissions. <manifest ... > <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission. access_coarse_location" /> <uses-permission android:name="android.permission.internet" /> </manifest> make class implement locationlistener , add following code. locationmanager = (locationmanager) getsystemservice(context.location_service); locationmanager.requestlocationupdates(locationmanager.gps_provider, 0, 0, this); @override public void onlocationchanged(location location) { log.d("latlng", "latitude:" + lo

html - php in href and iframe -

i have found lots of on site through search option totally confused latest problem. think punctuation problem cannot find it. i have image link change iframe, selector form radio button. link in iframe want taken php variable. i have got whole thing working until wanted add php variable. (i got working iframe link manually entered instead of the variable. </p><p> <input style="position: absolute;left:-9999px;" type="radio" name="size" id="a1" /> <label for="a1"> <a href="canvas_size.php?width=32&height=22&name=test.jpg"target="iframe_a"> <img src="/site_images/a1.png" alt="a1" style="display: inline-block;cursor: pointer;padding: 3px;" alt="a1" /> </label> the iframe points to:- www.mydomain.com/<?php=%27$filename%27%20?>

html - Space between td's - once again -

i've closed last topic cause havr thought answered, appear now, isn't. link: space between 2 td or tr tags line-height:0; isn't useful here, because @ original work i'm doin' other stuff, , thing is, line-geight combining content small line, except images, guess. know may line-height:0; specific td , not td, main point here rid of space between td's once @ html 4, think. hope some1 know answer thanks! the ''example'' <table class="main-table-default"> <tr> <td> <table class="main-table-header-default"> <tr> <td><img src="http://i1.ytimg.com/vi/oguou5cyiki/hqdefault.jpg" border="0"> </td> </tr> <tr> <td><img src="http://i1.ytimg.com/vi/oguou5cyiki/hqdefault.jpg" border="0">

PHP: Header doesn't redirect page after form submit -

what problem code? after submitting form, page doesn't redirected coming soon.html ; instead, shows blank. , apage exists! <?php if(empty($name) || empty($surname) || empty($email)){ return false; } else { header('location: coming soon.html'); } $name = $_post['name']; $surname = $_post['last_name']; $cons = $_post['cons']; $password = $_post['pass']; $email = $_post['email']; $message = $_post['message']; $subject = $_post['subject']; $recipient = "pixiedustmed@yahoo.com"; $msg = "please fill in required fields*"; $to = 'pixiedustmed@yahoo.com'; $subject = "contact message from: $name $surname - $email - subject: $subject"; $headers = "from: $name $surname \r\n"; $headers .= "reply-to: ". strip_tags($_post['email']) . "\r\n"; $headers .= "cc: avedis@avedis.ga\r\n"; $headers .= "mime-version: 1.0\r\n"; $

python - Removing the unwanted substrings from a series of strings -

i have series of strings given below tata jaguor 1474 psnl series car tata nano pro 5864 series car tata indica 8586 k5478 tata nano 5864 e5478 tata bolero 8974 1567 series after stripping unwanted string resultant string expecting given respectively follows jaguor 1474 nano 5864 indica 8586_k5478 nano 5864_e5478 bolero 8974_1567 i tried following code this,but not got expected result vehiclename.replace("tata ","").replace("series","").replace("pro ","").replace(" car","") is there other better way this? reobj = re.compile(r"tata ([\w ]+\d+).*?$", re.ignorecase | re.multiline) result = reobj.sub(r"\1", subject) http://rubular.com/r/jvvtcjltky jaguor 1474 nano pro 5864 indica 8586 k5478 nano 5864 e5478 bolero 8974 1567

python - NameError: global name 'END' is not defined -

i have found code scrollbar working fine. from tkinter import * master = tk() scrollbar = scrollbar(master) scrollbar.pack(side=right, fill=y) listbox = listbox(master, yscrollcommand=scrollbar.set) in range(10000): listbox.insert(end, str(i)) listbox.pack(side=left, fill=both) scrollbar.config(command=listbox.yview) mainloop() i try use in code this: import tkinter tk class interface(tk.frame): def __init__(self,den): self.tklist() #in code, tklist not called here. called here minimize code #there stuff in here def tklist(self): scrollbar = tk.scrollbar(den) self.lst1 = tk.listbox(den, selectmode="single", width="100", yscrollcommand=scrollbar.set) in range(1000): self.lst1.insert(end, str(i)) self.lst1.pack(side=left, fill=both) scrollbar.config(command=lst1.yview) den = tk.tk() den.title("search") inter = interface(den) den.mainloop() but when

ruby - Rails 3.2 model constructor with Rails 4 -

my model constructor: 3.2: def initialize(attributes = {}) super # must allow active record initialize! attributes.each |name, value| send("#{name}=", value) end end 4.0.4: activemodel::forbiddenattributeserror how change 3.2 constructor 4.0.4 compatibility? i guess getting error when try create new user user controller? if have code like: class userscontroller < applicationcontroller ... def create @user = user.new(params[:user]) ... end ... end then won't work because can no longer mass assignments in rails 4. instead need whitelist parameters in controller this: class userscontroller < applicationcontroller ... def create @user = user.new(user_params) ... end ... private def user_params params.require(:user).permit(:username, :password, :password_confirmation, :email) # etc. according user model end end having said this, i'm not sure why need constructor

c++ - Access violation reading location using WndClass -

i have 1 problem, using code: bool registerapp(hinstance hinst) { wndclass wc; wc.style = cs_hredraw | cs_vredraw; wc.lpfnwndproc = wndproc; wc.cbclsextra = 0; wc.cbwndextra = 0; wc.hinstance = hinst; wc.hicon = loadicon(null, idi_application); wc.hcursor = loadcursor(null, idc_arrow); wc.hbrbackground = (hbrush)getstockobject(gray_brush); wc.lpszclassname = szclassname; // // return registerclass(&wc); } when i'm trying using &wc , have error: unhandled exception @ 0x763adf81 in lab3.exe: 0xc0000005: access violation reading location 0xcccccccc. please me, need this? you have not initialized of data members of wc. refer http://msdn.microsoft.com/en-us/library/windows/desktop/ms633576(v=vs.85).aspx

c++ - Sharing Rendering Surfaces (FrameBuffers, Pbuffers, etc.) between OpenGL ES 2 Applications/Processes -

i'm designing opengl es 2.0-enabled applications on arm-based, embedded linux system using c++ , want share rendering surface (fbo or renderbuffer generated opengles2 or pbuffer created egl) of app "a" app "b". since i'm beginner opengl es 2 (and, more importantly, since buffers on gpu's memory on have no control nor access) , first thought of mapping shared memory object (e.g. uint8_t array of length width*height*colorcomponentcount , using posix shm_open() etc.) between 2 processes , periodically calling glreadpixels() on app "a" filling uploading in app "b" as, instance, 2d texture. of course, shared synchronization mechanism, such named semaphore, used well, not point of question: i aware downloading buffer gpu (i.e. glreadpixels() in app "a") , uploading (i.e. texture 2d in app "b") not optimal solution sharing rendering surfaces between opengl es applications, why know if there better solution ?

scala - How to determine to use trait to 'with' or class to 'inject'? -

i'm puzzled choose trait or class when writing scala code. at first, have controller with several traits: class mycontroller extends controller transactionsupport jsonconvertersupport loggersupport in these traits, defined methods , fields can used in mycontroller directly. but friend says: when extends or with trait, should be a trait. look @ mycontroller , controller , isn't transactionsupport , not jsonconvertersupport , not loggersupport , should not with them. so code becomes: class mycontroller(transupport: transactionsupport, jsonconverter: jsonconvertersupport, loggersupport: loggersupport) extends controller but don't feel code, seems strange. i see trait s used heavily in scala code, when should use or use classes inject? i'll refer interfaces should adjectives . though traits may play part of class (and, therefore, nouns ,

regex - Regular expression accepts all special characters except space -

i gave validation using regex not allowing special characters. want give space within regex . how this? i have created regex follows not allowing special characters @"^([a-za-z0-9])*" how include space within this? if trying add space set of allowed characters, insert character class. @"^([a-za-z0-9 ])*"

Matlab: N queens (checking 2 table's symmetry) -

i trying make simple script can decide whether 2 chess boards similar or identical or different. have test if same size first (3x3 example) because if not shouldn't run test in first place. have vertical , horizontal flip first board , compare them second board , see if of 2 flips match second board. code have far: function similar = symmetric_queens(b1, b2) %b1 table 1 , b2 table 2 similar= true; h1= flipud(b1); %flipping horizontal axis v1= fliplr(b1); %flipping vertical axis if b1==b2; imshow('the boards identical') %because same end if size(b1)==size(b2) %if of equal size test if horizontal flip= second board h1=b2 imshow('true') else v1=h2 %test if vertical flip = second board imshow('true') else %in these 2 codes trying check make function stop if boards arent same size size(b1)>size(b2) similar = false; return; else size(

java - Extra EFBFBD bytes in Hadoop thriftfs reading -

in hadoop-0.20 have thriftfs contrib, allow access hdfs in other programming language. hadoop provides hdfs.py script demonstration. problem located in do_get , do_put methods. if use get download utf-8 text file, it's totally ok, when get file in other encoding, can not original file, downloaded file has many "efbfbd" bytes. guess these java codes on hadoopthriftserver may cause problems. public string read(thrifthandle tout, long offset, int length) throws thriftioexception { try { = now(); hadoopthrifthandler.log.debug("read: " + tout.id + " offset: " + offset + " length: " + length); fsdatainputstream in = (fsdatainputstream)lookup(tout.id); if (in.getpos() != offset) { in.seek(offset); } byte[] tmp = new byte[length]; int numbytes = in.read(offset, tmp, 0, length); hadoopthrifthandler.log.

javascript - Select Picker plugin Bootstrap dropdown not working on mobiles/tablets -

i have select picker plugin bootstrap ( http://silviomoreto.github.io/bootstrap-select/ ) working on website. each dropdown option link different twitter page so: <select class="selectpicker" data-width="100%" name="venue" id="venue" onchange="location = this.options[this.selectedindex].value;"> <option value="none selected">choose twitter profile</option> <option value="https://twitter.com/lvplshooters">liverpool</option> <option value="https://twitter.com/leedsshooters">leeds</option> <option value="https://twitter.com/mancshooters">manchester</option> </select> $('.selectpicker').selectpicker(); it works 100% on laptops , computers. when use tablet or phone links dont work. has got ideas on why doing this? replace location = this.options[this.selectedindex].value; window.location = this.

javafx - JavaFX8 tree table view custom root row -

in tree-table-view have root item contains child items(i have mistakenly called them root items) in turn have child items. need customize mistakenly called root items rows text appearance. there such selector or how else done? thanks. this set pseudo-class on row containing root: final pseudoclass firstrowclass = pseudoclass.getpseudoclass("first-row"); treetableview.setrowfactory(treetable -> { treetablerow<...> row = new treetablerow<>(); row.treeitemproperty().addlistener((ov, oldtreeitem, newtreeitem) -> row.pseudoclassstatechanged(firstrowclass, newtreeitem == treetable.getroot())); return row ; }); now can select row in css with .tree-table-row-cell:first-row { ... } complete example here it sounds want style immediate child nodes of root node. in case, do row.treeitemproperty().addlistener((ov, oldtreeitem, newtreeitem) -> row.pseudoclassstatechanged(firstrowclass, newtreeit

android - removeAllViews not removing view completely -

i having problem removeallviews() method. can see in pictures, still has 2 textviews empty, still creating empty space in layout makes bad. http://jacho981.hol.es/screenshot_2014-04-22-11-55-12.png as can see in next picture, textviews should disappearing in previous picture, used in one. http://jacho981.hol.es/screenshot_2014-04-22-11-55-19.png everytime press "moto" or "coche" butons, first method called removeallviews() on linearlayout holds views. in theory views created if objects contains in string. in case removeallviews working properly, don't understand why it's creating textviews, in if sentence (the removeallviews() method called before sequence of if sentences next one): // cober_title if (listaseguros .get(j) .getseg_cober_title() != null

How to get Max id From Database using c#? -

cmd = new oledbcommand("select max(substr(tr_refno,9,6))as refid echallan dept='" +tmpdept.tostring() + "' , substr(tr_refno,5,2) ='" + tmpmonth + "'", con); maxid = convert.toint16( cmd.executescalar()); error= invalidcastexception unhandled user code before converting check nullity: var value = cmd.executescalar(); int maxi; if(value !=null) maxid = convert.toint32(value); else //......................

linux - Unix command for searching multiple keywords -

need check in error log on unix server multiple sites, ex. lets there 3 sites abc.com, xyz.com , opq.com. want error log server of these sites lies. i tried tail -99999 /apache/log/error_log| grep 'abc | xyz | opq' but not working.. just use egrep: tail -99999 /apache/log/error_log| egrep '(abc|xyz|opq)'

gwt - How to get GXT Pallette in Eclipse Kepler? -

Image
i trying add gxt palete in eclipse.using ext gwt (gxt) eclipse -kepler app engine 1.9.0 gxt 2.3.1 when right click on module file, couldn't see option google web toolkit > configure using ext gwt i added window builder pro please me gxt palette in eclipse. thanks for kepler there no gwt designer. for gwt designer new gwt designer builds include patch available following update sites: http://dl.google.com/eclipse/inst/d2gwt/latest/3.6 http://dl.google.com/eclipse/inst/d2gwt/latest/3.7 http://dl.google.com/eclipse/inst/d2gwt/latest/4.2 http://dl.google.com/eclipse/inst/d2gwt/latest/4.3 use 4.2 update site url 3.8. kepler use 4.3 note these update site urls use eclipse update manager. not direct download links. also gwt desinger support 2.1.x , 2.2.5 (recommended , latest in 2.x.x series) after adding pulgin , gxt jar right-click on project.gwt.xml file google web toolkit > configure using ext gwt (gxt). add gxt.jar classpath ,

php - How to generate unique request in CURL -

i have 1 script fetch data using curl in multiple request @ same time same url. is there configuration in curl each time sending new request ? because second time when ever tried behave fake request using curl. currently using configuration. $ch = curl_init(); curl_setopt ( $ch, curlopt_url, $url ); curl_setopt ( $ch, curlopt_header, true); curl_setopt ( $ch, curlopt_httpauth, curlauth_any); curl_setopt ( $ch, curlopt_ssl_verifypeer, false); curl_setopt ( $ch, curlopt_returntransfer, true); curl_setopt ( $ch, curlopt_binarytransfer, true); curl_setopt ( $ch, curlopt_timeout, 150); curl_setopt ( $ch, curlopt_followlocation, 1 ); curl_setopt ($ch, curlopt_connecttimeout, 30); $data = curl_exec($ch); curl_close($ch); if 1 have suggestion please me. thanks... if want curl request create new curl object again. $ch1 = curl_init(); $ch2 = curl_init(); ... curl_close($ch1); curl_close($ch2);

java - What is best way to create popup menu like in eclipse on Ctrl+F6? -

i want create popup menu same in eclipse on ctrl + f6 . it should have jscrollbar , list of strings each item has small border. i have idea use jdialog how make not display border , close buttons jlist scroll bar? thank you! the easiest , straightforward way use jpopupmenu class. can add jcomponent jpopupmenu , not jmenuitem s. here's button when clicked, shows jlist in popup without close buttons, scroll bar. wherever popup (the jlist ) loses focus, popup automatically closed. final jbutton b = new jbutton("press me"); b.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { final defaultlistmodel<string> model = new defaultlistmodel<>(); (int = 0; < 100; i++) model.addelement(i + "."); final jlist<string> l = new jlist<>(model); final jpopupmenu pm = new jpopupmenu(); final jscrollpane sp = new jscrollpan

c# - Appcrash while running the windows application after installing the setup -

i have developed windows application in visual studio 2012 , deployed application using installshield. when install application in 32-bit system works fine, while install in 64-bit system, installs fine after installing application not opening throwing , error that, problem signature: problem event name: appcrash application name: sappln.exe fault module name: kernalbase.dll , more goes on.. in configuration manager, have specified release -> cpu can give solutions avoid error? thanks in advance!! seems using libaries can't run on x64 platforms. libaries using? also check if program "special" upon startup. this should keep out. good luck!

select - How to sort by three-characters weekday in MYSQL -

i have mysql table column three-characters weekdays like mon, tue, wed, thu.. now want order select query these weekdays (not alphabetically!). when following line, it's doesn't work: select * table order str_to_date(day, '%a') can give me working query? try below code select * `table` order field(`day`, 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun');

php - regex that matches the text between the tags like p a, br -

i need regex matches text between tags p a, br: albert einstein, division head, princeton member of executive committee of princeton i have pattern (preg_match_all) $pattern="/<\s*a[^>]++>(.*?)<\s*\/\s*a\s*>/" ; but gives me text inside hrefs, any hints? // heres sample source <p> <a href="file.pdf" target="_blank"><b>albert einstein</b></a><br> division head, princeton<br> member of executive committee of princeton<br> </p> using dom parser can values inside tags want : <?php $html='<p> <a href="file.pdf" target="_blank"><b>albert einstein</b></a><br> division head, princeton<br> member of executive committee of princeton<br> </p>'; $dom = new domdocument; $dom->loadhtml($html); echo "[".$dom->getelementsbytagname('p')-&g

python - Adding or remvoing specific rows or columns in an h5py dataset -

once create h5py dataset , how add or remove specific rows or columns nxm array? my question similar this one , don't want blindly truncate or expand array. when removing, need able specify exact row or column remove. for adding, know have specify maxshape=(none, none) when creating initial dataset, resize method doesn't seem let specify rows or columns truncated if shrink size. h5py isn't designed doing this. pandas might better library use, it's built around concept of tables. having said that, here's how it: in [1]: f = h5py.file('test.h5') in [2]: arr = rand(4,4) in [3]: dset = f.create_dataset('foo',data=arr,maxshape=(2000,2000)) in [4]: dset[:] out[4]: array([[ 0.29732874, 0.59310285, 0.61116263, 0.79950116], [ 0.4194363 , 0.4691813 , 0.95648712, 0.56120731], [ 0.76868585, 0.07556214, 0.39854704, 0.73415885], [ 0.0919063 , 0.0420656 , 0.35082375, 0.62565894]]) in [5]: dset[1:-1,:] = d

How do I get node.js zlib gunzip pipe to work? -

i have large .gz file (roughly 100mb in size), however, when process file using following code, outputted file 256k. var fs = require('fs'), zlib = require('zlib'); var inp1 = fs.createreadstream('feed.xml.gz'); var out1 = fs.createwritestream('feed.xml'); inp1.pipe(zlib.creategunzip()).pipe(out1); the problem seems zlib.creategunzip() pipe. is there way fix this? i'm trying stream direct internet preferably.

sql - MySQL check if between multiple criteria with unique identifier -

i have list of events. | table: events | event_id | event_location | event_date | |----------|----------------|------------| | 10 | denver | 2014-02-01 | * | 11 | chicago | 2014-04-01 | * | 12 | denver | 2014-06-01 | | 13 | seattle | 2014-08-01 | * | 14 | chicago | 2014-10-01 | | 15 | denver | 2014-11-01 | * i have list of location access, dated. | table: allowed | allowed_location | date_begin | date_end | |------------------|------------|------------| | denver | 2014-01-01 | 2014-03-01 | | chicago | 2014-03-01 | 2014-05-01 | | seattle | 2014-07-01 | 2014-09-01 | | denver | 2014-10-01 | 2014-12-01 | what want find of event_id have event_date between 1 of respective allowed_location rows (date_begin , date_end). the results first table meet criteria denoted asterisks above. i able results, not seeking, following query: select event.event_id event l

verilog compiler error: near ";": syntax error, unexpected ';' -

i'm trying write traffic light fsm code green, yellow, red has delay of 20 time units. goes green-yellow-red-yellow- green. code , i'm getting error while using 'repeat' delay. errors: error: c:/users/desktop/design/tlights.v(33): near ";": syntax error, unexpected ';' error: c:/users/desktop/design/tlights.v(37): near ";": syntax error, unexpected ';' error: c:/users/desktop/design/tlights.v(44): near ";": syntax error, unexpected ';' `define delay 20; module tlights(clk, rst, y); input clk, rst; output [1:0]y; reg [1:0]y; reg [1:0] cs,ns; integer p; parameter red = 2'd2; parameter orange = 2'd1; parameter green = 2'd0; parameter s0 = 2'd0; parameter s1 = 2'd1; parameter s2 = 2'd2; always@(posedge clk or negedge rst) begin if(!rst) begin cs<=s0; end else cs<=ns; end always@(cs) begin case(cs) s0: begin repeat (`d

php - Simple MySQL query won't work -

i'm trying run simple php script browser won't work. seems connects database can't complete mysql query. anyway query works fine phpmyadmin. seems problem? <?php // db $db_hostname = "localhost"; $db_username = "********"; $db_password = "********"; $db_database = "vladbl0m_eshop"; // create connection $con=mysqli_connect($db_hostname, $db_username, $db_password, $db_database); // check connection if (mysqli_connect_errno($con)) { echo "failed connect mysql:" . mysqli_connect_error(); } else echo "connected " . $db_database; // mysql query // execute query. $result = $link->query("insert oc_test set text ='12345'") or die("error in consult.." . mysqli_error($link)); ?> there no $link defined anywhere... use $con instead of that. replace $link $con , see doing wrong , since mapped connection wrongly , not able see proper errors.

c# - Overriding Equals and type casting -

in following example third evaluation returns false, good, fourth example returns true.. don't quite understand how works however, default object.equals compares 2 references object equality, , seeing a , b both point unique instance of string, should return false, in third example not in fourth. understand why returns true in 2nd example seeing .equals() method overridden in string class, in fourth example we're casting string object. wouldn't call object.equals in case? static void main() { // create 2 equal distinct strings string = new string(new char[] {'h', 'e', 'l', 'l', 'o'}); string b = new string(new char[] {'h', 'e', 'l', 'l', 'o'}); console.writeline (a == b); // returns true console.writeline (a.equals(b)); // returns true // let's see happens same tests // variables of type object object c = a; object d = b; console.write

javascript - How does the bundle order work in browserify? -

i cannot figure out logic how browserify bundles required files. if this require('./one/one.js'); require('./two/two.js'); require('./three/three.js'); the output this (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new error("cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ var app = "app"; console.log(one); },{}],2:[function(require,module,exports){ require('./one/one.js'); require('./two/two.js'); require('./three/three.js'); //require('./three/three_a/three_a.js'); require('./app.js'); },{&qu

php - SSL decryption failed or bad record mac in NGINX Server with cacert.pem set -

i trying connect secure link using curl. i have set following 2 parameters in curl of php page curl_setopt ($ch, curlopt_ssl_verifypeer, true); curl_setopt ($ch, curlopt_cainfo, "/cacert.pem"); but still getting below error :ssl error. after adding pem file in nginx server getting error below in nginx ssl3_get_record:decryption failed or bad record mac the same pem file works on windows wamp server not working in nginx server. please let me know if else missing. basically curl used include list of accepted cas, not accept longer bundles ca certs. default reject ssl certificates unverifiable. you'll have ca's cert , point curl @ it. more details here

event handling - Why is a MenuItem not responding? -

there contextmenu has 2 options , when second option (item2 in code) pressed right mousebutton want print out text know did activate it. till nothing happens when click on second mousebutton. i haven't had experience yet eventhandlers apologies if made noobish mistake. private void maakcontextmenu() { menu = new contextmenu(); menuitem item = new menuitem("kleur assen"); menuitem item2 = new menuitem("tweede optie"); final lissajouscanvas canvas = this; item.setonaction(new eventhandler<actionevent>() { @override public void handle(actionevent event) { new kieskleur(canvas).show(); } }); item2.addeventhandler(mouseevent.mouse_clicked, new eventhandler<mouseevent>(){ @override public void handle(mouseevent t) { system.out.println("in loop"); if(t.getsource()==mousebutton.secondary){ system.out.println("in dee

jsf - Tooltip for h:message is conflicting with the tooltip of the inputfield -

Image
for inputfields have richface tooltip. works fine. when put invalid input in field goes wrong. to customize h:message tooltip if have added there richface tooltip. according following solution: community.jboss.org <h:message id="#{cc.attrs.id}id_tooltip" for="#{inputid}" styleclass="inputfield_error inplace" tooltip="true" showdetail="true" showsummary="true" /> <rich:tooltip id="#{inputid}_err_tt" target="#{cc.attrs.id}id_tooltip" styleclass="tooltip" layout="block"> <rich:message id="#{inputid}_msg_tt" for="#{inputid}" showdetail="true" showsummary="false" styleclass="inp_err_tt" /> </rich:tooltip> the input component: <h:inputtext value="#{cc.attrs.managedbean.formfield(cc.attrs.id).value}" id="#{inputid}"> <a4j:ajax event="c

java - why am i not able to implement a class in a class ,which already extends a class -

this dbinfo class: public class dbinfo stars table static final string stars = "stars"; static final string first_name = "first_name"; static final string last_name = "last_name"; static final string create_star_table = "create table " + stars + "(" + _id + " integer primary key autoincrement, " + first_name + " text not null, " + last_name + " text not null);"; //stars in movies static final string stars_in_movies = "stars_in_movies"; static final string star_id = "star_id"; static final string movie_id = "movie_id"; static final string create_star_in_movie_table = "create table " + stars_in_movies + "(" + star_id + &quo

leiningen - Trouble converting from Clojure application to latest Clojure -

i can't figure out why i'm getting following compile error after upgrading: compiling addr-verify.core exception in thread "main" java.lang.noclassdeffounderror: clojure/lang/ilookuphost, compiling:(core.clj:39:1) @ clojure.lang.compiler$invokeexpr.eval(compiler.java:3463) i using leiningen 2.3.4, , trying upgrade application use clojure 1.5.1 , dependencies. compiled fine old project.clj. want use clojure 1.5.1. i'm confused causing this. these differences between 2 project.clj versions. < (defproject addr-verify "1.0.0-snapshot" > (defproject addr-verify "1.0.1-snapshot" < :dependencies [[org.clojure/clojure "1.2.1"] < [org.clojure/clojure-contrib "1.2.0"] < [clojure-csv/clojure-csv "1.2.4"] < [org.clojure/tools.cli "0.1.0"] < [clj-http "0.1.3"]] < :main addr-verify.core) > :de

javascript - Facebook deleting post -

i'm using faceebok js api, function fb.ui post. whenever click on post no text, post deleted seconds after posted. when enter text, doesn't deleted. function is: function postar(){ fb.ui( { method: 'feed', name: 'x', link: 'x', picture: 'x', caption: 'x', description: 'x' }, function(response) { if (response && response.post_id) { console.log('post published.'); } else { console.log('post not published.'); } } ); does know how can solve it? thanks in advance

java - Determining the element that occurred the most in O(n) time and O(1) space -

let me start off saying not homework question. trying design cache eviction policy depends on entries occurred in cache. in software terms, assume have array different elements , want find element occurred most. example: {1,2,2,5,7,3,2,3} should return 2. since working hardware, naive o(n^2) solution require tremendous hardware overhead. smarter solution of using hash table works software because hash table size can change in hardware, have fixed size hash table, not big, collisions lead wrong decisions. question is, in software, can solve above problem in o(n) time complexity , o(1) space? there can't o(n) time, o(1) space solution, @ least not generic case. as amit points out , solving this, find solution element distinctness problem (determining whether elements of list distinct), has been proven take Θ(n log n) time when not using elements index computer's memory. if use elements index computer's memory, given unbounded range of values, requires @ lea

java - Changing url/ip when asynctask is running repeatedly -

i have call getxmltask service , repeatedly call every 1 seconds data ip address (myip). myservice.java public class myservice extends service { public int onstartcommand(intent intent, int flags, int startid) { if (globalfunctions.isinternetavailable(myservice.this) || globalfunctions.iswifi(myservice.this)) { mytimertask mytask = new mytimertask(); timer mytimer = new timer(); mytimer.schedule(mytask, 1000, 1000); } else { toast.maketext(myservice.this, "no internet connection", 1000).show(); } return service.start_sticky; } class mytimertask extends timertask { public void run() { getxmltask task = new getxmltask(); task.execute(new string[] { myip }); } } } asynctask use in getxmltask.java. public class getxmltask extends asynctask<string, void, string> { @override protected string doinba

html to excel with php. Big numbers converts to exponential -

i'm exporting html table excel php . have problem column big numbers example: 12345678901234567890 excel converts 1.23457e+19 in general format. i want display full number - completely. prepend single quote numbers have length > 10-12. have same problem few part numbers. vba bignumber = "'" & bignumber or php $bignumber = "'" . $bignumber my php rusty, might have escape quote.

Comparing Working and Member Revision in MKS -

i want list of files working revision , member revision different. there command revisioninfo of file (si revisioninfo) working file version not displayed. there command working file version? bottomline: want programatically check if files in project updated, if not show list of files not updated. here nice way list of space separated values name, memberrev , workingrev: si viewsandbox --fields=name,memberrev,workingrev --[no]recurse add additional options command, sandbox-path , filter not see pj-files.

sql server - How to take data from row from an SQL query and show it in column in SSRS -

Image
i have following design view in ssrs: when previewed get: as can see entity name appears twice 'group'. looking if there many entries per entity put them in same row in different column, this: i using table display data. how achieve result looking for? maybe u can use workaround ? first use column named "category". using case function can give new name. after need order by function. example : ,case when database.entityname '%group' 'xx group' when database.entityname '%asx' 'xx asc' end category then use "category" in table , not "entity name". this should make table following example : last name - category - date of last credentialing - credentialing expired same name - xx group - 10/01/2017 - 12/01/2017 same name - xx group - 15/01/2017 - 22/02/2017 same name - xx asc - 12/02/2017 - 05/03/2017 it not make columns in row, grouped if u use order by function

jquery - center large image inside container but keeping aspect ratio -

i'm trying replicate how slider image works on http://www.hmv.com . if shrink down screen size image if zooms out still keeps aspect ratio. understand when shrink screen down. i have container 739px tall , 100% width wise. i have created jsfiddle guys see me code is. //this can add jsfiddle link sizeheaderimg(); but when shrink screen down image doesnt keep nice scale. image size 1920 x 1000 i happy use plugin if there thing point me in right direction code going wrong appreciated thanks you don't need javascript achieve this: img { height: auto; max-width: 100%; } .hero-image { height: 739px; width: 100%; overflow: hidden; position: relative; } .hero-image img { position: absolute; top: 0; bottom: 0; margin: auto; } http://jsfiddle.net/lwj2c/2/

How to handle various view states in Windows 8.1 store app -

Image
i have windows 8.0 code , had handled ui viewstates portrait,landscape, filled , snapped. windows 8.1 viewer can move app size. how handle ui in case. doing this. private void questionpage_sizechanged(object sender, sizechangedeventargs e) { applicationviewstate currentstate = windows.ui.viewmanagement.applicationview.value; if (currentstate.equals(applicationviewstate.snapped)) { visualstatemanager.gotostate(this, "snapped", false); } else if (currentstate.equals(applicationviewstate.fullscreenlandscape)) { visualstatemanager.gotostate(this, "fullscreenlandscape", false); } else if (currentstate.equals(applicationviewstate.filled)) { visualstatemanager.gotostate(this, "filled", false); } else if (currentstate.equals(applicationviewstate.fullscreenportrait)) { visualstatemanager.gotostate(this, "f

ios - Webservice class instance does not persist, unrecognized selecter sent to instance -

i've been looking @ issue having ios app , it's webservice class. seems class gets initialized , assigned instance, when try trigger class starting timer button, seems instance has been removed memory. how initialize (and try instance from) class. + (reflexionsmetawebservice *)getinstance { static reflexionsmetawebservice *instance; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ instance = [[reflexionsmetawebservice alloc] init]; }); return instance; } i've determined button that's calling class working intended cleaning references mentioned in other topics on forum. there maybe cleaner way initialize , maintain our webservice class instance?. hope above information enough. i think assigning instance object gets released memory. don't think have problem webservice class, of it. put log message check class reference , assigned reference before timer kicks in , see problem is.