Thursday, 15 March 2012

ios - UIStoryboard define a collectionViewCell and reuse it -



ios - UIStoryboard define a collectionViewCell and reuse it -

this question has reply here:

in storyboard, how create custom cell utilize multiple controllers? 5 answers

i defined uicollectionviewcell in uistoryboard, want utilize in multiple uiviewcontrollers.

is there way, changes cell in storyboard propagated other instances? in day possible set uiview (or in case uicollectionviewcell) xib-file , straight instantiate that, storyboard can't figure out. possible?

the uicollectionviewcell subclassed, layout defined in storyboard.

although question uicollectionviewcell, sure this answer (which uitableviewcell) general enough, solve problem.

ios uicollectionviewcell

spring data neo4j - Enum conversion to String not working on @Indexed unique field -



spring data neo4j - Enum conversion to String not working on @Indexed unique field -

i'm neo4j/spring-data newbie apologies if obvious looked here , there , can't quite figure out if it's bug or feature. i'm using sdn 3.1.0 , neo4j 2.0.4, running in memory (for testing).

i have super simple pojo seek save neo4j using sdn. looks so:

@nodeentity public class weekday { @graphid private long id; @indexed(unique = true) public dayofweek weekdaycode; }

everything works beautifully when create non-uniquely indexed, or not indexed @ all. works fine unique constraint when create string well. (well, sort of, i'm aware doesn't throw exception silently updates existing 1 - not perfect found jira issue related that). unfortunately moment seek save enum unique constraint exception:

org.springframework.dao.invaliddataaccessresourceusageexception: error executing statement merge (n:`weekday` {`weekdaycode`: {value}}) on create set n={props} homecoming n; nested exception org.springframework.dao.invaliddataaccessresourceusageexception: error executing statement merge (n:`weekday` {`weekdaycode`: {value}}) on create set n={props} homecoming n; nested exception java.lang.illegalargumentexception: [monday:java.time.dayofweek] not supported property value @ org.springframework.data.neo4j.support.query.cypherqueryengineimpl.query(cypherqueryengineimpl.java:61) @ org.springframework.data.neo4j.support.schema.schemaindexprovider.merge(schemaindexprovider.java:114) @ [...] caused by: org.springframework.dao.invaliddataaccessresourceusageexception: error executing statement merge (n:`weekday` {`weekdaycode`: {value}}) on create set n={props} homecoming n; nested exception java.lang.illegalargumentexception: [monday:java.time.dayofweek] not supported property value @ org.springframework.data.neo4j.support.query.cypherqueryengineimpl.parseandexecutequery(cypherqueryengineimpl.java:72) @ org.springframework.data.neo4j.support.query.cypherqueryengineimpl.query(cypherqueryengineimpl.java:58) ... 63 more caused by: java.lang.illegalargumentexception: [monday:java.time.dayofweek] not supported property value @ org.neo4j.kernel.api.properties.propertyconversion.convertproperty(propertyconversion.java:107) @ org.neo4j.kernel.api.properties.property.property(property.java:51) @ [...]

this, far can see, because unique field set map "props", , contents of map not automatically converted sends enum neo4j, doesn't like.

is expected or should raise bug sdn? if that's expected behaviour, have alternatives other making field string?

i'm not sure if real bug, had similar problem using own enum class.

so, seek this:

create converters register them in neo4j

first create converters like:

@component public class stringtodayofweekconverter implements converter<string, dayofweek> { @override public dayofweek convert(string source) { homecoming dayofweek.valueof(source); } } @component public class dayofweektostringconverter implements converter<dayofweek, string> { @override public string convert(dayofweek source) { homecoming source.name(); } }

then register converters, neo4j can utilize them:

@configuration @enableneo4jrepositories("my.repository.package") @enabletransactionmanagement public class myneo4jconfiguration extends neo4jconfiguration { @autowired private stringtodayofweekconverter stringtodayofweekconverter; @autowired private dayofweektostringconverter dayofweektostringconverter; @override protected conversionservice neo4jconversionservice() throws exception { converterregistry converterregistry = (converterregistry) super.neo4jconversionservice(); converterregistry.addconverter(stringtodayofweekconverter); converterregistry.addconverter(dayofweektostringconverter); homecoming (conversionservice) converterregistry; } }

spring-data-neo4j

Android, ScrollView shows more space -



Android, ScrollView shows more space -

this code within scrollview shows more space it's textview, how can prepare it? checked both fillviewport true , false , didn't work.

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/details_root_layer" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10dp" android:gravity="right" android:text="@string/detail_header" android:textcolor="#454545" android:textsize="20sp" /> <view android:layout_width="match_parent" android:layout_height="2dp" android:background="#900" /> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingtop="10dp" > <textview android:id="@+id/tv_no" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:text="@string/pizza" android:textcolor="#333" android:textsize="18sp" /> <imageview android:id="@+id/iv_details_header" android:layout_width="200dp" android:layout_height="200dp" android:layout_below="@id/tv_no" android:layout_centerhorizontal="true" android:layout_margintop="10dp" /> <textview android:id="@+id/tv_price_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_below="@+id/iv_details_header" android:gravity="right" android:text="@string/price" android:textcolor="#767676" /> <textview android:id="@+id/tv_price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@id/tv_price_text" android:layout_marginright="14dp" android:layout_toleftof="@+id/tv_price_text" android:gravity="right" android:text="12000" android:textcolor="#666" /> <linearlayout android:id="@+id/ll_details_btn" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:orientation="vertical" > <view android:id="@+id/view_details_uper_btn" android:layout_width="match_parent" android:layout_height="2dp" android:background="#900" /> <button android:id="@+id/btn_details_ok" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/back_btn_details" android:padding="10dp" android:text="@string/ok" android:textcolor="#900" android:textsize="20sp" /> </linearlayout> <scrollview android:id="@+id/sv_details" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@id/ll_details_btn" android:layout_aligntop="@id/tv_price" android:layout_margintop="20dp" android:fillviewport="false" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginright="10dp" android:gravity="right" android:text="@string/combnation" android:textcolor="#343434" android:textsize="16sp" android:textstyle="bold" /> <textview android:id="@+id/tv_desc" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginright="20dp" android:text="@string/desc" android:textcolor="#343434" android:textsize="15sp" /> </linearlayout> </scrollview> </relativelayout>

change scroll view from

this:

<scrollview android:id="@+id/sv_details" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@id/ll_details_btn" android:layout_aligntop="@id/tv_price" android:layout_margintop="20dp" android:fillviewport="false" >

to this:

<scrollview android:layout_width="fill_parent" android:layout_height="fill_parent" >

android scrollview

Android Volley Post Request - Workaround for JsonArrayRequest -



Android Volley Post Request - Workaround for JsonArrayRequest -

i understand post requests using jsonarrayrequest not available out of box volley, saw post here talked adding constructor handle this. implementation this:

public jsonarrayrequest(int method, string url, jsonobject jsonrequest, listener<jsonarray> listener, errorlistener errorlistener) { super(method, url, (jsonrequest == null) ? null : jsonrequest.tostring(), listener, errorlistener); }

how go adding constructor? above question mentions placing in volley tool library. imported volley .jar, i'm not sure how add together constructor this, or if best approach. help much appreciated.

edit

i've created next class override , constructor suggested. here class:

public class postjsonarrayrequest extends jsonarrayrequest { @override protected map<string, string> getparams() throws authfailureerror { hashmap<string, string> params = new hashmap<string, string>(); params.put("name", "value"); homecoming params; } public postjsonarrayrequest(int method, string url, jsonobject jsonrequest, listener<jsonarray> listener, errorlistener errorlistener) { super(method.post, url, null, listener, errorlistener); } }

on line calling super i'm getting the constructor jsonarrayrequest(int, string, null, response.listener<jsonarray>, response.errorlistener) undefined

how right this?

create class , extend jsonarrayrequest override

@override protected map<string, string> getparams() throws authfailureerror { hashmap<string, string> params = new hashmap<string, string>(); params.put("name", "value"); homecoming params; }

and add together new constructor , in phone call

super(method.post, url, null, listener, errorlistener);

or utilize class

public class postjsonarrayrequest extends jsonrequest<jsonarray> { /** * creates new request. * @param url url fetch json * @param listener listener receive json response * @param errorlistener error listener, or null ignore errors. */ public postjsonarrayrequest(string url, response.listener<jsonarray> listener, response.errorlistener errorlistener) { super(method.post, url, null, listener, errorlistener); } @override protected map<string, string> getparams() throws authfailureerror { hashmap<string, string> params = new hashmap<string, string>(); params.put("name", "value"); homecoming params; } @override protected response<jsonarray> parsenetworkresponse(networkresponse response) { seek { string jsonstring = new string(response.data, httpheaderparser.parsecharset(response.headers)); homecoming response.success(new jsonarray(jsonstring), httpheaderparser.parsecacheheaders(response)); } grab (unsupportedencodingexception e) { homecoming response.error(new parseerror(e)); } grab (jsonexception je) { homecoming response.error(new parseerror(je)); } } }

android android-volley

How to convert 4 bytes to a Swift float? -



How to convert 4 bytes to a Swift float? -

i'm writing msgpack parser in swift way larn language. doesn't sense suited task i've been making progress. i've nail block can't seem convince convert 4 bytes float.

