Posts

Showing posts from July, 2012

php upload file condition not working -

i have page the visitor can upload file, thats not required, in script put condition if file input (i named 'upload') not set or empty don't upload anything, , file name equal 'file' existed in db; else upload it. problem condition not working; when leave input empty upload script executed; know because messages declared in script here coded , thank you //select exercice $ex_query = mysqli_query($link, " select * exercices id = '".$exercice_id."' "); $exercice = mysqli_fetch_assoc($ex_query); // --- update script if post if ($_server['request_method'] == 'post') { if (isset($_files["upload"]) && !empty($_files["upload"])){ $target_dir = "docs/"; $date_f_n = date("y-m-d_h-i-sa"); $file_n = basename( $_files["upload"]["name"]); $file_n = $date_f_n.$file_n; $target_file = $target_dir . $file_n; $up...

How do I show the title as well as URL on my share button on my blogger blog? -

here code have custom share buttons blogspot blog: <a expr:href='&quot;http://twitter.com/share?url=&quot; + data:post.url + data:post.title' target='_blank'><span class='share-box2'><i class='fa fa-twitter fa-2x'/><span><font size='3'>share on twittertop</font></span></span></a> so when click on button on blog new window opens, twitter share box empty, need title of post , url displayed. why not displaying? separate data-tags , re-read this page . correct use tweet button in blogger: <a expr:href='&quot;http://twitter.com/share?url=&quot; + data:post.url + &quot;&amp;text=&quot; + data:post.title' target='_blank'>

Android: Do I have to send all the variables to retain the values before fragment transaction? -

suppose have 2 fragments , b. has 2 integer variables named data_1=2 , data_2=3. transaction fragment -> fragment b . note fragment b needs data_1 doesn't need data_2, so, send variable data_1 through bundle. so, when transaction fragment b -> fragment a , sending modified value of data_1, use new value of data_1 original value of data_2 = 3 retained ? if not, how retain value? there various ways of doing it, easiest way in opinion share data parent activity. basically so: class mainactivity extends activity { public static int data_1 = 1, data_2 = 2; //all other code goes here } then in child fragment set data go: mainactivity.data_1 = 5; whereas read data call static value. int current_data = mainactivity.data_1; if need instances of activity whatever reason can set getter , setter functions instance's (not static) variable.

ios - Keypads showing on different views, causes UIKeyboardLayoutAlignmentView constraint error -

i've had crash report, it's real edge case. launch pin security view applicationwillenterforeground (the feature optional). however, have form sheets use in situations in app. so pin view added subview on window , keypad presented. when form sheet showing, appears on top of pin view (which wrong) , action on form sheet causes crash, when showing keypad. so believe need dismiss form sheets if application resigns / becomes active. i've looked sending notification form sheet in applicationwillenterforeground , i'll have firstly determine if form sheet visible add method dismiss every form sheet. this seems lot of work edge case, can suggest alternative approach? for completeness here's error... the layout constraints still need update after sending -updateconstraints <_uikeyboardlayoutalignmentview: 0x14e59b790; frame = (0 0; 0 0); userinteractionenabled = no; layer = >. _uikeyboardlayoutalignmentview or 1 of superclasses may have overridden...

windows - Adding manifest information to a Visual C++ project -

Image
i'm writing c++ program has run administrator. gather way arrange add note effect manifest file linked executable. how do this? in c# can create manifest add new item, doesn't seem apply c++. project properties/linker has section on manifests, seems discuss automatically generating manifest each time program compiled, rather generating manifest once can edited. however, though generate manifest has value of yes, no manifest file appears in project directory tree after build. what missing? project -> properties linker -> manifest file uac execution level : requireadministrator note: manifest embedded exe file itself, resource. don't need edit it.

java - Spring MVC realise a custom response for multiple controllers based on a variable -

