Posts

Showing posts from August, 2015

Python - How to read a set of images and put it in a matrix? -

i need read set of images in python using , put matrix able preform pca (principle component analysis). images in 1 folder. using numpy , pil : import numpy np import image dirname = '...' [np.asarray(image.open(os.path.join(dirname, fn))) fn in os.listdir(dirname)]

Firefox treating new iframe src as popup from jquery .click() trigger -

i have 2 forms, , trying submit them both @ same time. 1 posting our php framework, , other posting external system (a prestashop install) seems require user "visit" page through normal click submit of form process form. my solution is, fire 1 form after firing other $(document).ready(function() { $('#loginform2').hide(1); $("#loginbutton").click(function() { $("#useremail2").val($("#useremail").val()); $("#userpassword2").val($("#userpassword").val()); $.post( $("#loginform").attr("action"), $("#loginform").serialize(), function(data) { // alert('posted users/login successfully'); $("#submitlogin").click(); } ); return false; }); function refresh() { location.reload(); } }); the #loginform2 form being sent hidden iframe on same page, , ifr

c# - Creating separate admin account -

i using microsoft visual web developer 2010 express (c#) busy creating website project, involves users registering , logging on site. have done part, not sure how can create separate account 1 admin. i created new webform , added new login control, new login control works registered users, not admin (this maybe due membership class). how can create separate account 1 admin?

sorting - checkbox sort in datatable using jquery -

ive been trying sort checkbox field in datatable jquery plugin check , uncheck. im creating input(checkbox) inside datatable followed: '<input type="checkbox" '+ check +' />' check containing text "checked" or "". so far tried add dom-checkbox type of sort, followed: { "ssortdatatype": "dom-checkbox" } when use entire code provided in plugin web , error : uncaught typeerror: cannot read property 'afnsortdata' of undefined inside console. problem : pressing on column header wont sort column checked or unchecked checkbox . suggestions how fix error or way sort using jquery , plugin's methods thanks. edit: tried fixed code, no error.. sorting messed up..its replacing each other not sorting.. example: if have 1 checkbox checked , 9 arent, checked checkbox switching third place sixth , again third , on. what did creatinga bool var in hidden p in sameplace checkbox.than disab

html - SVG is visibly clipped, but I still get scroll bars - Cropping SVG -

if have svg element extends beyond size of svg, scroll bars in browser. want stretch svg control size of visible region , don't want elements partially visible cause scroll bars appear on page. i've distilled down simple example. here's have in body of html document: <svg width="200" height="200"> <defs> <clippath id="clippath"> <rect x="0" y="0" width="200" height="200" /> </clippath> </defs> <g clip-path="url(#clippath)"> <rect x="100" y="50" width="2000" height="50" style="stroke: red; stroke-width: 5; fill: lightblue" /> </g> </svg> as can see svg element defined 200x200 , visibly clipped 200x200. however, when open in browser see scroll bar because rectangle extends out past end of svg element , off page. how rid of

jquery - Passing multiple parameters to a function -

how can pass 2 parameters in function? what i've tried: function loadweek(loader,button){ var button_2 = button + "_2"; alert(button_2); alert(button); alert(loader); } $("#load_week").click(function () { loadweek("#load_weekme","#load_week"); }); alert(loader); working, button "undefined" the button undefined because there not exist element in document id of load_week_2 . double check code. the way you're passing parameters correct, seen success of loader parameter. update: working fiddle: http://jsfiddle.net/sy5jz/1/

generating struts2 taglib using Java6 Annotation Processor with ant -

i have written struts2 taglib , want package them jar. not using maven used use ant apt tag struts-annotations-1.0.5.jar. , task looks following <target name="generate-taglib" > <apt classpathref="tags.classpath" factorypathref="tags.classpath" srcdir="strutstags" compile="false" destdir="dist/apt" fork="true" preprocessdir="bin" verbose="false" source="1.5" encoding="utf-8" factory="org.apache.struts.annotations.taglib.apt.tldannotationprocessorfactory" includeantruntime="false"> <compilerarg value="-atlibversion=1.0" /> <compilerarg value="-ajspversion=2.0" /> <compilerarg value="-ashortname=mb" /> <compilerarg value="-auri=/struts-my-tags" /> <compilerarg value="-adescri

c# - How do I set AppSettings in an ASPX project's Configuration manager -

this aspx/cs project visual studio 2010. configuration manager question. i debugging (sort of) code being used on server. there piece of code plays url in live version should not used in debug/localhost version. protected void page_load(object sender, eventargs e) { if (configurationmanager.appsettings["istesting"] == "false" && request.url.tostring().contains("http:")) { response.redirect(request.url.tostring().replace("http:", "https:")); } loadmastertemplate(); } this piece of code lands on "response.redirect...." line when should not because "istesting" app setting should set true in configurationmanager . how set that? inside <configuration> element in app/web.config file, there should (or should create) <appsettings></appsettings> tag, , individual settings bit this: <appsettings> <add key="

python - How can I make Selenium click through a variable number of "next" buttons? -

i have internal web application has modal dialog. unfortunately cannot post actual web application location here, let me describe best possible. when application starts, box on screen tells bunch of text. can press "next" next page of text. on final page, "next" button disabled, , rest of ui of web application enabled. there variable number of pages, don't know how many times have click "next". i'm able click through fixed number of times (ex: if know there's 2 pages can click twice) unsure how vary it'll run no matter number of pages have. general solution; presumably uses loop of sort check if button enabled. if is, click it. if it's disabled, exit loop. the question is: how can set loop in selenium clicks button repeatedly until disabled? here's code i've tried: from selenium import webdriver selenium.common.exceptions import timeoutexception selenium.webdriver.support.ui import webdriverwait # available sin

jquery - Return the content from textarea with element inside -

i make script extract me within defined element. in exemple it's <u> element. html <textarea cols="75" rows="25" id="textshit"><u>sd</u></textarea><br> <input type="submit" name="submit" id="submit"/> <div id="res"></div> js $(function(){ $('#submit').on('click',function(){ $('textarea:contains("u")').each(function() { //$('#res').html($(this).val()+'<br>'); alert($(this).val()); }) }); }); i when hit submit, in <div class="res"> returns what's inside every <u> . how achieve ? http://jsfiddle.net/warface/ewve8/ $(function () { $('#submit').on('click', function () { var val = $.trim( $('textarea').val() ); var text = $('<div/>').html(val).

codeigniter - Eloquent cannot find Code Igniter Model -

so using eloquent code igniter , getting interesting bugs. class brand_model extends my_model { public function size() { return $this->hasone('size'); } } that line errors when trying load size model: class size extends my_model { public function brand(){ return $this->belongsto('brand'); } } "unable find class size" any ideas? you can try adding autoload part, composer.json file, here: http://snipr.it/~dh then tun php composer.phar dumpautoload, load models specified directories after this, classes should found. other option $this->load->model('brand_model'); $this->load->model('size'); try both, hope helps!

runtime error - Unable to create new instance of marrionette app -

Image
hi have installed latest version of 'marionette-rails' , 'rails-backbone' web app having issues in creating new marrionette instance. this did in web console app = new marionette.application() after see error typeerror: this.listento not function has got versioning of marionette or backbone? how around can create instance of marionette? i realize issue due old version of rails-backbone. did gem update latest version of rails-backbone did job

communication between Stellaris microcontroller and OSX -

i'm trying send sampled data stellaris lm4f120 launchpad ( link ) adc host computer runs osx 10.6.8. first, tried using uart send 4 bytes of data every 1.25 ms, rate @ collect data. read these values via minicom running in command line on osx side , printed text file. tested out correctly sampling signals 1 hz input sine wave , when plotting results, found 1.5 hz sine wave indicated there aliasing occuring. think uart not sending values host enough meant microcontroller wasn't sampling fast wanted to. i tried fixing problem creating bigger data buffer , sending data @ once. problem memory on board can hold 32 kb , need 400 kb without time lags in between. i'm not sure try next. i've heard usb might work, don't know start path. advice on direction take next?. i'm new working microcontrollers, i'm not sure options should considering when improving rate @ can send data.

java - How can I access enclosing class instance variables from inside the anonymous class? -

how access instance variables inside anonymous class's method ? class tester extends jframe { private jbutton button; private jlabel label; //..some more public tester() { function(); // call function } public void function() { runnable r = new runnable() { @override public void run() { // how access button , label here ? } }; new thread(r).start(); } } how access instance variables inside anonymous class's method ? you access them if need be: class tester extends jframe { private jbutton button; private jlabel label; //..some more public tester() { function(); // call function } public void function() { runnable r = new runnable() { @override public void run() { system.out.println("button's text is: " + button.gettext()); } }; new thread(r).start(); } } more imp

asp.net - Performance of SqlParameter in C# -

i have stored procedure this: create proc wsp_test ( @age int , @username varchar(30) ) select userid, username users username '%' + @username + '%' , age > @age and here c# code: case 1: sqlcommand _cmd = new sqlcommand(); _cmd.parameters.add("age", sqldbtype.int, 4); _cmd.parameters.add("username", sqldbtype.varchar, 30); case 2: sqlcommand _cmd = new sqlcommand(); _cmd.parameters.add("age", sqldbtype.int); _cmd.parameters.add("username", sqldbtype.varchar); case 3: sqlcommand _cmd = new sqlcommand(); _cmd.parameters.add("age"); _cmd.parameters.add("username"); case 4: sqlcommand _cmd = new sqlcommand(); _cmd.commandtext = "exec wsp_test 20, 'john'"; now question has got performance specify parameter's datatype or length? which 1 has best performance? there documents microsoft's web site can rely o

android - Best Practice: Defining a large database using SQLiteOpenHelper? -

i have class extends sqliteopenhelper, in have defined database tables , columns created. these strings 1 shown below: public string as_column_a_btn5 = "a_btn5"; i have defined string each create table statement. these tables created in oncreate() method. the problem have on 50 columns, file getting long , unmanageable. what best practice defining large number of columns? write create-database.sql script in file , save /assets folder. use following in sqliteopenhelper : oncreate @override public void oncreate( sqlitedatabase db ) { inputstream in_stream = null; try { in_stream = mcontext.getresources().getassets().open( create_script ); string[] statements = parsesqlfile( in_stream ); ( string statement : statements ) { db.execsql( statement ); } } catch ( ioexception e ) { e.printstacktrace(); } { try { if ( in_stream != null ) { in_stream.close

assignment operator - C++ function returns a rvalue, but that can be assigned a new value? -

the code follows: #include <iostream> using namespace std; class { }; rtbyvalue() { return a(); } void passbyref(a &aref) { // nothing } int main() { aa; rtbyvalue() = aa; // compile without errors passbyref(rtbyvalue()); // compile error return 0; } the g++ compiler gives following error: d.cpp: in function ‘int main()’: d.cpp:19:23: error: invalid initialization of non-const reference of type ‘a&’ rvalue of type ‘a’ d.cpp:12:6: error: in passing argument 1 of ‘void passbyref(a&)’ it says can't pass rvalue argument of non-const reference, i'm confused why can assign rvalue, code shows. passing rvalue rtbyvalue() function expects lvalue reference doesn't work because require lvalue reference argument initialized rvalue. §8.5.3/5 describes how lvalue references can initialized – won't quote in full, says lvalue reference can initialized either lvalue reference or can converte

web applications - IntelliJ, deploying on localhost without restart tomcat -

for special reason, webapp2 must deployed after webapp1. know in intellij, can configure local deployment 2 webapps (2 war files), start in random order , break apps. have manually start tomcat (using command line), go manager page (on localhost) , upload war files. webapp1 stable, of time, have change webapp2 , upload , debug. i'm looking way can set deployment webapp2 directly in intellij without restarting tomcat (the 1 started cmdline, webapp1 running on it). 1 exist? thanks you should configure idea perform deployment , update of both artifacts. use local tomcat configuration. idea has configuration artifacts deployment order.

command line - Bash - how to remove trailing "/bin/java" in commandline? -

i cannot work out, seems command in awk not enough: basically i'd extract information simple linux ls -l: ls -l /etc/alternatives/java lrwxrwxrwx. 1 root root 29 apr 5 12:28 /etc/alternatives/java -> /jre/ibm/jdk6sr10fp1/bin/java i use awk retrieve part: ls /etc/alternatives/java -l | awk -f"->" '{print $2}' /jre/ibm/jdk6sr10fp1/bin/java as need remove trailing /bin/java make valid $java_home, how in bash? all want is: /jre/ibm/jdk6sr10fp1 many in advance suppose assigned value /jre/ibm/jdk6sr10fp1/bin/java java_home using command substitution: java_home=$(ls /etc/alternatives/java -l | awk -f"->" '{print $2}') then can remove trailing part using java_home=${java_home%/bin/java} for more information, see, example section manipulating strings

css - Apply style to element, only if a certain element exists next to it -

i'm using <section> tag on several pages, on 1 page i'm using <aside> tag preceded <section> tag. in case have <section> followed <aside> , apply width both , have section float left, , aside float right. basically, if have <section> , <aside> want style work this: section { width: 500px; float: left; padding: 8px; } aside { padding:8px; width:400px; float:right; } if have <section> want like: section { padding: 8px; } is there way can either conditional statement in css3, or pseudo-class, without having use javascript, custom classes, or separate css files? this works if <section/> comes after <aside/> : <aside>content</aside> <!-- if there node in between, use '~' selector --> <section>content</section> in case use aside ~ section or aside + section : section { padding: 8px; } aside + section { width: 5

ruby - How do you pass an array into a model in a rails seed -

i have pretty simple question: let's trying create new city in city model in db:seed file. i have following code in seeds.rb , want pass in multiple values attribute city's sports teams this: city.create!(city: "chicago,il", teams: ["bulls", "cubs", "bears"]) however, when run console , city.first, following: #<city id: 375, created_at: "2013-04-05 02:55:32", updated_at: "2013-04-05 02:55:32", city: "chicago,il", teams: "---\n- bulls\n- cubs\n- bears\n-"> where weird characters coming in result? why not array intending? have tried number of different approaches none has made work want. how can pass array attribute? you need tell rails serialize attribute first. can adding following code in model class city < activerecord::base serialize :teams, array ...

Pick a random Entry from a database -

i trying code application me run quiz night. i have different databases different categories want able randomly pick out question from, , show on screen. so far have got: if lcat.text = "film" lques.text = film_questiontextbox.text film_usedtextbox.text = "y" filmbindingsource.endedit() filmtableadapter.update(me.database1dataset) end if this picks first question corresponding database, how make random question. in t-sql @ least, can use sql single random row questions table: select top 1 * [questions] order newid() the newid() function generates random uniqueidentifier every row.

java - Compare strings using recursion -

i've got homework assignment can't figure out. have write static method match(string x, string y) returns boolean whether or not string x , string y match. matching process should allow "wild cards" such '@' character match single character , '*' character match 0 or more characters of type. i'm not allowed use loops , have use recursion. i've written far this... public class comparestrings { public static boolean match(string x, string y) { if (x.length() <= 1 && y.length() <= 1) { if (x.equals("*") || y.equals("*")) { return true; } if ((x.length() == 1 && y.length() == 1) && (x.equals("@") || y.equals("@"))) { return true; } return x.equals(y); } string x1 = ""; string x2 = ""; string y1 = ""; string y2 = ""; if (x.length() == 0 &&a

want to load xml url and get the element value from them using javascript -

i have 1 xml url: http://services.gisgraphy.com/geoloc/search?lat=22.3000&lng=70.7833&radius1000 i want load url , <asciiname> element value. store different variable. using javascript if possible.

c# - Issues with creating Excel file and inserting data into sheet -

i'm trying create excel file , insert data excel file. creation of excel file doesnt fail, when try insert data sheet in excel file error: the microsoft office access database engine not find object 'sheet1$'. make sure object exists , spell name , path name correctly. this code: private void exporttoexcel_click(object sender, eventargs e) { string excelpath = environment.getfolderpath(environment.specialfolder.desktop) + @"\trackitexportfile - " + datetime.today.toshortdatestring(); file.exists(excelpath); microsoft.office.interop.excel.application excel = null; microsoft.office.interop.excel._workbook workbook = null; microsoft.office.interop.excel.sheets sheet = null; microsoft.office.interop.excel._worksheet newsheet = null; object misvalue = missing.value; excel = new microsoft.office.interop.excel.application(); excel.visible = tr

java - My BFS recursive call does not stop -

i have following code find paths between starting , ending node . graph.java import java.util.hashmap; import java.util.linkedhashset; import java.util.linkedlist; import java.util.map; import java.util.set; public class graph { private map<string, linkedhashset<string>> map = new hashmap(); public void addedge(string node1, string node2) { linkedhashset<string> adjacent = map.get(node1); if(adjacent==null) { adjacent = new linkedhashset(); map.put(node1, adjacent); } adjacent.add(node2); } public void addtwowayvertex(string node1, string node2) { addedge(node1, node2); addedge(node2, node1); } public boolean isconnected(string node1, string node2) { set adjacent = map.get(node1); if(adjacent==null) { return false; } return adjacent.contains(node2); } public linkedlist<string> adjacentnodes(string last) { linkedhashset<string> adjacent = map.get(last); if(adjacent==nu

jquery - Yii gridview ajax custom button before send updating the cell value -

am facing problem of showing loader.gif beforesend function via ajax in yii gridview in particular related cell value. here gridview. <?php $this->widget('zii.widgets.grid.cgridview', array( 'id'=>'deals-grid', 'dataprovider'=>$model->mersearch(), 'columns'=>array( 'title', 'description', array('header'=>'valid till','name'=>'valid','value'=>$data->valid), array('name' => 'status', 'value'=>array($this,'getstatus'), 'filter' => $active,'sortable'=>true, 'htmloptions'=>array('class'=>'status'), ), array ( 'name'=>'image', 'type'=>'image', 'value'=>array($this,'im

css - last separator in list not showing -

Image
i've got horizontal list following. <ul> <li>credits left : 200 usd</li> <li>items cold : 58</li> <li>system status : online</li> <li>sync details : updated </li> </ul> the css following. #status ul{ height: 100%; width: 100%; padding:0px 0px 0px 0px; margin: 0px; } #status li{ float: left; list-style: none; display: block; padding: 20px 10px 20px 10px; color: #dcdcdc; font-size: 14px; font-family:myriadproreg; background: url(../images/header_li_bg.jpg) no-repeat top left; } but last element not showing separator image. how can fix this. image explain issue. it's not showing last separator because you're using background image on left of menu items (none on right). here 1 way fix using pseudo-elements (ie8+) , absolute positioning. add these styles: #status li { position:relative; } #status li:last-child:after { display:block; content:""; position:abso

c# - Get a color 3D point cloud from depth image and RGB(WPF) -

i done code 3d point cloud using depth. using media3d class. i hope develop program kinect depth image , rgb image , convert color 3d point cloud final year project. i wanted know how can apply ts corresponding rgb points. plus how can put rgb points corresponding triangle?

MIPS: Printing Out a Histogram -

i'm writing mips program (assembly language) takes in 10 integers , prints out histogram represented asterisks. e.g.: user input of 1, 2, 3, 4 output: * ** *** **** i have of code written in mips. problem running printing out correct length of asterisks. of printing out histogram of same length; first user inputed integer. # program functionality: .data menu: .asciiz "\n1. new histogram\n2. print histogram\n3. quit\n" prompt: .asciiz "\nenter 10 numbers between 0 , 50 (inclusive):\n" prompt1: .asciiz "\nenter valid number:\n" asterisk: .asciiz "*" space: .asciiz "\n" array: .word 0:10 .text main: do: jal print_menu li $v0, 5 syscall beq $v0, 1, new beq $v0, 2, print beq $v0, 3, quit j # end new: jal new_user j print: jal print_user j j quit print_menu: la $a0, menu li $v0, 4 syscall

java - Illegal access: this web application instance has been stopped already. Could not load org.apache.log4j.spi.NOPLoggerRepository -

i using netbeans 6.7 tomcat 6.0 , jasper reports generating reports in web application. exception when run application. can please me out? the exception is info: illegal access: web application instance has been stopped already. not load org.apache.log4j.spi.noploggerrepository. eventual following stack trace caused error thrown debugging purposes attempt terminate thread caused illegal access, , has no functional impact. java.lang.illegalstateexception @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1566) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1526) @ org.apache.log4j.logmanager.getloggerrepository(logmanager.java:175) @ org.apache.log4j.logmanager.getlogger(logmanager.java:199) @ org.apache.log4j.logger.getlogger(logger.java:105) @ org.apache.commons.logging.impl.log4jlogger.getlogger(log4jlogger.java:283) @ org.apache.commons.logging.impl.log4j

android - Image Editing with rotate ,zoom and drawing -

i want make image editing app.for able drag,rotate , zoom view placed on image edited.now want implement draw line user want pencil on image.i have googled lot still not want.please me if have idea it.thanks in advance. using code rotate,zoom , drag image: link you have implemented every thing need listen touch events draw , draw lines according touches in canvas using this straight lines and this shaped lines for smooth lines , further refer this

actionscript 3 - Are dispatch events not necessary in Flex/ AS 3.0 -

i creating application, in calling many functions, say, not right way right functions, need dispatch events better results. please can clear me regarding benefits of dispatch events, many websites says "it executes event". the question may feel foolish, answer let me in learning flex in right way. thanks in advance. in general, if find writing code has parent.somefunction() or outerdocument.someotherfunction() , time use events. code makes child component dependent on it's parent. better way have function executed on parent use addeventlistener() on parent class register listener function , call dispatchevent() in child. if writing itemrenderers datagrids or list components, need learn technique.

design - Warm up some variables in C++ -

i have c++ library works on numeric values, values not available @ compile time immediatly available @ runtime , based on machine-related details, in short need values display resolution, number of cpu cores , on. the key points of question are: i can't ask user input values ( both coders/user of lib , final user ) i need warm once application starts, it's 1 time thing this values later used methods , classes the possible solutions are: build data structure data , declare data dummy dummy name of variable used store , contructor/s handle 1 time inizialization related values wrap first solution in method warmup() , putting method right after start main() ( it's simple thing remember , use ) the big problems still unsolved are: the user can declare more 1 data structure since data it's type , there no restrictions throwing 2-4-5-17 variables of same type in c++ the warmup() method can little intrusive in design of other classes, can happen w

ios - How can I use NSNotificationCenter to call a method in a second class? -

i'm trying use nsnotificationcenter call method in second class i'm getting error: second class method(request.m) : -(void)gettherequest:(nsstring *)wheretocall; and i'm trying call nsnotificationcenter this: request *newrequest=[[request alloc]init]; [self performselector:@selector(newrequest.gettherequest:) withobject:@"mysite"]; but i'm getting error in part "newrequest.gettherequest" says "expected expression". of know how can fix or how can use nsnotificationcenter call methods in different classes? try this: [newrequest performselector:@selector(gettherequest:) withobject:@"mysite"]; please note class names should start capital letter , getters should not use prefix apple's coding standards introduction coding guidelines cocoa

check for duplicates before saving record in Access 2010 -

Image
in saving data form, want check duplicate email , password. if email , password in table, prompt message. tried many control event events not fired; nothing happened. maybe code wrong, please , guide me how check duplicate email , password. thanks. it considered practice define validations , constraints @ table level whenever possible. in doing ensure restrictions enforced no matter how data added or updated (e.g., via import, append query, etc.) , don't have remember add validation rule(s) every form build. in case "check duplicate email , password" defining unique index on table. table open in design view click "indexes" button on "design" tab of ribbon... ...and define unique index on [password] , [email] fields:

actionscript 3 - weird behavior of variables in anonymous functions? -

could explain why trace result of code below "5,5,5,5,5" rather "1,2,3,4,5" , how make anonymous function refer collect element in array?( in example, "var item" should referring list[0],[1],[2],[3],[4]). var list:array=[1,2,3,4,5]; var funcs:array=[]; each(var item:int in list){ funcs.push( function(){ trace(item); }); } each(var func:function in funcs){ func(); } trace result: 5,5,5,5,5 this result of 2 things: function-level scope in as3: variable declaration inside for each(var item:int in list) equivalent declaring var item:int @ beginning of function (in example, @ start of code). anonymous functions closures, contain not code specify trace(item) , environment code run in. specifically, each of anonymous functions created code knows should use item variable (declared @ function scope) printing (via trace() ). so, happens item gets assigned elements of list , , retains last value (which 5). exists (does

c++ - CIN to either string or int variable then to overloaded constructor functions -

total newb here, go easy :) i've googled , can't seem find elegant solution this. i'm doing coding learn few concepts. i have class - called 'sally' has constructor overloaded twice i.e. sally.cpp is: #include "sally.h" #include <iostream> #include <string> using namespace std; sally::sally() { } sally::sally(int x) { inputvarint = x; cout << "you have int of value: " << inputvarint << endl; } sally::sally(string y) { inputstring = y; cout << "you have string is: " << inputstring << endl; } in main.cpp if create object sally myobj; , call function via object, i.e. sally.myobj(55) correct constructor firing off , telling me have int of value whatever, or if go sally.myobj("johhny") other constructor going , telling me have string says "johnny", part fine. what know is, there elegant way can use cin take input user, , either pass straight

casting - C++ mixing pointers to different char types -

i writing program in c++ takes act (adobe color table) file , converts plain-text readable jasc-pal file. want read binary data act file , store in memory use. wrote following code , builds using bcc55. problem build warning: "warning w8079 : mixing pointers different 'char' types in function read_file()". unsigned char * memblock; bool read_file() { int filesize; ifstream act ("test.act", ios::binary|ios::ate); if (act.is_open()) { filesize = act.tellg(); act.seekg(0); memblock = new unsigned char [filesize]; act.read(memblock, filesize); act.close(); cout << "color table loaded memory." << endl; return true; } else { cout << "failed open file." << endl; return false; } } looking warning @ embarcadero documentation wiki seems because passing unsigned char pointer function expecting regular char pointer.

To map a database view with no primary key, in hibernate xml mapping -

i have created view used fetching data only(readonly) view : grid_view > hibernate hbm file <hibernate-mapping> <class name="hibernate.domain.view" table="grid_view" mutable="false"> <property name="acct_br_cd" type="string"> <column name="acct_br_cd"/> </property> <property name="acct_no" type="string"> <column name="acct_no"/> </property> <property name="lgl_enty_nm" type="string"> <column name="lgl_enty_nm"/> </property> <property name="cust_ctry_cd" type="string"> <column name="cust_ctry_cd"/> </property> <property name="acct_src_sys_cd" type="string"> <column name=&qu

atmel sensor using printf -

i'm learning embedded system. have atmel uc3-l0 , compass sensor. install atmelstudio , download demo code board. have no idea function "printf" in demo code appear data. how should data? in order use printf in atmel studio should check following things: add , apply standard serial i/o module project->asf wizard. also add usart module asf wizard. include following code snippet before main function. static struct usart_module usart_instance; static void configure_console(void) { struct usart_config usart_conf; usart_get_config_defaults(&usart_conf); usart_conf.mux_setting = edbg_cdc_sercom_mux_setting; usart_conf.pinmux_pad0 = edbg_cdc_sercom_pinmux_pad0; usart_conf.pinmux_pad1 = edbg_cdc_sercom_pinmux_pad1; usart_conf.pinmux_pad2 = edbg_cdc_sercom_pinmux_pad2; usart_conf.pinmux_pad3 = edbg_cdc_sercom_pinmux_pad3; usart_conf.baudrate = 115200; stdio_serial_init(&usart_ins

abap - selecting in 4 tables with conditions -

i need select vbeln likp , have select vbeln has been marked 'c' in vbuk. , likp-vbeln(delivery) have search/select carrier in vekp , after searching carrier have search/select shiptype table. have table 7 fields, in code below im selecting deliveries dont know how add condition in vbuk table because dont need select vbuk. thanks. code below: select likp~vbeln tab~shiptype vekp~carrier vekp~service count( distinct vekp~shipment ) sum( vekp~packagecount ) sum( vekp~rate ) vekp inner join tab on tab~carrier = vekp~carrier inner join likp on vekp~delivery = likp~vbeln itab likp~erdat in so_date , vekp~delivery = likp~vbeln , vekp~carrier = tab~code group vbeln shiptype carrier service. you don't need select table in order join on it, add vbuk join. i notice haven't included clause, needed when use field-list. something like: select likp~vbeln tab~shiptype vekp~carrier vekp~service count(

uiimagepickercontroller - How can I seed the iOS simulator photo albums? -

i've got suite of kif tests our app, 1 part can't work out how cover use uiimagepickercontroller s. can't check camera, i'd write scenario user chooses image library. know there's +[kifteststep stepstochoosephotoinalbum:atrow:column:] , don't know how set there's consistent set of images test choose from. how seed simulator's photo albums? there 2 different ways (one involves programming) populate photo library of ios simulator: open safari in ios simulator, search large sizes images in google, open 1 , display in full size. long press on photo , choose save. repeat several photos fill library. create folder on mac images want populate photo-library with. write small ios application, iterates on directory , creates nsdata objects each photo file. save nsdata object photo-library using the (void)writeimagedatatosavedphotosalbum:(nsdata *)imagedata metadata:(nsdictionary *)metadata completionblock:(alassetslibrarywriteimagecompletion

java - How to get substring from the given string? -

i have read whole xml file single string using class.the output string result=<?xml version="1.0"?><catalog><book id="bk101"><part1><date>fri apr 05 11:46:46 ist 2013</date><author>gambardella, matthew</author><title>xml developer's guide</title><genre>computer</genre><price>44.95</price> <publish_date>2000-10-01</publish_date></part1></book></catalog> now want replace date value.so first want extract date string , replace new value.i have following code, date date=new date() string str=result.substring(result.indexof("<date>")); it displays whole string date tag end tag. how extract date tag , replace it? just value: string str = result.substring(result.indexof("<date>") + "<date>".length(), result.indexof("</date>")); including tags: strin

c# - Can we call Restful WCF Service from SSIS Package -

i have ssis package need call wcf serive exposed rest. possible here link learn how configure ssis package accss wcf service

imageresizer - How to keep color profiles when converting images -

when resize images using imageresizing.net(freeimagedecode) library in output image color profile srgb ignored. how keep color profile srgb when converting? have set ignoreicc=false http://imageshack.us/photo/my-images/59/93596133.png/ the version of freeimage used in freeimagedecoder plugin compiled without metadata/icc support performance reasons (250% performance boost). everything performed in srgb anyway; there shouldn't practical problem unless source files aren't srgb. we're hoping freeimage team allow set flag instead of requiring recompilation. @ moment there's no way support both performance , icc flexibility when using freeimage plugins.

reporting services - Auto Row Number in SSRS Table with Grouped Rows -

i working ssrs 2008. in 1 of report have table 3 columns. sr. no, column 1, column2. sr. no -rownumber("dataset") , other 2 data set columns. have grouped (row group) table on column 1 , column 2. ok sr.no column doesn't show right count shows row number of grouped row e.g 2,4,9,10 on. want keep sr.no or row number after grouping , on top of table want show count of rows in table after grouping. please suggest for distinct numbering of rows can try this: =runningvalue(countdistinct("yourtablename"),count,"yourtablename") if have 1 grouping level in report, group values in sql query , add new column row_number() over(...) numbering rows in sql query already.

html - How can I simply freeze the first row of my table using pure Javascript, no plugins? -

i need table work in latest version of google chrome (so no need worry cross-browser solutions, older versions of ie, etc.) i looking solution freeze first row , not having success. if exclude word relative in css position: fixed relative; header rows stack on top of each other. not sure how header stay @ top of screen when scroll. code table <html> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $( "#status_report .measure[data-bg='1']").css('background', 'red'); $( "#status_report .measure[data-bg='2']").css('background', 'grey'); $( "#status_report .measure[data-bg='3']").css('background', 'yellow'); $( "#status_report .measure[data-bg='4']").css(

starting liferay -

i work on liferay.we use 1 module in our project liferay theme creation. use command ant - ddeploy.war=true deploys in server. war file gets created in liferay deploy folder. when start server not options login. not liferay specific options. following server logs an error occurred @ line: 117 in jsp file: /html/portlet/login/login.jsp com.alepo.hooks.concurrentloginexception cannot resolved type 114: <liferay-ui:error exception="<%= userlockoutexception.class %>" message="this-account-has-been-locked" /> 115: <liferay-ui:error exception="<%= userpasswordexception.class %>" message="please-enter-a-valid-password" /> 116: <liferay-ui:error exception="<%= userscreennameexception.class %>" message="please-enter-a-valid-screen-name" /> 117: <liferay-ui:error exception="<%= com.alepo.hooks.concurrentloginexception.class %>" mes

git - How can always ignore a file while merge -

i have configuration file different in 2 branches. want config file tracked inside each branch ignored when merging branches. so, after merge 2 branches, file remains in each branch same before merging. firstly, need create ours merge driver unless have one. this, run command: git config merge.ours.driver true this driver allow prefer destination branch's version of file during merge session. secondly, let's call branches a , b . on branch a , in directory of file, create file called .gitattributes line in it: myconfig.conf merge=ours then add , commit .gitattributes file. it'll make git keep a 's version of myconfig.conf when merging b a . if need merge a b , repeat same steps b branch.

php - Want to get value of textboxes -

what want is, i have code generates 2 textboxes on button click event througn ajax many time button clicks. on click of submit button how can identify textboxes , getvalue of each textbox. so want give dynamic name each text box.and on form submit want fetch each textbox's value. can this <input type="text" name="fname[]" value="hello" /> <input type="text" name="fname[]" value="world" /> and value on submit <?php if(isset($_post['txtfname[]'])){ echo $_post['txtfname[0]']; } ?> can help? the values in $_post['fname'] -array. meaning: $_post['fname'][0] --> "hello" $_post['fname'][1] --> "world"

c - Understanding container_of macro in the Linux kernel -

when browsing linux kernel, found container_of macro defined follows: #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) i understand container_of do, not understand last sentence, (type *)( (char *)__mptr - offsetof(type,member) );}) if use macro follows: container_of(dev, struct wifi_device, dev); the corresponding part of last sentence be: (struct wifi_device *)( (char *)__mptr - offset(struct wifi_device, dev); which looks doing nothing. please fill void here? your usage example container_of(dev, struct wifi_device, dev); might bit misleading mixing 2 namespaces there. while first dev in example refers name of pointer second dev refers name of structure member. most mix provoking headache. in fact member parameter in quote refers name given member in container structure. taking container example:

c# datagridview differentiate user input from program -

i have c# winform datagridview . the program should able change cells values in datagridview , user should not allowed to. i.e.: how can differentiate whether user or program editing cell in datagridview ? so far found readonly property (e.g. of column). program not able edit column either. i leave column readonly=true , when program wants change cell value, make readonly=false , change value, readonly=true ...but solution seems bad me, if column needs constant update program (e.g. financial price data stream), don't want user change price (even though overwritten program, might or might not happen soon). thanks, imran you mean this? datagridview1.editmode = datagridvieweditmode.editprogrammatically;

java - Using ACE with WT -

update 3 final working code below. need ace.js src folder! not work libs, need pre-packaged version site. wtext *editor = new wtext(root()); editor->settext("function(){\n hello.abc();\n}\n"); editor->setinline(false); the above code can set contents of ace window. myclass::myclass(const wenvironment& env) : wapplication(env) { wapp->require("ace-builds/src/ace.js"); // wcontainerwidget rendered div wcontainerwidget *editor = new wcontainerwidget(root()); editor->resize(500, 500); std::string editor_ref = editor->jsref(); // text string element when executed in js std::string command = editor_ref + ".editor = ace.edit(" + editor_ref + ");" + editor_ref + ".editor.settheme(\"ace/theme/monokai\");" + editor_ref + ".editor.getsession().setmode(\"ace/mode/javascript\");"; editor->dojavascript(command); jsignal <std::string> *jsignal = new jsignal<std::string