var bytes:array<uint8> = [0x9a, 0x99, 0x99, 0x41] //19.20000 var f:float = 0 memccpy(&f, &bytes, 4, 4) print(f)

in playground get:

fatal error: can't disclose optional.none playground execution failed: error: execution interrupted, reason: exc_bad_instruction (code=exc_i386_invop, subcode=0x0).

any ideas seek next?

drop & on "&bytes". bytes array.

var bytes:array<uint8> = [0x9a, 0x99, 0x99, 0x41] //19.20000 var f:float = 0.0 memccpy(&f, bytes, 4, 4) // per op. memcpy(&f, bytes, 4) preferred println ("f=\(f)")// f=19.2000007629395

swift swift-playground

For iOS 7.1, how can you scale an interface or screen to fit smaller iPhone models? -



For iOS 7.1, how can you scale an interface or screen to fit smaller iPhone models? -

apologies in advance if question has been answered elsewhere, have searched , found no equivalent solution. sense free link me if 1 has been made.

i have built entire storyboard app (with around 50-60 view controller layouts in xib file) 4-inch iphone 5/5c/5s, , looking way scale downwards screen.

by "scale down" mean automatically take each screen laid out in storyboard , scaling aspect when programme run on smaller iphone, iphone 4s, 4, 3g, or smaller model compatible ios 7.1.

i not have time individually alter configuration of every single layout item on storyboard, amounts 1000s of objects, please restrict answers or suggestions have on more massive scale. surely, method of library must exist allows move smaller window on smaller iphone without clipping or cropping. if shrinking/scrunching causes blur or font less visible, much preferable entire portions of screen becoming off-screen.

a global setting allowing simple aspect scale, multiplying every dimension of every object in storyboard destinationphonewidth/iphone5width horizontal dimension , destinationphoneheight/iphone5height satisfactory solution. not aware of 1 exists...

one solution there goal accomplish , autolayout

beside ,i don't think there library such goal accomplish , certainly take lot of time of your's per u mention there 50-60 view controller. sorry should have decided off before compatibility of app in size. best , maintain coding. next time, when starting off app maintain in compatibility of in avoid such massive work @ end.

ios iphone xcode layout interface-builder

ios - Accessing variables of subviews from uipageviewcontroller class/passing variable values across views -



ios - Accessing variables of subviews from uipageviewcontroller class/passing variable values across views -

i implementing similar stock app on iphone. have got graph render , have implemented time granularity feature got stocks (1w, 1d, 1m, etc). problem don't know how can pass on chosen time granularity 1 view while swiping.

for example: have a: 1. uipageviewcontroller , have 3 subviews each views renders graph 2. each of 3 subviews have 4 buttons (to view graph 1day, 1week, 1hour or 1month)

if click "1day" button want next graph default "1day" , have button selected. same applies other buttons well.

