Posts

Showing posts from September, 2011

javascript - IONIC2 - Syntax Error when ionic serve -

i don't know did wrong, says syntax error codes copy pasted official ionic2 docs. syntaxerror: d:/manson/arts/ionic/ionictodo2/app/pages/list/list.js : unexpected token (14:23) while parsing file: d:\manson\arts\ionic\ionictodo2\app\pages\list\list.js for full code click here . constructor(nav: navcontroller) { it looks you're using types typescript, while code in plain javascript file (.js). nav: navcontroller declares nav of type navcontroller . when run ionic serve , ionic runs webpack compile , package code. since not valid js syntax, fails. ionic 2 based on angular 2 , written in typescript . while angular 2 can used plain javascript, undocumented, , recommend using typescript when developing angular 2 applications. when create new ionic 2 project, should use --ts flag if want project in typescript. command should be: ionic start myionic2project --v2 --ts after that, copy-pasting ionic 2 tutorials should work you.

angular - Parent variable not working inside of ng-content -

intro: i'm working on ng2 components structure looks this: <cards> <card> <card-content-type-1 (state)="cardstate"></card-content-type-1> </card> <card> <card-content-type-2 (state)="cardstate"></card-content-type-2> </card> <card> <card-content-type-3 (state)="cardstate"></card-content-type-3> </card> ... </cards> and i'm changing states of each <card> based on click/mouseenter/mouseleave events, , when action happen inside of <card> component (parent component), based on current state, i'd trigger animation methods inside <card-content-type-n> components (children component). sequence of animations i'll use animationbuilder , elementref . issue: decided pass parent component variable children component, , implement ngonchanges() inside of children, trigger specific animation depends of current

c# - Why am I getting ArgumentException? -

this code: t = environment.getenvironmentvariable("userprofile")+"\\documents"; string[] txtfiles = directory.getfiles(t, "*.txt",searchoption.alldirectories); var textfiles = txtfiles.selectmany(x => directory.getfiles(t, x)); i want text files documents directory , subdirectories. before did changes code was: string[] txtfiles = directory.getfiles(t, "*.txt",searchoption.alldirectories); and worked. but did changes since want later directory size , other stuff. problem on line: var textfiles = txtfiles.selectmany(x => directory.getfiles(t, x)); i'm getting exception: second path fragment must not drive or unc name the variable t contain: c:\users\bout0_000\documents variable x contain: c:\users\bout0_000\documents\3dmark\3dmarkerror.txt so why before worked , after changes did in code i'm getting exception ? you seem trying list of files using directory.getfiles on filename not directory path i

Assist in Cleaning a MySQL Join Query to Find Changes Between Rows -

table size ~500,000 rows, 137mb, query time 1.591 sec i junior programmer testing mettle on our mysql based otrs ticket database. i'm looking instances in ticket moves between queues. indicator move exists on same row new queue, , have setup query attempts return previous value of same column in same ticket id. example of ticket in table: id history_type_id ticket_id queue_id create_time 377 1 30 2 2012-09-14 11:06:02 378 21 30 2 2012-09-14 11:06:02 379 12 30 2 2012-09-14 11:06:02 380 4 30 2 2012-09-14 11:06:02 381 16 30 8 2012-09-14 11:08:29 383 16 30 2 2012-09-14 11:09:54 384 17 30 2 2012-09-14 11:11:28 *** stuff happens *** 396 27 30

jbpm - query all unassigned tasks -

i'm using jbpm 6.2 , i'm trying query tasks have not been assigned yet. taskservice doesn't seem (or @ least have not found proper method). how can done? i did using bamtasksummary table, not sure if way it. to first tried bamtaskeventlistener @ runtimemanager (so started recording table): defaultregisterableitemsfactory registerableitemsfactory = new defaultregisterableitemsfactory(); registerableitemsfactory.addtasklistener(bamtaskeventlistener.class); emf = persistence.createentitymanagerfactory("org.jbpm.persistence.jpa"); runtimeenvironmentbuilder builder = runtimeenvironmentbuilder.factory.get() .newdefaultbuilder().entitymanagerfactory(emf).registerableitemsfactory(registerableitemsfactory) .knowledgebase(kbase); with code had problem, bamtaskeventlistener didnt have empty constructor in jbpm 6.2 , there problem in instantiation...i extended add empty constructor , worked fine: public class bamtaskeventlistenerext exte

Make jpeg canvas animation "responsive" -

