Posts

Showing posts from June, 2010

java - log4j - show logs both in file and console -

i have 2 appenders, 1 file , console. want eclipse console show both file , console logs, in same time file show own logs. how do that? here conf. <appender name="file" class="org.apache.log4j.dailyrollingfileappender"> <errorhandler class="org.jboss.logging.util.onlyonceerrorhandler"/> <param name="append" value="true"/> <param name="threshold" value="info"/> <param name="file" value="${jboss.server.log.dir}/file.log"/> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d %-5p %m%n"/> </layout> <appender name="console" class="org.apache.log4j.consoleappender"> <errorhandler class="org.jboss.logging.util.onlyonceerrorhandler"/> <param name="target" value="system.out"/> <param name="

Line Counting Program in C -

i learning c language book called "the c programming language" brian kernighan & dennis ritchie , have been stuck @ basic lesson of line counting program. program runs not give output of how many lines inputed. have given program code below, please on same. #include <stdio.h> void main() { int c, nl; nl = 0; while ((c = getchar()) != eof ) if (c == '\n') ++nl; printf("%d \n", nl); return 0; } the code should read input , output how many lines of text given. how should changed make work? your program works fine. however, prefix main int type keep compiler quiet. should this: int main(void) when call it, did this: $$$ ->./test6 < test4.c 19 $$$ ->wc test4.c 19 48 379 test4.c $$$ -> the getchar function same thing getc(stdin), when run program, takes it's input stdin (keyboard) or file redirected stdin. edit: pointed out, if last line doesn't ha

charts - Extjs pie callout lines are not displayed -

Image
i created pie in extjs callout line not displayed, see following screenshots , code : this actual pie : this want : and code : ext.create('ext.chart.chart', { renderto: 'infos2', width: 500, height: 300, animate: true, store: store2, series: [ { type: 'pie', highlight: { segment: { margin: 20 } }, field: 'population', label: { field: 'state', display: 'outside', font: '12px arial', calloutline: { width: 5, length: 30 } } } ] }); according comment of yellen, calloutline has been added on 4.2.2 version of

objective c - Getting class from string in swift -

i have created custom class named predicatecontroller . i need pass class of predicatecontroller called framework written in objc. however, whenever using properties of swift, same returning me <projectname>.predicatecontroller . i need class name predicatecontroller . is there workaround in swift same. thanks. you can type of class using self on class , wrap string, e.g. ... let date = nsdate(); let clazz = nsdate.self let str = "\(date) of type \(clazz)" println(str)

javascript - Desktop Notification in asp.net -

i'm using below javascript desktop notification in asp.net. on button click event working fine permission getting error while implementing code behind. and code added on webpage... <script type="text/javascript"> function notifyme() { if (!("notification" in window)) { alert("this browser not support desktop notification"); } else if (notification.permission === "granted") { var options = { body: "this body of notification", icon: "stupidcodes.com.png", dir: "ltr" }; var notification = new notification("hi there", options); notification.onclick = function () { window.open("http://www.stupidcodes.com/"); }; } else if (notification.p

ios - Core Data takes too much time -

i have around 200,000 4 letter words, want use in app. don't want use csv file in app. using core data now. loading these values core data @ starting of app first time. , retrieving these values after sometime. so procedure time, more 20 seconds think. want access single word, want know whether word exists in core data or not, there other ways this, except looping through whole array. simply, want check whether word exists in core data or not, want access word ints index, don't wanna loop through objects. there other way .? want in fraction of second.how supposed load 0.2 million words .? reading csv takes more 2 minutes, in app. suggestion importing array of string core data.? this code using in project. // save coredata func savename() { //1 getting appdelegate let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate let managedcontext = appdelegate.managedobjectcontext! //2 fetching entity descrip

php - Cannot set public property on Mockery mock object -

i'm trying use mockery create mock object mimics php's internal ziparchive class. i have following php code: $zipmock = mockery::mock('ziparchive'); $zipmock->numfiles = 10; echo 'number of files: '.$zipmock->numfiles; however, when run following result: number of files: 0 i'd expect show 10, rather 0. can't work out why happening since the documentation implies should possible set public properties on mock objects directly. missing? i can't work out why happening since documentation implies should possible set public properties on mock objects directly. missing? you're missing point ziparchive::$numfiles not standard public property. ziparchive not userland php class (plain old php object) 1 php extension. means property effectively read-only: http://lxr.php.net/xref/php_5_6/ext/zip/php_zip.c#php_zip_get_num_files so mocking mockery not option num-files property. can mock own object, here 10 files:

