Posts

Showing posts from January, 2015

Sorting multi-dimensional associative array in PHP -

i have php array looks this: array (size=1) 'marriot' => array (size=7) 0 => string 'doc5.txt' (length=8) 1 => string 'test.txt' (length=8) 2 => string 'test1.txt' (length=9) 3 => string 'test2.txt' (length=9) 4 => string 'test3.txt' (length=9) 5 => array (size=1) 'special docs' => array (size=2) 0 => string 'doc4.txt' (length=8) 1 => string 'doc3.txt' (length=8) 6 => array (size=1) 'adocs' => array (size=0) empty as can see, holds non-associative files, , 2 folders, "special docs" , "adocs". problem two-fold: first, want move 2 folders top of array prominent in view. second, want sort folders alphabetically (i.e. put "adocs" above "special docs". have tried array_multis...

java - Dependency management for SLF4J and Logback -

i'd start using slf4j logback. read on logback's online documentation , ready add jars repo , try out. but i'm @ loss! jars need? downloaded latest slf4j (1.7.5) , expected see something slf4j-logback.jar , don't see of sorts. i've read logback contains "native implementation" of slf4j, don't know means, or if implies don't need slf4j-api-1.7.5.jar on classpath. so ask: use latest logback (1.0.13), jars need? took @ maven central repo for logback 1.0.13 , don't see dependencies listed, didn't me @ all. in advance! you need add logback-classic pom <dependency> <groupid>ch.qos.logback</groupid> <artifactid>logback-classic</artifactid> <version>1.0.13</version> </dependency> it transitively add <dependency> <groupid>ch.qos.logback</groupid> <artifactid>logback-core</artifactid> <version>1.0....

ios - iphone push didn't receive (Window Server/IIS/PHP) -

first of all, not problem certification or dev/distribution. i used distribution certification, , server url -> gateway.push.apple.com:2195 i tested in local server(apache2), , work! however, in real server(iis/window server) used same php code, same certification file(.pem), , same iphone application... etc, printed "connected apns message delivered", phone didn't receive message. one suspect is, tested certification file(.pem) cmd command line 'openssl s_client -connect gateway.push.apple.com:2195 -cert xxxx.pem', returned "verify return code: 20 (unabled local issuer certificate). found solution downloaded entrust certification(.cer) , did "openssl s_client -connect gateway.push.apple.com:2195 -cert xxxx.pem -cafile entrust_2048_ca.cer", , returned 'verify return code :0'. added php code 'stream_context_set_option($ctx, 'ssl', 'cafile', 'entrust_2048_ca.cer');', didn't work same problem. ...

android - recvmsg return error(EBADF) when communicate between two processes using socketpair? -

i'm developing program ipc's call between 2 processes.i create 2 socket fd using socketpair : int fds[2] = {-1,-1}; if (socketpair(af_local, sock_stream, 0, fds)) { return null; } in process a(with system permission), send integer(handle) send (using fd[0]) function: int sock_send_all(int sock_fd, const uint8_t* buf, int len) { int s = len; int ret = send(sock_fd, buf, s, 0); ... } in process b(with user permission), wait receive handle recvmsg (using fd[1]): ret = recvmsg(fd, &msg, msg_nosignal); problem occurs in here: recvmsg return -1 errorno equals 9(ebadf)! i have surfed web long time try find answer no helpful information. have hints or suggestions? thanks! is issue process privilege level? or should use setsockopt set something? unless there ibinder don't know, handles in 1 process aren't valid in process. why can't keep using original socket?

java - Instantiate parameterized type using Class.forName -

i have following classes: public class b { } public class a<b> { } how instantiate class a using class.forname , given have 2 string variables: string classnamea = "a"; string classnameb = "b"; due type erasure , there won't generic classes @ run time. for instance, following piece of code output class java.util.arraylist without generics: list<string> list = new arraylist<string>(); system.out.println(list.getclass());

php - Sessions not ending on all pages -

i'm trying create online sign system. purpose user can create event , members can sign them. i've got log in system i'm using when try log user out doesn't end session stores username on pages. when creating sign sheets new page made, it's on page session becomes stuck , won't change, when log in different user or log out. i'm still new php, works fine apart session. appreciated. sorry essay. page creates sign sheets <?php session_start(); $sitename = $_post['ename']; $title = $_post['ename']; $sdate = $_post['sdate']; $endate = $_post['endate']; $exdate = $_post['exdate']; $desc = $_post['desc']; $pname = $_post['ename']; $user = $_post['user']; $date = date('y-m-d'); if($exdate >= $date && $sdate <= $endate && $sdate > $exdate && !empty($title)) { $con=mysqli_connect("localhost","emuas"...

jquery - How to change DOM as 'if/else' statements are true individually, and also set variable to true if all if statements are true? -

wasn't sure how phrase question per usual. i've been working on password validation while (few previous questions on it) , i'm getting closer. i have html list showing rules password: <form id="form-password-change" method="post" action="/notrelevantrightnow"> <div class="control-group"> <label class="control-label" for="input-username">{{label_username}}</label> <div class="controls"> <input type="text" id="input-username" name="username" class="required" value="{{username}}" autocomplete="off"> </div> </div> <div id="password-info"> <ul> <li id="length" class="invalid">password must 8 characters</li> <li id="letter" class="invalid"...

regex - DataAnnotation TextArea Multiple Emails -

i using mvc 3. i have text area in user can enter multiple emails addresses. emails can separated comma , space. user may hit enter in box well. is there attribute can handle scenario? i using regular expression check characters , failing "abc@abc.com, tyz@tyz.com" here regular expression: [regularexpression(@"([a-za-z0-9 .@-_\n\t\r]+)", errormessage = validationmessageconstants.emailadressinvalid)] what missing here? regular expression off following post: dataannotations validation (regular expression) in asp.net mvc 4 - razor view you not stating question is, have assume answer data annotations aren't working expect. having assumption in mind, easy why not working: data annotation operates on entire field, text area in case. work expected if have 1 email. since have multiple emails in field, separated comma or space, field in entirety doesn't reflect data annotation email prescribes , fails. to answer numbered questions: no,...

Pentaho xaction - How can I change database name on runtime? -

i using pentaho design studio(pds-ce-win-32-4.0.0-stable). in xaction file need change database name in url jdbc:sqlserver://ip:1433;databasename=??????;integratedsecurity=false i generated output result set column holds url. when run xaction url shown output. when use result set column database url of next process doesnt work. not sure why use url pattern, in xaction far used jndi name db resource: <jndi><![cdata[tsi_test_blade4]]></jndi> and can replaced variable: <jndi>{jndddi}</jndi> so jndi pass parameter resource used.

android - SMS does not get sent -

this question exact duplicate of: sms sender app - sms not getting sent [closed] 4 answers i trying make sms sending app sms not sent. please guide. package com.example.smsbomber; import android.r.string; import android.app.activity; import android.os.bundle; import android.telephony.smsmanager; import android.view.menu; public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); sendlongsms(); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); return true; } public void sendlongsms() { string phone ="03322044685"; smsmanager smsman...

java - Code throws SEVERE: No value specified for parameter 1 excetion -

i trying find list of items database throws exception. code , error following , field types correct. code system.out.println("2"); try { ps = con.preparestatement("select * users name = ?);" resultset r = ps.executequery(); ps.setstring(1, "jack"); resultset result = ps.executequery(); .... } catch (sqlexception e) { system.err.println(e.getmessage()); system.out.println(e.getstacktrace()); } output info: 2 severe: no value specified parameter 1 info: [ljava.lang.stacktraceelement;@6520c5b you're calling resultset r = ps.executequery(); before setting parameters on preparedstatement . typo when coding method since have similar line below setting parameters on preparedstatement . ps = con.preparestatement(...); //comment line // resultset r = ps.executequery(); ps.setstring(1, "1"); //... resultset result = ps.executequery();...

html - CSS Table layout. Good way to accomplish this -

Image
i wondering how can take css seriously. i'm clean developer css seems smell. want create layout extending thing made javascript. can show me solution in css how can accomplished. forget gradients , text color etc. maybe need in future take work credits. <div class="faq"> <div class="faq-header"> <div class="help-title-label">questions , answers</div> </div> <div class="faq-entry"> <div class="faq-question"> <div class="faq-question-left"> <div class="faq-question-state">+</div> </div> <div class="faq-question-right"> <div class="faq-question-txt">my question text</div> </div> </div> <div class="faq-answer"> <div class="faq-answer-left...

javascript - Remove specified element from associated array -

hi looking ways delete elements associate array. need remove values null , '' while in loop. cant because know need identify , build array store, use elements in new array seek , remove them. var storedata3 = [ { 'key' : 'value1' }, { 'key' : 'value2' }, { 'key' : 'value3' }, { 'key' : null }, { 'key' : '' }, { 'key' : 'value10'} ]; try this:- using array.filter data after omitting unwanted data. var result= storedata3 .filter(function(val){ return (val.key != '' && val.key != null)}); .filter() fiddle

How to pass url to read png files in php -

if do $dir = './'; $files = glob( $dir . '*.png'); foreach( $files $file) { echo $file; } ?> and store php file in same folder images correct png files. if change location of php file how can read png files located in other folder? if do $dir = 'www.site.com/content/images'; $files = glob( $dir . '*.png'); foreach( $files $file) { echo $file; } it not display anything, necessary php file code in same folder of images? you shouldn't add "www.site.com" path. should use absolute path root of server (beginning "/" : /content/images ) or relative path current location of php script ( content/images ).

knockout.js - KnockoutJS Validation|Mapping Custom message does not work -

i create simple model mapping knowkoutjs , want validate it. even if specify validation message, default message still displayed. ko.validation.configure({ parseinputattributes: true }); var data = { name: "joe shmo", email: "joe@shmo.com" }; var validationmapping = { 'name': { create: function(options) { return ko.observable(options.data).extend({required: true,message:"name required"}); } } } var viewmodel = ko.validatedobservable(ko.mapping.fromjs(data, validationmapping)); ko.applybindings(viewmodel); here fiddle thanks help. yoann i found way, mistake, syntax of validation mapping wrong. there syntax : var validationmapping = { 'name': { create: function(options) { return ko.observable(options.data).extend( { required:{ params:true, message:"name required" } }); } } } ...

cordova - "Unable to locate tools.jar" while the environment variables are correct -

i want configure pc (windows 7) use phonegap 2.7.0 , create android application according tutorial m confirured enviroment variables. below variables need on configuration shown in command prompt: microsoft windows [version 6.1.7601] copyright (c) 2009 microsoft corporation. rights reserved. c:\users\adokis>echo %path% c:\program files (x86)\amd app\bin\x86_64;c:\program files (x86)\amd app\bin\x86 ;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\win dowspowershell\v1.0\;c:\program files (x86)\ati technologies\ati.ace\core-static ; c:\users\adokis\development\adt-bundle-windows-x86_64-20130514\sdk\platform-to ols;c:\users\adokis\development\adt-bundle-windows-x86_64-20130514\sdk\tools;c:\ users\adokis\development\apache-ant-1.9.0\bin;c:\program files\java\jdk1.7.0_17 c:\users\adokis>echo %java_home% c:\programs files\java\jdk1.7.0_17 c:\users\adokis>echo %ant_home% c:\users\adokis\development\apache-ant-1.9.0 c:\users\adokis> the p...

Playing Background sound in Android -

i trying play background sound runs throughout application. here have 3 activities , sound started when main activity launches. want achieve these: 1) play bg sound continuously throughout app whatever activity loads. 2) switch off sound when user clicks sound off button. 3) stop sound when app closes. so far have tried code start sound keeps on playing if app closed. protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); audioplayer(); } boolean isplayingsound = true; public void onclicksound(view view) { final button btn1 = (button) findviewbyid(r.id.button3); if(isplayingsound){ btn1.setbackgroundresource(r.drawable.sound00); isplayingsound=false; audioplayer(false);/*sound doesn't stops here*/ } else{ btn1.setbackgroundresource(r.drawable.sound11); isplayingsound=true; audioplayer(true); } } public vo...