improve html5 canvas frame frame jpg animation cache before animating the above code snippet great. i'd able apply new widths css/media queries canvas holds jpgs. there way add above code? when tried jpg's became wildly oversized. it appears in above code height , width declared in js image , height , width on canvas tag need match or things wonky. i want dynamically call image width css , media queries. thanks <style type="text/css"> /*css full screen animation.you may want remove this*/ html,body { height:100%; width:100%; padding:0; margin:0; } /*id canvas jpg animation - sets size, background image , loader*/ #anim { background-image:url('images/icon_loading_75x75.gif'),url('images/t5.png'); /*center=loading gif, left top= placeholder image*/ background-position: center, left top; background-repeat: no-repeat; height:500px; width:660px; } </style> <script type="text/javascript"> function draw() { v

php - keep query outside of "VIEW" in codeigniter -

i quite new codeigniter.i in situation have 2 table , have 1 many relationship between them.the schema following.one employee table , other table vacation application employee(id,name), application(id,start_date,end_date,reason,user_id), plan display application in single page showing start_date,end_date,reason , name .for querying application table have admin controller admin can query application table.and there usercontroller data employee table.in admin model have following query applications class adminmodel extends ci_model{ public function fetchallrequest(){ $q=$this->db->get('application'); if($q->num_rows()){ return $q->result_array(); }else{ return false; } } admin controller following : class admin extends ci_controller{ public function index(){ $this->load->model('adminmodel'); $data['request']=$this->adminmodel->fetchallrequest(

api - Base64 Authentication Python -

i'm following api , need use base64 authentication of user id , password. 'user id , password need both concatenated , base64 encoded' it shows example 'userid:password' it proceeds 'provide encoded value in "authorization header"' 'for example: authorization: basic {base64-encoded value} ' how write python api request? z = requests.post(url, data=zdata ) thanks you can encode data , make request doing following: import requests, base64 usrpass = "userid:password" b64val = base64.b64encode(usrpass) r=requests.post(api_url, headers={"authorization": "basic %s" % b64val}, data=payload) i'm not sure if you've add "basic" word in authorization field or not. if provide api link, it'd more clear.

xml - Are elements with mismatched prefixes allowed? -

the "common syntatic constructs" section of xml 1.0 recommendation contains following note: the namespaces in xml recommendation assigns meaning names containing colon characters. therefore, authors should not use colon in xml names except namespace purposes, xml processors must accept colon name character. this means following invalid xml: <xhtml:span xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml"> <xhtml:a>anchor text</html:a> </xhtml:span> however, the "qualified names" section of namespaces in xml recommendation contains statement: note prefix functions placeholder namespace name. applications should use namespace name, not prefix , in constructing names scope extends beyond containing document. this leads ambiguity. when happens, xml recommendation have precedence, rendering above document invalid, or should namespace-aware xml proce

High & Low Numbers From A String (Ruby) -

good evening, i'm trying solve problem on codewars: in little assignment given string of space separated numbers, , have return highest , lowest number. example: high_and_low("1 2 3 4 5") # return "5 1" high_and_low("1 2 -3 4 5") # return "5 -3" high_and_low("1 9 3 4 -5") # return "9 -5" notes: all numbers valid int32, no need validate them. there @ least 1 number in input string. output string must 2 numbers separated single space, , highest number first. i came following solution cannot figure out why method returning "542" , not "-214 542". tried using #at, #shift , #pop, same result. is there missing? hope can point me in right direction. understand why happening. def high_and_low(numbers) numberarray = numbers.split(/\s/).map(&:to_i).sort numberarray[-1] numberarray[0] end high_and_low("4 5 29 54 4 0 -214 542 -64 1 -3 6 -6") edit i tried , rec

virtual machine - Any good "training" or even "reference" books on kvm/libvirt? -

does know training or reference books on kvm/libvirt? kvm , virtualization rather specialized topic, don't expect find information them. there is, however, quite detailed documentation of kvm api in kernel source tree. can find here . furthermore, this article can serve getting started guide on linux kvm api. yet source of knowledge actual source code vmms rely on kvm, qemu . particularly, have @ i386 target implementation .

Adding event to native calendar in react-native iOS is not working -

i trying add event react-native ios app native calendar. not show event. for else coming question using react native calendar events module , there's an issue if don't specify end date when creating event won't work. if specify enddate in call saveevent , e.g.: rncalendarevents.saveevent('title', { location: 'location', notes: 'notes', startdate: '2016-10-01t09:45:00.000utc', enddate: '2016-10-01t10:45:00.000utc' } then event should created.

javascript - CSS Parallax - image 'splitting' and showing incorrectly -

Image
this relates following site: http://www.sandbox.sharonblance.com/ i have issue parallax images showing 'split'. refer sample image. have advice on how resolve issue? i'm not sure begin track down. please note theme purchased, author has not been forthcoming assistance. love theme otherwise, long can resolve issue! browser info: seeing problem on chrome on windows 7 , windows 8, in firefox (v22) , chrome (28.0.1500.95) , ie 10. okay when page first loads, if refresh screws up? the scrolling quite jerky , not smooth? i have same problem said, , found solution fix that, should using image height more b

SQL query returning same value for both tables colums -

select (count(v1.id) * 2) + (count(v2.id) * 0.5) total, count(v1.id) votes, count(v2.id) visits votes v1, visits v2 ; actually query results in 1710 votes , visits votes has 18 rows , visits 98... know why? , has solution? the correct return values be: total of 85 18 votes 98 visits current structure: http://sqlfiddle.com/#!2/b7604/1 try, select sum(visitscount) + sum(votescount) total, sum(visitscount) visits, sum(votescount) votes ( select count(id) votescount, 0 visitscount, 1 gr votes union select 0 votescount, count(id) visitscount, 1 gr visits ) t group gr check sql fiddle

markdown - Pygments styling for HTML, PHP, and JavaScript -

i using github's api convert github flavored markdown html. html has bunch of classes can used styling different code blocks (html, javascript, php, bunch of languages). after doing research, think pygments need proper styling code blocks can have syntax highlighting, having trouble finding stylesheets. know how use pygments syntax styling html, php, , javascript? thanks! here's great starting place, repository of sample pygments stylesheets: https://github.com/richleland/pygments-css thanks @richleland, whoever are

WSImport WSDL artifacts in same package -

i have wsdl has 3 schemas schema 1, schema 2 , schema 3 . schema 1 - target_namespace_1 schema 2 - target_namespace_2 schema 3 - target_namespace_3 when run wsimport in cmd line on wsdl file , creates java artifacts in folders namely target_namespace_1, target_namespace_2,target_namespace_3. this wsdl used in project , artifacts appear in single package. i have tried using options in wsimport.exe still not able generate packages in single package. advise in regard helpful assumed below wsdl includes multiple xsds different namespaces calling wsimport way: wsimport.exe -d c:/temp/generatedclasses -s c:/temp/sourcefiles c:/temp/mywsdl.wsdl will give package structure described in question (e.g. own package per namespace) you can use parameter -p way: wsimport.exe -d c:/temp/generatedclasses -s c:/temp/sourcefiles -p blob.der.bob c:/temp/mywsdl.wsdl and output resides in same package (your .java files reside in c:/temp/sourcefiles/blob/der/bob)

node.js - parent process kills child process, even though detached is set to true -

i confused , have been struggling find solution months. on osx. i hear using child_process.spawn detached option set true, start child process leader of new process group , if parent exits, child process may continue running. however, never witnessed evidence of this. https://nodejs.org/api/child_process.html for example: const n = cp.spawn('node', ['watch-transpile.js'], { detached: true, stdio: ['ignore'] }); the above executed parent, , if run $ ps aux | grep node we get: olegzandr 2546 0.0 0.2 3048544 19564 ?? ss 11:29pm 0:00.09 node lib/transpile/watch-transpile.js olegzandr 2541 0.0 0.7 3115684 60216 s000 s+ 11:29pm 0:01.47 node index -t -a -w but when kill parent control-c, child process dies parent. how can create background process independent of parent process node? killing me! try including child.unref() method. by default, parent wait detached child exit. prevent pare

Android <include layout inside NestedScrollView -

Image
i have coordinatorlayout nestedscrollview. trying include layout inside nestedscrollview however, layout assumes can overlap collaping toolbar. have searched on , not find solution problem. tried including fragment directly instead of layout. failed too. tried including simple textview inside nestedscrollview - worked. problem in include. please me solve it. doesn't work <android.support.v4.widget.nestedscrollview android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <include layout="@layout/content_detail"/> </android.support.v4.widget.nestedscrollview> does work <android.support.v4.widget.nestedscrollview android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_

ios - How do I make a subview of a UIScrollView remain stationary -

i have uiscrollview views in , want make 1 of them stay in same place. how can that? right have scroll view can have anywhere 1 30 or more views on it, , want 1 of them remain @ top of scroll view. thanks if set view controller scroll view's delegate, can implement - (void)scrollviewdidscroll:(uiscrollview *)scrollview , in method, can change coordinates of scrollview's subviews make 1 of them stationary.

ios - How to tell height of a sprite after zrotation? -

Image
i have sprite this: let sprite = skspritenode(imagenamed: "sprite.png") print("sprite height: \(sprite.size.height)") //results 150 sprite.zrotation = 90 * degreestoradians //turns sprite 90 degrees results this: however: print("sprite height: \(sprite.size.height)") //results 150 sprite height still 150 though takes far less space height-wise. is there way actual height of sprite after zrotating it? know work around in example above real problem have various sprites @ various zrotations , i'm trying make sure of them visible on screen. so have sprite (red bar), anchor point @ 0,0 (blue dot) , visible screen (black frame). i zrotate sprites random angles using arc4random_uniform sprites end not being visible on screen. have know height of green arrow or assign anchorpoint after zrotation. or perhaps there other ways have not thought of. appreciated! 0x141e's comment works. sprite.frame.size.height resul

dmarc - Reply-to ignored in emails sent on behalf of user on other domains -

we offer function send article email friend's personal email. friend able continue conversation replying email. to avoid yahoo, hotmail, etc. flag emails spam due dmarc policies violation, follow this recommeandation . so our header looks this: from: "john doe via example website" <service@website.example.com> reply-to: "john doe" <john@firstmailboxprovider.com> to: "bob smith" <bob@secondmailboxprovider.com> subject: "an article thought find interesting" unfortunately, many (lots) of email clients skip reply-to parameter. so, many people responding instead of friend. what recommendation? notes: respect of reply-to header seems client dependent (not destination domain dependent). many solutions unfortunately no more bulletproof in 2016: potential issues using member's “from” address , “sender” header can't include friend's email in body? way user can click on reply. perhaps send

loops - Vb.Net Wait for Async Response -

i working on windows form application controls number of stepper motors in turn drive camera. stepper motors controlled through arduino acting serial port. in app, arduino receives absolute position commands (e.g. x;23,y;90,z;120) , moves various motors respective commands, whilst motors moving arduino outputs current position, @ end have output x;ok,y;ok,z;ok response. as motor positions received arduino, these updated within application on status view, within code need loop below (pseudocode); for = lowerlimit upperlimit step intervalstep com1.writeline("x;" & x ",y;" & y & ",z;" & i) 'wait ok response serial port 'capture image next how go pausing loop (thread) until receive ok response serial port? many thanks!

rest - How to get swagger json separately? -

i try generate swagger.json java rest endpoints. pom <dependency> <groupid>io.swagger</groupid> <artifactid>swagger-jaxrs</artifactid> <version>1.5.9</version> </dependency> applicationpath import javax.ws.rs.applicationpath; @applicationpath("/rest") public class restapplication extends application { public restapplication() { beanconfig beanconfig = new beanconfig(); //beanconfig.setversion("1.0"); beanconfig.setschemes(new string[] { "http" }); beanconfig.settitle("my api"); beanconfig.setbasepath("/rest"); beanconfig.setresourcepackage("com.test.rest"); beanconfig.setscan(true); } @override public set<class<?>> getclasses() { hashset<class<?>> set = new hashset<class<?>>(); set.add(com.test.addre

javascript - Implement a logical part as Generic one in AngularsJs -

i have started working on angularjs in encountered case need guidance go through. implementing message section in application( asp net mvc - angularjs ).currently have implemented message section specific module under particular ng-app , under particular ng-controller . need same functionality used inside module. it's duplicating same code again ng-app under ng-controller not approach. wanted , plug , play kind of approach angularj s code. i have used 2 service,1 directive under particular ng-app , functions inside particular controller. want make these 1 common code , used inside under ng-app , ng-controller. is possible? if how can achieve. let me know if query unclear you said used 2 service, 1 directive, , controller etc messaging feature. if want re-use across various applications, need bundle of module. example: angular.module('custommessaging', []) .controller('messagingctrl', function(messenger, messagemanager) { .... }) .dir

oauth 2.0 - Connection refused in wso2 playground2 sample -

i doing playground2 sample of wso2 post . generating access token having problem when accessing userinfo. it's saying connection refused . using wso2is-5.0.0 thank you you can use below curl command call userinfo endpoint , if need more details can use url . curl -k -h "authorization: bearer <paste_access_token>" https://localhost:9443/oauth2/userinfo?schema=openid plus need adding claims in oauth service provider side , more details in offcial wso2 document .

python - import modules that come with anaconda when running jupyter notebook within tensorflow virtualenv -

i'm new tensorflow. have installed tensorflow in anaconda on ubuntu linux running on vmware on laptop. in tensorflow virtualenv, installed , launched jupyter notebook. question how can import python modules in anaconda when i'm running jupyter notebook tensorflow virtual environment? got import errors. when launch jupyter notebook in normal mode, seems ok. below steps followed install tensorflow in anaconda: 1. conda create -n tensorflow3 python=3.5 2. wget https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0rc0-cp34-cp34m-linux_x86_64.whl 3. mv tensorflow-0.8.0rc0-cp34-cp34m-linux_x86_64.whl tensorflow-0.8.0rc0-py3-none-linux_x86_64.whl 4. source activate tensorflow 5. pip install --ignore-installed --upgrade tensorflow-0.8.0rc0-py3-none-linux_x86_64.whl 6. conda install ipython 7. conda install jupyter now launched jupyter notebook virtual environment. when tried import matplotlib, scipy or sklearn, got error messages like: no module named xxxx

android - Jenkins SVN checkout ownership -

Image
i checking out svn repository jenkins workspace. here checked out repository directories if @ below image, hidden directory (.gradle) , it's subdirectories having root owner failing jenkins build. error: .gradle/2.10/taskartifacts/cache.properties.lock (permission denied) since .gradle folder doesn't have permission jenkins user. svn jenkin plugin version (2.5.7) how overcome this? this why checkout project correct user (jenkins) , run jenkins build root user. can resolve running jenkins under jenkins user, or have checkout project root user. try in post: run jenkins under different user

middleware - Check if queue is empty using esql -

i writing code clear messages in queue. using compute , node purpose. want loop through messages while clearing each message , want loop stop when queue empty. please give me suggestions achieving this the mqget node has no message output terminal, process routes in case there no message on queue. so achieve goal connecting out terminal of mqget in terminal of compute node, , no message terminal of mqget nothing or other compute if want more after getting messages.

jquery - how to define global namespace in javascript -

is there way define global namespace, can call function namespace page? e.g // in 1 file define below code definenamespace("my.namespace.api", { addobject: function(obj) { // store obj indexdb }, readallobject: function() { // return array of object indexdb } }) // in javascript file can do my.namespace.api.addobject({name: "foo", desc: "bar"}); is there way implement "definenamespace" method? thanks one way it, simple, this: my = { namespace: { api : {} } } my.namespace.api.addobject = function (obj) { } you're creating objects in way function namespace :) hm it's not method you're implementing. building namespace method require function called before script files loaded namespace used that, otherwise lines of code called before definenamespace method called , run parts of namespaces undefined @ point. above solution won't case, although not dynamic

Bulit in Exceptions available in java -

i reading exception handling in java. found there severaly types of exception classes in java. wanted know what exact number of exception (built-in) class available in java .i using java 7. looks 439 . goto: https://docs.oracle.com/javase/7/docs/api/allclasses-noframe.html and find exception

c++ - How to load a second .qml file in BB 10 cascade -

what want is, button (in one.qml ) click load separate .cpp file ( second.cpp ) , in .cpp file, call second.qml file. how can using bb10 c++ coding. not using qml coding. have done qml coding not want. if compare android development, 1 activity call second activity has separate .xml file. that's exact thing want test here in bb10. to load new qml document c++, have use that: bb::cascades::qmldocument *qml = bb::cascades::qmldocument::create("asset:///yoursecondfile.qml"); // can define properties page qml->setcontextproperty("_propertyname", yourobject); bb::cascades::page *secondpage = qml->createrootobject(); see qmldocument documentation complete explanation of can document. so, now, have page (or other component). you'll need push it, example, on navigationpane . can way: // create button bb::cascades::actionitem* backaction = bb::cascades::actionitem::create() .title(tr("previous page")) .imagesource

oop - What is adding methods to a class instead of "properly" subclassing called? -

take simple example in python : >>> class a(object): ... pass ... >>> def f(self): ... print "f called" ... >>> a.f = f >>> = a() >>> a.f() f called so in example, existing class a gets additional (instance) function f (though overriding existing ones works well). in real life of course happen e.g. in different modules. how procedure called? not sure following you, if do, talking extension methods

oracle - JAVA SQL command not properly ended -

i have code: buy.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent actionevent) { int r; r = table.getselectedrow(); string num = (string) table.getvalueat(r, 0);//numele jucariei //string cop = (string) table.getvalueat(r, 3);//nr de bucati try { pq = stmt.executequery("select *" + "from buyid_view"); xv = stmt.executequery("select toyid, copies " + "from alldatas_view" + "where toyname ='"+num+"'"); int buyid = pq.getint("buyid"); int toyid = xv.getint("toyid"); int copies = xv.getint("copies"); copies = copies-1; callablestatement cstmt = con.preparecall("insert buy (buyid, toyid)" + "values (?,?)"); cstmt.setint("buyid", buyid); cstmt.setint(&q

web - I have one million of small machines which can do small request to the Internet. What kind of service should I do with these? -

website testing? stress testing? calculation? cloud service? legitimate service, not ddos. ideas appreciated. thank you! **edited ** the machines don't have memory , storage. can send post/get/... request. they not necessary send request internet. thinking making request , response on internet may idea, ideas of local service welcomed too. are machines have send requests online or can send post requests?

python - How to create objects for a class automatically? -

is there way auto create objects in python class a: pass = a() i automatically create objects class. need parse bunch of xml , i'd create object 1 file (entry parse). or need create random names? you don't have manually assign variable names object instances, store them in list when create them dynamically, in example list of objects gets created information file: class a: def __init__(self, words): self.words = words a_objects = [] file = open("testfile.txt") line in file: words = line.split() a_objects.append(a(words)) if need access objects directly using key, have use dictionary instead of list: a_objects = {} you can add key-value pairs this: words = line.split() key = words[0] a_objects[key] = a(words)

javascript - Save edited data in ckeditor to html file -

i using ajax success function load content of html file ckeditor function gettextinfo(fileurl) { $.ajax({ url: fileurl, success: function (data){ document.getelementbyid("myform").value = data; } }); } and script call gettextinfo() <script type="text/javascript"> $(document).ready(function(){ gettextinfo(filepath); }); </script> and script load ckeditor <script type="text/javascript"> ckeditor.replace( 'myform', { fullpage: true, allowedcontent: true, extraplugins: 'wysiwygarea' }) </script> i need way save edited data editor html file. help. you can use blob that. note used template string multi line string, other es5. var somehtml = ` <html> <head> <title>some html</title> <

jquery - A little confusion over Sign up process in PHP -

i new php trying things differently make selft more proficient. here trying save data on database couldn't bale data's not saving in datbase during signup. here code. <?php $connection=mysqli_connect("localhost","root",""); $connection=mysqli_select_db("cinderella"); or die(mysqli_error($connection)); ?> <?php include('config.php'); if(isset($_post['action'])) { if($_post['action']=="signup") { $name = mysqli_real_escape_string($connection,$_post['name']); $email = mysqli_real_escape_string($connection,$_post['email']); $password = mysqli_real_escape_string($connection,$_post['password']); $phone = mysqli_real_escape_string($connection,$_post['phone']); $country = mysqli_real_escape_string($connection,$_post['country']); $city = mysqli_real_escape_string($connection,$_pos

php - Why I can't translated message with id in Symfony 3 -

i newbie symfony. trying translate message languages. can message 'syfony great'. want id id='hello_message'. my index.twig @ below {% block body %} <p>{{'hello_message'|trans}}</p> {% endblock %} my xliff file @ below <?xml version="1.0"?> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> <file source-language="en" target-language="en" datatype="plaintext" original="file.ext"> <body> <trans-unit id="hello_message"> <source>hello.message</source> <target>symfony harika!</target> </trans-unit> </body> </file> and default controller call twig public function indexaction(request $request) { return $this->render('default/index.html.twig'); } it's source translated, not id: {% block

mysql - PHP - inserting values error: Check SQL version -

i have tried insert few values database doesn't work. show error. you have error in sql syntax; check manual corresponds mysql server version right syntax use near '','pranavkumar.chess@gmail.com')' @ line 1 i need it. so, can please. the portion php code is: $reason= $_get['reason']; $option= $_get['option']; $for= $_get['category']; $approved= $_get['approved']; $before= $_get['before']; $username= $_session ["username"]; $myquery="insert request (`serial number`, `request date`, `request category`, `request`, `reason`, `approved by`, `username`) values ('',now(),'$for','$option','$reason',$approved','$username')"; $query = mysql_query($myquery); if ( ! $query ) { echo mysql_error(); die; } single quote missing @ '$approved' $myquery="insert

java - Specific comboBox on a specific column number in a table -

Image
i have jtable 17 columns. of these columns want comboboxes, others, don't. code: public final jtable table; void setcelleditors(){ setbooleancelleditor (table); // combobox boolean values setintcelleditor (table); // combobox int values settypecelleditor (table); setanothertypecelleditor (table); // .. , on, types need comboboxes } the celleditor function types this: private void settypecelleditor (jtable jt) { defaultcelleditor dce = new defaultcelleditor (type.buildcombobox ()); jt.setdefaulteditor (type.class, dce); } and works fine, because type unique table, in other words, have 1 column type boolean, 1 int, 1 anothertype etc. problem 2 columns have string values, need different comboboxes. meaning, code above doesn't work, because both string.class. naturally, tried solving saying "on column 10 want combobox": private void setyetanothertypecelleditor (jtable jt) { defaultcelleditor dce = new defaultcelleditor (y

c# - Why the last row never gets read? -

Image
hello have 1 question why last row never gets read? dosen´t matter if 1 row in excel file or 100 rows. last row never shows in list. , have no clue why.... here excel file: and method: public list<string> getlistdata(bool skipfirstrow, int numberofcolumns, string filepath) { int startpoint = 1; int cell = 1; int row = 1; list<string> stringlist = new list<string>(); //open excel (application) var excelapplication = openexcelapplication(); //open excel file excel.workbook excelworkbook = excelapplication.workbooks.open(filepath); //get worksheets file excel.sheets excelsheets = excelworkbook.worksheets; //select first worksheet excel.worksheet worksheet = (excel.worksheet)excelsheets.get_item(1); if (skipfirstrow == true) { startpoint = 2; } excel.range range = worksheet.get_range("a" + convert.tostring(startpoint), missing.value); while ((range.cells[startpoint, cell]

Convert color image png into color css gradient -

Image
i want convert png image css gradient color. how can if have png file? simply use gradient css rule? #grad { background: linear-gradient(black, white); /* standard syntax */ } #grad2 { background: red; /* browsers not support gradients */ background: -webkit-linear-gradient(red, yellow, green); /* safari 5.1 6.0 */ background: -o-linear-gradient(red, yellow, green); /* opera 11.1 12.0 */ background: -moz-linear-gradient(red, yellow, green); /* firefox 3.6 15 */ background: linear-gradient(red, yellow, green); /* standard syntax */ } <div id="grad"> <br><br> </div> <div id="grad2"> <br><br> </div> some reading: css gradients

javascript - Google maps only show search results in the US -

i'm using angular google maps api. problem when geolocation turned off , use search box search generic, not address-bound things or stores "pizza" or "ikea" map shows results in default. i want able choose own default location use when geolocation turned off. i'm not sure how this. this code //search features $scope.searchopen = false; $scope.searchmodel = {} //add , remove css classes on search bar show , hide searchbar $scope.togglesearch = function () { $scope.searchmodel.searchterm = null; var searchfieldinput = document.getelementbyid('pac-input') if (searchfieldinput.classlist.contains('searchactive')) { searchfieldinput.classlist.remove('searchactive') searchfieldinput.classlist.remove('pac-container') } else { searchfieldinput.classlist.add('searchactive') } } $scope.$watch("searchmodel.searchterm", function (searchtext) { $sco

c++ - QTabWidget corner QToolButton widget disappearing -

i have qtabwidget dynamically added , removed tabs. have qtoolbutton set corner widget in order handle add events on clicked() signal. while adding works fine removing tabs widget causes button disappear. have tried using stylesheets create invisible first tab of width 0, approach failed me. because have settabsclosable(true) on tabs makes space close button. i thought button disappearing when qtabbar collapses hight 0 when there no tabs. tried tabbar()->setminimumheight(30); workaround didn't work. ideas? here code sample reproducing problem: #include "mainwindow.h" #include "ui_mainwindow.h" #include "qtoolbutton" mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); ui->tabwidget->settabsclosable(true); ui->tabwidget->tabbar()->setminimumheight(30); qtoolbutton *btn = new qtoolbutton(ui->tabwidget); btn->settext("add ne

scope - API migration, need to request new permissions? -

the new api introduces new scope public_content not mandatory before. for app, need retrieve public datas user view. add public_content scope, access tokens generated? have log out users ask them authorize new public_content permission? you won't need log them out - old access tokens expired, they're 'logged out'. should handle scenario expired access token in first place, because due instagram doc access tokens may expire @ time in future. so user perspective, moving 1 api similar scenario, when access tokens had expired.

java - How to insert date or NULL to array -

i have following question. i'm using jdbc in project , made simple method insert data database. my problem is: when want insert sysdate or null auto increment? method send strings , writing null string doesn't work. can give me advice how improve it? this code constant null in query, isn't want to. public static void insertinto(string table, arraylist<string> values) throws sqlexception { connection conn = javaconnectdb.connectdb(); oraclepreparedstatement pst = null; stringbuilder query = new stringbuilder("insert " + table + " values (null, "); (int = 0; < values.size(); i++) { query.append("? "); if (i + 1 != values.size()) query.append(", "); } query.append(")"); pst = (oraclepreparedstatement) conn.preparestatement(query.tostring()); (int = 0; < values.size(); i++) { pst.setstring(i + 1, values.get(i)); }

c# - WPF TabControl no selected Item on start -

i using wpf tabcontrol display items bound viewmodel. by default on start first item of list selected want no item selected on start. can set selecteditem in onselectionchanged event null no item selected on start no longer possible manually select item. public partial class projectscopemain : window { private bool firststart = true; public projectscopemain() { this.initialized += this.projectscopemain_initialized; this.initializecomponent(); } private void projectscopemain_initialized(object sender, system.eventargs e) { this.tabcontrolsettings.selectionchanged += tabcontrolsettingsonselectionchanged; } private void tabcontrolsettingsonselectionchanged(object sender, eventargs e) { this.tabcontrolsettings.selecteditem = null; } private void buttoncreate_click(object sender, system.windows.routedeventargs e) { this.close(); } } my xaml code. selectedindex=-1 not work <customcontrols:tabcontrol x:uid="tabco

Compiling Java code from string results in ClassNotFoundException -

i'm trying code example uses javax.tools compile code in string. class.forname results in classnotfoundexception. know why? i'm using java 7. import java.io.ioexception; import java.io.printwriter; import java.io.stringwriter; import java.lang.reflect.invocationtargetexception; import java.net.uri; import java.util.arraylist; import java.util.arrays; import java.util.list; import javax.tools.diagnostic; import javax.tools.diagnosticcollector; import javax.tools.javacompiler; import javax.tools.javafileobject; import javax.tools.simplejavafileobject; import javax.tools.toolprovider; import javax.tools.javacompiler.compilationtask; public class main { public static void main(string args[]) throws ioexception { javacompiler compiler = toolprovider.getsystemjavacompiler(); diagnosticcollector<javafile

meteor - How to import&use javascript functions in jsx? -

i want use connect() javascript function in app.jsx. i'm using meteor framework. app.jsx import react 'react'; /* [i think import codes should here..] */ export default class app extends react.component { render() { return ( <div> <button onclick={ /* [i want use connect() function here] */ } > connect </button> </div> ); } } connect.js function connect() { console.log('connected'); } thank you. you can export , import function. connect.js export function connect() { console.log('connected'); } app.jsx import react 'react'; import {connect} '/path/to/connect.js' export default class app extends react.component { render() { return ( <div> <button onclick={connect} > connect </button> </div> ); } }

Implementing Tabu Search in R -

Image
i trying implement tabu search on classification dataset namely indian patients liver disease available in uci repository on https://archive.ics.uci.edu/ml/datasets/ilpd+(indian+liver+patient+dataset) facing issues. following code i've used nf <- 10 ntr <- 193 nte <- 193 library(class) library(e1071) library(caret) library(party) library(nnet) ilpd <- read.csv("c:/users/dell/desktop/codes , datasets/ilpd.csv") nrow(ilpd) set.seed(9850) gp<-runif(nrow(ilpd)) ilpd<-ilpd[order(gp),] idx <- createdatapartition(y = ilpd$class, p = 0.7, list = false) train<-ilpd[idx,] test<-ilpd[-idx,] ver<-test[,11] evaluate <- function(th){ if (sum(th) == 0)return(0) model <- svm(train[ ,th==1], train[,11] , gamma = 0.1, kernel ="sigmoid", na.action = na.omit) pred <- predict(model, test[ ,th==1]) csrate <- sum(pred == ver)/nte penalty <- (nf - sum(th))/nf return(csrate + penalty) } library(tabusearch) res <

c# - how to create datagridview NumericUpDown column -

Image
i want add column in datagridview numericupdown type. have created custom column type , working fine control visible every time. want when enter in particular cell of column(numericupdown column) control show. want shown in following screenshot. any appreciate. this might more of workaround solution, consider writing custom form displays directly on cell when click on cell. custom form give numericupdown behavior want, , click anywhere else on datagridview custom form hidden, value being saved cell. seems simple way handle issue , identical behavior. luck.

html - submit button php form not working -

i've started coding, however, while working on contact form can't work :(... the problem submit button, it's unclickable , nothing happens (= screen not changes) when try submit email myself using form. this code: <div class="col-sm-6"> <h4 class="font-alt">get in touch</h4> <br> <form id="contact-form" role="form" novalidate=""> <div class="form-group"> <label class="sr-only" for="cname">name</label> <input type="text" id="cname" class="form-control" name="cname" placeholder="name*" required="" data-validation-required-message="please enter name."> <p class="help-block text-danger"></p> </div> <div class="form-group"> <label class="sr-only" for="cemail">your email</label> <input