html - Have my asp:DropDownList slide down when selected and NOT sliding both up and down -

been looking similar issue moment couldn't find anywhere. working on asp.net project , need asp:dropdownlist have it's elements sliding down when selected. when selected item first one, ok since i'm @ top of element list, if select dropdownlist when selected item xxth, list displayed slide going , down @ same time (that makes selected item in middle of displayed list). i want list sliding down always, whatever selected element position (the same display if selected element 1st). hope question clear. if need screen, i'll send it's not necessary. thanks advance answers !

For /f loop in batch comprehension -

its easy (or should) have comprehension problem. however: have simple file 2 numbers in 0 , 1 and snippet: set adp= /f %%i in (file.txt) ( set adp=%%i call :test ) :test echo adp %adp% so expect result adp 0 adp 1 but adp 0 adp 1 adp 1 why 3 results instead of two? because batch file goes :test after loop, no matter what. you should : set adp= /f %%i in (file.txt) ( set adp=%%i call :test ) goto :end :test echo adp %adp% :end

wordpress - Custom post type to work with html auto reply -

i'm trying setup custom post type landing pages in wordpress, including option customize text html auto response email. i able call post meta on different page using using following loop, can't figure out how put in format works in html auto response. is possible turn following loop ". $_post['content'] ." or more appropriate? <?php $args = array( 'post_type' => 'landing_pages'); $loop = new wp_query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); echo esc_html( get_post_meta( get_the_id(), 'landing_pages_short_description', true ) ); endwhile; wp_reset_query(); ?> here html auto response <?php if(!empty($_post['rev_captcha'])) { die('nice try robot. nothing here.'); } $autoresponse = true; $autoresponsesubject = "brand name: copy of message"; $autoresponsemessage = "<html> <head> <title>brand name: copy of message</title> <

css - Brightness for a SVG path not working in Chrome but in Firefox -