i have couple of controllers, annotated @requestmapping so: @requestmapping(value = "/group/{groupname}", method = requestmethod.get) public responseentity<list<group>> getgroups(@pathvariable("groupname") string groupname) {...} as side note requests , responses (de)serialized jackson. those requests can handled if there exists connection server. if connection breaks receive notification , want retry establishing connection. while doing want return status code 500. what cleanest way so? -- thank in advance. edit: i think wasn't clear. when lose jmx connection other server controllers still work , return error codes in 200-range. but when receive notification connection has been lost want controllers return 500. the way think of achieve set flag , use if-statement in each controller. public class connector { void handlenotification(notification notification, object handback) { switch (notification.gettype()) { ...

java - Connect to SAP using JCO through a SAPRouter -

i've been trying connect java program sap using jco java connectors (latest version 3.0.13). having trouble , told problem was trying connect directly , need connect via saprouter. there's connection property called saprouter need place sap router string. i've found way specify such string jco (v 2.xx) , is: /h//h/ is same jco in latest versison? if so, specification of connection properties done this? properties connectproperties = new properties(); connectproperties.setproperty(destinationdataprovider.jco_ashost, "xx.xx.x.xx"); connectproperties.setproperty(destinationdataprovider.jco_sysnr, "00"); connectproperties.setproperty(destinationdataprovider.jco_client, "020"); connectproperties.setproperty(destinationdataprovider.jco_user, "xxxxx"); connectproperties.setproperty(destinationdataprovider.jco_passwd, "xxxxxx"); connectproperties.setproperty(destinationdataprovider.jco_lang, ...

hash - Is it possible to implement universal hashing for the complete range of integers? -

