Posts

Showing posts from August, 2012

Invalid sed --transform expression in shell script using gtar -

i'm running shell script in solaris 10, besides run in ubuntu (obviously making little changes) , same error. want change name of path when execute tar command indicate time done. have special case when pathname has spaces. use following command fails: $ /usr/sfw/bin/gtar --transform=s/"virtualbox vm"/"virtualbox vm_04_04_2013_14:14"/ \ --show-transformed-names -clvmspf /dev/cintarmt0n /new_vdi/"virtualbox vm" /usr/sfw/bin/gtar: invalid transform expression $ could give me tip?

asp.net mvc 3 - mvc3 cookie value not setting in ViewData page -

i have textbox , submit button people put in there enter 5 number pin , safed inside cookie 4 months not working im getting nothing out of it.. wrong.. first time trying cookies read view public actionresult index() { //read cookie , send view model var mycookie = request.cookies["mypreference"]; viewdata["prefvalue"] = mycookie.value; return view(); } httppost [httppost] public actionresult index(formcollection ss) { // create cookie httpcookie preference = new httpcookie("mypreference"); preference.value = ss["preffer"]; preference.expires = datetime.now.adddays(120d); response.cookies.add(preference); return view(); } the view @using (html.beginform("seotips", "home", formmethod.post)) { @html.textbox("preffer") <input type="submit" value="submit" /> } @viewdata["prefvalue"] you have try public actionres

how to serialize AMF body and send it with Ruby RocketAMF -

Image
i trying serialized amf body , send restclient.post. from charles proxy, can deserialized request body , show follows: # s raw binary request body pp rocketamf::envelope.new.populate_from_stream(s).messages however, cannot figure out how serialize such object , send (with restclient.post) in body. you'll want change url it's using, below correct way it. require 'rubygems' require 'rocketamf' require 'rest-client' data = [] # whatever data want env = rocketamf::envelope.new :amf_version => 3 env.messages << rocketamf::message.new('batchcontroller.authenticate_iphone', '/1', data) res = restclient.post "http://localhost:9292/amf", env.to_s, :content_type => 'application/x-amf' puts rocketamf::envelope.new.populate_from_stream(res).inspect

How to clear token using the facebook-ios-sdk v3.2.1? -

i using sample program learn facebook-ios-sdk, found problem: if logged facebook on device , run sample app, fine, however, when delete facebook account device , run sample app again, can still pass login process , scviewcontroller can still seen (there fast-app-switch facebook app process, need click "okey" button, don't need fill email/password information log facebook). i checked code , found after account removed device, token in fbsession.activesession.accesstoken still considered valid. there problem? , how can clear token , make log in dialog pop up? have invoked [fbsession.activesession closeandcleartokeninformation] when log out, token should cleared, according facebook sdk document, not case. the environment use: xcode 4.6.1, ipad 6.1 simulator , facebook-ios-sdk v3.2.1. updated: paste code here: in scappdelegate.m, added 3 functions, not in sample code in sdk online document: - (void)showloginview { uiviewcontroller* topviewcontroller = [self

osx - how to correctly setup credential-osxkeychain for git -

i have followed instructions on how set git integrate os x keychain git command. instructions password prompt should come once more, , keychain access window come up. password prompt up, keychain window did not. also, subsequent commands requiring authentication (to https:// url) came password prompt. none of these commands raised kind of error or warning went foul. my question how can git command use keychain https:// requests, dont have retype username , password? some useful command output follows: $ ls $(dirname $(which git)) | grep git git git-credential-osxkeychain git-cvsserver git-receive-pack git-shell git-upload-archive git-upload-pack gitk $ git credential-osxkeychain usage: git credential-osxkeychain <get|store|erase> $ git config --global credential.helper osxkeychain $ uname -a darwin mac-alex 11.4.2 darwin kernel version 11.4.2: thu aug 23 16:25:48 pdt 2012; root:xnu-1699.32.7~1/release_x86_64 x86_64 $ git --version git version 1.7.5.4 you nee

Image upload, ajax, php, mysql -

i have 1 question. possible upload image file input mysql ajax post , php? like this: <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $("#form_id").submit(function(){ $.ajax({ type:"post", data:image_data, url:"/path_to_php/imagesave.php", success: function(msg){ alert("ok"); } }); return false; }); }); }); </script> <form name="form_name" id="form_id" action="#" method="post"> <input type="file" name="image" id="image" /> <button>save</button> </form> upload file , store on database can done several ways. this 1 tutorial doing this. . problem if want using ajax, possible, check out common b