mysql - How to find records of a column if the data type of a column has been changed using a where condition -

to know data types of columns in table are, use 'desc schema.table_name' . if particular column's data type has been changed character numeric . how check if there records in table data type character. i see select distinct column_1 schema.table_name gives distinct values in column but can check if data type of 'character' got table using where condition? if using sql. can use query. select column_name table_name column_name not [0-9]

user profile - Setting up employee resource management system -

how can set employee resource management system highlight employee's skills , projects working? ]project-open[ open-source project management system supports skill management , resource management in version 4.0. in understand "highlighting" skills , project refer sort of report list employees , skills per project, can draw kind of conclusion skills associated specific projects, right? the problem necessary data system, though... affiliation note: i'm member of ]po[ team.

linux - Zend_Form validate crashing PHP -

running php 5.4.15 / zf 1.12.3 (upgraded 5.4.12 or 13 believe). running nginx w/ php-fpm, tested apache. note : appears related apc. highly prefer apc, , cannot use eaccelerator because of issues w/ doctrine , doctype entity declarations. when validating form, causing signal 11 sigsegv across board (different versions). running form validate inside of html template (shouldn't problem) $p = zend_controller_front::getinstance()->getrequest()->getparams(); if (!$form->isvalid($p)) { .. } i dumped out backtrace. #0 _zend_mm_free_int (heap=0x22f8800, p=0x28d4130) @ /root/php-5.4.15/zend/zend_alloc.c:2100 #1 0x000000000079aefb in zend_hash_destroy (ht=0x28e6cf0) @ /root/php-5.4.15/zend/zend_hash.c:560 #2 0x000000000078b657 in _zval_dtor_func (zvalue=0x28e6c30) @ /root/php-5.4.15/zend/zend_variables.c:45 #3 0x000000000077dee0 in _zval_dtor (zval_ptr=0x28e83a8) @ /root/php-5.4.15/zend/zend_variables.h:35 #4 _zval_ptr_dtor (zval_ptr=0x28e83a8) @ /root/php-5.4.15/...

c# - Error in Microsoft Enterprise Library 6 Unitycontainer -

i using following code in project enterprise library 6 , error : "the type or namespace name 'enterpriselibrarycoreextension' not found " how fix error ? var container = new unitycontainer().addnewextension<enterpriselibrarycoreextension>(); container.registertype<ilog, logger_enterprise>(); var logger = container.resolve<ilog>(); logger.log("message"); according grigori melnik on release announcement page , the enterprise library blocks no longer use unity container resolve instances. should remove calls addnewextension method of unity container code. if application resolves enterprise library objects container, must either manually register required types in unity container, or modify application use static facades in blocks configure , retrieve enterprise library objects application uses. also, other changes, don't forget check out change log , migration guide .

Create DataSource using JBoss 7 JNDI and Spring -

i first time making webapp jboss server. jboss have jndi details, wondering how create datasource using in spring application context. if has example create connection, please share it. i put sample here. just show way it. <bean id="datasource" class="org.springframework.jndi.jndiobjectfactorybean"> <property name="jndiname"> <value>java:jboss/datasources/dsname</value> </property> </bean>

oracle - disabling constraints will affect indexes -

i have migrate records 1 db db. involves 200+ tables. migrating records use exp/imp feature of oracle. to avoid constraint violation errors disable constraints before importing data. once done enable constraints. , in export not exporting source db indexes. so, questions here are when disable constraints respective indexes disabled? it won't indexing @ all? will index rebuilds indexes when enable constraints after importing data? if you're on 10g or above use data pump, , these no longer issues have address. data pump import , export allow greater control on type of object include, can choose not import indexes if not want them: http://docs.oracle.com/cd/e11882_01/server.112/e10701/dp_import.htm

Prolog - deconstructing goals into individual facts and arithmetic -

i'm attempting write small program breaks given goal smallest parts , evaluates them. far have: alien(x) :- frommars(x), fromsaturn(x); fromjupiter(x), x = 'john'. frommars(john). fromsaturn(john). fromjupiter(john). test(true) :- !. test((goal1,goal2)) :- test(goal1), test(goal2). test((goal1;goal2)) :- test(goal1), test(goal2). test(x = y) :- call(x = y). test(goal) :- clause(goal,body),test(body). as far can tell far, recursively inspect rules using clause/2 e.g. if call test(alien(john)). . when reaches point body contains facts such frommars(x), fromsaturn(x); fromjupiter(x), x = 'john' split using test((goal1,goal2)) :- , test((goal1;goal2)) :- rules, reaching singular facts. when passed singular fact, clause/2 instantiate body true if can solved. problems arise arithmetic. in above program, there singular goal x = 'john' causes error clause/2 (private procedure?). introduced rule test(x = y) :- catch case can deal way. want rule ca...

ios - change colors in image objective c -

i have black , white image, change black in blue color , white in yellow color(for example) in objective-c. how ? thanks you can use core image this. uiimage *bwimage = ... // image somewhere cgimageref bwcgimage = bwimage.cgimage; ciimage *bwciimage = [ciimage imagewithcgimage:bwcgimage]; cifilter *filter = [cifilter filterwithname:@"cihueadjust"]; // change float value here change hue [filter setvalue:[nsnumber numberwithfloat:0.5] forkey: @"inputangle"]; // input black , white image [filter setvalue:bwciimage forkey:kciinputimagekey]; // output filter ciimage *hueimage = [filter valueforkey:kcioutputimagekey]; cicontext *context = [cicontext contextwithoptions:nil]; cgimageref cgimage = [context createcgimage:hueimage fromrect:[hueimage extent]]; uiimage *coloredimage = [uiimage imagewithcgimage:cgimage]; cgimagerelease(cgimage); see documentation more info: core image filter reference

mysql - Get entries which share other entires in an associated table? -

i have 2 tables: users , interests. interests consists of interest (e.g. "football") , user id. i query user , other users shares @ least 3 interests don't know how efficiently. how write sql "get user's interests , fetch other users shares @ least 3 of interests"? thanks. select i.interest, i.user_id, count(*) amount # , u.username interests left join interests i2 on i.interest i2.interest # left join users u # on i2.user_id = u.id i.user_id = 1 group i.interest having amount >= 3 this asume have users (id, username) , `interests (interest, user_id)´. uncomment including username. consider having interests id references instead of varchar . it's more logical maintain.

objective c - Measure the memory usage of an UIImage array -

i implementing custom control present images, , control uses array store either uiimage or nsstring object. want implement such kind of mechanism:if memory usage high, control write big uiimage objects files, replace uiimage objects corresponding files path( nsstring objects). so question how mesure memory usage of uiimage ? thanks! whenever code utilizes memory portion generates problem ios calls - (void)didreceivememorywarning method. conversion part you'll have in method.

objective c - Can't convert hex color to rgb because of int representation -

i'm downloading hex color web , when try convert rgb it's not working. i'm using function: #define uicolorfromrgb(rgbvalue) [uicolor colorwithred:((float)((rgbvalue & 0xff0000) >> 16))/255.0 green:((float)((rgbvalue & 0xff00) >> 8))/255.0 blue:((float)(rgbvalue & 0xff))/255.0 alpha:1.0] i think problem when value internet (for example 000) when convert int can pass argument function above, int represented 0 function doesn't recognize color. same thing example 090 when in int 90. you need think of hex colour string , process each component separately. the colour #3b9 has digits "3" "b" , "9" however, looking here see 3 digit representation, characters doubled. so in case colour #33bb99: red = 3*16+3 = 51 green = 11*16+11 = 187 blue = 8*16+8 = 136 alpha = 255 so colour '#3b9' become: [51/255.0, 187/255.0, 136/255.0, 1.0] so should first determine if string representing colours in c...

java - ProcessBuilder keep process window from closing -

i using processbuilder execute program. when execute process program opens up, runs scripts , closes. keep program open after execute process. such thing possible? code similar implementation in separate thread processbuilder pb = new processbuilder("b32", "aess" ); pb.start(); of course inputstream , errors streams output console.

c# - Create Access Token using Dotnet Open Auth -

i have website contains lot of user informations. want share client website through proper authentication. going develop api using asp.net mvc 4, selected dotnetoauth providing authentication. if website want access data website, have register developer website, after registration website generate consumer key , secret key . after registration, each api request client pass these keys. done. using consumer key , secret key, client send api request , if valid token not available in request, redirect login page. after successful login, token generate , client can use token furthor request expiry. anybody have idea creating token based on consumer key , secret key of dotnetoauth . iam using asp.net mvc thanks in order create access token using dnoa, should implement interface iauthorizationserverhost. method createaccesstoken responsible of creating token. i recommend download dotnetopenauth samples, , have 'oauthauthorizationserver' project. hope help...

image - Android - How to display 4 text views with Icons? -

Image
i want display 4 texts images showed in screenshot: notice 4 texts @ buttom of image, icons next them. my question how do it, mean, how attach icon each text field , display symmetrically @ bottom of page. i want position texts icons example. thanks help, it's great exercise newbie :) dvir use drawableleft this <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableleft="@drawable/icon_1" android:gravity="center_vertical" android:textstyle="bold" android:textsize="24dip" android:maxlines="1" /> or in java code textview textview = (textview) findviewbyid(r.id.yourtv); textview.setcompounddrawableswithintrinsicbounds(r.drawable.icon_1, 0, 0, 0);

reporting services - How to register custom data provider in C# -

we have middle tier provide data. trying write custom data provider. have overriden intefaces of system.data namespace idbcommand, idbconnection , generated dlls. we wanted register dll.so, should listed in data source type window of ssrs. we not able register it. can help? development setup on development machine, dll data extension needs installed in visual studio directory. like: c:\program files (x86)\microsoft visual studio 8\common7\ide\privateassemblies in same folder need add data extension rsreportdesigner.config follows: in <extensions> <data> section, add following line: <extension name="mydataextension" type="my.name.space.mydataextensionclass"/> in <extensions> <designer> section, add following line: <extension name="mydataextension" type="microsoft.reportingservices.querydesigners.vdtquerydesigner,microsoft.reportingservices.querydesigners"/> you need add full...

how to handle multi-release of a project -

i have maintain 3 separate releases of project, (1) development (2) uat (3) production. each have separate db, servers, , machines. project same 1 3 releases based on. now best way handle below: do need 3 separate cvs repositories ? when applying fixes ? how maintain fixes , applying 1 one in long run, how keep them separate if issue appear on 1 place , should not effect others, or apply fix @ 1 place only. thanks if difference between these 3 environments in settings database servers or other configurations, can still keep code in same repository or branch easy maintenance. instead, have having configuration file different settings different environments. example, practice or concept used in zend framework project. application.ini ; production site configuration data [production] webhost = www.example.com database.adapter = pdo_mysql database.params.host = db.example.com database.params.username = dbuser database.params.passw...

c# - Null reference when passing an array to a stored procedure -

i following error: system.nullreferenceexception: object reference not set instance of object. when try run unit test: [testmethod] public void testdecreasetutorarea() { helpwith info = new helpwith(); info.subcategories[0] = 1; info.userid = 14; tutorservice tutorservice = new tutorservice(); tutorservice.decreasetutorarea(info); } the helpwith class looks this: public class helpwith { public int userid { get; set; } public int[] categories { get; set; } public int[] subcategories { get; set; } } does know i'm doing wrong? seems me made clear info-subcategories is. you haven't initialized arrays size. , trying access element info.subcategories[0] = 1; that why getting exception. initialize them size before using or in constructor. public void testdecreasetutorarea() { helpwith info = new helpwith(); info.subcategories = new int[10]; //here i...

.htaccess - Using regular expression in htaccess for 301 redirects -

i have wordpress blog redirecting blog posts old blog new blog in format below: the old blog called 'news' , new blog called 'blog' - both exist on same domain in subdirectory indicated below. old 'news' blog structure http://www.site.com/news/new-android-os-3431 new 'blog' blog structure http://www.site.com/blog/new-android-os essentially redirect needs 2 things:- redirect 'blog' directory retain post name in same structure remove last set of numbers @ end of url i have around 900+ posts need setup redirects - know manually add each 1 in take time. indicate if using regular expression directly within htaccess file minimise process. my htaccess looks this: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase /news/ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /news/index.php [l] </ifmodule> end wordpress ...

java - Filter twitter4j stream -

i'm trying filter twitter4j stream following code : twitterstream twitterstream = gettwitterstreaminstance(); // listener twitterstream.addlistener(listener); // filter filterquery filtre = new filterquery(); string[] keywordsarray = { "iphone", "samsung" }; filtre.track(keywordsarray); twitterstream.filter(filtre); // listening twitterstream.sample(); but result is, example : 27/59 - "taking risk on means want more anything" 28/63 - more attractive are, more awkward am. 29/64 - thing pain demands felt and don't recover keywords want follow, problem ? you don't need: twitterstream.sample(); if remove it, should start seeing tweets matching filter query. when invoke filter listener receive filtered tweets, because invoke sample replacing filtered-stream listener receiving sample steam, random selection tweets. so in other words call either sample or filter , not both. ...

validation - How to customize the error message on programmatically created LongRangeValidator? -

i created long range validator not able find way customize corresponding message text. using jsf 2.x , apachemyfaces. in advance. if ((integerfield.getmaximalvalue() != null) && (integerfield.getminimalvalue() != null)) { // serverside validation required long maximum = integerfield.getmaximalvalue().longvalue(); long minimum = integerfield.getminimalvalue().longvalue(); validator validator = new longrangevalidator(maximum, minimum); inputinteger.addvalidator(validator); } use uiinput#setvalidatormessage() . inputinteger.setvalidatormessage("please enter value in range");

asp.net mvc 4 Send form from site to email -

Image
i have feedback form on mvc site, looks like and need send form email. i created model form using system; using system.collections.generic; using system.linq; using system.web; namespace componenttrading.web.models { public class feedbackform { public string name { get; set; } public string email { get; set; } public string phone { get; set; } public string message { get; set; } } } i created view form contacts.cshtml @using (html.beginform("contacts", "home", formmethod.post, new { id = "contact-form" })) { <fieldset> @html.textboxfor(model => model.name, new { @value = name }) @html.textboxfor(model => model.email, new { @value = "e-mail" }) @html.textboxfor(model => model.phone, new { @value = phone }) @html.textareafor(model => model.message, new { @class = "img-shadow" }) <input class="form-button" data-type="reset" value...

javascript - Whats a simple way to get a text input Alertdialog box on an Android -

i want password. simple text input dialog box. simple way this? in iphone creates this. style : ti.ui.iphone.alertdialogstyle.secure_text_input but in android how can thi?? currently appcelerator not provide such facility. can in simple way using view, textfield , button follows var vwalert = ti.ui.createview({ backgroundcolor : '#311919', width : '90%', height : '40%', layout : 'vertical', borderradius: 5 }); var lblmessage = ti.ui.createlabel({ text : 'alert', top : 10, color : 'white', font : {fontweight : 'bold', fontsize : '16'} }); var textfield = ti.ui.createtextfield({ width : '90%', top : '20', passwordmask: true, hinttext : 'enter text here', borderstyle : ti.ui.input_borderstyle_rounded, returnkeytype : ti.ui.returnkey_return, max...

android - dynamically adding views and toasting it -

i'm adding views dynamically. mean that, there 1 edittext , button add , button submit . 1.onclick of button add i'm inflating new layout has 1 edittext and button remove . if button add keep on pressed add inflated layout respectively. 2.onclick of button submit has toast edittext values of inflated layout. i'm getting last edittext toast, , toast rest of edittext didn't show. how this? public class mainactivity extends activity implements onclicklistener { button add, submit; arraylist<view> viewlist; linearlayout lin_layout; edittext et1, et2; string s1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); et1 = (edittext) findviewbyid(r.id.edittext1); add = (button) findviewbyid(r.id.button_add); submit = (button) findviewbyid(r.id.bsubmit); lin_layout = (linearlayout) findviewbyid(r.id.linearlayout_view); viewlist = new arraylis...

java - PreUpdate listener triggered during empty update -

i have entity last modified attribute: @temporal(temporaltype.timestamp) private date lastmodified; @preupdate @prepersist protected void onupdate() { lastmodified = new date(); } and named jpql update query, sets attributes old entities: update entity e set ... e.lastmodified < :threshold the onupdate() method called entities, has not been modified, event if: entitymanager.createquery("...").executeupdate(); returns 0 number of updated entities. can update old entities without touching recent ones? threshold parameter not known in updated entity, cannot move update onupdate() method. can native query me in this? why don't replace @preupdate/@prepersist mechanism @version on lastmodified field ? way updated entity have field set (and updated ones). it should make job expect if understood case.

codeigniter - php escape characters, replacing string content with image source tag -

<?php echo anchor($this->lang->switch_uri($switchlang), "switch language" ?> i want replace switch language message country flag. how can escape characters , display img src inside string message <?php echo anchor($this->lang->switch_uri($switchlang), "<img src='/somepath.jpg')"; ?> thanks try this: <?php echo anchor($this->lang->switch_uri($switchlang), "<img src=\'/somepath.jpg\'"); ?> moved trailing double quotes inside bracket added escape slashes single quotes

In Powershell -- Export object to textfile in custom format -

since, beginner, 've no hands-on powershell programming.although had script developed insert data array csv file follows: #following array $inventoryreport = new-object -typename psobject -property @{ computername = "1mycomputername" domainname = "2mycomputerdomain" manufacturer = "3mycomputermanufacturer" } #now export data csv, using following: $inventoryreport |select-object -property computername, domainname, manufacturer | export-csv -path "c:\abc.csv" -notypeinformation -erroraction stop #this works fine and output of above : "computername","domainname","manufacturer" "1mycomputername","2mycomputerdomain","3mycomputermanufacturer" .... now, don't want , want ouput appear in columnar fashion i.e. "computername","1mycomputername" "domainname","2myco...

JSF best practices : One form for the whole application or a few smaller forrms? -

what best practice in jsf , create 1 main <h:form> in template example , put content inside or have few forms each parts, example if have 2 logical blocks of code on page should have wrapped these blocks in 2 separate forms ??? this overly broad question, , has nothing di jsf. question of html understanding , design. if abstract away of jsf details, you'll find out rendered component plain html <form> . recall specification , form is: a section of document containing normal content, markup, special elements called controls (checkboxes, radio buttons, menus, etc.), , labels on controls. users "complete" form modifying controls (entering text, selecting menu items, etc.), before submitting form agent processing (e.g., web server, mail server, etc.) so a whole form submitted server. in case of component-based framework, jsf, bound values of components populate backing beans submitted data, in case there no errors. but data submitted? da...

iphone - Generating the tableview in this format Category/subcategoy/subcategory -

i having requirement using tableview have give categories & in every category there subcategory , in every subcategory there subcategory list there.but every subcategory wont have subcategories not mandetory few subcategory has subcategories. in format in need display tableview.. for example: row 1 subdetails 1 subsubdetails 11 subsubdetails 12 subsubdetails 13 subdetails 2 subdetails 3 row 2 subdetails 1 subsubdetails 11 subsubdetails 12 subsubdetails 13 subdetails 2 subsubdetails 21 subsubdetails 22 subsubdetails 23 subdetails 3 subsubdetails 31 subsubdetails 32 subsubdetails 33 please me overcome problem. you can subclass uitableviewcell. in can create views depending on data. in heightforrowatindexpath: calculate height data. dynamic depending on number of subcategories.

google analytics - HTML Form Submit Button Not Passing HTTP_Referrer Info -

i looking site's google analytics code , realized a lot of pages show when site visitor clicks on html form submit button ( ) being logged direct visitors. since these pages not show unless visitor clicks on form submit button, reason why these pages show landing page direct visit because referrer details not being tracked. could me out on how can fixed? in advance can't begin tell why referrer details not being tracked, without posting or pointing code.. in general can specify referring url _setreferreroverride()

vb6 - I want to call java servlet from vb 6.0 button -

i want call java servlet from vb 6.0 code. have tu use url of servelet on remote machine , display message after execution of program. private sub command3_click() dim req winhttp.winhttprequest dim buffer variant set req = new winhttp.winhttprequest req.settimeouts 1800000, 1800000, 1800000, 1800000 req.open "post", "http://www.google.co.in", false buffer = "tusharp 0" req.send cmbuffer debug.print req.responsetext end sub try this.....

croping Text Images From Pdf File in C# -

Image
i have pdf documents contains questions multiple answers. , questions , options of questions images or u called them text images or sketches. doing extracting questions , options. how can extract these sketches or text images . i thinking questions sketches or text images should croped pdf document have no format .some times questions text , times images how can these images , if able crop images how coordinates sharing pdf file's image .

Android studio, gradle and NDK -

i new whole gradle , android studio support. have managed convert android project gradle using export option. but looking documentation or start point how integrate ndk build gradle build process. if possible need sort of "after" stage copies build binaries (.so files) asset directory. we have released first version of integration preview in 1.3: http://tools.android.com/tech-docs/android-ndk-preview the integration stay preview after 1.3 becomes final. no current eta when it'll final (as of 2015/07/10). more information here: http://tools.android.com/tech-docs/android-ndk-preview

self extracting - How do i protect my sfx from being opened by other winrar, winzip, 7zip applications? -

how protect sfx being opened other applications winrar, winzip, 7zip, etc? i want add password if opened other applications winrar? my sfx should never ask password if directly executed. i tried creating password using winrar sfx prompt password upon execution. i agree elektro hacker. perhaps need different approach , winrar not need. believe need portableapps or boxedapp, spoon one.

angularjs - can i use angular js with kendoUi wrappers? if yes how? -

i have 3 questions can use angular js kendoui wrappers? if yes how? if using angular js , kendo-all.min.js on same html tag let converting input tag auto-complete , @ same time binding ng-model possible affect can produce in each other? what angular-kendo is? code point no-2 <script src="~/scripts/jquery-1.7.1.min.js"></script> <script src="~/scripts/kendo/kendo.all.min.js"></script> <script src="~/scripts/angular/angular.js"></script> <script src="~/scripts/angular/app.js"></script>*@ <script type="text/javascript"> $(document).ready(function () { var data = ["akshay", "tiwari", "ranjit", "swain"]; $("#name").kendoautocomplete({ datasource: data }); }) </script> <h2>kendoangular</h2> <div ng-app> <input id="name" type ="text" ng-model="yourname...

javascript - Data tables, get data , js -

i'm using datatables , datatable, receve json api , in js use code... // variable send in get// var id = $cookiestore.get('uid'); $(document).ready(function() { $('#example').datatable( { "sdom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>", "spaginationtype": "bootstrap", "bprocessing": true, "sajaxsource" : "http://localhost:3347/api/controlerx", "aocolumns": [ { "mdata": "1fild"}, { "mdata": "2fild"}, { "mdata": "3fild"}, { "mdata": "4fild"}, { "mdata": "5fild"}, { "mdata": ...

ios - How to use one date picker for two textfield? -

i follow link have 2 textfield how use 2 textfield.my code here date1 , date2 textfields.here when select date textfield1 , textfield2 , textfield1 takes value textfield2 you need set tag on every text field , identify in donbuttonpressed method , set text according tag. otherwise - (void)textfielddidendediting:(uitextfield *)textfield { if([textfield isequal:date1]) { date1.text=@"yourdate"; } else { date2.text=@"yourdate"; } }

php - Clear html text fields -

i have html form submitting , retrieves data mysql database 2 buttons, "save/submit" , "new/reset" fetch data correctly mysql database when click on new/reset button new contact entry couldn't clear forms text fields. html , php codes under: <?php //database connection file. include'connect.php'; $sql = mysql_query("select * contact_list id='1'"); while($result = mysql_fetch_assoc($sql)){ $fname = $result['fname']; $lname = $result['lname']; $email = $result['email']; $contact = $result['contact']; } if(isset($_post['fname'])&&isset($_post['lname'])&&isset($_post['email'])&& isset($_post['contact'])){ $fname = $_post['fname']; $lname = $_post['lname']; $email = $_post['email']; $contact = $_post['contact']; if($sql = mysql_query("insert contact_list values ('', '$fnam...

android - HTML embedded with applets or flash in phonegap -

i have converted websites using plain html, css or js apk files. html embedded applets or flash files not working! tried phonegap on android. it seems applets not supported mobile browsers. flash, following link helped: https://groups.google.com/forum/?fromgroups#!topic/phonegap/s3xz8qxtl-m

http - Describing RESTful URLs -

here's example url: /users/123/comments based on url, term best describe users ? users resource or part of resource. name of part? the same question goes other parts. terms best describe 123 , comments ? is there term refer second part of restful urls? describe 123 in /users/123 , purchases in /me/purchases . rest resource-oriented. urls represent resources. in example, /users/123/comments : users resource. 123 unique identifier of user. in case, comments sub-resource of users, resources on own (ex. calling /comments/{id} ) about second question, format /me/purchases not same /users/123 . , /me/purchases short url /users/{myid}/purchases purchases sub-resource of users (and resource on own also, available /purchases/{id} ) . for more information, here video , not directly related question, made , interesting rest web services.

iphone - Condition always fails though the comparative values seems correct in iOS -

when check value of number in nslog shows '0' nsmutabledictionary *data = [[nsmutabledictionary alloc] initwithcontentsoffile: path]; nsnumber *number=[data objectforkey:@"serial"]; nslog(@"%@",number); if(number ==0 ) { imgbutton.hidden=yes; } but condition fails , changed code nsstring *number=[data objectforkey:@"serial"] nslog(@"%@",number); if(number == @"0" ) { imgbutton.hidden=yes; } but here condition fail ,what issue this? in first code checking nsnumber, object, against int. correct check is: if([number intvalue] == 0) { imgbutton.hidden = yes; } in second code checking 2 nsstring, have use "isequaltostring" method , not "==". correct code is: if([number isequaltostring:@"0"]) { imgbutton.hidden = yes; }

linux - C Send Socket without Defining Socket -

what line of code do send(4, "test\n", 15, 0); if there no socket defined in code? it fails, ebadf error (in errno ). see manual page more possible error values. note could succeed, if there code before sets socket hardcoded descriptor value of 4 (the first argument). see dup() function 1 way of attempting that. also note parent process doing setup, might not visible in source file silently assumed. finally note undefined behavior due reading outside provided buffer (the string isn't 15 characters long). pretty suspect code.

c# - SCardTrasmit return empty receive byte array -

i'm working on c# pc/sc implementation acs readers , nfc tags. i have prototyped scardtransmit follows: [dllimport("winscard.dll")] public static extern int scardtransmit (int32 hcard, ref scard_io_request piosendrequest, byte[] sendbuff, int32 sendbufflen, ref scard_io_request piorecvrequest, byte[] recvbuff, out int32 recvbufflen); and have following code: scard.scard_io_request iorequest = new scard.scard_io_request(); iorequest.dwprotocol = protocol; // going t=1 iorequest.cbpcilength = 8; byte[] cmdbytes = new byte[] { 0xff, 0xca, 0x00, 0x00, 0x00 }; byte[] rcvbytes = new byte[10]; int rcvlenght = 0; retcode = scard.scardtransmit(handle, ref iorequest, cmdbytes, cmdbytes.length, ref iorequest, rcvbytes, out rcvlenght); if (retcode != scard.scard_s_success) throw new exception("failed querying tag uid: " + retcode); all (not shown) init'in...

php - Update nth cell of row MySql -

i need cell based on number... when use query or fetch can use column name or number , didn't find way how make in reverse. something like: "update shops set column1 = '$value'" => "update shops set id = '$value'" "update shops set column2 = '$value'" => "update shops set adress = '$value'" etc... this db structure: +----+---------+--------------+ | id | address | phone number | +----+---------+--------------+ why bother concatenation @ all? "update shops set cell$cellnumber = $value id = $id" however, right way change database structure , use prepared statements so, proper code be "update shop_cells set cell = ? id = ? , cellnumber = ?"