Posts

Showing posts from February, 2012

Running Python code in Aptana Studio 3 - executes in Firefox -

Image
i'm new python , aptana. i'm doing tutorials on python using aptana , first time ran sample code fine. i've installed github , ipython , when want execute python code aptana keeps on using firefox internal server run it, not want. want run in console. here screenshot of problem:

php - using array input names in forms and form validation - CodeIgniter -

i have form on submit send data 2 different tables.so thought writing me deal posted data easily. <?=form_input(array('name'=>'item["item_manufacturer"]','class'=>'form-control'),set_value('item["item_manufacturer"]'));?> <?=form_input(array('name'=>'vat["vat_percentage"]','class'=>'form-control'),set_value('vat["vat_percentage"]'));?> and in config/form_validation config file,i have this $config = array( 'products/add' =>array( array('field'=>'item["item_manufacturer"]','label'=>'lang:manufacturer-name','rules'=>'required|trim|xss_clean'), array('field'=>'vat["vat_percentage"]','label'=>'lang:vat-percentage','rules'=>'required|trim|xss_clean') )); but comes

database - Liferay document checkin issue -

i'm still new liferay , using liferay 6.2 what i'm doing: trying add document manually database using insert statement. inserted dlfileentry , dlfileversion , assertentry . also, created folder valid name , file. the issue: upon entering documents , media portlet, can see document name there when click on checkout, prompt error saying documents , media temporarily unavailable . still able download valid document. am doing wrong? personally, feel missing 1 more table database i'm not sure . thanks! yes, you're doing wrong: should never write liferay's database sql, there might more data required what's directly visible you. obviously, you're running such issue. liferay has an api can use locally, within same application server, or remotely json or soap service. should exclusively use write access database. alternatively, might consider webdav access document repository way add more documents document library.

regex - Remove unwanted characters from URL -

i have used getrouteurl create seo friendly urls want remove %20 ie spaces , replace dash ("-"). example page website shown below. want title variable "madonna-item" , not "madonna%20item". /productsbydepartment/gracya/madonna/madonna%20item?categoryid=9&productid=8&departmentid=4 i have create class (stringhelpers) fix url don't know call fixurl public static class stringhelpers { public static string fixurl(this string url) { string encodedurl = (url ?? "").tolower(); encodedurl = regex.replace(encodedurl, @"\+", "and"); encodedurl = encodedurl.replace("'", ""); encodedurl = regex.replace(encodedurl, @"[^a-z0-9]", "-"); return encodedurl; } } the code contains link update below. want use fixurl on title field, not work. please can advise me how use fixurl? <td class="product_title&quo

sql - Create VARCHAR FOR BIT DATA column -

i trying create sql table in netbeans 8.0 1 of columns meant store byte[] (so varbinary type looking for). wizard creation of new table offers me option of varchar bit data, should work, raises syntax error when creating table: create table "bank".accounts ( id numeric not null, pin varchar bit data not null, primary key(id) ) the error due presence of word for, manually change statement is create table "bank".accounts ( id numeric not null, pin "varchar bit data" not null, primary key(id) ) but problem type not exist. ideas? thank you. here's manual page varchar bit data: http://db.apache.org/derby/docs/10.10/ref/rrefsqlj32714.html note section says: unlike case char bit data type, there no default length varchar bit data type. maximum size of length value 32,672 bytes. so problem haven't specified length. if byte array is, say, 256 bytes long, specify pin varchar

c++ - Workaround for lack of expression SFINAE -

i'm trying call function each value in std::tuple , of course there no way iterate tuple , i've resorted using template techniques discussed in iterate on tuple however, i'm using visual studio 2013 , not support expression sfinae, code won't work. i've tried partially specialize templates based on constant numbers (e.g 5, 4, 3, 2, 1, 0), haven't had success. i'm no template expert, , hoping me out. expression sfinae code below. #include <iostream> #include <tuple> using namespace std; struct argpush { void push(bool x) {} void push(int x) {} void push(double x) {} void push(const char* x) {} void push(const std::string& x) {} template<std::size_t = 0, typename... tp> inline typename std::enable_if<i == sizeof...(tp), void>::type push_tuple(const std::tuple<tp...>& t) { } template<std::size_t = 0, typename... tp> inline typename std::enable_if<i < si

PHP equivalent to jQuery html() or text() -

im trying print result of php function specific html id or class the php function called button input jquery code: function myfunction() { $answer = 'random text <b>' + $radomvar +'more random'; $('#resultline').html($answer); } is there equivalent $('#resultline').html($answer); in php? what you're asking doesn't make sense. can can embed php code alongside html code , processed server before http response sent client. therefore, why not like: <span id="resultline"><?php echo myfunction(); ?></span> where myfunction php function returns string want embed?

unicode - How to replace characters in a file utf8 in perl? -

i have (it works): perl -c -mtext::unidecode -n -i -e'print unidecode( $_)' unicode_text.txt and want same in script: #!/usr/bin/perl -w -csa use utf8; use text::unidecode; while(<>) { print unidecode($_); } but doesn't work. you should have got error message too late "-csa" option which makes program read input file utf-8-encoded. instead need put use open qw( :std :utf8 ); before while loop, same -cs on command line, i.e. set stdin , stdout , stderr handles utf-8 encoding