regex - Need to split a string with line breaks by finding PHP tags -

i'm trying split string line breaks finding php tags. here code have far: $contents = ' test more test test 1 <?php test 2 , test 4 test 6 ?> test 7 test 9 <?php test 10 test 12 >? test 13 <?php test 14 test 16 ?> test 17 '; as can tell, php code test examples, , odd test examples outside php tags. what looking extract array every iteration of php code: expected result: array( [0] => <?php test 2 , test 4 test 6 ?> [1] => <?php test 10 test 12 >? [2] => <?php test 14 test 16 ?> ) i have tried preg_split end tags, , capturing $explode[1] beginning tags code wrong... $ends = preg_split("/[?>]/s", $contents, preg_split_no_empty, preg_split_delim_capture ); print_r($ends); foreach($ends $flufcode){ $trimcode = explode('<?php', $flufcode); echo $trimcode . " next:

Nginx service start failure in CentOS 5.5 -

i installed nginx in centos 5.5 using yum nginx repo. after installation, in service stopped status. want start nginx service , configure started @ boot time. before starting service, created new ssl configuration in /etc/nginx/conf.d/ssl.conf on third line of configuration file, set server name follow: server_name {{ www_name }}; i executed following commands in terminal: $ chkconfig nginx on $ service nginx start chkconfig command got executed successfully, service start command gives me following error: starting nginx: nginx: [emerg] directive "server_name" not terminated ";" in /etc/nginx/conf.d/ssl.conf:3 this how ssl.conf looks like: server { listen 443 default_server; server_name {{ www_name }}; underscores_in_headers on; ssl on; ssl_certificate cert.pem; ssl_certificate_key cert.key; ... } this link

Unit Testing and Android DownloadManager -

i unit test class makes use of android downloadmanager service, i'm not sure how go doing it. should use downloadmanager service or there way can mock up? rather not have test call external web server. there existing testing library can use this? this solution use robolectric one important thing know the count of download manager requests starts @ -1 . if enqueue request, request count gonna 0. mock downloadmanager object write test public void shouldenqueuerequest() { //... //... verify(downloadmanager, times(1)).enqueue(anyobject()); //is downloadmanager empty assertthat(shadowof(downloadmanager).getrequestcount(), greaterthan(-1)); //get request downloadmanager shadowrequest realrequest = shadowof(shadowof(downloadmanager).getrequest(0)); assertthat(realrequest, notnullvalue()); assertthat(realrequest.getdescription(), equalto("your description")); assertthat(realrequest.gettitle(), equalto(app_name)); }

sql server - SSRS - List with dynamic items - prevent hidden items from taking space -

i have sql 2008 r2 ssrs report - works great of time, depending on rules of specific customer, may not beautiful. it has list in - , rules may specific items within list should shown or not shown. there 1 query, returns 1 row, , if @ possible, i'd leave @ 1 query performance reasons. so example, have list has: -- section \- item 1 | item 2 -- section b \- item 1 | item 1a item 2 | item 3 -- section c \- item 1 | item 2 | item 3 | item 4 item 5 | item 6 | item 7 | item 8 based on rules, though, need hide , "collapse" section b, section c rolls right underneath of section a. or perhaps section collapsed. i know if had ability make matrix, dynamically hide rows, can't make matrix without massive reconfiguration of query. any thoughts how accomplish hiding sections, or hiding lists, , making next list, or section, come right beneath previous visible section or list? thanks! you put section b inside of rectan

c - Casting negative numbers -

