Posts

Showing posts from September, 2014

optimize the performance of informix stored procudure in asp.net application? -

i want know how use equivalent : set arithabort on and with recompile option in informix stored procedure ? set arithabort on sql server manual says : terminates query when overflow or divide-by-zero error occurs during query execution. at informix , default, error occurred during execution of udr/sp (procedure or function) trigger exception , automatically raised @ user session level. include arithmetic error. what can inside of spls inverse , include treatment not allow exception reach scope of user session. read on exception with recompile option sql server manual says : creating stored procedure specifies recompile option in definition indicates sql server not cache plan stored procedure; stored procedure recompiled each time executed. use recompile option when stored procedures take parameters values differ between executions of stored procedure, resulting in different execution plans created each time. use of option unco

ruby - ActiveRecord boolean value returning "f", "t" -

i've added boolean column active record migration class addincludeinconsolidationtocompanies < activerecord::migration def change add_column :companies, :include_in_consolidation, :bool, :default => true end end whenever fetch record database "f" or "t" instead of true or false. is activerecord not supposed automatically handle type casting , database. it's activerecord::base.connection.quoted_true/false defaulting true. what best way around this? ideally should work, boolean column should return boolean default not string. 't' , 'f' postgresql uses boolean values. 'bool' not valid datatype rails migration. need use 'boolean'. guess 'bool' getting column created in database, rails confused when data loaded model. change , rerun migration , bet works out.

unix - shell prints line shell -

write script named print_lines.sh uses head , tail print out specific set of lines file. script should take 3 arguments: line number start at, line number stop at, , file use. here's example run: [user@localhost ~]$ print_lines.sh 7 10 /etc/passwd shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin in example, script prints line 7 through 10 (inclusive) of /etc/passwd file. script must error checking. specifically, need check following things: you right number of arguments (3). the file specified exists , normal file. the first line number specified less or equal last line number specified. the actual number of lines in file greater last line printed. if of conditions not true, should print appropriate error message user , stop. if met, you'll need bit of arithmetic , use head , tail print out lines requested. this work not working good f

sql - How to inner-join in Excel (eg. using VLOOKUP) -

Image
is there way inner join 2 different excel spreadsheets using vlookup? in sql, way: select id, name sheet1 inner join sheet2 on sheet1.id = sheet2.id; sheet1: +----+------+ | id | name | +----+------+ | 1 | | | 2 | b | | 3 | c | | 4 | d | +----+------+ sheet2: +----+-----+ | id | age | +----+-----+ | 1 | 20 | | 2 | 21 | | 4 | 22 | +----+-----+ and result be: +----+------+ | id | name | +----+------+ | 1 | | | 2 | b | | 4 | d | +----+------+ how can in vlookup? or there better way besides vlookup? thanks. first lets list of values exist in both tables. if using excel 2010 or later in sheet 3 a2 put following formula: =iferror(aggregate(15,6,sheet2!$a$1:$a$5000/(countif(sheet1!$a$1:$a$5000,sheet2!$a$1:$a$5000)>0),row(1:1)),"") if using 2007 or earlier use array formula: =iferror(small(if(countif(sheet1!$a$1:$a$5000,sheet2!$a$1:$a$5000),sheet2!$a$1:$a$5000),row(1:1)),"") being array formula,

scope - Python exec and __name__ -