i can't seem find clean way of passing button selected previous view new view gets loaded. i've experimented lot adding code in pageviewcontroller class functions such : willtransitiontoviewcontrollers, transitioncompleted, viewcontrollerbeforeviewcontroller , viewcontrollerafterviewcontroller no avail! :(

for starters, if @ to the lowest degree help me passing string 1 view great (would great if can give me little example).

for example, have

@proper nsstring *tmp; in view1: tmp = @"day";

when user swipes view1 view2, want view2 have @"day" when "viewdidappear" method gets called. appreciate help!

i solved problem using below code after reading on nsuserdefaults. helps me restore info after app restarted cool. phone call storefoo in "viewdiddisappear" , phone call restorefoo in "viewdidappear".

since did not answer, answering own question may benefit others facing similar problem.

-(nsstring *)storefoo { nsuserdefaults *defaults; nsstring *gran_store; defaults = [nsuserdefaults standarduserdefaults]; store = [defaults objectforkey:@"sometext"]; if (store == nil) { store = @"test"; } homecoming store; }

and code retrieve stored string be:

-(nsstring *)restorefoo { nsuserdefaults *defaults; nsstring *store; defaults = [nsuserdefaults standarduserdefaults]; store = [defaults objectforkey:@"sometext"]; if (store == nil) { store = @"something"; //in case want default string if null } homecoming store; }

ios objective-c subview uipageviewcontroller

hadoop - Installing R package tm in amazon EMR -



hadoop - Installing R package tm in amazon EMR -

i couldnt install bundle tm in emr. seems version issue. first installed teh latest version tm 0.6. not supported r 2.15.2 in emr. seek install version tm 0.5-8.1. i'm getting next error.

dependency 'slam' not available bundle 'tm'

can suggest me right package/packages install tm in emr amason?

r hadoop amazon-web-services emr tm

javascript - Controlling table-row height based on which gets its height from text -



javascript - Controlling table-row height based on <td> which gets its height from text -

i have table contains rows 2 columns. 1 column contains images, , other contains text. images big images resize (meaning, take height container). need row take height textcell. amount of text variable in row, can't assign explicit height. considering images larger size of text, row takes height imagecell rather textcell. how row , imagecell take height of textcell?

<table border="0" cellspacing="0" cellpadding="0" id="articletable"> <tr id="row-1" class="articlerow light" > <td class="imagecell" id="image-cell-1"> <img src="images/support/cfd.png" alt="" class=""/> <img src="images/support/cfd3.png" alt="" class="" /> </td> <td class="textcell" id="text-cell-1" > <div class="articletextwrapper"> text text text text text text text text text text </div> </td> </tr> <tr id="row-2" class="articlerow dark" style=""> <td class="textcell" id="text-cell-2" > <div class="articletextwrapper"> text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text </div> </td> <td class="imagecell" id="image-cell-2"> <img src="images/support/tm2.png" alt="" class="" /> <img src="images/support/tm1.png" alt="" class=""/> </td> </tr>

maybe javascript method one:

var txts = document.getelementsbyclassname("textcell"); for(var i=0; i<txts.length; i++) { var h = txts[i].getelementsbyclassname("articletextwrapper")[0].offsetheight; txts[i].parentnode.style.height = h + "px"; }

this set fixed height <tr> relative height of text within cell, giving ability set image total height.

javascript jquery html css internet-explorer-8

Building FreeImage 3.16.0 for Android -



Building FreeImage 3.16.0 for Android -

i'm having problem building freeimage 3.16.0 android. i've referenced both how build freeimage android source distribution? , http://recursify.com/blog/2013/05/25/building-freeimage-for-android (both freeimage 3.15.4) neither work due believe compiler issues freeimage 3.16.0.

here's configuration:

ubuntu 13.04 64-bit (also have tried os x 10.9.2 same results)

android-ndk-r9d (also have tried android-ndk-r8-crystax-1 , android-ndk-r8e same results)

file structure:

freeimageandroid/ -- jni/ -- android.mk -- application.mk -- makefile.srcs (from freeimage source archive root directory) -- source/ (freeimage source folder)

android.mk:

local_path := $(call my-dir) include $(local_path)/makefile.srcs include $(clear_vars) local_module := freeimage local_c_includes := $(local_path)/source \ $(local_path)/source/metadata \ $(local_path)/source/freeimagetoolkit \ $(local_path)/source/libjpeg \ $(local_path)/source/libpng \ $(local_path)/source/libtiff4 \ $(local_path)/source/zlib \ $(local_path)/source/libopenjpeg \ $(local_path)/source/openexr \ $(local_path)/source/openexr/half \ $(local_path)/source/openexr/iex \ $(local_path)/source/openexr/ilmimf \ $(local_path)/source/openexr/ilmthread \ $(local_path)/source/openexr/imath \ $(local_path)/source/librawlite \ $(local_path)/source/librawlite/dcraw \ $(local_path)/source/librawlite/internal \ $(local_path)/source/librawlite/libraw \ $(local_path)/source/librawlite/src local_src_files := $(srcs) local_cpp_features := rtti exceptions local_cflags := -o3 -fpic include $(build_static_library) include $(clear_vars) local_module := freeimageshared local_static_libraries := freeimage include $(build_shared_library)

application.mk:

app_stl := gnustl_static app_abi := app_optim := release

other steps:

commented #define have_search_h 1 out in source/libtiff4/tif_config.h

deleted "././source/freeimage/pluginjxr.cpp" srcs definition in makefile.srcs (b/c looked broken)

added swab function source\librawlite\internal\dcraw_common.cpp

here compiler errors after running ndk-build freeimageandroid directory:

compile++ thumb : freeimage <= dcraw_common.cpp in file included /home/parallels/freeimageandroid/jni/source/librawlite/libraw/libraw.h:40:0, /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:29: /home/parallels/freeimageandroid/jni/source/librawlite/libraw/libraw_datastream.h:93:35: warning: 'auto_ptr' deprecated (declared @ /home/parallels/android-ndk-r8-crystax-1/sources/cxx-stl/gnu-libstdc++/4.6/include/backward/auto_ptr.h:87) [-wdeprecated-declarations] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp: in fellow member function 'void libraw::kodak_radc_load_raw()': /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000002' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000003' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000011' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000005' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000007' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000012' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000009' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000002' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x0000000000000001c' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000031' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000009' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x0000000000000004f' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000001' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000010' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000025' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x0000000000000001a' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x0000000000000000d' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000027' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x00000000000000037' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:2412:3: error: narrowing conversion of '-0x0000000000000004c' 'int' 'const char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp: in fellow member function 'void libraw::vng_interpolate()': /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:3965:3: error: narrowing conversion of '128' 'int' 'const signed char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:3965:3: error: narrowing conversion of '136' 'int' 'const signed char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:3965:3: error: narrowing conversion of '128' 'int' 'const signed char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:3965:3: error: narrowing conversion of '136' 'int' 'const signed char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:3965:3: error: narrowing conversion of '128' 'int' 'const signed char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:3965:3: error: narrowing conversion of '136' 'int' 'const signed char' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp: in fellow member function 'void libraw::adobe_coeff(const char*, const char*)': /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:7270:3: error: narrowing conversion of '65535' 'int' 'short int' within { } [-fpermissive] /home/parallels/freeimageandroid/jni/source/librawlite/./internal/dcraw_common.cpp:7270:3: error: narrowing conversion of '65535' 'int' 'short int' within { } [-fpermissive] make: *** [/home/parallels/freeimageandroid/obj/local/armeabi-v7a/objs/freeimage/source/librawlite/./internal/dcraw_common.o] error 1

has else compiled freeimage 3.16.0 android? there other options can utilize build ndk?

i had same problem, , compiled on android ndk r10d workarounds.

since i'm using jpg , png formats, of changes made supposed work, untested (mostly webp , tiff support)

i disabled jxr plugin removing makefile , static plugin initialization, freeimage's plugin scheme nightmare, i'm not sure didn't break anything.

my patch available under http://j.mp/_fidroid

android android-ndk freeimage

jquery - Closing the Colorbox when clicking on its image -



jquery - Closing the Colorbox when clicking on its image -

i've got colorbox closes nicely with:

$.colorbox.close();

i closes when clicking on overlay, i'd close when clicking on image. can add together phone call close function?

i this:

$('img').click(function() { $.colorbox.close(); });

jquery colorbox

c# - How to bind two properties of two classes together -



c# - How to bind two properties of two classes together -

first of apologize if question explicit, i'm confused way best , googled can't find solution.

i have class this:

public abstract class auto { public point3d location { get; set; } }

and class this:

class motion { public point3d location {get; set;} public motion(point3d location) { location = location; } }

i want motion.location updated when car.location changed. done until car.location don't renewed.

car1.location=new point3d();

after 2 properties separated. can guarantee motion.location car.location

all declare event @ object level notified when property changes. you'd have add together backend property location can fire event.

public abstract class auto { private point3d _loc; public event system.eventhandler locationchanged; public point3d location { get{ homecoming _loc; } set; { _loc = value; if ( locationchanged != null ) { locationchanged( this, new eventargs() ); } } } }

c# properties bind

c++ - Can a class name instead of a namespace be pre-pended to :: for scope resolution? -



c++ - Can a class name instead of a namespace be pre-pended to :: for scope resolution? -

so understand it, when see double colons(abc::xyz) used thing on left namespace , thing on right can function or variable of sort defined in namespace. ex. namespace::bar, namespace::foo()

now, can thing on left class? ex. class::bar, class::foo()

if so, have info on this. can find lots of info of scope resolution pertaining namespaces not when comes classes.

in situation going through rather big project of code individual. code usage trying understand have next line of code...

multi_img::ptr input = imginput::imginput(config.input).execute();

on right imginput::imginput() can found because there namespace imginput can find. on left, multi_img::ptr, there no multi_img namespace in project. there multi_img class contains next line...

typedef boost::shared_ptr<multi_img> ptr;

i believe multi_img::ptr means can not find documentation assumption.

now, can thing on left class?

yes can, , justify consider next example:

#include <iostream> class foo { public: void fun() const { std::cout << "foo:fun()" << std::endl; } }; int main() { foo f; f.foo::fun(); homecoming 0; } demo every class fellow member lies in scope of class.

edit after @cheersandhth.-alf constructive comment:

thus, can access fellow member through object either classical way (e.g., f.fun()) in case you'll have virtual phone call or phone call in illustration (i.e., f.foo::fun()) in case explicitly disambiguate scope of fellow member function @ compile time.

c++ scope

osx - Terminal, svn copy not working after multiple svn commands -



osx - Terminal, svn copy not working after multiple svn commands -

i executed command similar following:

svn re-create https://myrepo.com/projectfolder1/myproject.prj https://myrepo.com/projectfolder2 -m "copied myproject.prj projectfolder2"&& svn update

and indeed re-create went through update too.

but every other command similar afterwards re-create more projects presenting me symbol: ">" assume means need to/ want come in more stuff? , actual command not beingness executed.

second command:

svn re-create https://myrepo.com/projectfolder1/myproject2.prj https://myrepo.com/projectfolder2 -m "copied myproject2.prj projectfolder2"&& svn update

i know exit have hit: cntl c. intent execute re-create commands. not find solution (possibly because don't know search exactly). doing wrong or missing here? give thanks you

the issue has nil executing multiple commands. instead issue in textedit.app. entering && after these quotes:" result in quotes changing smart quotes “. entering && after:

"

will result in

“&&

where quotes different if closely.

as test, textwrangler.app not this, textedit.app, maybe bug.

i henceforth using textwrangler prepare terminal commands.

osx svn command-line terminal svn-copy

c# - Returning an object from PowerShell cmdlet -



c# - Returning an object from PowerShell cmdlet -

i'm trying create own set of cmdlets powershell snapin. problem i'm having i've created own object create , populate within processrecord method i'm not able alter homecoming type allow me homecoming object created.

protected override void processrecord() { reportfilesettings rptfilesettings = new reportfilesettings(); rptfilesettings.enabled = string.equals((reader.getattribute("enabled").tostring().tolower()), "yes"); rptfilesettings.filelocation = reader.getattribute("filelocation").tostring(); rptfilesettings.overwriteexisting = string.equals(reader.getattribute("overwriteexistingfile").tostring().tolower(), "yes"); rptfilesettings.noofdaystokeep = int.parse(reader.getattribute("numberofdaystokeep").tostring()); rptfilesettings.archivefilelocation = reader.getattribute("archivefilelocation").tostring(); homecoming rptfilesettings; }

this processrecord method it's overriding 1 pscmdlet cannot alter homecoming type void.

can help best way homecoming rptfilesettings object can utilize values in other cmdlets?

you don't ever need homecoming value cmdlet.processrecord method. method has it's specific place , way of utilize in powershell cmdlet processing lifecycle.

passing objects downwards cmdlet processing pipeline handled framework you. same way cmdlet instance gets input info can send info output farther processing. passing objects output done using cmdlet.writeobject method within of input processing methods, beginprocessing, processrecord , endprocessing.

to pass constructed rptfilesettings object cmdlet output need this:

protected override void processrecord() { reportfilesettings rptfilesettings = new reportfilesettings(); ... writeobject(rptfilesettings); }

c# powershell return-type cmdlets pscmdlet

objective c - [MyObject myObjectWith: ...] -



objective c - [MyObject myObjectWith: ...] -

this question has reply here:

class methods create new instances 4 answers

does knows how create kind of "class auto instantiator":

mydict = [nsdictionnary dictionnarywithcapacity: 0];

i can't find resource on (maybe don't know terminology)

not sure mean... mean class method create object?

@implementation myclass +(myclass *)myclasswithparameter:(int)whatever { myclass instance = [[myclass alloc] init]; [instance dowhatever:whatever]; homecoming instance; }

objective-c constructor initialization

dynamic - Resizing vertical and horizontal images in CSS -



dynamic - Resizing vertical and horizontal images in CSS -

html

<section class="rama"> <ul> <li><img src="images/rama_detail.jpg"/></li> <li><img src="images/rama_detail2.jpg"/></li> </ul>

css

section img { max-height:500px; width:100%; height:auto; overflow:hidden; }

so here's problem. want dynamically resize both images. width:100%; height:auto; work great horizontal image, vertical images width stretch out because of width:100%;. there simple way dynamically resize both vertical , horizontal images without using different classes both image type?

thank you!

i think best alternative utilize jquery iterate on images, , dynamically add together appropriate class:

fiddle: http://jsfiddle.net/m5y53/4/

css

section img {overflow:hidden;} section img.landscape {max-width:200px; width:100%; height:auto;} section img.portrait {max-height:200px; width:auto; height:100%;}

i split declarations landscape , portrait images in subclasses, rest of declarations (in case overflow:hidden; don't have repeated both subclasses.

js (jquery)

$(window).on('load',function(){ $('section img').each(function(){ //you need set within window.onload-function (not document.ready), otherwise image dimensions won't available yet if ($(this).width()/$(this).height() >= 1) { $(this).addclass('landscape'); } else { $(this).addclass('portrait'); } }); });

now, using jquery, iterate on each image fits section img-selector, , dynamically add together appropriate class. determine whether image has landscape or portrait format, check see if width/height larger (or equal) 1.

i wasn't sure how wanted images scaled, set max-width:200px , max-height:200px within subclasses, scale them parent-width , -height (see commented-out css rule .rama ul li).

css dynamic resize

ios - Coordinating two UIView animations on UIButton down/up -



ios - Coordinating two UIView animations on UIButton down/up -

i'm trying build animation around uibutton. uibutton has uiimageview contains image i'd shrink when uibutton held downwards , when uibutton allow go, i'd play separate animation bounce.

the issue i'm experiencing right 2nd part of animation doesn't seem play if press downwards , quickly. if press , hold (wait first animation finish), allow go, seems work fine.

here's relevant code:

-(void)presseddown { [uiview animatewithduration:0.2 delay:0 options:uiviewanimationoptioncurveeaseout animations:^{ self.heartpart.layer.transform = catransform3dmakescale(0.8, 0.8, 1); } completion:nil]; } -(void)pressedup { [uiview animatewithduration:0.8 delay:0.0 usingspringwithdamping:20 initialspringvelocity:200 options:uiviewanimationoptionbeginfromcurrentstate animations:^{ self.heartpart.layer.transform = catransform3didentity; } completion:nil]; }]; }

in viewdidload add together following:

[self.heartbutton addtarget:self action:@selector(pressedup) forcontrolevents:uicontroleventtouchupinside]; [self.heartbutton addtarget:self action:@selector(presseddown) forcontrolevents:uicontroleventtouchdown];

any thought how can 2 animations sequence , not interrupt each other on quick press?

here's potential plan of action. maintain 2 global variables, bool buttonpressed , nsdate *buttonpressdate. when button pressed, should set buttonpressed true , set buttonpressdate current date. in touch method, set buttonpressed false , check whether time interval between buttonpressdate , current date greater duration of animation. if is, run touch animation; if not, return. in completion block of touch downwards method, check if button still pressed. if is, nothing; if it's not pressed anymore, run touch animation.

the effect you'll using approach should following: if tap button quickly, run total 0.2-second shrink animation , run enlarge animation in sequence.

now, if don't want touch downwards animation run in case of quick touch, should delay first animation , check if button still pressed when start it. if quick touch, run modified animation covered both touch downwards , touch phases.

ios objective-c animation uibutton

php - Is SQL injection not possible if only one result is displayed on the page? -



php - Is SQL injection not possible if only one result is displayed on the page? -

i'm doing sql injection project security module in college, , i'm trying larn how works.

i can see how works when script doesn't filter input, , loops on db result set, displaying info on screen. far can tell, next code not susceptible sql injection, expecting display single set of values on screen:

<?php mysql_connect("localhost", "root", ""); mysql_select_db("testdb"); $result = mysql_query("select id, name, description test_table id = ".$_get['id']); list($id, $name, $description) = mysql_fetch_row($result); echo "id: $id \n"; echo "name: $name \n"; echo "description: $description \n"; ?>

if set value of id to:

1 or 1 = 1 union select id, username, password users limit 1, 1 --

the values union part of query not displayed, unless run mysql_fetch_row($result) statement twice, so:

<?php $result = mysql_query("select id, name, description test_table id = ".$_get['id']); list($id, $name, $description) = mysql_fetch_row($result); echo "id: $id \n"; echo "name: $name \n"; echo "description: $description \n"; list($id, $name, $description) = mysql_fetch_row($result); echo "id: $id \n"; echo "name: $name \n"; echo "description: $description \n"; ?>

only values union part of statement displayed, (i.e. username, password).

if knows thing or 2 this, can confirm right in saying above code not susceptible sql injection, expecting display single set of values on screen.

please right me if i'm wrong.

thanks help.

an attacker set id this:

1 , false union select id, username, password users username="carl" limit 1, 1 --

...and carl's relevant information. repeat process usernames (or ids) , still lot of info shouldn't get. take longer.

therefore can not querying 1 row makes sql injection "less dangerous".

php mysql security sql-injection

javascript - Weird Chrome Developer Tools debugger bug -



javascript - Weird Chrome Developer Tools debugger bug -

every when i'm viewing page in chrome developer tools open, , page includes underscore, developer tools jump debugger mode , pause @ same spot, line 1206 of underscore.js, line starting "render" in section:

try { render = new function(settings.variable || 'obj', '_', source); } grab (e) { e.source = source; throw e; }

i'm not asking damn thing debug, , i'm not adding breakpoint @ spot. i've got on several otherwise different pages. has else seen phenomenon, , there can stop it?

paused on javascript breakpoint

this means script found next statement:

debugger;

in particular case, looks debugger; somewhere in string beingness passed new function (you'd need @ scope variables , find source's value check that).

javascript google-chrome underscore.js google-chrome-devtools javascript-debugger

wpf - MahApps Metro setting Window Border styles from App Resources -



wpf - MahApps Metro setting Window Border styles from App Resources -

i trying set window border styles mahapps metro app. have read articles how set different border styles , think it. however, trying set border style windows in app same (all drop shadow) , doesn't seem want work.

i have app resources this:

<application.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="pack://application:,,,/gsdxthemes;component/gsdxdarkyellowtheme.xaml" /> </resourcedictionary.mergeddictionaries> </resourcedictionary> </application.resources>

my resource dictionary looks this:

<!-- merge in resourcedictionaries defining base of operations styles use. theme based on metro dark yellowish theme. --> <resourcedictionary.mergeddictionaries> <resourcedictionary source="pack://application:,,,/mahapps.metro;component/styles/colors.xaml" /> <resourcedictionary source="pack://application:,,,/mahapps.metro;component/styles/fonts.xaml" /> <resourcedictionary source="pack://application:,,,/mahapps.metro;component/styles/controls.xaml" /> <resourcedictionary source="pack://application:,,,/mahapps.metro;component/styles/accents/yellow.xaml" /> <resourcedictionary source="pack://application:,,,/mahapps.metro;component/styles/accents/basedark.xaml" /> <resourcedictionary source="pack://application:,,,/gsdxthemes;component/gsdxcontrolstyles.xaml" /> </resourcedictionary.mergeddictionaries>

the gsdxcontrolstyles dictionary sets custom style values app. in file seek set window borders.

<resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:resx="clr-namespace:gsdxthemes.properties" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:system;assembly=mscorlib" xmlns:controls="clr-namespace:mahapps.metro.controls;assembly=mahapps.metro" xmlns:gsdusercontrols="clr-namespace:gsd.commongui.usercontrols;assembly=commongui"> <resourcedictionary.mergeddictionaries> <resourcedictionary source="pack://application:,,,/mahapps.metro;component/styles/controls.xaml" /> </resourcedictionary.mergeddictionaries> <!-- customize theme our use...mostly changing font sizes, etc...--> <style targettype="{x:type controls:metrowindow}" > <setter property="windowtransitionsenabled" value="false" /> <setter property="enabledwmdropshadow" value="true" /> </style> <style targettype="{x:type label}" basedon="{staticresource metrolabel}"> <setter property="fontsize" value="16"/> </style> <style targettype="{x:type textbox}" basedon="{staticresource metrotextbox}"> <setter property="fontsize" value="16"/> </style> ...

all other style settings work fine. first line setting window border nothing. windows show no border.

how can work windows have drop shadow border?

you must give style key working solution

<style x:key="customdefaultwindowstyle" targettype="{x:type controls:metrowindow}" basedon="{staticresource {x:type controls:metrowindow}}" > <setter property="windowtransitionsenabled" value="false" /> <setter property="enabledwmdropshadow" value="true" /> </style>

now utilize style on metrowindows

<controls:metrowindow x:class="yourwindowclass" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="clr-namespace:mahapps.metro.controls;assembly=mahapps.metro" xmlns:system="clr-namespace:system;assembly=mscorlib" title="custom window style demo" height="600" width="800" windowstartuplocation="centerscreen" style="{dynamicresource customdefaultwindowstyle}"> ... </controls:metrowindow>

(don't afraid of the'invalid style target type:...' message, it's vs bug)

hope helps

wpf mahapps.metro

java - Opening an applet from a frame button click -



java - Opening an applet from a frame button click -

i have button within frame. on click of button, applet should load in frame. these exceptions coming up. defg applet class. there other way it. thanks.

private void jbutton1actionperformed(java.awt.event.actionevent evt) { // todo add together handling code here: japplet applet = new defg(); // send applet init() message. applet.init(); // build jframe. final jframe frame = new jframe("frametitle"); // transfer applet's context pane jframe. frame.setcontentpane(applet.getcontentpane()); // transfer applet's menu bar jframe. // line can omitted if applet // not create menu bar. frame.setjmenubar(applet.getjmenubar()); // create application shut downwards when user clicks // on close button. frame.setdefaultcloseoperation(jframe.exit_on_close); // set size of frame. // pack frame tightly possible // replace setsize() message following. // frame.pack(); frame.setsize(800, 800); // set location of frame. frame.setlocation(30, 30); // show frame. frame.setvisible(true); }

the exception...

exception in thread "awt-eventqueue-0" java.lang.nullpointerexception @ defg.init(defg.java:198) @ appmain1.jbutton1actionperformed(appmain1.java:80) @ appmain1.access$0(appmain1.java:75) @ appmain1$1.actionperformed(appmain1.java:40) @ javax.swing.abstractbutton.fireactionperformed(abstractbutton.java:2018) @ javax.swing.abstractbutton$handler.actionperformed(abstractbutton.java:2341) @ javax.swing.defaultbuttonmodel.fireactionperformed(defaultbuttonmodel.java:402) @ javax.swing.defaultbuttonmodel.setpressed(defaultbuttonmodel.java:259) @ javax.swing.plaf.basic.basicbuttonlistener.mousereleased(basicbuttonlistener.java:252) @ java.awt.component.processmouseevent(component.java:6505) @ javax.swing.jcomponent.processmouseevent(jcomponent.java:3320) @ java.awt.component.processevent(component.java:6270) @ java.awt.container.processevent(container.java:2229) @ java.awt.component.dispatcheventimpl(component.java:4861) @ java.awt.container.dispatcheventimpl(container.java:2287) @ java.awt.component.dispatchevent(component.java:4687) @ java.awt.lightweightdispatcher.retargetmouseevent(container.java:4832) @ java.awt.lightweightdispatcher.processmouseevent(container.java:4492) @ java.awt.lightweightdispatcher.dispatchevent(container.java:4422) @ java.awt.container.dispatcheventimpl(container.java:2273) @ java.awt.window.dispatcheventimpl(window.java:2719) @ java.awt.component.dispatchevent(component.java:4687) @ java.awt.eventqueue.dispatcheventimpl(eventqueue.java:735) @ java.awt.eventqueue.access$200(eventqueue.java:103) @ java.awt.eventqueue$3.run(eventqueue.java:694) @ java.awt.eventqueue$3.run(eventqueue.java:692) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:76) @ java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:87) @ java.awt.eventqueue$4.run(eventqueue.java:708) @ java.awt.eventqueue$4.run(eventqueue.java:706) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:76) @ java.awt.eventqueue.dispatchevent(eventqueue.java:705) @ java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:242) @ java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:161) @ java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:150) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:146) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:138) @ java.awt.eventdispatchthread.run(eventdispatchthread.java:91)