i trying interpret hex bytes , consolidate them useful information. void processdata(){ signed char data; unsigned long a;//holds 4 bytes unsigned long b; unsigned int c;//holds 2 bytes unsigned char d;//holds 1 byte a=reada();//reada,readb,readc,readd return 1 unsigned byte; b=readb(); c=readc(); d=readd(); data=(signed char) ((0xffffffff-((a<<24)|(b<<16)|(c<<8)|(d)))/1000); } the scenario whole package received contains four-byte information, example value of 0xaabbccdd. reada() return highest byte in package i.e. 0xaa. readd() return 0xdd. need shift them before using "|" put them together: (a<<24)|(b<<16)|(c<<8)|(d) so question is, right hand side of sentence data=(signed char) ((0xffffffff-((a<<24)|(b<<16)|(c<<8)|(d)))/1000); why not return char while cast result signed char? when print out wrong. however, if set data signed long, correct. guess it's because signed char not bi

c# - WCF Client error: “The address of the security token issuer is not specified” -

Image
error occur: "the address of security token issuer not specified. explicit issuer address must specified in binding target 'net.tcp://localhost:5054/player' or local issuer address must configured in credentials." there wrong in credentials? have idea? binding setup issuedtoken credential type: <issuedtokenparameters keytype="symmetrickey" tokentype="" /> use next child node issuer. for follow link: http://msdn.microsoft.com/en-us/library/bb924499.aspx this allows specify address of secure token server client should use negotiate token. <issuer> written follows: <issuer address="https://server/secure token server" binding="<binding type>" bindingconfiguration="<binding configuration secure token server>" /> hope helpful.

sqliteopenhelper - unable to see Sqlite database in my Android's FileExplore -

i creating sqlite database , when want see database using file_explorer @ time , not getting in location 2 folders present there : cache , lib , database folder not present there , point getting location , logs , protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_db__creation); database db = new database(this); } // -- sqliteopenhelper class ( extended )! public database( context context ) { super(context, "new_one.db" , null , 2 ); log.i("2nd class : constructor","tushar"); log.i(context.getdatabasepath("new_one.db").tostring(),"tushar"); //(data base location ) ///data/data/com.example.database_creation/databases/new_one.db } public void oncreate(sqlitedatabase db) { log.i("2nd class : oncreate", "tushar"); db.execsql("create table timerecords " +"(id integer primary

PrestaShop import items to show in iOS application -

i have new project in need work on prestashop , create universal mobile application. not getting anywhere how use in ios application items in different categories, search api items, etc. please me urgent. prestashop implements full-featured restful web service. you need enable web service in advanced parameters > web service, use guides , how-to located @ http://doc.prestashop.com/display/ps15/using+the+prestashop+web+service you have example library on github: https://github.com/prestashop/prestashop-webservice-lib

ios - UIDatePicker show only picker like Sleep Cycle -

Image
i add uidatepickermodetime picker, grey area around seems ugly me. wondering what's best way of removing it? there property can set or frame reset? ! well, know 1 of way be place picker below "background" image, hides picker itself well, in case can create own custom date picker uipickerview . this link might you.

java - Receiving unpredictable parameters in Struts2 interceptor -

i aiming write interceptor add headers in response. have following interceptor public class cachinginterceptor extends abstractinterceptor{ @override public string intercept(actioninvocation ai) throws exception { httpservletresponse response = (httpservletresponse) getactioncontext(ai).get(strutsstatics.http_response); if(null != response) { response.setheader("cache-control","no-store,no-cache"); response.setheader("pragma","no-cache"); response.setheader("expires","-1"); } return ai.invoke(); } } i need enhance in such way headers can defined in configuration file ( struts.xml ) .... <!-- define , add following interceptor in default interceptor stack --> <interceptor name="cachinginterceptor" class="demo.cachinginterceptor"> .... <action name="myaction" class="demo.myaction">

c - accessing the array inside array of structures -

i have structure follows struct { char* ap; char* inputs[10]; int e; }; then have created array of structure struct list [100]; now want fille array inputs[10] , using syntax access first location : ip=0; inp=0; list[ip].inputs[inp] but gettin error "error c2107: illegal index, indirection not allowed" on compiling code please suggest how access array location inside array of structure. regards priya here use array of character pointer in structure. allocate memory structure creation list of 100. think didn't create memory array of character pointer. have create memory each of character pointer. suggest example code. #include <stdio.h> struct { char* ap; char* inputs[10]; int e; }; int main() { int ip=0; int inp=0; struct list[100]; list[ip].inputs[inp]= (char*)malloc(25); scanf("%s",list[ip].inputs[inp]);//or other copy function fill string printf("output %s",list[i

c# - WebInvoke POST stops service from installing -