javascript - How to draw a YUV image to HTML5 canvas without converting it to RGB first? -

is possible draw yuv image html5 canvas without converting rgb first? i found this gist , takes yuv image, converts rgb, , draws canvas. there anyway skip rgb converting phase? i need live video streaming, drawing each frame should fast possible.

c# - i dont understand what "protected void Page_Load" is -

im learning computer science , in cs files have line of code not understand purpose for...i understood waits page load or void , protected about? protected void page_load is piece of code protected access modifier , means access limited containing class or types derived containing class. void return type of method , means it not return anything. as mentioned other page_load re event method triggered when current page loaded method doesn't return need accessed other classes other class resides. (sometimes may need change modifier). here may have general access modifiers

sql - Show gaps between dates in MySQL -

how can show remaining/complementary dates in mysql? for example in table has 2 columns, snapshot from_date>14-06-2014 , to_date<01-07-2014 would give output: from date || to_date 15-06-2014 || 20-06-2014 23-06-2014 || 27-06-2014 29-06-2014 || 30-06-2014 i able show dates have gap , no records exist, this: 2 //21-06-2014 - 23-06-2014 1 //28-06-2014 is possible? thank you along lines: drop table if exists dates; create table dates (d_from date, d_to date); insert dates values ('2014-06-15' , '2014-06-20'), ('2014-06-23' , '2014-06-27' ), ('2014-06-29' , '2014-06-30' ); select low.d_to, high.d_from, to_days(high.d_from) - to_days(low.d_to) - 1 gap dates low, dates high high.d_from = (select min(d_from) dates d_from > low.d_to) ; which means: join table on adjacent end/start dates , compute difference. +------------+------------+------+ | d_to | d_from | gap | +------------+--

cocoa touch - Ask for User Permission to Receive UILocalNotifications in iOS 8 -

i have set local notifications in app delegate using this: - (void)applicationdidenterbackground:(uiapplication *)application { uilocalnotification *notification = [[uilocalnotification alloc]init]; [notification setalertbody:@"watch latest episode of cca-tv"]; [notification setfiredate:[nsdate datewithtimeintervalsincenow:5]]; [notification settimezone:[nstimezone defaulttimezone]]; [application setscheduledlocalnotifications:[nsarray arraywithobject:notification]]; } when run app , quit receive error saying: 2014-06-07 11:14:16.663 cca-tv[735:149070] attempting schedule local notification {fire date = saturday, june 7, 2014 @ 11:14:21 pacific daylight time, time zone = america/los_angeles (pdt) offset -25200 (daylight), repeat interval = 0, repeat count = uilocalnotificationinfiniterepeatcount, next fire date = saturday, june 7, 2014 @ 11:14:21 pacific daylight time, user info = (null)} with alert haven't received permission

r - How to recognize a category from a matrix -

i have matrix 6*4 matrix , stacked them 2 columns matrix. first column numerical values, , second column category names. want calculate mean of values each category don't know how characters column 2. to aggregate values in data frame category, use aggregate function. consider artificial data: x <- data.frame(values=sample(1:6), categories=sample(c('a','b'), 6, replace=true)) x ## values categories ## 1 4 b ## 2 1 b ## 3 5 ## 4 3 b ## 5 6 ## 6 2 aggregate(values~categories, data=x, fun=mean) ## categories values ## 1 4.333333 ## 2 b 2.666667

git - How can I configure $source_dir to match /Users/${user}/src/${github-owner}/${project}? -

i'm new boxen , i'm trying create project manifest points correct path given project. organize source code in /users/${user}/src/${github-owner}/${repo} matches github urls. is there way boxen? for example, here's configuration basic static site: class projects::blog { boxen::project { 'blog': server_name => 'faun.dev', source => 'faun/blog', ruby => '2.0.0-p353', nginx => "projects/shared/nginx.middleman.conf.erb" } } when run boxen , places source code in /users/faun/src/blog , should go in /users/faun/src/faun/blog . ideally, i'd projects work way, since projects live under owner directory. i've tried modifying $source_dir , if override it, must provide fully-qualified path. there way replace $source_dir version of ${boxen::config::srcdir}/${github-owner}/${name} globally? when consider boxen manifest one , see can define configuration setup, like

html - how to make button with image responsive -

the background responsive well, button image , marquee don't appear on right position via on mobile, how make the whole index responsive <div class="main"> <div class="marquee"> <marquee dir="ltr" direction="right" scrollamount="3"> <h3 style="color:#804000;font-size:large;margin-top:0px;" align="center" > <strong> <img src="http://www.ghadaalsamman.com/new/images/image21.png" height="37" /> </strong> </h3> </marquee> </div> </div> <a href="http://ghadaalsamman.com/new/site.html" id="btn1" class="button"></a> css body { background: url('images/bg.gif'); background-repeat:no-repeat; background-size:contain; background-position:center;