Image
i have created interactive map shows when instance river mousehovered , on. how shall like. in firefox works not in chrome: so how can enable brigthness successful in chrome well. here class use: .highlightelement { fill: #666; filter: brightness(125%); -webkit-filter: brightness(125%); -moz-filter: brightness(125%); -o-filter: brightness(125%); -ms-filter: brightness(125%); } btw fill lakes have on map. not working in chrome. somehow changing text color when hovering on them working in chrome (but i'm realizing fill ). so brigthness property believe. it seems chromium project slow on issues. still not fixed , seems has low priority: https://code.google.com/p/chromium/issues/detail?id=494947&thanks=494947&ts=1433152536

WARNING: Use strings for Figaro configuration in rails migration -

i creating new rails migration it's show me error "warning: use strings figaro configuration. 3543009 converted "3543009"." here migration rails g paymentinfo post userid:integer type:string figaro uses strictly strings. 1 of configuration values in application.yml file integer, , warning announce class transformation.

windows - libEvent on Windows2008 server 64 or on ubuntu linux 13.0 server? -

currently i'm developing client-server system on windows2008 server r2 64, server comsume 2 or 3 clients, each client send seperate binary message 1.6k each server 20pc/second, is, every 50ms client send message (size: 1.6k) server. i supposed libevent toolkit , have performance based questions stackoverflow. , libevent version 2.0.21.x64, used i/o completion ports in windows platform, , end user need monitor server status, don't know how use ubuntu linux, selected windows 2008 server server. however, after developed windows server program, losts 30+ binary messages, our application must stable , messages must received. are there wrong on windows network card settings? or should switch server ubuntu server? thank in advanced support!

php - Symfony Form - Expected argument of type "string or Symfony\Component\Form\FormTypeInterface", "array" given -

i have created form doctrine. works if not pass option, this: $builder ->add('name') ->add('password', 'password') ->add('password_repeat', 'password') ->add('email', 'email') ->add('save', 'submit') ; but, if add array options says docs ( http://symfony.com/doc/current/book/forms.html#book-form-creating-form-classes ), error says: expected argument of type "string or symfony\component\form\formtypeinterface", "array" given this formtype created doctrine: <?php namespace mainbundle\form; use symfony\component\form\abstracttype; use symfony\component\form\formbuilderinterface; use symfony\component\optionsresolver\optionsresolverinterface; class usertype extends abstracttype { /** * @param formbuilderinterface $builder * @param array $options */ public function buildform(formbuilderinterface $builder, array $options) { $builder

communicating with a LPC1768 as a HID via python -

background: evaluating replacing ftdi+fpga+ram cortex chip , playing around lpc1768 dev card. flashing led? [x] communications via virtual comms port [x] now looking @ communicating via libusb (either cdc or hid... evaluating) i started trying example: https://developer.mbed.org/cookbook/usbhid-bindings- & usbhid_testcase program compiles , runs. the issue on python side (using linux example & libusb). the 1st issue py script has: mbed_vendor_id = 0x1234 mbed_product_id = 0x0006 equally mbed usbdevice:usbhid has: usbhid(uint8_t output_report_length = 64, uint8_t input_report_length = 64, uint16_t vendor_id = 0x1234, uint16_t product_id = 0x0006, uint16_t product_release = 0x0001, bool connect = true); ie same product , vendor id. however... lsusb lists nxp chipset @ different location. bus 003 device 008: id 0d28:0204 nxp lpc1768 issuing: lsusb -vvv -d 0x0d28:0204 can see 4 devices card exposes (good) , matched simple python testcase import usb

email - Issues in mail received time when using hotmail in php mailer -

here code sending email localhost after referred lot online. html form: <form method="post" action="email.php"> email: <input name="email" id="email" type="text" /><br /> message:<br /> <textarea name="message" id="message" rows="15" cols="40"></textarea><br /> <input type="submit" value="submit" /> </form> email.php: <?php // $email , $message data being // posted page our html contact form $email = $_request['email'] ; $message = $_request['message'] ; require_once('class.phpmailer.php'); require 'phpmailerautoload.php'; require 'class.smtp.php'; $mail = new phpmailer(); $body='hellooooo'; $mail->issmtp(); $mail->host = "ssl://smtp.gmail.com"; // specify main , backup server $mail->smtpauth = true; // turn on smtp authenticatio

.net - Display a view in _Layout.cshtml? -

i have followed tutorial generate dynamic list menu http://dotnetawesome.blogspot.se/2014/06/how-to-create-treeview-with-database-data-mvc4-aspnet.html this view @model list<project.models.treeview> @{ viewbag.title = "simple"; } <h2>simple treeview database data</h2> <div style="border:solid 1px black; padding:10px; background-color:#fafafa"> <div class="treeview"> @if (model != null && model.count() > 0) { <ul> @treeview.gettreeview(model, model.firstordefault().parentcategoryid) </ul> } </div> </div> @* here need jquery code make treeview collapsible *@ @section scripts{ <script> $(document).ready(function () { $(".treeview li>ul").css('display', 'none'); // hide 2-level ul $(".collapsible").click(function (e)

iphone - ios media picker shows only white screen/stuck -

so i'm making music application project, , allows user create own music playlist. when clicked on s how media picker button shows white screen, it doesn't happen when view contains media picker initial view controller . when come segue media picker view controller shows white screen if tapped button. here code media picker view controller: var mymusicplayer: mpmusicplayercontroller? override func viewdidload() { super.viewdidload() var buttonpickandplay = uibutton.buttonwithtype(.system) as? uibutton if let pickandplay = buttonpickandplay{ pickandplay.frame = cgrect(x: 0, y: 0, width: 200, height: 37) pickandplay.center = cgpoint(x: view.center.x, y: view.center.y - 50) pickandplay.settitle("pick , play", forstate: .normal) pickandplay.addtarget(self, action: "displaymediapickerandplayitem", forcontrolevents: .touchupinside) view.addsubview(pickandplay) } } overrid

bitmap - Android video thumbnail is null -

so i'm trying achieve user can choose select existing video or take new one, bitmap has null value. @override protected void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == request_video_capture && resultcode == result_ok || requestcode == select_video && resultcode == result_ok) { uri selectedvideo = data.getdata(); addvideototable(thumbnailutils.createvideothumbnail(selectedvideo.getpath(), mediastore.video.thumbnails.mini_kind)); } } public void addvideototable(bitmap video) { tablelayout tl = (tablelayout)findviewbyid(r.id.videotable); if (videocount == 0 || videocount % 3 == 0) { tr = new tablerow(this); tr.setlayoutparams(new tablerow.layoutparams(tablerow.layoutparams.fill_parent, tablerow.layoutparams.wrap_content, gravity.center_horizontal)); tl.addview(tr); } imageview iv = new imageview(this); iv.setimagebitmap(video); iv.setpadding(0, 0, 10,

python - GAE - Share user authentication across apps -

let's run 2 different apps on different domains, coded in python flask , running gae instances; 1 site.co.uk , 1 site.us . if use gae authentication on 1 site possible have them authenticated other site too? don't want make them have authenticate each country specific domain. you can't reuse users service authentication across different applications. possible solution using oauth2 (or similar mechanism) - create application (or use 1 of existing applications) authentication provider. each application redirect authentication provider user authenticated, , redirected back. if user authenticated, not need authenticate again when switching applications. way won't able use users service on end applications, in provider, need rely on way store logged in user in each application (like datastore+memcache).

c# - MahApps.Metro Message and Progress connect -

i create logic mahapps looks this: showscreencommand = new command(async () => { var window = application.current.mainwindow metrowindow; if (await window.showmessageasync("are sure remove it?", "removal", messagedialogstyle.affirmativeandnegative) == messagedialogresult.affirmative) { await removepatienttask(); } }); private async task removetask() { var window = application.current.mainwindow metrowindow; var controller = await window.showprogressasync("please wait...","process message",false,new metrodialogsettings()); await task.delay(5000); await controller.closeasync(); } problem is, there gap between message , progress dialogs. 1 dialog hides, second 1 shows. not looking perfectly. is there way remove gap? mean, replace 1 dialog another? try removing closing animation of showmessageasync method: await window.showmessageasync("are sure remove it?",

drop function source code in R -

i trying find source code of drop function getting .rd file or references used. i searched in following urls: https://github.com/wch/r-source/search?p=2&q=drop&utf8=%e2%9c%93 https://github.com/wch/r-source/search?p=3&q=drop&utf8=%e2%9c%93 edit(drop) fetched me this: function (x) .internal(drop(x)) can me out here?

python 2.7 - How to fix ImportError: No module named pygame -

i trying import pygames python using canopy firstly , after no success tried terminal , in both cases get: import pygame traceback (most recent call last): file "", line 1, in importerror: no module named pygame i did: sudo apt-get install python-pygame and in desperate act did following: sudo apt-get install mercurial python3-pip libfreetype6-dev sudo apt-get build-dep python-pygame sudo pip3 install hg+ http://bitbucket.org/pygame/pygame and when check on /usr/lib/python2.7 able see folder named pygame (/usr/lib/python2.7/dist-packages/pygame) can guide me on how fix problem?, thank in advance try searching pygame in synaptic package manager. install there.

How to change the Android gallery selected item color? -

Image
i trying write code display android gallery view infinite list. able display gallery in screen want change color of selected item in gallery. mycode: mainactivity.java package com.example.mycircularlistview; import android.app.activity; import android.os.bundle; import android.widget.gallery; public class mainactivity extends activity { string[] txtdata; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); gallery gallery = (gallery) findviewbyid(r.id.mygallery); txtdata = new string[12]; for(int i=0;i<txtdata.length;i++){ txtdata[i] = ""+i; } gallery.setadapter(new galleryadapter(this,txtdata)); gallery.setspacing(18); } } galleryadapter.java package com.example.mycircularlistview; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.vi

apache spark - How to read RC file using scala -

how read content of rc file (in hdfs) using scala ? able read textfile avro. not rc file. val inputrdd = sc.hadoopfile[longwritable, bytesrefarraywritable, rcfileinputformat[longwritable, bytesrefarraywritable]](path) on rdd can apply map , read data.

multithreading - Why does the main thread's output come first in C#? -

Image
i wrote little program: class program { static void main(string[] args) { thread t = new thread(writex); t.start(); (int = 0; < 1000; i++) { console.write("o"); } } private static void writex() { (int = 0; < 1000; i++) { console.write("."); } } } i ran fifty times, , first character on console "o". weird me, because t thread starts first main continues. is there explanation this? this because thread.start first causes change of state of thread on called , os schedules execution whereas main thread running , not need these 2 steps . reason statement in main thread executes first rather 1 in newly created thread. keep in mind sequence of thread execution not guaranteed. thread.start method 1) thread.start method causes operating system change state of current instance threadstate.running. 2) once thread i