i'm totally new @ c#. sorry i'm trying create wcf rest service , put files on web server. following operation works great: [operationcontract] [webinvoke(method = "get", bodystyle = webmessagebodystyle.bare, uritemplate = "getmediafile?shopnumber={shopnumber}&filename={filename}")] stream getmediafile(string shopnumber, string filename); everything works expected until add following operation [operationcontract] [webinvoke(method = "post", bodystyle = webmessagebodystyle.bare, responseformat = webmessageformat.json, uritemplate = "putmediafile?shopnumber={shopnumber}&filename={filename}")] string putmediafile(string shopnumber, string filename, stream mediafile); i'm installing service clicking on green arrow launches tool installs service. need test ios device. the problem once add post method, following error during service install: "failed add service. service meta

asp.net - string variable date to double in c# -

in following code ,i need convert string double . code doesn't work. string fdate="7/4/2013"; double nextdate = convert.todouble( fdate); try this.. datetime ddd=convert.todatetime("7/4/2013"); double dd = convert.todouble(convert.tostring(ddd.month) + convert.tostring(ddd.day) + convert.tostring(ddd.year)); it surely work

javascript - how to make origin marker to bounce in directionsDisplay without using suppressmarkers:true? -

i have developed route 2 places using google maps api .... need origin marker should bounced don't want make suppressmarker value true ... don't want add custom markers... there way make default marker rendered directionsdisplay bounced? you can change standart markers letters other markers google-chart service. let me show how add text on marker: directionsdisplay = new google.maps.directionsrenderer({ markeroptions: { icon: "https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=sometext|ff0000|000000" } }), or, can take other idea change marker's there: https://developers.google.com/chart/image/docs/gallery/dynamic_icons?hl=fr&csw=1#plain_pin

nginx + python + websockets -