node.js - How to run elasticsearch-hq? -

i trying run elasticsearch-hq monitor es cluster. as understand node.js application. i've tried run npm install and seems fine.. far understand (that's node.js tutorials do...) but when run node app it returns: module.js:340 throw err; ^ error: cannot find module '/elasticsearch-hq/app' @ function.module._resolvefilename (module.js:338:15) @ function.module._load (module.js:280:25) @ function.module.runmain (module.js:497:10) @ startup (node.js:119:16) @ node.js:906:3 what can that? thanks! rather run node.js application (particularly if you're not familiar node.js) why don't run plugin? that's do: http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/modules-plugins.html in case you'll run following commands: cd <yourelasticsearchhome>/bin plugin -install royrusso/elasticsearch-hq then navigate http://<yourhost>:9200/_plugin/hq/ and should go -

For loop query sql database in asp.net c# -

i not sure how use loop or while loop ever suits problem better. need query database based on selected item in drop down list , field processed ='false' then code within loop then update database based on selected item in drop down list , field processed becomes ='true' my code below, need the loop within document.open , document.close protected void generatereport(object sender, eventargs e) { datarow dr = getdata("select * onsiteworktx docid = " + dropdownlistpdf.selecteditem.value).rows[0]; ; document document = new document(pagesize.a4, 88f, 88f, 10f, 10f); font normalfont = fontfactory.getfont("arial", 12, font.normal, basecolor.black); using (system.io.memorystream memorystream = new system.io.memorystream()) { pdfwriter writer = pdfwriter.getinstance(document, memorystream); phrase phrase = null; pdfpcell cell = null; pdfptable table

python - SQLAlchemy Many-to-Many Relationship on a Single Table Error: NoReferencedTableError -

i'm using flask , sqlalchemy. i'm trying reference column in same table create tree structure, using additional table store ancestor-child connections, not parent-child. i've used example here https://stackoverflow.com/a/5652169/2947812 , , code in models.py is: # -*- coding: utf-8 -*- my_app import db cats_hierarchies = db.table('cats_hierarchies', db.metadata(), db.column('parent_id', db.integer, db.foreignkey('category.id')), db.column('category_id', db.integer, db.foreignkey('category.id')) ) class category(db.model): __tablename__ = 'category' id = db.column(db.integer, primary_key=true) children = db.relationship("category", secondary = cats_hierarchies, primaryjoin = cats_hierarchies.c.category_id == id, secondaryjoin = cats_hierarchies.c.parent_id == id, backref="children") when try create database from my_app imp

python - Tkinter mouse event initially triggered -

i'm learning tkinter , cannot find solution problem here nor outside stackoverflow. in nutshell, events bind widgets triggered initialy , don't respond actions. in example, red rectangle appears on canvas when run code, , color=random.choice(['red', 'blue']) revealed event binding doesn't work after that: import tkinter tk class application(tk.frame): def __init__(self, master=none): tk.frame.__init__(self, master) self.can = tk.canvas(master, width=200, height=200) self.can.bind('<button-2>', self.draw()) self.can.grid() def draw(self): self.can.create_rectangle(50, 50, 100, 100, fill='red') app = application() app.mainloop() i use mac platform, haven't got clue role in problem. please point me @ mistake did here? there 2 things here: you should not calling self.draw when bind <button-2> . when click <button-2> , event object sent self.draw .

installation - magento install script 1.8.1 -

i'm trying create symply module import country region , more in database.it's simple data wasn't import.i can't figure why: config.xml <?xml version="1.0" encoding="utf-8"?> <config> <modules> <province_italian> <version>1.0.50</version> </province_italian> </modules> <global> <resources> <province_italian_setup> <setup> <module>province_italian</module> <class>province_italian_model_resource_setup</class> </setup> <connection> <use>core_setup</use> </connection> </province_italian_setup> <province_italian_write> <connection> <use>core_write</use>

c# - WPF Datagrid, possible to select or focus on row once created? -

as question states really.. i row created selected when has been created, user want row once created. i create row using observable collection via viewmodel, , once collection added, itemsource of wpf datagrid refreshed. i post code if necessary. however, if there solution this, can in view of datagrid, or in mvvm. don't care. thanks first of need bind datagrid's selecteditem property in model. can't remember if default binding mode 2 way selecteditem if not, specify 2 way in binding can set it's value in model. when new record added need store reference primary key value , after refresh itemsource need locate object matches stored primary key value. for example, if have integer primary key: int recordid = [value of primary key in new record] records = [select records database] griditemsource = records; selecteditem = records.where(x => x.recordid == recordid).firstordefault(); if using primary key consists of identity column need obta

delphi - Rescale AnimatedGIF at run-time according to Windows DPI Display Settings? -

in delphi xe2, have jvgifanimator component (from jvcl) on form. now, when run program on computer windows dpi display settings set 125%, while other gui elements , system text scaled 125%, gif animation unfortunately not resized. gif embedded in jvgifanimator component tjvgifanimator.image property @ design time tjvgifimage. is there way rescale embedded gif @ run-time according windows dpi display settings? you'll have 1 way or another. there nothing built in automatically rescale. options include: decode each frame of gif. use graphics library resize images. create new gif resized images. provide multiple gifs @ different sizes , use 1 size closest target. of these options, latter better. resizing on fly lead horrid visual artifacts , aliasing. animation dreadful. not mention coding involved. choose option 2. in fact, issue no different rasterized animations rasterized static images. need provide multiple glyphs toolbar buttons, need supply multiple versi

java - Questions about contains method in Hash Set -

i high school student apologize terms may misuse. so making slide puzzle game , working on ai part. have constructor construct board , assign hashcode such 123456780. in a* algorithm, compare if board generate (to find solution) in hashset. use contains method right? how contains method works check if 2 boards identical?. public board() { board = new int [3][3]; setpieces (board); hashcode = generatehashcode (); } this 1 of constructor. in board object, have 2d array , hashcode. wonder again, if built-in contains method in hash set compare 2 boards hashcode. or need write one. also, when assign hash code board, should in constructor right? thanks you as you've discovered, need return hashcode object in overridden hashcode() method. you can either compute hashcode in method, or compute in ctor , store in field, return field in method override.

java - Any ways to find out "beautiful numbers" -

a beautiful number number containing 1 type of digit, such these: 0 , 4 , 44 , 55555 , 3333 . i write android app finds out if number beautiful or not. try check how many digits number has, example number has 5 digits(between 10000-99999 , >= 11111) if(num % 11111 == 0){ //it beautiful number }else{ //it not beautiful } this example 5 digit numbers. can develop algorithm checking other num of digits. don't know there algorithm created before.

css - How to align input and label from collection_check_boxes? -

i using collection_check_boxes , have problems aligning checkbox , text. code: <div class="col-md-4"> <%= f.collection_check_boxes :dog_ids, dog.all, :id, :name %> </div> form displayed this: [checkbox1] text1 [checkbox2] text2 [checkbox3] text3 i trying align input , label didn't have success. have seen these question don't work me: align checkboxes f.collection_check_boxes simple_form i want accomplish this: [checkbox1] text1 [checkbox2] text2 [checkbox3] text3 thank help! the definition collection_check_boxes : collection_check_boxes(object, method, collection, value_method, text_method, options = {}, html_options = {}, &block) the last argument permits this: (this want using collection_check_boxes) <%= f.collection_check_boxes(:dog_ids, dog.all, :id, :name) |b| %> <div class="row"> <%= b.label(class: "check_box") %> <div class="col-xs-4&quo

How to configure ipage php ini to work with laravel 3? -

i registered ipage web hosting , uploaded laravel 3 php web app , didn't work , said functions deprecated , downgraded php 5.2 replied via message : " internal server error the server encountered internal error or misconfiguration , unable complete request. please contact server administrator, , inform them of time error occurred, , might have done may have caused error. more information error may available in server error log. " http://codumanity.com/kalamakom-test/kalamakom/public/index.php any ? the problem run laravel 3 solved now, did following: used php version 5.3 (not 5.2) set register_long_arrays , register_globals ' off ' in php.ini file. and started work.

oracle adf - Export the search results in .pdfs and Excel -

i have requirement export search results in pdfs , excel. export command button of drop down list pdfs , excel how achieve this. i have implemented using report declarative component not take data: <report:reportdeclarative buttonname="export" iteratorname="#{bindings.mchecklistvo1iterator}" reportname="checklist instruction template" reporttype="excel,pdf" tableid="tt1" id="rd1" serialcolumnheader="#{ngb_bizfile_e_portalbundle.serial_no}" rendered="#{pageflowscope.checklistinstructionbean.searchdetailsrender}" pagination="true" serialnumber="false"/> <af:spacer width="10" height="10" id="s3"/> if ha

eclipse - Project library not getting added to android project -

Image
iam trying reference android project library application. this:- 1)file->import->general->existing project workspace->select project library->check copy workspace. 2)right click on project->properties->android-> add-> select project library-> apply-> ok. but when again check if library added following:- how resolve this? make sure library has same location project source files. means if source on workspace , library should add workspace. if not, should copy lib same folder source mount again.

inno setup - How to import prototype to Pascal -

i have function prototype installshield script, unfortunately unable import pascal code #define serial_dll "serial.dll" prototype cdecl number serial._validatecdkey( hwnd, byref string, byref string, byref string, byref string, byref string, byref string, byref string, byref string, byref string, byref string, byref string, byref number, byref number); prototype bool isserialcorrect( string ); i able import dll successfully, every attempt call function ends access violation.

view - Hide Banner Space when there there are no Ads Android -

Image
i changed admob sdk gps lib , there 1 thing bothering me. have simple view define line in layout prevent users clicking on ads unintentionally. admob sdk line drop bottom of layout when there no ads, gps lib, view remains is. and when there no ads, when user using app in offline mode there empty ugly space. how can rid of space when there no ads? here xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/back2" > <relativelayout android:id="@+id/upperbar" android:layout_width="match_parent" android:layout_height="48dp" android:background="#000000" > <relativelayout android:id="@+id/relativelayout1" andro

delphi - How to have a list of options when clicking a TButton on Firemonkey? -

Image
i know tbutton on firemonkey let me add tpopup menu. works when right click it. i need make open right below button when normal click. popupmenu.popup(x, y) based on form believe. how translate x,y of button (that deep inside other layouts) same coordinate? and when clicking , popup shown weird behavior happens selection bar of popup menu disappear. button keeps pressed, good. look here: http://blogs.embarcadero.com/sarinadupont/2013/10/17/463/ is example mobile, use in desktop too.

php - Laravel not debugging -

this laravel routes file route::get('d', function() { return view::make('hello'); }); i have debug set true when navigate localhost:8000 instead of localhost:8000/d, blank page instead of not found http exception.but when navigate localhost:8000/d , works usual . please tell me how debugging fixed. magically resolved somehow, reinstalled laravel , terminal log [mon jun 9 19:13:27 2014] 127.0.0.1:48483 [200]: /favicon.ico [mon jun 9 19:13:50 2014] php fatal error: uncaught exception 'runtimeexception' message 'could not find resource 'views/layout.html.php' in resource paths.(searched: /home/nsnihalsahu/code/laravel/vendor/laravel/framework/src/illuminate/exception/resources, /var/www/working/laravel-master/vendor/filp/whoops/src/whoops/handler/../resources)' in /home/nsnihalsahu/code/laravel/bootstrap/compiled.php:10631 stack trace: #0 /home/nsnihalsahu/code/laravel/bootstrap/compiled.php(10513): whoops\handler\pretty

c# - Imagebutton causing __dopostback event of some other javascript -

i have gridview in asp.net webforms page imagebutton s inside updatepanel jquery ui slider buttons , textboxes pass values slider. i'm using following script slider: $(function () { var lvalue = $(".lbllrating").text(); var rvalue = $(".lblhrating").text(); $("#slider-range").slider({ range: true, min: 0, max: 5, values: [lvalue, rvalue], slide: function (event, ui) { // showcurrenttime(); // $(".txtrng1").trigger("change"); $(".txtrng1").val(ui.values[0]); var lval = $(".txtrng1").val(); // if conditions $(".txtrng2").val(ui.values[1]); var rval = $(".txtrng2").val(); // if conditions //documen

scala - How to use GzipCodec or BZip2Codec for shuffle spill compression with Spark shell -

so when start spark shell -dspark.io.compression.codec=org.apache.hadoop.io.compress.gzipcodec get. due space limitations on our cluster, want use more aggressive compression codec how use bzip2codec , avoid exception? possible? java.lang.nosuchmethodexception: org.apache.hadoop.io.compress.bzip2codec.<init>(org.apache.spark.sparkconf) @ java.lang.class.getconstructor0(class.java:2810) @ java.lang.class.getconstructor(class.java:1718) @ org.apache.spark.io.compressioncodec$.createcodec(compressioncodec.scala:48) @ org.apache.spark.io.compressioncodec$.createcodec(compressioncodec.scala:42) @ org.apache.spark.broadcast.httpbroadcast$.initialize(httpbroadcast.scala:106) @ org.apache.spark.broadcast.httpbroadcastfactory.initialize(httpbroadcast.scala:70) @ org.apache.spark.broadcast.broadcastmanager.initialize(broadcast.scala:81) @ org.apache.spark.broadcast.broadcastmanager.<init>(broadcast.scala:68) @ org.apache.spark.sparkenv$.cr

unable to add filter on a collection in Meteor helper -

i've got sort filter working, in helper, on collection shows "goals" ordered date. i'm trying add filter shows goals have status of 1. /server/publications.js meteor.publish("goals", function() { return goals.find(); }); /client/main.js meteor.subscribe("goals"); /client/views/goals_list.js template.goalslist.helpers({ goals: function() { return goals.find({}, {sort: {submitted: -1}}, {status: 1}); } }); the sort on submitted works fine, , continues working addition of status, still see goals, not ones status of 1. i've tried this, , many more ideas: return goals.find({}, {sort: {submitted: -1}}, {filter: {status: 1}}); any appreciated. directives limit returned documents based on contents belong in selector argument find . in case: return goals.find({status: 1}, {sort: {submitted: -1}});

Can't clone/push from GIT using IntelliJ Idea with ssh -

i'm trying clone git repository using intellij idea, encounter error. says: 21:28:57.558: cd c:\users\myuser\documents\ideaprojects 21:28:57.559: git clone --progress git@git.xxx.com:qa-automation/selenium.git selenium cloning 'selenium'... fatal: 'qa-automation/selenium.git' not appear git repository fatal: not read remote repository. please make sure have correct access rights , repository exists. if copy git command second line , execute in git bash clones repository correctly , works cli (including commit , push). tried open cloned project in idea , commit there, throws error above again. i'm on win 7 idea ssh client.

virtual - Operating large numbers of VM's -

i have machine , need run tests on it. these tests involve firing large number of identical vm's (up ~1000) @ same time, , commanding them same thing @ same time. does know best hypervisor this? i've been searching while , nobody seems interested in doing this. can find running multiple vm's on single host, isn't helpful. any thoughts appreciated! in advance! for record, everyone, solved in easy way! created python server , client scripts , set them run on boot. way have each vm boot , wait signal on virtual network. on signal, start work. gets them close same timing. so, easiest solution, use virtual network set them going! thanks all!

python - How to merge two columns together in Pandas -

i have data: 1975,a,b 1976,b,c 1977,b,a 1977,a,b 1978,c,d 1979,e,f 1980,a,f i want have two-column list of years , items, so: 1975,a 1975,b ... i have code: import pandas # set column names colnames=['date','item1','item2'] # read csv adding column names data = pandas.read_csv('/users/simon/dropbox/work/datasets/lagtest.csv', names=colnames) # create dataframe info on dates first column datelist1 = data[['date', 'item1']] # create dataframe info on dates first column datelist2 = data[['date', 'item2']] bigdatelist = datelist1.append(datelist2) print bigdatelist but gives me this: date item1 item2 0 1975 nan 1 1976 b nan 2 1977 b nan 3 1977 nan 4 1978 c nan 5 1979 e nan 6 1980 nan 0 1975 nan b 1 1976 nan c 2 1977 nan 3 1977 nan b 4 1978 nan d 5 1979 nan f 6 1980 nan f i want line numbering conti

How to create a JMeter Plugin -

i've been trying figure out how add on functionality of jmeter couple days, , i'm sort of stumped. want build testing functionality of proprietary db (it's not important on specifics here). however, issue encountering begin creation of functionality. i've tried various stuff on jmeter website (an example) , the wiki (an example) , boils down can't seem find repository can pull eclipse (or building ant, can't seem download_jars because can't connect repo listed in there). there date resources on how build jmeter plug in? or doing wrong here because inexperienced in setting this? any appreciated, please don't link first thing on google; have done quite bit of searching already. thanks! edit: turned out reason couldn't eclipse working repo due network restrictions had deal with. when tried on computer/network, worked fine. used this jmeter tutorial , since out of date regarding repository (they use svn now), used http://svn.apache.org/repos/a

Lotus IBM Notes 9 -

i count number of emails sent , name of associates have sent email specific common sent items. it take ages me count number of emails sent , segregate name of associates. please me create lotus notes script perform above 2 steps , store in excel. as thank help. sumit please post code wrote, easier help. i suspect code slow because did not write performance. first of all, make sure don't use getnthdocument(). second, if iterating through view, use notesviewentrycollection notesviewentries. read values using columnvalues property of notesviewentry class. make code faster if open each document. can read more here: http://blog.texasswede.com/re-using-lotusscript-lists-to-increase-performance/ next use list store number of documents per person/address. fast , efficient. can read more list here: http://blog.texasswede.com/sntt-lists-the-forgotten-gem-in-lotusscript/

linux - Compatibility Issue from centos 5.x to 6.x -

i have rpm compiled in centos 5.x requires libnetsnmp.so.10 , other shared objects. want create rpm of run on centos 6.x fails install on installation says : error: failed dependencies: libnetsnmp.so.10()(64bit) needed , on... but centos 6.x contains libnetsnmp.so.20 created symbolic links of libnetsnmp.so.10 of libnetsnmp.so.20. problem still same. so can please me resolve problem? if recompiling centos 6 isn't option, can try 2 things, first, install correct libnetsnmp in centos 6 server. if that's not option, can add following rpm spec file: autoreq: no this cause not scan binary dependencies (such dynamically linked libraries), , automatically build rpm. of course, if version of libnetsnmp required, hosing down road, newer versions work fine.

ios - how to read a huge array of bytes in chunks - pj_strset -

i working on ios project i have read huge file in chunks of 4kb here have far: nsdata *filedata= [self getbytesfrominput]; pj_str_t text; int chunksize = 4*1024; int filesize = [filedata length]; while (filesize>0){ if (filesize<=chunksize) { chunksize = filesize; filesize=0; } else filesize = filesize-chunksize; pj_strset(&text, (char*)[filedata bytes], min([filedata length], chunksize); //takes first chunk //but how take next chunk of data? //do &text .... } i refactor code loading files in chunks, can access later chunks adding offset byte-pointer: int currentoffset = 0; while (filesize>0) { ... char* bytepointer = (char*)[filedata bytes]; pj_strset(&text, bytepointer+currentoffset, min([filedata length], chunksize); currentoffset += chunksize; } edit: this should same thing reading file chunk chunk: nsstring *yourfilepath; nsfilehandle *filehandle = [nsfilehandle filehandleforreadingatpath:yourfilepath]; int chunksize =

c# - Reusing connections in Azure Relay Bus -

we're looking connecting azure websites on-premises wcf services. want use azure relay bus this. there cost involved in setting tcp channel first time, 3 seconds in our case. understood. cache channel, next call goes faster. ( 250ms ) channel cached in threadlocal storage. when multiple users using website, every new thread used, new instance of channel created, , have pay price again setting tcp channel. my question are: how prevent real user confronted delay of setting channel? normal practice have tcp channel each client thread? note: on-premises use iis auto-start or nt services 'warm up' our wcf services, way go website running on azure? fact each thread has own channel doesn't make easier. code shown below. public static class nettcprelayclient<tchannel> { /// <summary> /// threadlocal instance of channel, each thread can have open tcp channel /// </summary> private static threadlocal<tchannel> staticchann

c# - Can I replicate the table header when a table keep on in more pages? -

i have following situation creating pdf itextsharp. i have pages contains tables. happen table begin in page , keep on in following page. i want know if, when table keep on in following page, possible "replicate" table header in new page. for example if table begin in page 1 , keep on in table 2 want have following situation: the table begin header in page 1 , keep on in page 2 @ beginning of page 2 have again table header. happen table in microsoft word. can it? tnx you asking called "repeating table headers". can find examples on official itext site on page keyword pdfptable > header rows . for instance, if have instance of pdfptable named table , , first 2 rows you've been adding header, can define them header rows this: table.setheaderrows(2); if want c# version of examples taken book, can find them here : http://tinyurl.com/itextsharpiia2c04 these examples show syntax in c# different, still easy: table.headerrows = 1;

asp.net - How can I trigger Html.BeginForm by clicking a button? -

here html.beginform code. want pass 2 values action checkoutproduct . how can trigger html.beginform clicking button? @html.beginform("checkoutproduct", "checkout") { <input type="hidden" id="productcodeforcheckout" value="" /> <input type="hidden" id="productqtyforcheckout" value="0" /> } <button class="btn" id="checkout"><span>add cart</span></button> just place submit button inside form @html.beginform("checkoutproduct", "checkout") { <input type="hidden" id="productcodeforcheckout" value="" /> <input type="hidden" id="productqtyforcheckout" value="0" /> <input type="submit" class="btn" id="checkout" title="add cart" /> } if prefer stick button instead of input , set

opencv - Is there any easy way to find the maximum (i.e. white) value for a given Open CV type? -

if have open cv matrix , don't know type (e.g. 8 bit unsigned, 32 bit float), there easy function give me value used represent white (so 255 8 bit unsigned, 1.0 32 bit float, etc)? on opencv 2.x, take @ mat::depth retrieve (quoting docs): the identifier of matrix element depth (the type of each individual channel) from there can calculate value represent white color switch: switch (image.depth()) { case cv_8u: white = scalar(255,255,255); break; case cv_8s: ... }

vb.net - How to .SetValue(string, object) for context menu in internet explorer? -

i trying add new entries internet explorer context menu. want use default menu , according site http://msdn.microsoft.com/en-us/library/aa753589%28v=vs.85%29.aspx want use value 0x1. when type: key.setvalue("contexts", 0x1) into visual studio, error "comma, ")", or valid expression continuation expected." it works in example using c#: http://support.microsoft.com/kb/2618576 but in example using vb.net: http://code.msdn.microsoft.com/windowsdesktop/vbcustomiecontextmenu-913227d7/sourcecode?fileid=22702&pathid=537448198 they use: iemenuextkey.setvalue("contexts", &h2) does know how can work in vb.net? 0x prefix hexadecimal numbers. vb.net uses &h instead. code should key.setvalue("contexts", &h1) . because 1 has same value in both hexadecimal , decimal systems, can delete &h - key.setvalue("contexts", 1) fine.

jquery - Catch event on nth div click -

what's possible way catch event on click, if event target must nth div? example, we've following html: <div id="wrapper"> <div class="item"></div> <div class="item"></div> <div class="item"></div> </div> how can fire event if have clicked on second div? something that: if($(event.target).is('item:eq(1)')){alert('second')} or if($(event.target).is('.item:eq(1)')){alert('second')} is not working. jsfiddle quick edit: http://jsfiddle.net/uxqm2/ thanks answers. don't need code strictly binded on 1 element, that's why asking event target. i've function starting clicktarget.on('click', function(event){ //some code here }); where clicktarget item class example above. , don't want write 3 functions work similar change 1 line of code - it's not good, asked because want catch event inside function , ch

android - List with read and unread status drawable adding to listview -

am able display list data coming read , unread need add 1 draw able icon list item.am able data source , of base adapter based on status flag read , unread able add icon list view after when scroll list data changes automatically please provide help. you should specific decoration of item in getview method of list adapter . refresh via adapter.notifydatasetchanged listview refresh views based on adapter data.

scala - environmental variable substitution when including another configuration file in Play 2.2 -

Image
is possible use environmental variable substitution when including configuration file? i have that: include "${home}/.foo/credentials.conf" configuration documentation mentions locating resources , include substitution not together. this works: include "/home/me/.foo/credentials.conf" and home correctly set. but attempts make include "${home}/.foo/credentials.conf" far failed background: i deliberately want keep credentials , other sensitive data out of our code base have them available local dev environments testing. aware of more sophisticated solutions using external storage hinted here playframework 2 - storing credentials , use similar live , preview environments these not suitable local dev setup. an alternative include credentials file code base after use git ignore prevent pushing it, fragile solution , risk push , compromise credentials. tbh i'm not able include file absolute path /home/me... anyway appr

javascript - Creating anonymous functions inside conditional statements -

i've snippet : if(el) { el.addeventlistener("click", function(){ if (body.classlist.contains("el-is-open")) { body.classlist.remove("el-is-open"); } else { body.classlist.add("el-is-open"); } }); foo.addeventlistener("click", function(){ body.classlist.remove("el-is-open"); }); } is okay wrap these statements inside condition? i'm new js i'm not sure if okay do.. before got: uncaught typeerror: cannot read property 'addeventlistener' of null after can have js inside same file, , run if document have id el (i.e). thanks

c# - Simple RegEx Example -

i'm horrible @ regex please bare me here: i need match first character can , next 2 have rs. so... xrs123445 - match thanks! this regex you're looking for: ^.rs.* this match on of these: xrs123445 4rsabc yrs

ios - UICollectionView and UITableView calls scrollViewDidScroll after a pop on UINavigationController -

my situation: i've view controller a uicollectionview on it. push new view controller b and when come (with button) b a , uiscrollviewdelegate on a call - (void)scrollviewdidscroll:(uiscrollview *)scrollview . i've same behavior view controller uitableview . this drive me crazy... ideas ? try set self.automaticallyadjustsscrollviewinsets = no; in controller or disable storyboard.

c# - Cannot Find MVC 3 in Visual Studio 2010 -

i trying create new mvc 3 project in visual studio 2010. when selecting new project cannot see mvc 3 in list of installed templates. have option set .net framework 4 , still not appear. need download dependency somewhere or missing simple step?

duplicate symbol error in C -

i have following code layout header.h #ifndef _header_h #define _header_h void empty(float *array, int l) { int i; (i=1 ; i<=l ; i++) { array[i]=0; } } #endif and 2 files (lets call them file1.c , file2.c) #include "header.h" void function/*1 or 2*/(){ .... empty(a,b); .... } so compiling works fine linker command fails compiler says there duplicate function definition. how can avoid still using header file? working fine when define function in header , create .c file containing full function. thought declaring in header way go. i thought declaring in header way go. yes, is. declaring in header fine. not define in header, though. (unless it's static inline , don't want these days.)

Magento Invalidated BLock Cache -

i monitoring magento store , have observed "blocks html output" cache invalidated after few hours , have refresh make enable. i not sure why getting "invalidated cache" error message, though have not made changes on site. because 1 of block output not correct? if so, how can identify such block? thank you. check link : what "invalidated" cache mean in magento? brief explanation : magento caches blocks. when products updated blockc cached not have updated details hence magento shows this, indicating these blocks not mark , action needs taken.

html - Table with spacing before/after separation line between rows -

Image
i'm trying build html table separation line between rows. main concern fact need add padding left/right in tbody. tried different things, such: add :before/:after floating element add space add border-collapse: collapse table, add border tbody, lost border on table doing that here table: and need do: codepen source: http://codepen.io/anon/pen/gojuw do have suggestion? thanks how setting left , right border in first , last <td> , respectively? see working example in here . works this: html: <div id="table_wrapper"> <table> <thead> <tr><td>item 1</td><td>item 2</td><td>item 3</td></tr> </thead> <tbody> <tr><td>item 1</td><td>item 2</td><td>item 3</td></tr> <tr><td>item 1</td><td>item 2</td><td>item 3</td&g

algorithm - Find largest product of negative numbers in Java -

i taking semi-advanced class in java. taught myself javascript hobby, i'm not real beginner, i'm not experienced when comes making algorithms. have homework problem do. goes along lines of: given n positive integers, n >= 5 find largest product possible picking 2 (not consecutive) numbers factors. for example, if input is: 3 6 0 10 4 , output should 60 . this seemed easy. picked largest 2 , multiplied them: system.out.println("how many numbers give me?"); int n = sc.nextint(); if (n < 5) throw new error("n must @ least 5"); system.out.println("enter numbers"); int max1 = 0, max2 = 0; (int = 0; < n; ++i) { int newint = sc.nextint(); if (newint > max1) { max2 = max1; max1 = newint; } else if (newint > max2) { max2 = newint; } } system.out.println("the largest product " + (max1 * max2)); this worked perfectly. now, there "bonus" or extended problem after 1 (option

javascript - Go to page after 10 minutes of no interaction -

i creating local website (only 1 person able interact @ time) displayed on big touch screen @ office working at. the client wants have screensaver appear on website after 10 minutes of no interaction. creating in flash actionscript 3.0. there 7 pages , 7 screensavers. tried persuade them have 1 screensaver make life whole lot easier client insists. is possible write javascript statement says "if no click registered after 10 minutes, go url (where flash screensaver be)". i share links further explanation of content confidential @ stage. if possible try hand @ writing .js code, , update section, thought check if possible first. i have tried write javascript can't alert box appear, ideas? function redirect(){ window.location.href = "autoplay/index.html"; } var initial=settimeout(redirect,6000); function click() { cleartimeout( initial ); alert("helo"); initial=settimeout(redirect,12000); } i using under