when run: exec "print __name__" it prints __main__ . but when run: exec "print __name__" in {} it prints __builtin__ . how make second example print __main__ ? what try achieve run piece of code exec perspective of looks run command line. i tun code clean scope second example breaks code relying on if __name__ == "__main__" . how fix this? you use imp.load_module instead: import imp open(mainfile) src: imp.load_module('__main__', src, mainfile, (".py", "r", imp.py_source)) this imports file __main__ module, executing it. note takes actual file object when type set imp.py_source , you'd need create temporary file work if source code comes somewhere other file. otherwise, can set __name__ manually: >>> src = '''\ ... if __name__ == '__main__': print 'main!' ... else: print 'damn', __name__ ... ''' >>> exec src main

c - How do I define a pattern that will equate to all tokens not recognized by the scanner in Flex? -

i trying define pattern in flex throw error when reads token isn't defined. tried this: digit [0-9] int -?[0-9][0-9]* double {int}"."({digit})* char [a-za-z] char_ [a-za-z_] id {char}({char_}|{digit})* hex (0x | 0x)[a-fa-f0-9][a-fa-f0-9]* stringlit \"(\\.|[^"])*\" errstring \"(\\.|[^"])* unrecchar [^("+"|"-"|"*"|"/"|"%"|"<"|">"|"="|"!"|";"|","|"."|"["|"]"|"{"|"}"|{char_}|{digit})] %% "+" {return '+';} "-" {return '-';} "*" {return '*';} "/" {return '/';} "%" {return '%';} "<" {return '<';} ">" {return '>';} "=&quo

System kills my android app after some idle in onStop() state. How to avoid or detect this situation? -

i have application plays audio , video files remote server or own cache directory. when minimize application "home" or "back" button changes state onstop(). then, after idle (20-50 minutes or about) activity manager sends "no longer want" message activity , closes it. according activity lifecycle in case aplication jumps oncreate (the branch left onstop() on diagram). when happens activity has incorrect representation - fragments track lists start load on top of existing ones, ui becomes unusable , way fix situation competely restart application. i guess there 2 ways solve problem: 1) make system not kill application (may it's not correct, because approach violates normal application lifecycle in android , accelerates battery discharge). 2) detect situation when os kills application , clean resources let os create new activity properly. i think second variant preferable. is there ideas how implement it? possible detect android going ki

css - Responsive Font Size Calc() Bug -

i'm trying scale font-size between 0.875rem , 1.3rem media widths 20rem 40rem using following css works fine in firefox , chrome not safari calc() returns value big. any ideas how make work or different approaches take? https://jsfiddle.net/larsenwork/gjhc9bzp/2/ html { font-size: 0.875rem; } @media (min-width: 20rem) { html { font-size: calc(0.875rem + (1.3 - 0.875) * ((100vw - 20rem)/(40 - 20))); } } @media (min-width: 40rem) { html { font-size: 1.3rem; } } edit: added sass version $min-font: 0.875; $max-font: 1.3; $min-font-media: 20; $max-font-media: 40; html { font-size: $min-font + rem; } @media (min-width: $min-font-media + rem) { html { font-size: calc(#{$min-font + rem} + (#{$max-font} - #{$min-font})* ((100vw - #{$min-font-media + rem})/(#{$max-font-media} - #{$min-font-media}))) } } @media (min-width: $max-font-media + rem) { html { font-size: $max-font + rem; } }

php - how to set_relationship between two module Account and contacts -

public function setrelationship() { $arr = array( "session" => $_session['crm_sessionid'], 'set_relationship_value' => array( "module_`entname" => 'contacts', "id" => '667c8f2f-0fa7-d62f-350a-515447ae9054', "module_name" => 'accounts', "module_id" => 'dd3a6387-e2e4-1ae6-4c37-515931596121' ) ); $res = $this->client->call('set_relationship', $arr); print_r($arr); return $res; } you should follow following pattern defining relationship parameters : public function setrelationship() { $arr= array( 'session'=> $_session['crm_sessionid'], 'set_relationship_value'=>array( 'module1'=>'contacts', //primary module 'module1_id'=>667c8f2f-0fa7-d62f-350a-5154

masm - Comparing negatives and accumulating in Assembly -

i'm having trouble figuring out how compare inputs negatives in masm. positive input integers, use cmp doesn't seem working me in program. i'm missing 1 or 2 lines in calcloop think, because program ends right after user inputs positive value, after inputting negative values. program should add , average values entered, 1 should negatives between [-100,-1]. when input -100 or -1, these should allowed not. any appreciated i'm still trying figure out of basics of assembly. thanks! code: title program3 (program3.asm) include irvine32.inc lengthlimit = 20 .data intro byte "program 3: accumulator ", 13,10 byte "what name: ",0 prompt1 byte "oh hello, ",0 enternumprompt byte "enter numbers between -100 , -1.",13,10 byte "enter non-negative now: ",13,10,0 prompt2 byte "enter #: ",0 prompt3 byte "okay, ",0 prompt4 byte " numbers.",0 addprompt byt

windows - How to delete Line feed on my lines -

i come ask help. have document created automatically. result of sql query. an example of line line feed. word see that "2k45.10 new";"arc ca 125 control";"4";"0";"8 640"; "2k45.23 new";"arc ca 125 reagent 400 tests ";"4";"0";"103 777" "2k45.28 new";"arc ca 125 reagent 100 test ";"4";"0";"27 113" "2k46.01";"arc anti tg calibrator ";"4";"0";"11 626" "2k46.10";"arc anti tg control";"4";"0";"8 483" "2k46.25";"arc anti tg rgt 100 test ";"4";"0";"26 872" if open nopad++ "2k45.10 new";"arc ca 125 control";"4";"0";"8 640";"boite";"";"taxe 39% cd 38220000000" "2k45.23 new";"arc ca 125 reagent 40

python - Only one Class possible for GUI programming -

i'm new gui-programming , using tkinter python. in past "non-gui" programs consisted out of few classes if examples gui appears 1 class used. functions included in 1 class. normal way or possible write gui class "calls" functions other classes? as @ seems concept of object oriented programming dissapears implementing gui in oop manner it possible use multiple classes in gui apps. example can have 1 class defines , layouts gui elements (like buttons, text fields, scrollbars etc.) , second class subclass adding functionality on top of it.

scikit learn - sklearn GridSearchCV, SelectKBest, and SVM -

i trying make classifier uses feature selection via functioni have written, golub, returns 2 np arrays selectkbest requires. want link svm classifier linear , and optimize on possible combinations of k , c. however, have tried far has not succeeded , not sure why. code follows: import numpy np sklearn import cross_validation sklearn import svm sklearn.feature_selection import selectkbest sklearn.pipeline import make_pipeline, pipeline sklearn.grid_search import gridsearchcv golub_mod import golub class svm_golub_linear: def __init__(self,x,y): self.x=x self.y=y def golub_svm(self): x=self.x y=self.y kbest=selectkbest(golub,k=1) k_vals=np.linspace(100,1000,10,dtype=int) k_vals=k_vals.tolist() c_vals=[0.00001,0.0001,0.001,0.01,.1,1,10,100,1000] clf=svm.linearsvc(penalty='l2') steps=[('feature_selection',kbest),('svm_linear',clf)] pipeline=make_pipeline(steps)

asp.net mvc - anti-forgery token could not be decrypted -

some forms in asp.net website cause "anti-forgery token not decrypted" exception. tried of solutions did not work: i dont't have duplicate @html.antiforgerytoken() in form. i dont't use web farm tried adding machinekey . used autogenerate has no effect. i added fixed machine key value isolateapps complains "decryption key specified has invalid hex characters". i removed isolateapps , application pool stopped. what else can do? why happens? thanks.

BASH let command..gives wrong result on padded numbers -

the following code prints 4 expected: let x=21 let x=$x-1 echo $x but following prints 16: let x=000021 let x=$x-1 echo $x could explain difference? 00021 octal constant. output 16 correct decimal result. octal value use printf "%o\n" $x remove leading zeros if number decimal.

unix - using sed -n with variables -

i having log file a.log , need extract piece of information it. locate start , end line numbers of pattern using following. start=$(sed -n '/1112/=' file9 | head -1) end=$(sed -n '/true/=' file9 | head -1) i need use variables (start,end) in following command: sed -n '16q;12,15p' orig-data-file > new-file so above command appears like: sed -n '($end+1)q;$start,$end'p orig-data-file > new-file i unable replace line numbers variables. please suggest correct syntax. thanks, rosy when realized how it, looking anyway line number file containing requested info, , display file line eof. so, way. with pattern="pattern" input_file="file1" output_file="file2" line number of first match of $pattern $input_file can retrieved with line=`grep -n ${pattern} ${input_file} | awk -f':' '{ print $1 }' | head -n 1` and outfile text $line eof. way: sed -n ${line},\$p ${input_file}

java - Selenium - Automate a task -

currently have web application when give acct number/ bill number acct details in next page. i have 700+ accounts , need address each , every account. as repetitive manual tasks i'm planning automate using selenium(i have never used it). here steps:- 1. 700 accounts listed in file. 2. read 1 account. 3. plug web application in acct number text box. 4. redirect next page. 5. extract address acct , write file. repeat process 700 accounts. is possible using selenium. can use selenium ide or web driver this? im familiar java/python, automating should problem. i have bought course in udemy on selenium need quick jump start. you familiar java should go selenium web driver. , using testng data provider can iterate on data. data provider should read data file. example of data provider , selenium web driver can find here: http://www.seleniumeasy.com/testng-tutorials/import-data-from-excel-and-pass-to-data-provider

Get all options from Android Spinner using Appium -

i trying pull options off android spinner, using appium. selenium, can use select object , getoptions (i forget exact syntax). need text options in spinner. considering spinner options accessible through appium. getting values of options on spinner shall work follows : list<webelement> spinnerlist = driver.findelements(getby("identifier")); //where identifier vary on how can access elements string spinnerlistelementtext[index]; //e.g. store text of options (int index = 0; index < spinnerlist.size(); index++) { string spinnerlistelementtext[index] = spinnerlist.get(index).gettext(); }

Solr with Rails - rake sunspot:reindex is not working -

hope fine , doing good! stuck strange issue looking inputs. my problem is: after deploying application on production using capistrano, when doing solr re-indexing, giving me below error: $ bundle exec rake sunspot:reindex --trace ** invoke sunspot:reindex (first_time) ** invoke environment (first_time) ** execute environment ** execute sunspot:reindex skipping progress bar: progress reporting, add gem 'progress_bar' gemfile rake aborted! rsolr::error::http - 404 not found error: not found request data: "<?xml version=\"1.0\" encoding=\"utf-8\"?><delete>query>type:occupationdata</query></delete>" backtrace: /data/app_name/shared/bundled_gems/ruby/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response' /data/app_name/shared/bundled_gems/ruby/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute' /data/app_name/shared/bundled_gems/ruby/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `

maven-jarsigner-plugin Enter Passphrase for keystore -

i using maven-jarsigner-plugin sign applet jar. when run "maven clean install" build fails , gives following error. [debug] 'cmd.exe /x /c ""c:\program files\java\jdk1.6.0_33\jre\..\bin\jarsigner.exe" -keystore mykeystore -keypass '*****' c:\myproject\target\myapplet-1.0.0.jar applet"' [info] jarsigner: must enter key password [warning] enter passphrase keystore: following maven configuration. <plugin> <artifactid>maven-jarsigner-plugin</artifactid> <version>1.2</version> <executions> <execution> <id>sign</id> <phase>install</phase> <goals> <goal>sign</goal> </goals> </execution> </executions&

java - Generating files by reading excel sheet -

there excel file having lot of file names in 1 of column . need write java code should read file names , generate same in destination.can 1 me ? import java.io.file; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.util.iterator; import org.apache.poi.hssf.usermodel.hssfsheet; import org.apache.poi.hssf.usermodel.hssfworkbook; import org.apache.poi.ss.usermodel.cell; import org.apache.poi.ss.usermodel.row; import org.apache.poi.ss.usermodel.sheet; import org.apache.poi.ss.usermodel.workbook; import org.apache.poi.xssf.usermodel.xssfsheet; import org.apache.poi.xssf.usermodel.xssfworkbook; public class test { public static void main(string[] args) throws ioexception { try { fileinputstream file = new fileinputstream(new file("c:\\test.xls")); hssfworkbook workbook = new hssfworkbook(file); hssfsheet sheet = workbook.g

Making a basic poll with javascript/jquery -

just starting learn javascript/jquery. for recent task i've been asked create function listens clicks on 2 buttons , looks @ " data-vote " attribute see voted for. i need set event listener on buttons ' vote ' class, both of have ' data-vote ' attribute, 1 ' great ', other ' greatest '. when 1 of buttons clicked need @ attribute determine was, , increment counter affected tally. i know seems simple, i'm lost. here's code far : $('.vote').on('click', function(event){ var targetelement = event.target; $(targetelement).find('data-vote').each(function(){ if .attr(great) any @ appreciated. var great = 0; var greatest = 0; $('.vote').on('click', function() { var value = $(this).data('vote'); if(value === 'great') { great++; } else if(value === 'greatest') { greatest++; } }); the key here inside click handler, $(this)

asp.net mvc - When is it necessary to protect both GET and POST versions of /Edit? -

all controllers have pairs of actions /edit , 1 request , 1 post request. add permissions-checking (authorization) on call make sure nobody shouldn't have access object, doesn't in there. do need add same check on post version of method? redundant, or should reasonably expect spoof http post request though won't have access version? it's trivially easy send post request url. if site deals sensitive/secret data, should expect people try sorts of ways of getting @ it, , should make sure access points (including post requests) check user authorized access request.

parse.com - what is this Javascript opening syntax? -

i'm doing tuts tutorial on intel xdk , parse , 1 of source files has syntax i've never seen anywhere. file opens function not has no name, declared inside regular parentheses. can explain and/or link online resource explains this? (function (credentials) { var exports = {}; var baseurl = 'https://api.parse.com/1/classes/article/'; exports.articles = function (params) { params = params || {}; var artid = ''; if (params.id) { artid = params.id; } var url = baseurl + artid; return $.ajax({ url: url, headers: { 'x-parse-application-id' : credentials.apikey, 'x-parse-rest-api-key' : credentials.apisecret } }); }; return exports; }) your code snippet many pointed out, missing pair of () @ end. (), becomes iife, wikipedia article pointed mike explains clearly. in brief, immediately-invoked function expression executed once program enco

ruby on rails - Error when calling a partial: SQLite3::SQLException: no such column: -

i've browsed stackoverflow answer error , haven't had luck in trying out solutions other questions. i'm new rails , i'm doing to-do list app project. when i'm attempting view todo_list#show view, i'm getting following error on line #2: sqlite3::sqlexception: no such column: todo_items.todo_list_id: select "todo_items".* "todo_items" "todo_items"."todo_list_id" = ? show view <div id="todo_items_wrapper"> <p><%= render @todo_list.todo_items %></p> #this line highlighted error <div id="form"> <%= render "todo_items/form" %> </div> </div> i'm attempting call following partial on line #2; here partial file: <%= form_for([@todo_list, @todo_list.todo_items.build]) |f| %> <%= f.text_field :content, placeholder: "new todo" %> <%= f.submit %> <% end %> i'm assuming have issue migratio

php - Question Mark is occured on Laravel query -

i'm trying run code below in laravel $posts= db::table('rmm') ->select( array('message', db::raw('count(message) number'), db::raw('rmm.receivedtime time'))) ->join( 'rcs', 'rmm.smscid', '=', 'rcs.smscid', 'inner') ->where(db::raw('rcs.status =1 , rmm.receivedtime > \'2012-12-26\' , rmm.receivedtime \'2013-04-01\' , length(\'message\') >\'3\' ')) ->group_by('message') ->get(); and got error code below sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near '? group message ' @ line 1 sql: select `message`, count(message) number, rmm.receivedtime time `rmm` inner join `rcs` on `rmm`.`smscid` = `rcs`.`smscid` rcs.status =1 , rmm.receivedtime > '2012-12-26' , rmm.receivedtim

How to execute command line script on a different machine from Jenkins -

i access jenkins dashborad located on server called myserver accessing url http://<myserver>:8080/ . have written build steps on build part of job configuration page. after completing build steps, need access different server , execute command line script. how run command line script on different server current node? we have sounds similar situation run automated tests must initiated on non-jenkins host. this, use ssh , keyed authentication, requires bit of setup in execute shell step: # generic prep eval `ssh-agent -s` ssh-add ~/.ssh/my-agent-key at point, key in ssh-agent keyring , can ssh without needing worry passwords account , host accepts key. ssh testuser@targetmachine "<commands>"

actionscript 3 - Import classes from SWF into Flex app without starting the imported SWF -

background i write ai flash game, , part of want train image recognizer elements of game. in order that, first want generate many samples various configurations can used training data. in generating process have use game have in swf format. conception create own flash app accesses game swf , uses classes generate images (i have reverse engineered game swf tool, hence know classes need). question i created mxml file following content: <?xml version="1.0"?> <s:windowedapplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:script><![cdata[ public function onload():void { var clazz:class = loader.loaderinfo.applicationdomain.getdefinition("com.game.foo") class; // here use clazz } ]]></fx:script> <mx:swfloader id="loader&quo

spring - Namespace for wsse:security -

my problem trying call web service has wss4jsecurityinterceptor username password authentication. the request generated : <wsse:security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap-env:mustunderstand="1"> this not working when change namespace i.e. xmlns:wsse <wsse:security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext" soap-env:mustunderstand="1"> it works fine. i want know how can change namespace generated tag code you extends endpointinterceptoradapter , override method handleresponse this: @override public boolean handleresponse(messagecontext messagecontext_, object endpoint_) { webservicemessage _webservicemessage = messagecontext_.getresponse(); soapmessage _soapmessage

apache - EC2 port 80: Connection refused -

i'm doing request ec2 instance, i'm getting following error: 80: connection refused these security rules of instance: ports protocol source launch-wizard-1 80 tcp 0.0.0.0/0 ✔ 22 tcp 177.32.53.207/32 ✔ what's wrong these rules? why can't access port 80? edit i attached apache conf file (/etc/apache2/apache2.conf) in url, since it's big post code here. edit2 when run netstat -ntlp | grep listen this: (no info read "-p": geteuid()=1000 should root.) tcp 0 0 0.0.0.0:22 0.0.0.0:* listen - tcp 0 0 127.0.0.1:3306 0.0.0.0:* listen - tcp6 0 0 :::80 :::* listen - tcp6 0 0 :::22 :::* listen what source of connection request? attempting access instance o

knockout.js - KnockoutJs & Asp.Net MVC 4 - multi model views Submit -

i in situation have 2 tabs , each tab have partial views, using jquery ui create tabs. i have 2 options each user 1. save, 2. submit. on save save particular tab ( tab contains model view 1) second same ( tabe contains model view 2 ) how can submit both models both tabs 1 click? i have in save tab 1 , tab 2. my first view model. self.save = function() { $.ajax({ url: "mytabs", data: { data: ko.tojson(self.firstvm) }, type: "post", contenttype: "application/json", success: function(result) { alert(result); } }); }; my second view model. self.save = function() { $.ajax({ url: "mytabs", data: { data: ko.tojson(self.secondvm) }, type: "post", contenttype: "application/json", success: function(

c# - Write json to .txt file -

im serializing list of string json string , generating file json string reason file doesnt have "{}" of json. list serialization: list<string> list = new list<string>(); foreach(item in model){list.add(item)} var requsers = list; var json = jsonconvert.serializeobject(requsers); system.io.file.writealltext(@"\path.txt", json); my path.txt show this: ["ens frutas","rest","cenas","$26.50",0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,"$26.50"] but need output this: [["ens frutas","rest","cenas","$26.50",0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,"$26.50"]] my foreach loop fil list: (int = 1; <= 31; i++) { var value = 0; if (item.fecha.day == i) { value = item.cantidad; costo = costo + item.total; }

networking - Network in Simulator IOS -

i'm newbie of ios. have problem network of ios simulator. i'll explain more detail below. i have url abc.com/infor.json want read information of app before display main screen. have network : network a, network b far know, simulator using same network macbook. mac connect network a: safari of mac , safari of simulator can open url application can read information url -> app works fine ! mac connect network b: safari of mac , safari of simulator can open url application can read information url -> app does not work! i don't know reason in problem - of course , it's not app's problem -> because app works fine network a - if network b has proxy'problem -> why url can open simulator's safari please me resolve it. thank

c++ - How to use .hide on a Qt LineEdit, still take input? -

i have qlineedit hide user still take in input form somewhere. creating typing tutor , want take input in hidden manner in order provide more dynamic form of feedback. any other suggestions best accomplish appreciated you can not it. when qlineedit hidden, there no focus on it, , can not grab events. if persist on using qlineedit there's option turn off displaying text. qlineedit::noecho . lineedit->setechomode(qlineedit::noecho); this show edit box, doesn't show text. otherwise, should write slot grab window keypressed signals, , handle yourself.

html - Required an alert of success or failure after form post in asp.net -

i have input box , html file uploader in form. want submit text of input box , uploaded file saved in database , need success or failure alert in html page. i've no idea how can this. have done procedure of getting post value , save in database can't give alert web page.net mvc3. using asp.net mvc3. kind of appriciated. httpcontext.current.response.write ("<script>alert('" + pagetable[page].dequeue() + "');</script>"); see example you

machine learning - lexical-level similarity word clustering tool -

is there open software toolkit compares lexcial-level similarities among words , group similar words together? example, blue jean, blue jeans, , blue jea (miss-spelled) should grouped together? don't need semantic similarity here. try natural language toolkit http://nltk.org/ here's rather abstract treatment of brown clustering algorithm http://www.cs.columbia.edu/~cs4705/lectures/brown.pdf the standard similarity metric between words levenstein distance http://en.wikipedia.org/wiki/damerau%e2%80%93levenshtein_distance

Compile C++ Code to behave the same in Windows and Linux -

i've installed cygwin , use program c++ on windows. i prefer write code (these assignments) in windows code needs able run on linux. while code ports of time appears there things work on windows cause segfaults on linux (such referencing uninitialized variables , pointers). i compile using g++ in both windows (via c:\cygwin\bin\g++.exe) , linux, don't understand why code works in former fails in latter (or why don't behave same). how code behave same in both? possible? i not using windows specific libs though c++ noob may misunderstanding simple/important. lastly know using uninitialized variables , pointers bad - i'd use cause segmentation faults in windows. what describing "referencing uninitialized variables , pointers" called undefined behaviour. means "your luck may vary" - may in 1 way on 1 system, , else on different system. unfortunately, part of "c , c++ supposed efficient languages", behaviour of undefined behav

NHibernate: How to select the root entity in a projection -

ayende describes great way page count, , specific page of data in single query here: http://ayende.com/blog/2334/paged-data-count-with-nhibernate-the-really-easy-way his method looks like: ilist list = session.createquery("select b, rowcount() blog b") .setfirstresult(5) .setmaxresults(10) .list(); the problem example in hql, , need same thing in icriteria query. achieve equivalent icriteria, need like: ilist list = session.createcriteria<blog>() .setfirstresult(5) .setmaxresults(10) .setprojection(projections.rootentity(), projections.sqlfunction("rowcount", nhibernateutil.int64)) .list(); the problem there no such thing projections.rootentity(). there way select root entity 1 of projections in projection list? yes, know use criteriatransform.transformtorowcount() require executing query twice - once results , once row count. using futures may

javascript - Links to download and print a PDF doc (w/o PHP) -

could please me make 2 different links: 1 launch open/save pdf, print dialog boxes (e.g. in adobe reader application) <a href="http://gasparean.com/resume.pdf">my résumé</a> i mean, maybe need put file on server in way (without extension, instance; please, check how's done here: http://gasparean.academia.edu/gasparean/curriculumvitae please note, hosting use, not support php, need solution without scripts. thank you! ideally, php best option. if can use .htaccess files on server, or can access apache config files, add line in there: addtype application/octet-stream .pdf note: if add in .htaccess, make pdf in directory download -- , if set line in apache config files, force pdf download. you use html5 download attribute, works in chrome @ minute anyway... <a href="http://gasparean.com/resume.pdf" download="resume">my résumé</a>

android - Building table layout dynamically at run time from XML -

Image
new android, have view below actual values. my code dummy values below: <?xml version="1.0" encoding="utf-8"?> <tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margintop="10dp"> <tablerow android:background="#607d8b" android:padding="5dp"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="title" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="due on" /> <textview andr

postgresql - How to get update statement in trigger function or when condition -

create table accounts ( id serial primary key, email text, verified boolean default false, ... ); create or replace function fn_reset_verified() returns trigger $$ begin if ( old.email != new.email -- nothing if no change ) raise notice 'update'; update users set verified=false id=new.id; end if; return new; end; $$ language 'plpgsql'; create trigger reset_verified after update of email on accounts each row when (old.email != new.email) -- when email changed execute procedure fn_reset_verified(); based on above schema, wish create trigger automatic update verified false if user change email. work below statement: update accounts set email='newemail@email.com' id=1; my problem come in when intend update email , set verified true @ same time below statement: update accounts set email='verified@email.com', verified=true id=1; if verified been set in update statement, should skip function. maybe condition below: when (old.

javascript - Why was await* removed from the async/await proposal? -

the place seems documented this issue thread , the actual specification . however, reasoning removal isn't posted anywhere find. the new recommended way seems await promise.all() , i'm curious why await* removed. well, last revision of readme before removed mentions in paragraph: await* , parallelism in generators, both yield , yield* can used. in async functions, await allowed. direct analogoue of yield* not make sense in async functions because need repeatedly await inner operation, not know value pass each await (for yield* , passes in undefined because iterators not accept incoming values). it has been suggested syntax reused different semantics - sugar promise.all . accept value array of promises, , (asynchronously) return array of values returned promises. expected 1 of common promise-related oprerations not yet have syntax sugar after core of proposal available. so it's no direct analogue yield* 1 might e