so problem within applet's init method...

try { java.awt.eventqueue.invokeandwait(new runnable() { public void run() { initcomponents(); } }); } grab (exception ex) { ex.printstacktrace(); }

you can't phone call invokeandwait within context of event dispatching thread generate deadlock

instead, want phone call init outside event dispatching thread , then, when loaded, load rest of ui.

in case, swingworker might useful, example...

public class loadappletworker extends swingworker<japplet, japplet> { @override protected japplet doinbackground() throws exception { // todo add together handling code here: japplet applet = new defg(); // send applet init() message. applet.init(); homecoming applet; } @override protected void done() { seek { japplet applet = get(); // build jframe. final jframe frame = new jframe("frametitle"); // transfer applet's context pane jframe. frame.setcontentpane(applet.getcontentpane()); // transfer applet's menu bar jframe. // line can omitted if applet // not create menu bar. frame.setjmenubar(applet.getjmenubar()); // create application shut downwards when user clicks // on close button. frame.setdefaultcloseoperation(jframe.exit_on_close); // set size of frame. // pack frame tightly possible // replace setsize() message following. // frame.pack(); frame.setsize(800, 800); // set location of frame. frame.setlocation(30, 30); // show frame. frame.setvisible(true); } grab (interruptedexception | executionexception ex) { logger.getlogger(initapp.class.getname()).log(level.severe, null, ex); } } }

then phone call using like...

private void jbutton1actionperformed(java.awt.event.actionevent evt) { new loadappletworker().execute(); }

java applet

javascript - Create object property with two optional conditions -



javascript - Create object property with two optional conditions -

what want?

i want create object property capitalizes every word in string, optional replaces underscores spaces and/or lowercase string first. want set options 2 parameters:

first parameter true?

then replace underscores whitespace.

second parameter true?

then lowercase finish string first.

what have far working?

replace underscore space first , capitalize words:

string.prototype.capitalize = function(underscore){ homecoming (underscore ? this.replace(/\_/g, " ") : this).replace(/(?:^|\s)\s/g, function(a) { homecoming a.touppercase(); }); } var strunderscorefalse = "javascript replace_first_underderscore whitespace_false"; //replace underscore first = false console.log(strunderscorefalse.capitalize()); var strunderscoretrue = "javascript replace_first_underderscore whitespace_true"; //replace underscore first = true console.log(strunderscoretrue.capitalize(true));

fiddle

lowercase string first , capitalize words:

string.prototype.capitalize = function(lower){ homecoming (lower ? this.tolowercase() : this).replace(/(?:^|\s)\s/g, function(a) { homecoming a.touppercase(); }); } var strlcasefalse = "javascript lowercase first false"; //lowercase first = false console.log(strlcasefalse.capitalize()); var strlcasetrue = "javascript lowercase first true"; //lowercase first = true console.log(strlcasetrue.capitalize(true));

fiddle

what questions?

this first time i'm trying create object property status notice. how can bring together 2 options object property function have set 2 parameters?

for example:

//replace underscore first = true , lowercase first = true console.log(str.capitalize(true , true)); //replace underscore first = false , lowercase first = true console.log(str.capitalize(false , true)); what anyway name of writing status syntax notation "?" , ":"?

javascript parameters condition object-property

Inline function and & Operator in C++ -



Inline function and & Operator in C++ -

what function ?

inline bool myfunc(int aval) {return aval & 1;}

edit have edited code runnable.

keyword inline shall written lower case letters.

inline bool myfunc(int aval) {return aval & 1;}

the function returns true if first bit of value aval set 1. otherwise returns false.

using function can check illustration whether aval odd or number. :) if function homecoming true means number odd.

the operator & bitwise , operator.

c++

osx - How to connect to aws Redshift db from mac -



osx - How to connect to aws Redshift db from mac -

i using mac , typically utilize sequel pro interact sql databases. utilize mysql, understand redshift uses postgres.

when seek connect redshift db, should utilize ip, or "endpoint"?

also when seek connect, error sequel pro.

unable connect host {{my_db_host}}, or request timed out. sure address right , have necessary privileges, or seek increasing connection timeout (currently 10 seconds). mysql said: can't connect mysql server on '{{my_db_host}}' (4)

can offer advice on how connected?

thanks

you should using redshift endpoint, if have security grouping settings configured correctly. might want set grouping 0.0.0.0/0 during testing(this opens cluster entire internet, , can lock downwards later 1 time works)

you need create sure have right odbc/jdbc driver. recommend either netbeans(comes connection driver), sql workbench, or aginity redshift. default port 5439.

i thikn using wrong driver(a mysql driver not psql driver), becaues error says mysql server.

http://docs.aws.amazon.com/redshift/latest/gsg/rs-gsg-prereq.html

for mac, believe seek , utilize terminal psql client. like...

psql -h endpoiint.aws.com -p 5439 -u username -p

osx postgresql amazon-web-services amazon-redshift sequelpro

xpages copy field value to another field from other datasource -



xpages copy field value to another field from other datasource -

i followed how re-create datetime field current document new document , seek this:

cdoc.save(); pdoc.copyitem(cdoc.getdocument().getfirstitem("mytest1")); getcomponent('exampledialog').show()

but handling error message.

thanks time!

assuming cdoc , pdoc defined xp:dominodocument info sources have alter code to:

cdoc.save(); pdoc.getdocument().copyitem(cdoc.getdocument().getfirstitem("mytest1")); getcomponent('exampledialog').show()

so, need add together .getdocument() pdoc notes document. otherwise fails , error "error calling method 'copyitem(lotus.domino.local.item)' on object of type 'notesxspdocument'".

keep in mind have save pdoc after copying item if want show copied item in exampledialog.

if don't want save document pdoc @ point yet can re-create item on notesxspdocument level just:

pdoc.replaceitemvalue("mytest1", cdoc.getitemvaluedatetime("mytest1")); getcomponent('exampledialog').show()

xpages

php - How to upload multiple music files simultaneously to a single column in mysql database -



php - How to upload multiple music files simultaneously to a single column in mysql database -

i beginner in php creating project of music download website using php , mysql. want upload multiple songs in single column below code not working.

i have 3 tables: album, artist, , music.

album table +================================ | album_id | album_name | poster| +================================ | | | | | | | | +===============================+ arist table +========================== | artist_id | artist_name | +========================== | | | | | | +=========================+ music tabel +=====================================+ | artist_name | album_name | song_name| +=====================================+ | | | | | | | | +=====================================+

i want insert info @ 1 time in above tables. code below:

<?php $album_name1=$_request['txtmovie1']; $album_name2=$_request['txtmovie2']; $album_name3=$_request['txtmovie3']; $album_name4=$_request['txtmovie4']; $album_name5=$_request['txtmovie5']; $artist1=$_request['txtartist1']; $artist2=$_request['txtartist2']; $artist3=$_request['txtartist3']; $artist4=$_request['txtartist4']; $artist5=$_request['txtartist5']; if(isset($_request['cmdsubmit'])) { $con = mysql_connect("localhost","root") or die(""); $db=mysql_select_db("omg",$con); //movie poster upload //poster1 $target_file="upload/".$_files['upsongs1']['name']; $source_file=$_files['upsongs1']['tmp_name']; if(move_uploaded_file($source_file, $target_file)) { $poster1=$_files['upsongs1']['name']; } echo $poster1; //poster2 $target_file="upload/".$_files['upsongs2']['name']; $source_file=$_files['upsongs2']['tmp_name']; if(move_uploaded_file($source_file, $target_file)) { $poster2=$_files['upsongs2']['name']; } echo $poster2; //poster3 $target_file="upload/".$_files['upsongs3']['name']; $source_file=$_files['upsongs3']['tmp_name']; if(move_uploaded_file($source_file, $target_file)) { $poster3=$_files['upsongs3']['name']; } echo $poster3; //poster4 $target_file="upload/".$_files['upsongs4']['name']; $source_file=$_files['upsongs4']['tmp_name']; if(move_uploaded_file($source_file, $target_file)) { $poster4=$_files['upsongs4']['name']; } echo $poster4; //poster5 $target_file="upload/".$_files['upsongs5']['name']; $source_file=$_files['upsongs5']['tmp_name']; if(move_uploaded_file($source_file, $target_file)) { $poster5=$_files['upsongs5']['name']; } echo $poster5; //song upload //song1 upload $targets1_file="song/".$_files['txts1']['name']; $sources1_file=$_files['txts1']['tmp_name']; if(move_uploaded_file($sources1_file, $targets1_file)) { $s1=$_files['txts1']['name']; } //song2 upload $targets2_file="song/".$_files['txts2']['name']; $sources2_file=$_files['txts2']['tmp_name']; if(move_uploaded_file($sources2_file, $targets2_file)) { $s2=$_files['txts2']['name']; } //song3 upload $targets3_file="song/".$_files['txts3']['name']; $sources3_file=$_files['txts3']['tmp_name']; if(move_uploaded_file($sources3_file, $targets3_file)) { $s3=$_files['txts3']['name']; } //song4 upload $targets4_file="song/".$_files['txts4']['name']; $sources4_file=$_files['txts4']['tmp_name']; if(move_uploaded_file($sources4_file, $targets4_file)) { $s4=$_files['txts4']['name']; } //song5 upload $targets5_file="song/".$_files['txts5']['name']; $sources5_file=$_files['txts5']['tmp_name']; if(move_uploaded_file($sources5_file, $targets5_file)) { $s5=$_files['txts5']['name']; } $qry1=("insert music(artist_name, album_name, song_name ) values('$artist1','$album_name1', '$s1'), values('$artist1','$album_name2', '$s2'),('$artist1','$album_name3', '$s3'), ('$artist1','$album_name4', '$s4'),('$artist1','$album_name5', '$s5')"); $qry2=("insert album(album_name, poster) values('$album_name1','$poster1'), ('$album_name2','$poster2'), ('$album_name3','$poster3'), ('$album_name4','$poster4'), ('$album_name5','$poster5')"); ?> <form name="form1" method="post" action="admin_new2.php" enctype="multipart/form-data" id="main" onsubmit="return check();"> <table> <thead><tr> <th>song</th> <th>movie/album</th> <th>artist</th> <th>poster</th> </tr></thead><tbody> <tr > <td> <input type="file" name="txts1"> <input type="file" name="txts2"> <input type="file" name="txts3"> <input type="file" name="txts4"> <input type="file" name="txts5"> </td> <td> <input type="text" name="txtmovie1"> <input type="text" name="txtmovie2"> <input type="text" name="txtmovie3"> <input type="text" name="txtmovie4"> <input type="text" name="txtmovie5"> </td> <td id="artist-clm"> <input type="text" name="txtartist1"> <input type="text" name="txtartist2"> <input type="text" name="txtartist3"> <input type="text" name="txtartist4"> <input type="text" name="txtartist5"> </td> <td id="poster"> <input type="file" name="upsongs1"> <input type="file" name="upsongs2"> <input type="file" name="upsongs3"> <input type="file" name="upsongs4"> <input type="file" name="upsongs5"> </td></tr> </tbody></table> <center><input type="submit" name="cmdsubmit" value="submit"></center> </form>

basically, because must not repeat values keyword when insert many records 1 query.

insert music(artist_name, album_name, song_name ) values('$artist1','$album_name1', '$s1'), ('$artist1','$album_name2', '$s2'), ('$artist1','$album_name3', '$s3'), ('$artist1','$album_name4', '$s4'), ('$artist1','$album_name5', '$s5')

then, next step, know beginner code not optimized. instead repeat 4 times, see loop or store info array :)

this decrease code size , maintaining easier.

php html mysql

iTextSharp does not retrieve the TAB character -



iTextSharp does not retrieve the TAB character -

i'm reading pdf file itextsharp next command not homecoming tab character, enter.

var rect = new system.util.rectanglej(x, y, width, height); var filters = new renderfilter[1]; filters[0] = new regiontextrenderfilter(rect); itextextractionstrategy strategy = new filteredtextrenderlistener(new locationtextextractionstrategy(), filters); var currenttext = pdftextextractor.gettextfrompage(pdfreader, pagenumber, strategy);

can help me?

thank you

nobody can reply question because assumption concept of tab character in pdf content stream exists wrong.

there no such thing tab character between 2 words. tabs created defining distances between words. text added @ absolute positions , if 2 snippets of text need separated tab space, coordinates adapted in accordance requirement. there no tab characters! differences in distances between text snippets.

itextsharp can give detailed info position of text snippets stored within pdf. can find code in accepted reply question: pdf reading highlighed text (highlight annotations) using c#

we've demonstrated concept of text extraction @ our itext summit in cologne on june 17, 2014. these slides help on way: http://www.slideshare.net/itextpdf/itext-summit-2014-talk-unstructured-pdf

itextsharp

How to parse file as an argument to python function? -



How to parse file as an argument to python function? -

currently, have next script multiple sub tasks , want create each sub task function , provide same file input functions.

current :

import sys open(sys.argv[1], 'r') my_file: print(my_file.append()) print(my_file.split())

want:

import sys def append(file) return; def split(file) return; def main() append(file) split(file) main()

so want pass file/dir name @ run time.

thanks.

or can utilize argparse, in orderto solve problem

https://docs.python.org/dev/library/argparse.html

python function

lua - Download large file with LuaSocket's HTTP module while keeping UI responsive -



lua - Download large file with LuaSocket's HTTP module while keeping UI responsive -

i utilize luasocket's http module download big file while displaying progress in console , later on in gui. ui must never block, not when server unresponsive during transfer. additionally, creating worker thread handle download not option.

here's got far:

local io = io local ltn12 = require("ltn12") local http = require("socket.http") local fileurl = "http://www.example.com/big_file.zip" local fileout_path = "big_file.zip" local file_size = 0 local file_down = 0 -- counter filter used in ltn12 function counter(chunk) if chunk == nil homecoming nil elseif chunk == "" homecoming "" else file_down = file_down + #chunk ui_update(file_size, file_down) -- update ui, run main ui loop etc. homecoming chunk -- homecoming unmodified chunk end end -- first request -- determine file size local r, c, h = http.request { method = "head", url = fileurl } file_size = h["content-length"] -- sec request -- download file r, c, h = http.request { method = "get", url = fileurl, -- set our chain, count first write file sink = ltn12.sink.chain( counter, ltn12.sink.file(io.open(fileout_path, "w")) ) }

there few problems above, ignoring error checking , hard-coding:

it requires 2 http requests when possible 1 (a normal request sends content-length) if server unresponsive, ui unresponsive, filter gets called when there info process.

how making sure ui never blocks?

there illustration on non-preemptive multithreading in programming in lua uses non-blocking luasocket calls , coroutines multiple parallel downloads. should possible apply same logic process avoid blocking. can add together should consider calling logic idle event in gui (if there such thing) avoid getting "attempt yield across metamethod/c-call boundary" errors.

http lua luasocket

java - HQL, can I parameterize the FROM clause? -



java - HQL, can I parameterize the FROM clause? -

i have hql query:

query q = em.createquery ( "delete annotation a.id in ( " + " select ja.id :entityname bring together an.annotations ja)" );

and i'm beingness told: querysyntaxexception: unexpected token: : near line 1 have hope of making entity name after parameter? have list of entities send query , i'm afraid string concatenation slow.

you can't substitute entity name parameters work entity properties not instead.

you select entities ids deleted 1 query , pass them sec delete query, read_commited transaction isolation might still end else inserting 1 kid entity have matched query. serializable solve issue.

java hibernate jpa hql hsqldb

java ee - Select with JOINED Inhertiance leads to no results -



java ee - Select with JOINED Inhertiance leads to no results -

maybe overlooking crucial when working jpa/eclipselink (postgresql 9.2) , inheritancestrategy.joined not create sense me.

i have hierarchy this:

@entity @inheritance(strategy = inheritancetype.joined) @classextractor(projectclassextractor.class) public class project extends abstractentity { @manytoone company c; }

and entity

@entity @inheritance(strategy = inheritancetype.joined) public class morespecificproject extends project { }

i seek query projects (including morespecificprojects) assigned company given set of companies.

the criteria code follows:

public list<project> getprojectswithcompany(company company) { criteriabuilder cb = getentitymanager().getcriteriabuilder(); criteriaquery<project> query = cb.createquery(project.class); root<project> projectroot = query.from(project.class); query.select(projectroot); query.where(cb.equal(projectroot.get(project_.c), company)); query.distinct(true); homecoming getentitymanager().createquery(query).getresultlist(); }

i have 1 project in database , morespecificproject table empty. project has company c set properly.

now eclipselink (glassfish4.0) produces next sql (remark: removed long list of irrelevant columns):

select distinct t0.*, t1.* project t0, morespecificproject t1 ((t0.c_id= 664) , (t0.id=t1.id))

obviously returns no result, since there no matching entry in morespecificproject. should homecoming 1 project in project table.

how eclipselink generate proper sql (e.g. using left bring together on morespecificproject)?

please help me on one.

thanks in advance.

edit: found out if limit result

typedquery<project> tquery = entitymanager. createquery(query); tquery.setfirstresult(0).setmaxresults(5); homecoming tquery.getresultlist();

the right sql beeing created:

select t0.*, t1.* project t0 left outer bring together morespecificproject t1 on (t1.id = t0.id) (t0.c_id = 664) limit 5 offset 0

and resultin list contains right project. why limiting result set, lead right query criteria api? may bug?

according http://wiki.eclipse.org/eclipselink/userguide/jpa/basic_jpa_development/entities/inheritance#outer_joining_subclasses default query subclasses , bring together results in memory. should see query each class returned, not morespecificproject class.

java-ee jpa eclipselink glassfish-4

C++ push_back only adds objects to position 0 in vector -



C++ push_back only adds objects to position 0 in vector -

in advance: i'm new c++, please kind. ;-)

i'm trying add together several objects (result) vector (results), somehow doesn't work way want.^^

update: changed code little , showed more code more information

//file1 class result{ public: result(string rtype, string rname, double rcosts){ type = rtype; name = rname; costs = rcosts; } private: string type, name; double costs; }; //file2 void getcosts(vector<parts> parts){ vector<part *> p; for(unsigned = 0; < parts.size(); i++){ p.push_back(&parts[i]); } cout << p.at(0)->getname() << p.at(0)->getprice << endl; //this output right cout << p.at(0)->getname() << p.at(0)->getprice << endl; //this output right cout << p.at(0)->getname() << p.at(0)->getprice << endl; //this output right vector<result *> r; for(std::vector<part *>::iterator ip = p.begin; ip != p.end(); ip++){ addresult((*ip)->gettype(), (*ip)->getname(), r, (*ip)->getprice()); } sortandprintresults(r); //after method printed results file programm ends. scope shouldn't matter. (getcosts called once) } void addresult(string type, string name, vector<result *> results, double costs){ result * res = new result(type, name, costs); results.push_back(res); cout << res->getname() << endl; //this prints name of every object }

the output should follows:

abc //results.at(0) def //results.at(1) ghi //results.at(2)

but instead it's:

abc //results.at(0) def //results.at(0) ghi //results.at(0) error: out of range. //results.at(1) error: out of range. //results.at(2)

what doing wrong?

the issue in debugging.

this code adds single, expects three.

void addresult(string type, string name, vector<result *> results, double costs){ results.push_back(new result(type, name, costs)); cout << results.at(0)->getname() << endl; cout << results.at(1)->getname() << endl; cout << results.at(2)->getname() << endl; }

you want phone call addresult 3 times before outputting.

in case, want set after forloop in getcosts:

void getcosts(vector<parts *> p){ for(std::vector<part *>::iterator ip = p.begin; ip != p.end(); ip++){ addresult((*ip)->gettype(), (*ip)->getname(), r, (*ip)->getprice()); } //check results here. }

edit: captainobvlious mentioned, you're passing vector by-value addresult function.

adding by-value means vector<result *> created locally within function, , doesn't connect r variable passed in (hence when seek r.at(0), there's nil inside)

fixing straight forward, link function-parameter results r vector, need pass by-reference, simple prepending type '&':

void addresult(string type, string name, vector<result *>& results, double costs)

have read of by-value vs by-reference.

c++ vector

c# - CSV (or excel) parsing ; eliminate empty column -



c# - CSV (or excel) parsing ; eliminate empty column -

i using textfieldparser class parse file. want eliminate or ignore finish column if "entire column" empty (which means single empty cell of perticular row should considered) possible?

note: per functionality, need utilize info copied clipboard. can not pass direct file path parser.

textfieldparser parser = new textfieldparser(new stringreader(row)); string[] delimiters = { ",", "\t" }; parser.setdelimiters(delimiters); string[] columns = null; while (!parser.endofdata) { columns = parser.readfields(); }

appreciate help.

after reading through textfieldparser class page on msdn, see there nil written there create me think class can ignore whole column. have manually. furthermore, code not seem right because trying read fields repeatedly same variable:

while (!parser.endofdata) { columns = parser.readfields(); }

c# .net wpf excel csv

extjs - Changing test set of an existing test case in Rally using Ext Js -



extjs - Changing test set of an existing test case in Rally using Ext Js -

i want create study where have capability reparent our test cases 1 test set other.

in simple language, need remove existing link test set , assign new test set existing test case/cases.

i referring 1 existing study @ https://github.com/rallytechservices/test-picker/blob/master/deploy/app.html

listeners: { scope: this, artifactchosen: function(items){ ext.create('rally.data.wsapidatastore',{ model:'testset', pagesize: 1, autoload: true, filters: [{property:'objectid',value:record.get('objectid')}], listeners: { load: function(store,records){ console.dir(records.length); var ts = records[0]; me._log(["selected items:",items]); var tc_store = ts.getcollection('testcases'); me._log(["got store:",tc_store]); tc_store.add(items); me._log("added items."); tc_store.sync({ // callback: function(){ // me._log("inside callback"); // me._gettestsets(me.iteration_selector.getvalue()); // } success: function(batch,options) { me._gettestsets(me.iteration_selector.getvalue()); }, failure: function(batch,options) { me._gettestsets(me.iteration_selector.getvalue()); } }); } } }); } }

here if seek utilize remove gives me error, not sure causing issue. or how can approach issue. need alter test set of user selected test case in report. can please help me on same.

the error "uncaught typeerror: cannot read property 'getref' of null". when can add together same object why cant delete. understand has 1 value. tried removing filters code snippet mentioned below, still gives current selected test case object id.

thanks in advance

extjs rally

javascript - How to apply a function to an angularjs expression inside a controller? -



javascript - How to apply a function to an angularjs expression inside a controller? -

simple question, apply function within controller scope expression.

this html within controller

<p><span ng-if="paginadetail.pubdate !== '' ">vanaf {{paginadetail.pubdate}}</span></p>

this javascript

$scope.formatmysqltimestamptohumanreadabledatetime = function(sdatetime){ sdatetime = sdatetime.tostring(); var shumanreadabledatetime = sdatetime.substring(8, 10) + "/" + sdatetime.substring(5, 7) + "/" + sdatetime.substring(0, 4); shumanreadabledatetime += " " + sdatetime.substring(11, 13) + ":" + sdatetime.substring(14, 16); homecoming shumanreadabledatetime; };

and trying apply formatmysqltimestamptohumanreadabledatetime paginadetail.pubdate this

<p><span ng-if="paginadetail.pubdate !== '' ">vanaf {{formatmysqltimestamptohumanreadabledatetime(paginadetail.pubdate)}}</span></p>

or

<p><span ng-if="paginadetail.pubdate !== '' ">vanaf {{paginadetail.pubdate|formatmysqltimestamptohumanreadabledatetime}}</span></p>

but both ways not correct.

the first method works on console i've error

error: [$interpolate:interr] http://errors.angularjs.org/1.2.16/$interpolate/interr?p0=tot%20%7b%7bformatmysqltimestamptohumanreadabledatetime(paginadetail.endpubdate)%7d%7d&p1=typeerror%3a%20sdatetime%20is%20undefined t/<@http://mysite.local/js/libs/angular.min.js:6:443 g/r@http://mysite.local/js/libs/angular.min.js:78:354 yd/this.$gethttp://mysite.local/js/libs/angular.min.js:106:161 yd/this.$gethttp://mysite.local/js/libs/angular.min.js:109:285 f@http://mysite.local/js/libs/angular.min.js:71:234 f@http://mysite.local/js/libs/angular.min.js:75:408 ve/http://mysite.local/js/libs/angular.min.js:76:457

http://mysite.local/js/libs/angular.min.js line 89

and sec 1 doesn't work.

do have suggestions? lot.

if can offer alternative alternative controller based actions... looks great scenario filter

the thought utilize filter input while it's beingness set html {{mydate|format}}.

the filter defined like:

myapp.filter('format', function () { homecoming function (input) { //your date parser here }; });

or whatever else wish it. way can reuse without having set function in every controller wish utilize in.

here's fiddle can expand on, going.

edit looking more closely @ error think actual problem .pubdate not populated (typeerror: sdatetime not defined). seek set breakpoint in function or see console says.

javascript angularjs controller angularjs-scope

multithreading - How to use javascript variable in Web worker thread -



multithreading - How to use javascript variable in Web worker thread -

i need update javascript array in web worker thread. cannot accces javascript array in web worker thread.

my code :

self.onmessage = function(event) { var array = new uint8array(event.data); var sum = 0; var temparray = new array(); for(var list = 0; list < array.length; list++ ){ var temp = mymethod(array[list]); //some operation availablearray.push(temp); } self.postmessage("success"); }

i getting error: availablearrayis undefined availablearray.push(temp);

you define 2 variables arrays (or array-like objects): var array = new uint8array , var temparray = new array, in loop utilize variable isn't declared anywhere availablearray, suspect want alter variable temparray. error message makes perfect sense: availablearray not defined anywhere. you're using array, , invoking push method on it. however, js, default, creates new variable whenever utilize var hasn't been declared. default value non-initialized variable is, of course, undefined. undefined doesn't have push method, hence error.

however, slight remark, though: in js new array discouraged. best utilize array literal notation:

var temparray = [];

it's shorter and safer.

javascript multithreading worker-thread

How to export table data from Server Explorer in Visual Studio -



How to export table data from Server Explorer in Visual Studio -

in visual studio > server explorer, can execute show table data command open new tab table data. there quick way export info csv or excel or need utilize 3rd party tool?

sql-server

Ruby On Rails - Using concerns in controllers -



Ruby On Rails - Using concerns in controllers -

possible noob warning: new ror

i trying utilize concerns in ror. right have simple concern writen

#./app/controllers/concerns/foo.rb module foo extend activesupport::concern def somethingfoo puts "ayyyy! foo" end end

when seek , utilize concern in controller undefined method error

#./app/controllers/foo_controller.rb class foocontroller < applicationcontroller include foo def show foo.somethingfoo # undefined method 'somethingfoo' foo:module render plain: "ohh no, doesnt show me because of error above me" end end

to knowledge somethingfoo should called not. have tried defining somethingfoo in included ... end block in concern not work either. there missing? can concerns not used controllers?

if include modules (extended activesupport::concern or not), methods of module become instance methods of including class/module.

your controller method should hence read

def show somethingfoo render plain: "yeah, i'm shown!" end

ruby-on-rails ruby web separation-of-concerns

regex - Retreiving text from Pattern1 to Pattern2 - Python -



regex - Retreiving text from Pattern1 to Pattern2 - Python -

i have input file below

pattern1 ptr1 blah blah blah needthis blah blah blah thisoneaswell blah blah blah pattern2 pattern1 ptr2 blah blah blah needthis blah blah blah thisoneaswell blah blah blah pattern2 ............................ ............................ pattern1 ptrn blah blah needthis blah blah blah thisoneaswell blah blah blah pattern2

i need function homecoming first column entries pattern1 pattern2 below,

ptr1 needthis thisoneaswell ptr2 needthis thisoneaswell ...................... ...................... ptrn needthis thisoneaswell

ptr1 , ptr2 ...... ptrn each different texts. pattern1 & pattern2 different consistently nowadays in file.

how can accomplish in python?

i still beginner in python , trying accomplish utilize re.findall() not getting desired o/p:

def retreive(): file = open("filename","r") string = re.findall(r"pattern1",file.read()) print string

you nest 2 regexes:

txt='''\ pattern1 ptr1 blah blah blah needthis1 blah blah blah thisoneaswell1 blah blah blah pattern2 pattern1 ptr2 blah blah blah needthis2 blah blah blah thisoneaswell2 blah blah blah pattern2 ............................ ............................ pattern1 ptrn blah blah needthisn blah blah blah thisoneaswelln blah blah blah pattern2''' import re m in re.finditer(r'^pattern1\s*(.*?)(?=^pattern2)', txt, re.m | re.s): print re.findall(r'(^\w+)', m.group(1), re.m)

prints:

['ptr1', 'needthis1', 'thisoneaswell1'] ['ptr2', 'needthis2', 'thisoneaswell2'] ['ptrn', 'needthisn', 'thisoneaswelln']

edit 1

if using file fit in memory:

with open(fn) f: txt=f.read() m in re.finditer(r'^pattern1\s*(.*?)(?=^pattern2)', txt, re.m | re.s): print re.findall(r'(^\w+)', m.group(1), re.m)

use mmap larger files won't fit in memory.

edit 2

just append results list after joining string:

with open(fn) f: results=[] txt=f.read() m in re.finditer(r'^pattern1\s*(.*?)(?=^pattern2)', txt, re.m | re.s): results.append('\n'.join(re.findall(r'(^\w+)', m.group(1), re.m)) print '\n===\n'.join(results)

python regex python-2.7

opencv - Using CRF suite C++ on images -



opencv - Using CRF suite C++ on images -

i have been implementing object localization , segmentation of images. need classify different objects on image , segment image accordingly.

i implemented research paper follows:

make super pixels of image(done using slic algorithm) classify each super pixel using annotated images also using back upwards vector machine classifier classify every super pixel.

till here code working correct. next part improvement of segmentation using conditional random field graphical model segment image. have no thought how should implement conditional random field model. need create graph between super pixels have done.

there crf suite in c++ of link provided not understand how utilize images training info crf model , functions should phone call of library(crf).

now inquire how should go implementing conditional random field suite in c++ on graph of super pixel. went through unable understand how should go it.

http://www.chokkan.org/software/crfsuite/

c++ opencv machine-learning svm crf

processing large JSON without root element (Ruby) -



processing large JSON without root element (Ruby) -

i new ruby, question might vary basic.

i looking ruby library help me parse big json file (of order of 100 mbs)

the peculiarity of json file is, created set of processes, , has no root element. imagine file looks this

//this element 1 { "name":"person 1", "dresses":[{"type":"pants","color":"green"},{"type":"shirt","color":"green"},{"type":"t-shirt","color":"green"}], "age":"34" } //this element 2 { "name":"person 2", "dresses":[{"type":"pants","color":"blue"},{"type":"shirt","color":"red"}], "age":"33" }

since there lot of such elements(around 3m), need find way can elements @ time,or treat input stream if possible, , write each of elements text file after processing based on values,

a guy of age 34 have 3 clothes, including pair of greenish pants a guy of age 33 has 2 clothes, , no t-shirt

basically, parsing xml using sax parser, but without root element. can please suggest ruby library work ?

if strings , poping few @ time, can utilize json.parse.

for example:

a = '{ "name":"person 1", "dresses":[{"type":"pants","color":"green"},{"type":"shirt","color":"green"},{"type":"t-shirt","color":"green"}], "age":"34" }' b = json.parse(a) b['name'] => 'person 1'

or if prefer symbols(i do!)

b = json.parse(a).deep_symbolize_keys! b[:name] => 'person 1'

if want sax machine, experimental gem: https://github.com/brianmario/json-machine

ruby-on-rails ruby json bash streaming

linux - How can i get the list of databases in Postgresql in python -



linux - How can i get the list of databases in Postgresql in python -

i want list of databases in postgresql server in python list. want create insode database not able it.

this have tried

config_read = { 'host':'psql-002', 'database':'tesdb', 'user':'pguser', 'port':'5432', 'password':'mypass' } class exportpsql(): def __init__(self): try: conn = psycopg2.connect(**config_read) self.conn = conn except: print "eror connecting database" def run(self): # list of databases : db_command=" psql -h localhost -u pguser tesdb -c '\l'" db_list = os.popen(db_command)

do pg_dumpall , psql superuser

pg_dumpall -h localhost -u postgres -f pg_dumpall.sql

if want re-create schema utilize --schema-only parameter.

to restore cluster

psql -f pg_dumpall.sql postgres

python linux postgresql

Remove Bootstrap from Meteor app -



Remove Bootstrap from Meteor app -

i want remove bootstrap exclusively meteor app because utilize thoughtbot's neat , bourbon responsive css framework. made sure have no bootstrap packages installed, when start application , check css, see bootstrap styles in css file.

so assume bootstrap enabled , loaded default meteor? possible remove it?

if you've removed bootstrap packages, meaning can't see when this

meteor list --using

that means don't have external bootstrap files included in project. can have them other sources own css files or have set in yourself.

meteor doesn't include bootstrap in projects default.

meteor

javascript - Extending require JS like in PHP Classes -



javascript - Extending require JS like in PHP Classes -

i'm using requirejs. sample code:

psmapa.js file

define('psmapa', ['jquery'], function ($) { 'use strict'; homecoming { map: null, init: function () { console.log('init'); }, init_map: function () { }, customfunc: function () { return; } } });

now in html want extend object, alter customfunc , add together new ones - this:

<script> define(['psmapa'], function (psmapa) { psmapa.extend({ cutomfunc: function() { console.log('extended'); }, newfunc: function() { } }) }); require(["psmapa"], function(psmapa) { psmapa.init(); psmapa.newfunc(); }); </script>

is possible?

javascript requirejs

javascript - innerText vs innerHtml vs label vs text vs textContent vs outerText -



javascript - innerText vs innerHtml vs label vs text vs textContent vs outerText -

i have dropdown list populated javascript.

whilst deciding should default value show on load, realised next properties showed same values:

innertext innerhtml label text textcontent outertext

my own research shows bench marking tests or comparisons between few of them, not all.

i can utilize own mutual sense , take 1 or other provide same result, but, i'm concerned not going thought if info change.

my findings are:

innertext show value , ignores html formatting may included innerhtml show value , apply html formatting label appears same innertext, can't see difference text appears same innertext jquery shorthand version textcontent appears same innertext keeps formatting (such \n) outertext appears same innertext

my research can take me far can test can think of or read published, can 1 confirm though if research right , if there special label , outertext?

from mdn:

internet explorer introduced element.innertext. intention pretty much same couple of differences [compared textcontent]:

note while textcontent gets content of elements, including <script> , <style> elements, equivalent ie-specific property, innertext, not.

innertext aware of style , not homecoming text of hidden elements, whereas textcontent will.

as innertext aware of css styling, trigger reflow, whereas textcontent not.

so innertext not include text hidden css, textcontent will.

innerhtml returns html name indicates. quite often, in order retrieve or write text within element, people utilize innerhtml. textcontent should used instead. because text not parsed html, it's have improve performance. moreover, avoids xss attack vector.

a main reason there many different properties different browsers had different names these properties, , there still isn't finish cross-browser back upwards these properties. if using jquery, should stick .text() since designed smooth out cross-browser differences.

for of others: outerhtml same innerhtml, except includes start , end tags of element belongs to. can't seem find much description of outertext @ all. think obscure legacy property , should avoided.

javascript