c++ - Windows Qt Invoke batch file and exit the App -

i developing application in windows8 using qt, need create updater it. have wrote update downloader part, , update script replace previous content newly downloaded data. now need execute bat file application itself, , exit app before script executed, because script going remove dlls , application binary running. how can resolve issue? thanks haris you can use qprocess::startdetached run instance of command prompt batch file argument in new process , detach it. after should exit application : qprocess::startdetached("cmd.exe", qstringlist() << "/c" << "path\\to\\mybat.bat"); qapp->quit();

Appium is not identifying the device -

i new appium. did set configurations , tried test samsung galaxy tab of android kitkat 4.4.2. device not getting identified appium. device getting identified android not appium.please me resolve issue. i giving coding here @beforetest public void setup() throws exception { /* * file classpathroot = new file(system.getproperty("user.dir")); file * appdir = new file(classpathroot, "../../../apps/apidemos/bin"); file * app = new file(appdir, "apidemos-debug.apk"); */ desiredcapabilities capabilities = new desiredcapabilities(); capabilities.setcapability("automationname","selendroid"); capabilities.setcapability(capabilitytype.version, "4.4.2"); capabilities.setcapability("devicename", "4d0001f745b350e1"); capabilities.setcapability("platformname","android"); capabilities.setcapability(ca

oracle - Redundant blank line in query result -

i have sql: with p_1 ( select 1 sorszam, 'x1' tipus dual union select 2 sorszam, 'x2' tipus dual union select 3 sorszam, 'x3' tipus dual ) select ( (case when p1.sorszam=1 ('[' || chr(13) || chr(10)) else '' end) || p1.tipus || (case when p1.sorszam=(select max(sorszam) p_1) (chr(13) || chr(10) || ']') else '' end) ) szoveg p_1 p1 order p1.sorszam the result is: szoveg -------- [ x1 x2 x3 ] my question is: why there blank line after first line? using set recsep off removes record separator. http://docs.oracle.com/cd/b19306_01/server.102/b14357/ch12040.htm#i2699269

spring - glassfish hangs on hibernate Using ASTQueryTranslatorFactory -

i working on android project following technologies : glassfish, hibernate, spring, rest services , android sdk. problem after few executed services android app rest services, service loading , nothing happen. when on glassfish log, there not error. log stays on using astquerytranslatorfactory , thats all. make things work need restart server. strange because happens after 5 or 6 transactions database. can me issue? thats on log after glassfish/spring/hibernate freezes [2015-06-03t16:52:08.211+0300] [glassfish 4.0] [info] [] [org.hibernate.cfg.configuration] [tid: _threadid=20 _threadname=http-listener-1(2)] [timemillis: 1433339528211] [levelvalue: 800] [[ hhh000043: configuring resource: /hibernate.cfg.xml]] [2015-06-03t16:52:08.211+0300] [glassfish 4.0] [info] [] [org.hibernate.cfg.configuration] [tid: _threadid=20 _threadname=http-listener-1(2)] [timemillis: 1433339528211] [levelvalue: 800] [[ hhh000040: configuration resource: /hibernate.cfg.xml]]

sql - PG::InvalidColumnReference: ERROR: for SELECT DISTINCT in Ruby on Rails app -

i have query looks this: person.where.not(first_name: nil).where.not("lower(first_name) = ?", 'mike').order('random()').limit(6).pluck("distinct(lower(first_name))") it returns me following error when try run it: activerecord::statementinvalid: pg::invalidcolumnreference: error: select distinct, order expressions must appear in select list line 1: ...and (not (lower(first_name) = 'mike')) order random() l... how can solve problem? person.where.not(first_name: nil).where.not("lower(first_name) = ?", 'mike').order('random()').limit(6).select("lower(first_name)").uniq since pluck fire query instead of pluck should use select

Ambiguity at Builder Design Pattern -

i have several questions on builder pattern. builder pattern uses several methods constructing instance of class , each method return this return value. my questions are: why each method return return type instance of same class? what benefit of pattern vs using setter method? you can implement builder pattern without having methods return this . advantage of having methods return instance of same class can chain methods together. example: return new objectbuilder().withwidget("a").withgadget(5).build(); the primary reason use pattern (over setters on constructed object) separate logic building object object itself. typically means built object has no public setters simplifies considerably. might need either complex constructors or protected setters support builder.

ios - Reflecting UIView changes after drawing -

how can reflect uiview changes of setneedsdisplay ? in drawrect triggered setneedsdisplay - (void)drawrect:(cgrect)rect { double = 0; for(...) //i incremented dispatch_after(dispatch_time(dispatch_time_now, (int64_t)(i * nsec_per_sec)), dispatch_get_main_queue(), ^{ drawstuff(element, context); }); for example, each draw update happen after 1s, 2s, 3s, ... drawstuff switches main thread dispatch_async(dispatch_get_main_queue(), ^(void) { ... when updating ui. have tried both uibezierpath , core graphics , same results. using uigraphicspushcontext , uigraphicspopcontext correct context. using nslog, can tell drawstuff called in 1s increments. however, visible uiview remains unchanged. can rotate device screen , reposition uiview , change size. on rotation uiview reflect has drawn, need rotate again see updated state after few seconds. back question above, there call tell uiview display current graphics after setneedsdispla

In SQLite in Cordova, why do I get "Error preparing SQLite statement" error? -

i'm working on windows 8 cordova app in visual studio 2015. right i'm trying test creating tables error. below in console log: adding proxy sqliteplugin open database: nanodb.db db name: nanodb.db @ full path: .[...] new transaction waiting open operation db opened: nanodb.db sql exception error: error preparing sqlite statement. sql exception error: error preparing sqlite statement. sql exception error: error preparing sqlite statement. sql exception error: error preparing sqlite statement. sql exception error: error preparing sqlite statement. sql exception error: error preparing sqlite statement. sql exception error: error preparing sqlite statement. this script i'm running inside after "deviceready" listener: var nanodb = window.sqliteplugin.opendatabase({ name: "nanodb.db" }) nanodb.transaction(function (tx) { tx.executesql(nanodb, "create table if not exists nanoinst (id integer primary key, api_id integer, name text)");

spring - How to transfer files in order (first come first serve) using apache camel -

in code there 2 types of files extension .csv or .psv , .tigger files. .csv files have more size .trigger files, .trigger files getting transfer in prior .csv files. how make sure once .csv files transferred .trigger files should transferred. am using same single route transfer both files. you can use sortby-option of camel file component. see http://camel.apache.org/file2.html more information.

Developing webapi in Grails using jaxrs plugin Spring Security settings needed -

i developing webapi using jaxrs plugin in grails project (existing) in there spring security configured not allowing me access api urls i.e /api/** i getting you not authorised access page though have logged in admin not able configure access path with/without authentication. i guess you're using spring security? authentication handled little differently when implementing rest api. check out excellent spring security rest plugin . there's nice documentation here explains authentication lifecycle.

printf - C format string when writing to file -

i'm having bit of noob confusion how use formated string when writing file, , more in general guess sprintf . #include <stdio.h> int main(int argc, char* argv[]) { file *fp; const char *exts = ".txt"; char *savetopath; sprintf(savetopath, "/path/to/my/file%s", exts); fp = fopen(savetopath, "w+"); fprintf(fp, "this testing fprintf...\n"); fputs("this testing fputs...\n", fp); fclose(fp); } i segmentation fault when trying formatted savetopath, if use plain string const char* "/path/to/my/file.txt" works. allocate memory savetopath variable e.g. char savetopath[100]; also, consider using snprintf avoid buffer overflows e.g. snprintf(savetopath, 100 ,"/path/to/my/file%s", exts); so make sure don't write beyond 100 bytes allocated savetopath

java - Retrieving Data from MySQL With Partial Data -

currently, use search field in java obtain information employee using mysql search outlined below: string sql = "select * cisdata name = ?"; pst=conn.preparestatement(sql); pst.setstring(1, searchpeoplefield.gettext()); rs=pst.executequery(); if(rs.next()) { string add1 = rs.getstring("monthyear"); ymfield.settext(add1); string add2 = rs.getstring("name"); namefield.settext(add2); string add3 = rs.getstring("referenceno"); ernfield.settext(add3); string add4 = rs.getstring("utr"); utrfield.settext(add4); string add5 = rs.getstring("verificationno"); vrfield.settext(add5); string add6 = rs.getstring("monthending"); mefield.settext(add6); string add7 = rs.getstring("gap"); gapfield.settext(add7);

python - How can I pass a variable in a decorator to function's argument in a decorated function? -

i in progress learn python. points me correct way. i'd below: def decorate(function): def wrap_function(*args, **kwargs): str = 'hello!' # want return function(*args, **kwargs) return wrap_function @decorate def print_message(): # i'd pass 'str' mentioned above # functions' argument below: print(str) # 'str' same above any idea? in advance. you can't pass own name, can add keywords. def decorate(function): def wrap_function(*args, **kwargs): kwargs['str'] = 'hello!' return function(*args, **kwargs) return wrap_function @decorate def print_message(*args, **kwargs): print(kwargs['str']) alternatively can name own argument: def decorate(function): def wrap_function(*args, **kwargs): str = 'hello!' return function(str, *args, **kwargs) return wrap_function @decorate def print_message(str, *args, **kwargs

html - PHP mail Form redirect URL doesn't work. Webpage is here. (Tried other "SOF" answers) -

first of all, have this.i used "wix" website since doesn't have function [img] tag percentage width.so have started making own website, , that's 1month ago, when knew how [img src], without other html knowledge. forced myself make myself can make website want, , seems done uploaded on hosting server. the problem is, in 'order page', after filling out form, , press 'submit button', doesn't show page attended show. turns out first part of order page. the code tried if(isset($_post['submitted'])) { if($formproc->processform()) { $formproc->redirecttourl("http://ljhbunkercom.ipage.com/index/thank-you.php"); } when filled form gets submitted submit button, sends every information mailbox, thank-you.php doesn't show up. i tried if(isset($_post['submitted'])) { if($formproc->processform()) { $formproc->header("location: http://ljhbunkercom.ipage.com/index/thank-you.php

asp.net mvc - MVC index method with change to viewmodel -

i want know best way of writing index method in mvc when need make changes model before passing view. i picked technique somewhere can pass in model intend pass view, , make changes it, have noticed model binding kicks in when passing index method, , validation fires, when there no need because initial load. for example, more correct: public actionresult index(viewmodel model) { model.someproperty = "mynewvalue"; return base.index(model); } or public actionresult index() { viewmodel model = new viewmodel(); model.someproperty = "mynewvalue"; return base.index(model); } and there should know implications of using either one? with initial loads, latter makes more sense. controllers in mvc newed each , every single time use them. there no persistence whatsoever. first option, http requests need pre-existing knowledge of api. so, recommendation have view model come persistence layer. public actionresult index() {

Subsetting and Indexing in For Loop in R -

i trying collect n number of smallest values in dataset sorted rank. here code: testscript <- function(num) { df <- data.frame(state = paste0("state",sort(rep(1:2,10))), city = rep(paste0("city",rep(1:10,2))), value = runif(n=20)) vec <- null df$rank <- ave(df$value, df$state, fun=rank) (i in 1:num) { vec[i] <- df[df$rank==[i],] } } the argument num number of smallest values want collect. when run function, following error: error: unexpected '[' in: "for (i in 1:num) { vec[i] <- df[df$rank==[" if wanted n smallest values in dataset sorted rank, can order , head functions -- no need for loop: num <- 10 head(df[order(df$rank),], num) # state city value rank # 7 state1 city7 0.1075155728 1 # 19 state2 city9 0.0008769566 1 # 5 state1 city5 0.2829263743 2 # 17 state2 city7 0.0407836910 2

javascript - I want to Show the Hidden Shrunken Header and Not Shrink The Already Visible Header -

http://callmenick.com/post/animated-resizing-header-on-scroll im using method,... how edit jquery , css give me small version of header @ top of page once hit scroll point top, making disappear when scrolling top, instead of shrinking , growing bigger header in tutorial? here js way: <!-- js --> <script src="http://dageniusmarketer.com/wordpress/wp-content/classie.js"></script> <script> function init() { window.addeventlistener('scroll', function(e){ var distancey = window.pageyoffset || document.documentelement.scrolltop, shrinkon = 265, header = document.queryselector("header"); if (distancey > shrinkon) { classie.add(header,"smaller"); } else { if (classie.has(header,"smaller")) { classie.remove(header,"smaller"); } } });