i reading universal hashing on integers. prerequisite , mandatory precondition seems choose prime number p greater set of possible keys . i not clear on point. if our set of keys of type int means prime number needs of next bigger data type e.g. long . but whatever hash need down-casted int index hash table. doesn't down-casting affect quality of universal hashing (i referring distribution of keys on buckets) somehow? if our set of keys integers means prime number needs of next bigger data type e.g. long. that not problem. necessary otherwise hash family cannot universal. see below more information. but whatever hash need down-casted int index hash table. doesn't down-casting affect quality of universal hashing (i referring distribution of keys on buckets) somehow? the answer no. try explain. whether p has data type or not not important hash family universal. important p equal or larger u (the maximum integer of universe ...

ios - Executing code, when the application is in background not working on physical device (SWIFT) -

i making app, reliant on executing minor code in background , ran peculiar problem. app has timer, nstimer() . principle behind of similiar of timer (in clock application, installed on ios devices), meaning, when timer ends uilocalnotification displayed. everything works expected when run on emulated device in xcode, when test on iphone, there no notifications. along lines of: var end = timerhasended() if end == true{ println("the timer has ended") } and not working. checked if application detects background uiapplicationstate doing , not on physical device. interestingly enough, on emulated device. i tried running timer on background thread, using qos_class_background , dispatch_async no avail. can me? could schedule uilocalnotification appear after delay, when delay remaining time left in alarm? var date: nsdate = /*time until timer expires*/ let app = uiapplication.sharedapplication() let oldnotifications = app.scheduledlocalnotifications if...

php - empty $_POST variables -

i know people had problem , many asked here no solution seems work me. have tried increasing post_max_size etc. in php.ini , found solution link remove line rewriterule ^(.*)$ http://www.whitemagicsoftware.com/$1 [r=301,l] .htaccess file can not find .htaccess file in xampp folder anywhere. looking solution 2 days , tried changing code nothing worked me. tried using $_get , $_request result same. can see values of variables being sent using firebug variables empty. appreciated . this code <?php require ("database_connect.php");?> <!doctype html> <html> <body> <form method="post" action="<?php echo ($_server["php_self"])?>"> name : <input type="text" name="name"><br/> password : <input type="password" name="password"><br/> <input type="submit" name="login" value="log in"> ...

Passing Unicode parameters to Windows .bat file when rerunning it -

Image
my .bat file looks this: @echo off cd /d "%~dp0" if [%2]==[] ( set user=%username% ) else ( set user=%2% ) :getfile if [%1]==[] ( set /p file=enter file name : ) else ( set file=%~f1 echo file name: %~f1 ) :checkfile /f "useback tokens=*" %%a in ('%file%') set file=%%~a if not exist "%file%" ( echo error: not find file: %file% echo. ) :: check admin permissions >nul 2>&1 "%systemroot%\system32\cacls.exe" "%systemroot%\system32\config\system" if '%errorlevel%' == '0' ( goto gotadmin ) :: rerun batch admin rights echo set uac = createobject^("shell.application"^) > "%temp%\getadmin.vbs" echo uac.shellexecute "cmd", "/c """"%~f0"" ""%file%"" ""%user%""""", "%cd%", "runas", 1 >> "%temp%\getadmin.vbs" ...

C# MySQL Raspberry Pi - Access denied for user -

heyhey! i having issues mysql server on raspberry pi. works flawlessly connect remotely both pc , others in house, when send application friend, get: "access denied user "admin2"----." things i've tried: • quoting out bind-address in config file, using static ip rpi, , using 0.0.0.0 ip. • added line "skip-name-resolve" in "/etc/mysql/my.cnf" file. • port 3306 open on router. checked using canyouseeme. the following queries: create user 'admin2'@'%' identified 'password'; grant privileges on database.* 'admin2'@'%'; flush privileges; show grants 'admin2'; | grant usage on *.* 'admin2'@'%' identified password '<lots of encrypted password letters here assume>' grant privileges on 'database.* 'admin2'@'%' i have logindata.settings in visual studio project strings: username, password & ipstring each has textbox assigned them...

vb.net - System.Net.Http.Formatting.dll in package Microsoft.AspNet.WebApi.Client 5.2.3. doesn't seem to work -

Image
i have vb.net class library project targeting .net 4.5.1 framework. using visual studio 2013 community edition. the project library consuming webapi 2 rest api. as guide using this example . project's packages.config following: <?xml version="1.0" encoding="utf-8"?> <packages> <package id="microsoft.aspnet.webapi.client" version="5.2.3" targetframework="net451" /> <package id="newtonsoft.json" version="7.0.1" targetframework="net451" /> </packages> project's assemblies references are: newtonsoft.json, version=7.0.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed, processorarchitecture=msil system system.data system.net.http system.net.http.formatting, version=5.2.3.0, culture=neutral, publickeytoken=31bf3856ad364e35, processorarchitecture=msil <hintpath>..\..\..\..\packages\microsoft.aspnet.webapi.client.5.2.3\lib\net45\system.net.http.f...

php - How to populate a form with data selected from options on my mysql data -

i have form data selects data database. want each selected item have units echoed in corresponding unit input form. pls need simplified way of solving problem. here form: <?php include ("header.php");?> <?php $start=1; $end= $_post['item']; for($start;$start<=$end;$start++){ require("connect.php"); $sql = "(select * drug_name)"; $result = mysqli_query($conn, $sql); ?> <form align="center" method="post" action="transactions.php" id='myform'> name: <select align="right" name="inputname[]" id='drug_item_name' value="drug_item_name"><option selected="selected" value="0">s/n select drug --</option> <?php while($row = $result->fetch_assoc()){ ?> <option ><?php echo$row['drug_item_name']?></option> <?php } ?> </selec...

Values not showing in spinner Android -

values not getting shown in spinner getting values when click on spinner , dropdown shown values . not when select spinner vechtype_spinner.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int position, long arg3) { if (position != 0) { toast.maketext(createitinerary.this, "testing vehicle", toast.length_long).show(); selectedvehicaltype = vechiclelist.get(position); if (selectedvehicaltype.contains("car") || selectedvehicaltype.contains("motor cycle") || selectedvehicaltype.contains("bike")) { expectedkm.setvisibility(view.visible); //classspinner.setvisibility(view.gone); } else { ...

how to add filters to servlet when using @enablewebmvc annotation in spring 4? -

here current configuration public class webappconfig implements webapplicationinitializer { private static final string character_encoding_filter_encoding = "utf-8"; private static final string character_encoding_filter_name = "characterencoding"; private static final string character_encoding_filter_url_pattern = "/*"; private static final string dispatcher_servlet_name = "dispatcher"; private static final string dispatcher_servlet_mapping = "/"; @override public void onstartup(servletcontext servletcontext) throws servletexception { annotationconfigwebapplicationcontext rootcontext = new annotationconfigwebapplicationcontext(); rootcontext.register(exampleapplicationcontext.class); configuredispatcherservlet(servletcontext, rootcontext); enumset<dispatchertype> dispatchertypes = enumset.of(dispatchertype.request, dispatchertype.forward); configurecharac...

keyboard - Using KeyLoggers in Java -

i trying implement key loggers in java using jnative hook.i 'm able record every key movement.this output able till now when i'm trying type "facebook" how recording f c e b o o k but want print single word every other keylogger does. means when enter facebook.it should record "facebook" not recording every keyboard char. below posted code: public class key_logger implements nativekeylistener { @override public void nativekeypressed(nativekeyevent nativekeyevent) { system.out.print(nativekeyevent.getkeychar()); if(nativekeyevent.getkeycode()== nativekeyevent.vk_escape) { //system.out.println("ter"); globalscreen.unregisternativehook(); } } @override public void nativekeyreleased(nativekeyevent nativekeyevent) { } @override public void nativekeytyped(nativekeyevent nativekeyevent) { system.out.println(nativekeyevent.getkeychar()); } public static void main(string[] args) { try { globalsc...

linux - apache virtual host subdomains is accessable only by localhost -

i try make pic.localhost virtual host accessible public network(all of internet) problem works on same machine in address pic.localhost not accessible lan network, machine runs it. should do? i add , edited files make pictures sub domain site: 1 - included httpd-vhosts file in httpd.conf file. 2 - added httpd-vhosts file lines: <virtualhost *:80> serveradmin admin@domain documentroot "/opt/lampp/htdocs/" servername pic.localhost # serveralias www.pic.localhost errorlog "logs/picture-error_log" customlog "logs/picture-access_log" common </virtualhost> 3 - added line /etc/hosts 127.0.0.1 pic.localhost 4 - restarted xampp server i running xampp 5.6.8 on centos 7 machine. centos 7 has firewall default blocks ports (including port 80). in comand line, sudo privileges try.. service firewalld stop then in terminal see centos lan ip (ifconfig) , try access ip (ex 192.168.1....

Trying to set one value from another in crystal reports -

hi have problem can't seem around, new crystal if have missed please point out. trying achieve this. if set of conditions met print value if other conditions met print different value or else print main header. below have far, my problem can't seem set string correct. whileprintingrecords; booleanvar bprintedrad; booleanvar bprintedgcs; booleanvar bprintedhead; booleanvar bprintedthrom; booleanvar bprintedwar; booleanvar bprintedpap; booleanvar bprintedsym; if {is_dhft_aide_memoir.codenum} = 5 {is_dhft_aide_memoir.orderitemname}; shared stringvar orderitemnameq:= {is_dhft_aide_memoir.orderitemname}; if orderitemnameq = "ct brain" if {cv3orderuserdata.userdatacode} = "rad clinical pathways" //and {cv3orderuserdata.value} = "stroke" , instr ({cv3orderuserdata.value},"stroke")>0 bprintedrad := true; if {cv3orderuserdata.userdatacode} = "ctbrain2gcs" , {cv3orde...

iphone - iOS 8.4 MPNowPlayingInfoCenter skip/prev disappeared -

Image
i'm working on music playing app , in previous ios versions media player show play/pause skip , prev buttons. now, 8.4 update, shown play/pause. i'm updating mpnowplayinginfocenter in usual way: nsdictionary* nowplayinginfo = @{ mpmediaitempropertytitle:[self.currentsong title], mpmediaitempropertyartist:[self.currentsong artist], mpmediaitempropertyplaybackduration:[nsnumber numberwithdouble:(double) self.duration], mpnowplayinginfopropertyelapsedplaybacktime: [nsnumber numberwithdouble:(double)self.currentplaybacktime], mpnowplayinginfopropertyplaybackrate: self.isplaying ? @1.0 : @0.0, mpmediaitempropertyartwork: mediaplayerartwork, mpnowplayinginfopropertyplaybackqueueindex: [nsnumber numberwithinteger:playqueue.queueposition], mpnowplayinginfopropertyplaybackqueuecount: [nsnumber numberwithinteger:playqueue.queueids.count] }; [[mpnowplayinginfocenter defaultcenter] setnowplayinginfo:nowplayinginfo]; but result is... and thanks ...

maven - how to run vaadin charts demo in eclipse -

tried following these instructions https://github.com/vaadin/charts/blob/7a55e8dab5b9941a05603c2624a576866e86045d/devinstructions.md , can't download dependencies step, though worked yesterday. widget compile not work. in 'vaadin-charts-directorypackage' shows 4 errors after import failed run task (com.github.eirslett:frontend-maven-plugin:0.0.23:bower:bower install:generate-resources) failed run task (com.github.eirslett:frontend-maven-plugin:0.0.23:gulp:gulp deploy:deploy) failed run task (com.github.eirslett:frontend-maven-plugin:0.0.23:gulp:gulp stage:generate-resources) failed run task (com.github.eirslett:frontend-maven-plugin:0.0.23:npm:npm install:generate-resources) caused by: com.github.eirslett.maven.plugins.frontend.lib.taskrunnerexception: 'npm install --color=false' failed. (error code 34) then after add facets: cannot change version of project facet dynamic web module 2.4. vaadin-charts-demo line 1 maven java ee configuration p...

VIM: why do these bindings work only sometimes? -

i've got these bindings in .vimrc. work of time, don't: save file not run it. then go insert mode , exit normal mode, , work again. problem? thanks! autocmd filetype python map <c-k> :write <cr> :! python % <cr> autocmd filetype lisp map <c-k> :write <cr> :! clisp % <cr> autocmd filetype scala map <c-k> :write <cr> :! scala % <cr> there many topics discuss here out further ado: mappings your current mappings map <c-k> ... work in normal, visual, , operator-pending modes. executing mappings in visual mode or operator-pending modes save buffer range of lines (read not good). suggest make mappings normal mode only. two general rules of thumb: always supply mode n normal. always use noremp instead of map unless mapping <plug> mapping. so 1 of mappings might similar this: nnoremap <c-k> :w<cr>:!python %<cr> for more information: :h :map-modes :h map-overvi...

java - Wrong JDBC driver being used? -

i have method inserts record postgres db , returns identity field generated said record. problem is, if include redshift driver in pom file, driver getting used instead of postgres driver - , redshift driver doesn't allow returning identity value. the code is: try { class.forname( "org.postgresql.driver" ).newinstance(); connection connection = drivermanager.getconnection( "jdbc:postgresql://localhost:5433/postgres", "postgres", "password" ); statement stmt = connection.createstatement(); stmt.execute( "insert public.job ( job_name ) values ( 'test' )" , statement.return_generated_keys ); resultset keyset = stmt.getgeneratedkeys(); if ( keyset.next() ) system.out.println( keyset.getlong( 1 ) ); } catch ( exception e ) { e.printstacktrace(); } when pom used, works: <dependencies> <dependency> <groupid>org.postgresql</groupid> <artifactid>postgresql...

java - Cannot Find Symbol error when using jsp page import -

i have been trying import java class jsp page using typical syntax: <%@ page import="packagename.helloworldtest" %> and <%@ page import="packagename.* %> whenever try receive error: pwc6199: generated servlet error: cannot find symbol symbol: class helloworldtest location: package packagename pwc6197: error occurred @ line: 3 in jsp file: /web-inf/jsp/test.jsp pwc6199: generated servlet error: cannot find symbol symbol: variable helloworldtest location: class org.apache.jsp.web_002dinf.jsp.test_jsp i'm using maven. have reconfigured project default output folder web-inf/classes, still receive error. it's when maven build finishes don't have helloworldtest class generated inside /web-inf/classes/packagename/ folder. if not, need fix maven configuration. if class file there, check final war artifact maven generating. class there too? if yes, check exploded...

c# - Displaying values from a Dictionary within a Dictionary within MVC Razor view -

i'm not sure possible mvc razor, pass dictionary includes dictionary view , display child dictionary keys , values. public dictionary<int, dynamic> getdata(dateinfo datainfo) { //create parent dictionary dictionary<int, dynamic> parentdict = new dictionary<int, dynamic>(); //load child dictionary (int = 0; < list.count; i++) { //create child dictionary store values dictionary<int, dynamic> dict = new dictionary<int, dynamic>(); parentdict[i] = dict; parentdict[i].clear(); if (beginningyear < datetime.now.year) { //...code left out brevity if (numberofyears > 1) { for(int j = 1; j < numberofyears; j++) { beginningyear = beginningyear + 1; //...code left out brevity dict.add(beginningyear, new { month = 12, monthlyamount = nextyearamount.premium, totalyearamount = totalyearamount }); } } ...

c# - Add attribute to method without modifying the code file containing the method? -

is there way add attribute method without modifying class file? e.g. i'm importing wsdl generates reference.cs containing proxy class methods. i have written attribute work me , adding method below, , works fine: reference.cs file public partial class whatever { [mycustomattrubute()] public void mymethod(string bleh) { // stuff return; } } however, problem if wsdl changes need update it, automatically lose changes reference.cs. can add attribute method file? if other method string, can not concatenate other method this? in other words when call mymethod(string bleh), pass 2 strings concatenated it. for example: mymethod(string1 + "|" + string2); this pass 2 parameters concatenated pipe, in method can use string[] vals = val.split('|'); which give array of parameters passed. way pass more 2 parameters through. then parameters as: sting para1 = vals[0]; sting para2 = vals[1];

How can i get just some info from XML using XSLT? -

i want fields xml, here xml: <server xmlns="urn:jboss:domain:1.4"> <extensions> ... </extensions> <management> ... </management> <profile> <subsystem xmlns="urn:jboss:domain:logging:1.2"> ... </subsystem> <subsystem xmlns="urn:jboss:domain:cmp:1.0"/> <subsystem xmlns="urn:jboss:domain:datasources:1.1"> <datasources> <datasource jta="true" jndi-name="java:/calypso/datasources/calypsods" pool-name="calypsods" enabled="true" use-ccm="false"> <connection-url>jdbc:oracle:thin:@//tcomora-app.t-maps.local:1521/tit1cal.ora.bde.es</connection-url> <driver>oracle</driver> <pool> <min-pool-size>5</min-poo...

shortcuts - Why does '<,'> come up in Vim -

sometimes when press : normal mode, starts : ' < , ' >. why happen , for? you not in normal mode, visual mode. when in visual mode every command starts visual mode range, '<,'> , automatically. useful if want run ex command on visually selected lines, e.g. :s , :g , , :sort . more information see :h v_: .

java - Which UI component can contain static html files? -

i want display static html file in vaadin view. use com.vaadin.server.fileresource class under: string basepath = vaadinservice.getcurrent().getbasedirectory().getabsolutepath(); fileresource resource = new fileresource(new file(basepath + "/web-inf/my_file.html")); but dont know can use this.? you can use label component this. set html content mode , read content of html file , set label text. see here

java - is there any way to use @Async for a method being called N amount of times but know when it processed all calls? -

ive been trying find out if possible (working spring). what want this: i have process, has make huuuge comparation between many records , records of database, so, because want avoid timeout exception thinking use method , call async. method take each comparation , go database see if exists or not. it works great, , dont know , how know first method (where call aysnc method) if calls @ method finished. is there way this? my async method looks this: @async future<string> mymethod(someparams){ somecode... } thanks. one way achieve hold of executorservice used @async method under hoods. can, instance, pass own executor service @async("customexecutorservicebeanname") . once have that, can call shutdown() , awaittermination() on executor service instance (probably within @predestroy method).

validation - Issues changing border color in javascript -

i submitting form, , has validation make sure text box has value. if false , alert displays fine, can't border change color. can't seem find out doing wrong. <script> function validate(){ var dob = document.forms["ppm"]["dob"].value; if(dob == ""){ document.getelementbyid("dob").style.border="red"; alert("error"); return false; } } </script> <form onsubmit="return validate()" name="ppm" id="ppm" action="index.php" method="post"> <p>what dob<br /> <input type="text" name="dob" id="dob" value="" /> <input type="submit" name="continue" value="continue"/> </form> you have give border width before visible. can use individual border* properties that: document.getelementbyi...