how can configure nginx (latest version, supports websockets) support websockets. and how can use python run websockets connection. that want: client creates websocket javascript; websocket server script runs on python; and nginx in backend of of this. can body me? i took quick @ relevant changeset nginx, , looks need start handling websocket requests set proxy in nginx config. example: upstream pythonserver { server localhost:5000; } server { // normal server config stuff... location /some/uri/here { // minimum required settings proxy websocket connections proxy_pass http://pythonserver; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; // other settings location } } this little configuration snippet proxy incoming websocket traffic python application server, assumed in example listening local connections on port 5000. hope h

split - in HBase what will happen if a single row size exceeds region max size? -

i know if region size exceeds configured max size, hbase split 2 regions, , seems 1 row located in 1 region. happen if row size exceeds configured max region size? for example, if have row has 100 columns, , each column contains 3m bytes, totally there 300m bytes row. , max region size set 256m, happens this? maybe can't insert such row successfully? hbase splits done on row boundaries. if row happens larger region size, not split.

jQuery Is there a way to wait for object to load before continuing? -

i have problem relating cookies. have group of buttons display specific table related button pushed. have setup assign cookie values , i'm trying remember last viewed users don't have reselect every time close page. if($.cookie('lastviewed') == "value") { $('#button1').trigger('click'); $('#button2').trigger('click'); } button 1 loads in button 2, above doesn't work because trying trigger doesn't exist yet. is there way make wait load before continuing? edit: using document.ready. clicking button 1 loads button 2 onto page, need wait finish loading in button 2 before tries click it. you might wanna try too: $(document).ready(function () { if ($.cookie('lastviewed') == "value") { settimeout(function () { $('#button1').trigger('click'); $('#button2').trigger('click'); }, 100); } }); after delay o

junit4 - java.lang.RuntimeException: Stub! running Junit in Android project -

in android project try run simple junit tests. fail with: java.lang.runtimeexception: stub! @ org.apache.http.impl.client.abstracthttpclient.<init>(abstracthttpclient.java:5) @ org.apache.http.impl.client.defaulthttpclient.<init>(defaulthttpclient.java:7) @ com.my.android.jsonparser.getjsonfromurl(jsonparser.java:27) @ com.my.android.test.jsonparser_test.getjson(jsonparser_test.java:19) this line fails, new class initiation that. public jsonobject getjsonfromurl(string url) { defaulthttpclient httpclient = new defaulthttpclient(); ... } in several posts found junit jar should included before android sdk . did in intellij , did not help. using junit 4.9 , android sdk 4.2.2 i think robolectric can useful you. running tests on android emulator or device slow! building, deploying, , launching app takes minute or more. that’s no way tdd. there must better way. wouldn’t nice run android tests directly inside ide? perhaps you’v

Remove Item have same key in List C# -

this question has answer here: using linq remove elements list<t> 14 answers i have list<object> n objects . in n objects have object have same id . example list<t> = {t1, t2, t3, t4, t5....,t10}. assuming that: t1.id = t5.id so want remove t5 list . who can me plz. in question: using linq remove objects within list know object duplicates (ex: "bob"), in question, in list, don't know object duplicate before. using linq objects only: source = source.groupby(t => t.id).select(g => g.first()).tolist();

asp.net - how to get or retain file upload control value after postback -

hi have usercontrol on there 1 file upload control, user control inside tab container on aspx page.hirarchy bellow: 1.master page 2.aspx page having ajax tab control. 3.user control inside tab container. 4.file upload control on user control. , submit button problem facing: when click on submit button page load event called before buttons on click event value of file upload control getting nulll. could please tell me how can fetch file upload control value after postback. advance. the file upload control not retain posted file each request. when user selects file, available in next postback request occurs. you should check postedfile on each postback , save file on server. keep reference path in viewstate. can process file when user has finished inputs.

vb.net - using toupper and tolower in visual basic -

trying change case of first letter of parsed strings segments. if user enters "john wayne doe" in txtname display "john wayne doe" entered way shows in book message box displays parsed string entered in above example return "john wayne doe" figure logic error since known lot have no idea made error. dim name string = txtname.text name = name.trim dim names() string = name.split(cchar(" ")) dim firstname string = names(0) dim middlename string = names(1) dim lastname string = names(2) dim firstletters1 string = firstname.substring(0, 1).toupper dim otherletters1 string = firstname.substring(1).tolower dim firstletters2 string = middlename.substring(0, 1).toupper dim otherletters2 string = middlename.substring(1).tolower dim firstletters3 string = lastname.substring(0, 1).toupper dim otherletters3 string = lastname.substring(1).tolower messagebox.show("first name: " &am

how to change the extension of multiple files using bash script? -

i new linux usage maybe first time hope detailed please. have more 500 files in multiple directories on server (linux) want change extensions .xml using bash script used lot of codes none of them work codes used : for file in *.txt mv ${file} ${file/.txt}/.xml done or for file in *.* mv ${file} ${file/.*}/.xml done i not know if second 1 valid code or not tried change txt extension beacuse prompt said no such file '.txt' i hope thank you explanation for recursivity need bash >=4 , enable ** (i.e. globstar ) ; first, use parameter expansion remove string .txt , must anchored @ end of filename ( % ) : the # anchors pattern (plain word or glob) beginning, and % anchors end. then append new extension .xml be cautious filename, should always quote parameters expansion . code this should in bash (note echo the old/new filename) : shopt -s globstar # enable ** globstar/recursivity in **/*.txt; [[ -d "$i" ]] && cont

c# - How to fit WPF MenuItem's size based on it child's size -

Image
i have context menu. 1 of menuitems contains combobox. when menu item w/ combobox rendered menuitem wider combo box. ideas how can set menu item's size snaged combobox. here how create menu , combobox: xamcomboeditor combo = new xamcomboeditor(); combo.itemssource = context.recipientoptions; combo.displaymemberpath = "display"; combo.iseditable = true; combo.minwidth = 250; combo.dropdownresizemode = popupresizemode.none; combo.horizontalalignment = horizontalalignment.stretch; combo.limittolist = false; combo.setbinding(xamcomboeditor.selecteditemproperty, new binding("recipient") {source = this, mode = bindingmode.twoway}); menuitem combomenu = new menuitem {header = combo, staysopenonclick = true, rendersize = combo.rendersize,}; menu.items.add(combomenu); menuitem removemenu = new menuitem {header = "remove recipient"}; removemenu.click += (sender, e) => removerecipient(); re

Python ctypes. How to pass IN LPVOID to C++ function -

i trying use ctypes pass string c++ function, , 1 in return. function declaration is: bool performaxcom_api _stdcall sendreceive(in handle phandle, in lpvoid wbuffer, in dword dwnumbytestowrite, in dword dwnumbytestoread, out lpvoid rbuffer) i happy enough handle , dword variables, , achieved out lpvoid in similar function following setup: szreplybuffer = create_string_buffer(64) replybuffer = c_char_p(addressof(szreplybuffer)) which when used similar out lpvoid got string back. my current method @ creating in lpvoid inputted string cmdstr (for example "e0=1") is: szsendstr = c_char * 64 sendstr = szsendstr() in range(len(cmdstr)): sendstr[i] = cmdstr[i] i pass function using following declaration: status = sendreceive(byref(husbdevice), c_void_p(addressof(sendstr)), 64, 64, replybuffer) i have tried lots of different permutations of pas

.net - Programmatic database structure rollout -

i have definition datamodel , let application check , sync @ startup. unfortunately cannot find product out there doing hear if know 1 or if have recommendations how solve problem. the solution think of: application reads definition (an xml file example) @ startup , compares db structure. if different generates alter table statements , adopts. might create default records in tables if missing. , should support multiple rdbms (ms sql, oracle, db2, etc.) , run in .net. doing hundreds of sql scripts , rollback-scripts seem kind of unpractical , error-prone me. i can start programming myself maybe there out there quite pretty?

objective c - Can't set multiple musical instruments in iOS using MusicPlayer and AUGraph -

i have musicplayer holds musicsequence containing 3 musictracks. have set augraph 3 ausampler nodes plugged multichannel mixer, in turn connected output node. i using soundfont, , 3 different musictracks play on 3 different musical instruments, described here . however, code i've got doesn't work - instead, plays 1 of parts. i create augraph follows: newaugraph (&_processinggraph); aunode samplernode, samplernodetwo, samplernodethree, ionode, mixernode; audiocomponentdescription cd = {}; cd.componentmanufacturer = kaudiounitmanufacturer_apple; //---------------------------------------- // add 3 sampler unit nodes graph //---------------------------------------- cd.componenttype = kaudiounittype_musicdevice; cd.componentsubtype = kaudiounitsubtype_sampler; augraphaddnode (self.processinggraph, &cd, &samplernode); augraphaddnode (self.processinggraph, &cd, &samplernodetwo); augraphaddnode (self.processinggraph, &cd, &samplernodethree);

c# - WCF client request returns bad request (400) -

my client application use wcf web service hosted in local iis. web service use upload image. once image size become bigger gives bad request(400). client configure dynamically web service url. client code string serviceurl=geturl(); /* http://localhost:85/imageuploaderservice.svc */ timespan timeout = new timespan(0, 30, 0); endpointaddress endpoint = new endpointaddress(serviceurl); basichttpbinding binding = new basichttpbinding() { closetimeout = timeout, maxreceivedmessagesize = 65536, opentimeout = timeout, receivetimeout = timeout, sendtimeout = timeout, maxbuffersize = 65536, maxbufferpoolsize = 524288, usedefaultwebproxy = true, }; binding.readerquotas = new system.xml.xmldictionaryreaderquotas() { maxarraylength = 64000000, maxstringcontentlength = 8192, maxdepth = 32, maxnametablecharcount = 16384, maxbytesperread = 4096 }; client = new imageuploaderserviceclient(binding, endpoint); web service

cruisecontrol.net - Programmatically generate .generated.cs from an EDMX in an CCNET automated build process -

i'm trying use ccnet automatically build mvc project using edmx. don't save generated files in source control (such files created edmx when open , save(.generated.cs)), have regenerated in build process, not. i'm using mvc4 , ccnet date. make sure have texttransform utility installed in build server. guidance on code generation build server can found here .

entity framework - C# unit of work bad implementation -

i tried implement unit of work sqlce database. works correctly except 1 thing. i have scenario patient can perform different sessions , each session based on specific test. these implementations: public class patient { public int id { get; set; } public byte[] identificationcode { get; set; } public string sex { get; set; } public virtual list<session> sessions { get; set; } } public class session { public int id { get; set; } public guid unique { get; set; } public datetime datetime { get; set; } public virtual patient patient { get; set; } public virtual test test { get; set; } public virtual list<videoexerciseresult> videosessionresults { get; set; } public virtual list<audioexerciseresult> audiosessionresults { get; set; } } public class test { public int id { get; set; } public string name { get; set; } public virtual list<session> sessions { get; set; } } when perform test dat

java - Extracting jar to specified directory -

i wanted extract 1 of jars specified directory using jar command line utility. if understand right -c option should trick when try jar xvf myjar.jar -c ./directorytoextractto i getting usage information jar utility, doing wrong. is thing want achievable jar or need manually move jar , there invoke jar xvf myjar.jar it's better this. navigate folder structure require use command jar -xvf 'path_to_ur_jar_file'

php - how can i call two api's together at same time without waiting for response from first? -

i making search widget. when searching taking results 2 api's 1 yelp , other source. process taking longer time $dataprovider = searchutil::locallookup($for, $near); //local api $content=searchutil::yelplookup($for,$near); //yelp api $array=array_merge($dataprovider,$content); is there way can call both api's together? dont want yelp api called after first api gives result. want call both of them together. is there way ? it possible, have rewrite both locallookup , yelplookup , tie them both curl multi_exec context. curl, default, runs synchronously. in case, want async on multiple sets of data, , best way run both channels multi_exec context. more info on page: http://php.net/manual/fr/function.curl-multi-exec.php . once curl_multi_exec(), able track status of set of calls using second parameter (which reference-changed true or false), , there, you'll able content of each channel using curl_multi_getcontent().

php - Magento: Detect if admin is logged in in frontend pages -

i have created magento extension. want implement access extension. extension creates page in frontend , want admin access page. need detect if admin logged in in frontend pages. i have tried several solution noting seem work . if(mage::getsingleton('admin/session', array('name' => 'adminhtml'))->isloggedin()) echo 'logged in'; else echo 'not logged in'; check on frontend if admin logged in mage::getsingleton('core/session', array('name'=>'adminhtml')); $adminsession = mage::getsingleton('admin/session'); $adminsession->start(); if ($adminsession->isloggedin()) { echo 'logged in'; } the above solutions doesn't work! here solution works ( not clean ! work anywhere in application in phtml view or model or controller or helper ! ) $sesid = isset($_cookie['adminhtml']) ? $_cookie['adminhtml'] : false ; $session = false; if($sesid){ $session = mag

arrays - Python: Merging list elements into one -

i wondering if there methods in python join elements of list 1 element. have like: test = [(1, 2, 3), (4, 5, 6)] print test[0] (1, 2, 3) print test[1] (4, 5, 6) i want this: test = [(1, 2, 3), (4 ,5, 6)] print test[0] (1, 2, 3), (4, 5, 6) i want able transfer contents of test[0] , transfer numpy array such that: array = [(1, 2, 3), (4, 5, 6), (1, 2, 3), (4, 5, 6), ...] array[0] = (1, 2, 3), (4, 5, 6) array[1] = (1, 2, 3), (4, 5, 6) i tried converting string , concatenating, converts everything in list (i.e., brackets , all) chars. suggestions? edit1: forgot mention using large amount of data. tried using extend(), append() , "+" operator doing run memory issues seems extend, append, , + holds growing list in memory. edit2: note elements (x, y, z) numpy array structure. edit3: there confusion. don't want print format (1, 2, 3), (4, 5, 6), need data types in numpy array fashion. test = [test] should trick

Ruby string manipulation, remove first 3 characters and add them to the end of the string -

mystring = "svn-myapplication" or mystring = "git-myapplication" my desired output: mystring = "myapplications(svn)" mystring = "myapplication(git)" question: first 3 characters of string should moved last enclosed brackets , "-" should removed. i tried this: mystring.gsub('svn-','')+"(svn)" svn might git, want use first 3 characters moved end "-" removed , brackets enclosed a regular expression groups work well: mystring.gsub(/^([a-z]+)-(\w+)/, '\2(\1)')

asp.net - Unable to determine a valid ordering error when using self referencing -

Image
i have schema : category entity have reference via parentcategoryid field. parentcategoryid field nullable.i use database first way.this generated code entity : public partial class category { public category() { this.category1 = new hashset<category>(); this.news = new hashset<news>(); } public int categoryid { get; set; } public string name { get; set; } public nullable<int> parentcategoryid { get; set; } public virtual icollection<category> category1 { get; set; } public virtual category category2 { get; set; } public virtual icollection<news> news { get; set; } } when insert category parentcategoryid field nullable,every thing ok,but when select value parentcategoryid i exception: unable determine valid ordering dependent operations. dependencies may exist due foreign key constraints, model requirements, or store-generated values i had category pk=0 , when selected parent

c++ - How to create gettable template type data sa class field? -

i have a: template<class t, class e> class bla { } i want make t accessable other classes like: bla::typeofe is such thing possible in c++03 , how it? add in public section typedef t typeoft; use like bla<int, double>::typeoft value;

java - Using swing components with an applets paint method -

i have functioning java applet can embedded web page , wish add swing components additional functions. whenever add component jlabel, not appear on viewport/canvas unless remove entire paint method. latter option allows me add swing components naturally cannot render shapes. appears resemble exclusive or (xor), either 1 not other. is there anyway in native java applet add swing components , still maintain paint(graphics g) method. please note inheriting applet , not japplet. if override paint method in applet there no simple way. what instead of overriding paint in applet. extend jcomponent instead , custom drawing there. create jpanel contains needed swing components including component earlier step. add panel applet using default paint method.

oauth 2.0 - Google oAuth2 & OpenId without Gplus button (Java) -

i'd create web-application in java uses google services both initial authentication , api calls. (e.g. google calendar) i want stay away google apps engine, because of overhead creates , because of requirements gae project. next want avoid google plus login button, because isn't custom brandable. for authentication i'd use openid , access google api's i'd use oauth2. currently have working project using recent oauth2 lib , code : https://code.google.com/p/google-api-java-client/wiki/oauth2 i'm using light-weight openid library jopenid openid authentication. the combination can used succesfully authenticate, have 2 main concerns: jopenid not actively maintained on 2 years. authentication mechanism outdated , incomplete (based on issue section of project) in authentication process, users needs select google account , grant permissions twice. confusing user , can problem if user selects 2 different accounts in process. i've looked @ step2 (

cycle - jquery cycle2 initialisation script failing -

i can utilise jq cycle2 fine required options inline within div, preferred style. instead use initialisation script, old method of operation. prefer keep gallery options stuff out of markup , in external .js file wherever possible. i've made script of options work 'inline' method , linking properly, silently fails , slideshow reverts default setting of fade whereas specify scrollhorz. also i'm using previous/next buttons , animated cations - captions work without animation , prev/next buttons visible fail completely. my script in file named 'functionality.js' , believe i've followed instructions 'custom initialisation script' as outlined in api . have relevant plugins in file called 'plugins.js' link fine , you'll see them referenced in console screengrab below. please see following markup/script (it's straight copy of cycle2 example simplicity) , link console screengrab: <a href="#"><span class="

html - Javascript window.close() for all browsers? -

i've been searching around problem, couldn't find that'll solve this. found lot of questions, none me. basically, problem has no difference questions asked, tried every answers. no luck. i want close tab of browser, when user clicks button. tried the stuff below: 1. <p class="submit"><input type="button" onclick="window.open(window.location, '_self');window.close(); return false;" value="{% trans 'close' %}"/></p> 2. <p class="submit"><input type="button" onclick="window.open('','_parent',''); window.close(); return false;" value="{% trans 'close' %}"/></p> 3. <p class="submit"><input type="button" onclick="var win = window.open('', '_self');win.close();return false; " value="{% trans 'close' %}"/></p> 4. <p class=&q

wiki - How can I make that the new pages of a Mediawiki would not be blank/empty? -

i'm using mediawiki in organisation. our pages must have same structure of titles , sections. since beginning create new page, copy structure without content , start edit new info. i when create new page, not appear blank or empty, have basic structure of titles. i don't know if possible. mediawiki's manual page creating pages preloaded text explains how this.

java - Freeze table row header to vertical scroll of table view -

i have activity in having table layout. table getting dynamically populated through activity. as table horizontally long, ease user handling, have implemented horizontal scrolling table after s.no. column. s.no. column should not exposed horizontal scrolling ever , achieved. the whole table vertically scrollable, what want freeze header row of table vertical scrolling, horizontal scrolling should present in header rows after s.no. column. this activity code : public class reportlistactivity extends activity { tablelayout srno_table; tablerow srno_report_tr_data; tablelayout report_table; tablerow report_tr_data; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_report_list); srno_table=(tablelayout) findviewbyid(r.id.srno_table); //---------------serial no table header-----------------------------------------------