Posts

Cutting part of image and saving to file in MATLAB -

lets assume have image 'image.jpg'. want choose part of imrect function, , save new file 'newimg.jpg'. have idea how implement in simple way? thanks. use imcrop function cut out region, , imwrite save separate image.

php - Parsing Json in JQuery get error "ReferenceError: href is not defined" -

when try parse json connection.php , using jquery : <!doctype html> <html> <head> <script type="text/javascript" src="jquery-2.1.1.js"></script> <script type="text/javascript"> $("document").ready(function() { $.getjson('connection.php', { cid: href, format: 'json' }, function(data) { $.each(data, function(index, element) { /* mengisikan table dari hasil json */ $('#tabledata').find('tbody') .append($('<tr>') .append( '<td>' + data.sys + '</td>' + '<td>' + element.procid + '</td>' ) ); }); }); }); </script> </head> </html>...

java - Why does importing JFrame require inheritance but FlowLayout, JLabel, etc not? -

i started learning guis , watching tutorial "thenewboston" wrote this. don't understand why jframe import that's inherited? i'm not sure if 1 of cases has because java give error otherwise. import java.awt.flowlayout; import javax.swing.jframe; import javax.swing.jlabel; public class tuna extends jframe { private jlabel item1; public tuna(){ super("the title bar"); setlayout(new flowlayout()); item1 = new jlabel("this sentence."); item1.settooltiptext("this gonna show on hover"); add(item1); } } jframe not require inheritance. in fact should not use inheritance. look @ framedemo.java code swing tutorial on how make frames better design. also, java class names should start upper case character. stick swing tutorials instead of current tutorials looking at.

Receiving data from php curl to another php file -

i trying send data 1 php file on webserver webserver using curl, unsure how access data sent second webserver work. able access data before using $_post array curl being used send data no longer able use reason. can point me in right direction on how access data? function post_to_url($url, $data) { $fields = ''; foreach($data $key => $value) { $fields .= $key . '=' . $value . '&'; } rtrim($fields, '&'); //dl: ugh. $post = curl_init(); curl_setopt($post, curlopt_url, $url); curl_setopt($post, curlopt_post, count($data)); curl_setopt($post, curlopt_postfields, $fields); curl_setopt($post, curlopt_returntransfer, 1); $result = curl_exec($post); curl_close($post); } that code using curl post itself, here receiving end $username = $_post['email']; if using curl make sure post: curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $array());

java - Why does my program print out the exception statement endlessly give bad user input? -

ive no idea if title made sense here code © import java.util.inputmismatchexception; import java.util.scanner; public class gussing { public static void thegame(scanner input){ int randomnum= (int)(math.random()*101);//randomizes number between 0-100 inclusive of both system.out.println(randomnum); //for debugging purposes int attemptcounter = 0; //counts how many attempts user make system.out.print("welcome guess-the number game! enter guess: "); while(true){ system.out.println("here bad input"); try{ system.out.println("here after bad input"); int userinput= input.nextint(); if (userinput==randomnum) //when usr input , generated random number equal print how many attempts { attemptcounter++; system.out.println("congrats made right guess after "+ attemptcounter + "...

c# - Entity Framework: Server did not respond within the specified time out interval -

Image
i trying access remote oracle database using vpn connection. using oracle sql developer tool able connect database. when use ado.net model , devart dotconnect oracle, gives me error server did not respond in specified timeout interval. any 1 has face issue? update: increases timeout 60s default 15s. getting error: ora-12154: tns:could not resolve connect identifier specified 1st issue quiet common server did not respond in defined time, increasing connection time should trick. append ;connection timeout = 60; (here time in seconds) connection string. 2nd after update looks tns not resolved properly: can check: do tnsping (db name in tns ora file). see should not error , connection should ok. if problem still persist check oracle home in registry have correct path in case have multiple client.

visual c++ - Creating a new "internal" process? -

i'm writing dll (in visual c++) , decided need move stuff happens in threads own process. because want support multiple instances of dll being loaded , running. however, need access same group of resources (i/o buffers com port) needs autonomously monitored long there @ least 1 instance of dll running. it seems need use createprocess(), i'm unclear on how should use lpapplicationname argument. in examples i've seen, name of existing program gets passed, isn't imagine need do. expected able start process specifying function, createthread(). process doesn't need compiled , output own executable, it? shouldn't used other dll. thanks. edit: okay, if createprocess() can start pre-existing program, how can work? if following happens: process loads dll dll starts port monitoring threads second process loads dll second dll establishes ipc access same data first dll first dll exit, , terminates monitoring threads second dll starts own monitoring threads ,...