Posts

Showing posts from April, 2010

html - How To Make A Responsive Sidemenu In CSS -

i've finished coding website 1024x768 resolution , want add @media queries code sidebar disappears when screen @ width of 980px , stays way down there. have tried adding @media max-width 980 myself not seem working @ all. i've tried in various places on page again, no luck. it's frustrating! code below (sorry if it's long, i'm gonna leave in there avoid questions regarding code). html: <head lang="en"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width" /> <title>lakeside books</title> <link rel="stylesheet" type="text/css" href="masterstyle.css"> <meta name="viewsize" content="width-device-width,initial-scale=1.0"> <!--[if ie]> <script type="text/javascript" src="_http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif...

Why does this simple Windows bat file give error "Syntax incorrect"? -

this in windows 7. here simple bat file test if parameter exists: if [%1] equ [] ( echo no parameter given; usage: testparam <something> exit ) else ( echo gave parameter: %1 ) when run (with no parameter) error message: the syntax of command incorrect. can tell me wrong? many other examples have construct... this problem caused missing quotes in echo statement missing argument because didn't put quotes around argument, cmd see < "read input file something> " because "something>" isn't valid file name in windows, used invalid syntax how fix problem: echo "no parameter given; usage: testparam <something>"

ajax - RestEasy method receiving null as parameters in case of POST method and working fine for Get Method -

i have created resteasy web service , using get method , passing parameters services using uri http://localhost:8080/rest/search?name=foo , accessing parameters using @queryparam , working fine: note: calling web service using ajax call @get @path("/search") @consumes({"application/xml", "application/json", "text/plain"}) @produces( mediatype.text_plain) public jsonarray getdetails(@queryparam("name") string name) { //my code here } my ajax call $.ajax({ type : 'get', url : searchurl, headers : { 'sm_user' : userid }, datatype : 'json', success : function(data) { now have change method post , in case not accepting uri paramenter have tried in different way like: passing value through ajax data. ajax call: $.ajax({ type : 'post', url : searchsuppurl, headers : { 'sm_user' : userid}, contenttype: "application/jso...

How to delete a row in SQL Server via Identity? -

what's proper syntax row delete via identity column? query: "delete [table] [column 'count'] = 1" works. while same query identity column 'index' fails. "delete [table] index = 1" i'm trying delete last inserted row ident_current([table]). index reserved word. have escape square brackets. delete [table] [index] = 1 and sure give special "thanks" whoever designed schema column name in first place.

reporting services - How to make objects inside a rectangle NOT move in SSRS? -

Image
i have rectangle , background image screenshot of form. i have placed many gauge panels on rectangle check marks need be. based on logic, gauge panel visible or not. the problem if gauge panels on left side hidden, moves gauge panels on right side. here's screenshot during design mode: and here's when run it: i'm assuming has moved because there no visible "yes" check mark. how should go making sure these panels fixed inside rectangle? edit - i tried putting items inside rectangles , i'm running same problem: place gauges inside fixed rectangles when they're not visible, container rectangles still take space in report on left side , not interfere checks on right hand side. my general rule of thumb when trying fixed layouts in ssrs use lot of rectangles, rendered absolute divs , therefore bend whim bit more in terms of heights, widths, , positioning.

java - Output JSON image in listView -

i tried uploading image using json. create link image in json. many times tried fix problem, no success. is there mistake in use of downloadimagetask in adapter adapter ? mainactivity protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); list = (listview) findviewbyid(r.id.list); newslist = new arraylist<news>(); //this take json image new newsasynktask().execute(); } public class newsasynktask extends asynctask<string , void, string> { protected string doinbackground(string... params) { //code } protected void onpostexecute(string file_url) { pdialog.dismiss(); //this run adapter newsadapter adapter = new newsadapter(getapplicationcontext(), r.layout.list_row, newslist); list.setadapter(adapter); } } my adapter adapter public class newsadapter extends arrayadapter<news> { arraylist<news>...

function - My template code in C++ is generating odd errors I can't seem to resolve. -

i having errors appear in code , can't figure them out. reduced code down basic simple functions/class calls still have issues this. #include <iostream> using namespace std; template <class t> class fc { private: double netprofit, costofinvest; double curras, invent, curliab; public: void roi(double np, double ci) { netprofit = np; costofinvest = ci; } double getroi() { return (netprofit - costofinvest) / costofinvest; } void atr(double ca, double inv, double cl) { curras = ca; invent = inv; curliab = cl; } double getatr() { return (curras - invent) / curliab; } }; int main() { fc roi, acidtestratio; roi.roi(27, 288); cout << roi.getroi() << endl; acidtestratio.atr(77, 2l, 344); cout << acidtestratio.getatr() << endl; return 0; } the errors this: in function 'int main()': 39:22: error: missing template arguments before 'roi' ...

string - How to obtain a substring based on index in C -

for background, i'm not familiar c, i'm proficient in java. in current program i'm working on, i'm trying figure out how implement java method somestring.substring(int startindex, int endindex) returns new string based on starting , ending index of previous one. for purposes of implementation, cut first char off , return remaining string. here's implementation in java. public string cut_string(string word) { string temp = word.substring(1, word.length()); return temp; } use this #include <stdio.h> #include <stdlib.h> char* substring(char*, int, int); int main() { char string[100], *pointer; int position, length; printf("input string\n"); gets(string); printf("enter position , length of substring\n"); scanf("%d%d",&position, &length); pointer = substring( string, position, length); printf("required substring \"%s\"\n", pointer); free...

SQL Server on update move to separate column -

my company requires column in customer table show number of previous addresses customer. number must update automatically whenever address updated. create trigger deleted_address on tblcustomer instead of insert begin set nocount on end so far have i've come issue don't know how make if address of customer edited adds old address new column called previousaddress , updates customeraddress use after update trigger: create trigger deleted_address on tblcustomer after update begin set nocount on if update (address) update t set countprev = countprev + 1, oldaddress = d.address tblcustomer t join inserted on t.customer_id = i.customer_id join deleted d on t.customer_id = d.customer_id end

regex - Regular expression to match a line that doesn't contain a word? -

i know it's possible match word , reverse matches using other tools (e.g. grep -v ). however, i'd know if it's possible match lines don't contain specific word (e.g. hede) using regular expression. input: hoho hihi haha hede code: grep "<regex 'doesn't contain hede'>" input desired output: hoho hihi haha the notion regex doesn't support inverse matching not entirely true. can mimic behavior using negative look-arounds: ^((?!hede).)*$ the regex above match string, or line without line break, not containing (sub)string 'hede'. mentioned, not regex "good" @ (or should do), still, is possible. and if need match line break chars well, use dot-all modifier (the trailing s in following pattern): /^((?!hede).)*$/s or use inline: /(?s)^((?!hede).)*$/ (where /.../ regex delimiters, i.e., not part of pattern) if dot-all modifier not available, can mimic same behavior character class [\...

java - Clear cache of apps in android programitiically Not for images -

in android application, want make app has button named cleancache , inside code list down applications cache , clear toast message cache cleared. looked @ different questions , answers didn't find interesting. i'd implemented consists of errors. here mainactivity.java file: package com.example.ahsankhan.cache; import android.app.activity; import android.content.context; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import java.io.file; public class mainactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); addlisteneronbutton(); } public void addlisteneronbutton() { //select specific button bundle action want button button = (button) findviewbyid(r.id.button1); button.setonclicklistener(new onclicklistener() { @override public void on...

c# - Detecting part of string and using part of it in a variable -

i have tcp server setup receives strings of text clients. data = new byte[1024]; recv = client.receive(data); string recvconv = encoding.ascii.getstring(data, 0, recv); i can detect string , example: if (recvconv == "l") { console.writeline(encoding.ascii.getstring(data, 0, recv)); console.writeline("l printed..."); } however need detect part of string. example, "name:programmer". need able detect "name:" part, , assign "programmer" part of string variable. i not sure how this. have tried using substring, , other string techniques have no idea doing. you can use string.split method. https://msdn.microsoft.com/en-us/library/system.string.split%28v=vs.110%29.aspx data = new byte[1024]; recv = client.receive(data); string recvconv = encoding.ascii.getstring(data, 0, recv); string[] results = recvconv.split(':'); foreach (string result in results) { console.writeline(result); }

ruby - Gem dependencies in Rails Engines -

i have followed getting started engines in rails documentation , have set api engine in engines directory. according paragraph 6.6 other gem dependencies 1 supposed define gem dependencies in engines/my_api/my_api.gemspec file , pretty did: s.add_dependency "responders", "2.0" after adding `gem 'my_api', path: "engines/my_api"` to applications gemfile , running bundler, looks expected: bundle install | grep responders installing responders 2.0.0 in next step set root path corresponding controller etc. , go engines/my_api/app/controllers/my_api/application_controller.rb , add following content: module myapi class applicationcontroller < actioncontroller::base respond_to :json end end i start rails server, go root url , guess what? following message: the controller-level respond_to' feature has been extracted responders gem. add gemfile continue using feature: gem 'responders', '~> 2.0'...

mysql - do the data aggregation with min value of other field -

i have 1 table in mysql database. name age code foo 24 23 bar 23 21 mit 19 23 and doing data aggregation on basis of "code" attribute, using "group by" in mysql this select * table group code output foo 24 23 bar 23 21 i interested in aggregated result min age. expected output mit 19 23 bar 23 21 i looking optimized query that. thanks in advance. please let me know if need more detail. you want row has minimum age each code. means there no smaller age code. here 1 method: select t.* table t not exists (select 1 t2 t2.code = t.code , t2.age < t.age);

Android action bar's title color not changing -

i change contextual action bar's title text color , button colour. please find code using, still couldn't able achieve <!-- base application theme. --> <style name="apptheme" parent="theme.appcompat.light.noactionbar"> <!-- customize theme here. --> <item name="android:actionmodebackground">@color/dark_blue_shade1</item> <item name="android:windowactionmodeoverlay">true</item> <item name="titletextstyle">@style/myactionbartitletext</item> </style> <!-- actionbar title text --> <style name="myactionbartitletext" parent="@style/textappearance.appcompat.widget.actionbar.title"> <item name="android:textcolor">@color/white</item> </style> please me fix </style> <style name="mytheme" parent="@android:style/theme.holo.light"> ...

java - How to implement insertion sort to my ArrayList? -

i have homework problem i've been able easily, i'm stuck on how implement insertion sort arraylist i've constructed. here's code far: public class emaildirectory { public static void main(string[] args) { new emaildirectory(); //relay main menu until 3 entered } public arraylist<string> emailrecords=new arraylist<string>(); //construct array directory, array or arraylist? public emaildirectory() { scanner scnr=new scanner(system.in); //scanner , empty string option choice string menuchoice; do{ //do while keep repeating system.out.println("please enter number of option choice:"); system.out.println("1. add new contact"); system.out.println("2. search exsisting contact"); system.out.println("3. exit"); menuchoice=scnr.nextline(); if (menuchoice.equals("1")) //add new contact { ...

java - Change Action bar background and text colours programmatically using AppCompat -

Image
i'm trying change background colour , text colour of action bar programmatically using appcompat. code used before when using holo theme seems can't use same thing appcompat. know need change? actionbar bar = getactionbar(); bar.setbackgrounddrawable(new colordrawable(color.parsecolor("#95cdba"))); getactionbar().settitle(html.fromhtml("<font color='#000099'>hello world</font>")); instead of getactionbar() use getsupportactionbar() edit: you getting errors, because imports wrong. please use same below. works fine. import android.graphics.color; import android.graphics.drawable.colordrawable; import android.os.bundle; import android.support.v7.app.actionbar; import android.support.v7.app.actionbaractivity; import android.text.html; public class testactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); ...

haskell - understanding do notation and bindings -

i new haskell , trying understand methodology used create monadic parser in document https://www.cs.nott.ac.uk/~gmh/pearl.pdf instead of following exactly, trying little bit differently in order understand correctly, therefore, ended code newtype parser = parser (string -> maybe (a, string)) item :: parser char item = parser (\cs -> case cs of "" -> nothing (c:cs) -> (c, cs)) getparser (parser x) = x instance monad parser return x = parser (\cs -> (x,cs)) (parser p) >>= f = parser (\cs -> let result = p cs in case result of nothing -> nothing (c,cs') -> getparser (f c) cs') takethreedropsecond :: parser (char, char) takethreedropsecond = c1 <- item item c2 <- item return (c1, c2) this seems working, having hard time following going on in notation. for example; in c1 <- item , assigned c1 ? function contained ...

php - The unstopable Loop X( -

this first code. im trying add new posts wordpress site. mysql query return 4035 rows have details insert new post. problem : loop wont ever stop! it reach 4035 row , start on 1st row things tried make stop: added - if ($loopstimes > 4400) {break;} limited mysql query 4050 rows the weird parts: when limit mysql query limit 900 , works perfectly . loop stops when 900 post added, if add 950, script add 943 posts , give me fatal error "maximum execution time reached" . script stops. i increase "maximum execution time" 300 sec , increase memory 128 256mb, use query without limit , loop wont ever stop. is code problematic? or server issue? <?php $username = "xxxx"; $password = "xxxx"; $hostname = "localhost"; $loopstimes = 0; //connection database $dbhandle = mysql_connect($hostname, $username, $password) or die("unable connect mysql"); //select database work $selected = mysql_select_db("...

visual studio 2013 - Testing an app under multiple Windows user accounts -

i have simple windows 8.1 universal app created in visual studio 2015 under windows login a. want log in using windows login b , run app. problem : the app isn't available login b because deployed under login a's account. i can't deploy in visual studio via login b because it's deployed is possible? i've tried running visual studio administrator, doesn't work. don't know else try. unfortunately windows 8.1 deployment system has buzzword like: per user deployments app isolation multi version existence but used other way solve problem (not same similar) enterprise deployment login script (which tries deploy app via dism) (i know not answer expected :/ )

linux - print matching word after a pattern using grep -

grep '[branch "default"]' -a 3 config | grep -po 'merge = \k\w+' this grep command prints "master" want, there way single grep command instead of 2 grep's ? or other solution? file config has: .... .... [branch "default"] remote = origin merge = master .... .... with gnu grep: grep -zop '\[branch "default"\].*\n.*\n.*merge = \k\w+' filename or gnu sed: sed -n '/\[branch "default"\]/{n;n;s/.*merge = \(\w\+\).*/\1/p}' filename output: master

Encrypt Password in Android and verify it wit PHP / Yii -

i use yii framework in php, , encrypt password in database, use : $pass = cpasswordhelper::hashpassword ($this->newpassword); to verify password match, use : if (!cpasswordhelper::verifypassword($this->currentpassword,$this->_user->passwd)) { ... } now, have send encrypted password android device. should send without encryptation , process php, doesn't seem secure send clean password. so, there way in android encrypt pass same way cpasswordhelper does???? [ thing don't know encryptation / hash applied in php ] any appreciated! tx

php - PhpMailer sends to gmail but not to hotmail accounts -

i know has been asked before, wanted show case because tried solve other answers coundt solve it. i m trying contact form when choose email of receiver if choose @hotmail.com or @advancedinstitute.cl dont receive email. tried choose type of email gmail, yahoo or terra , email arrives without problem. i know must because spam policies of servers dont know how fix it. this code of phpmailer: $mail = new phpmailer(); $mail->host = "localhost"; $mail->hostname = "advanced institute"; $mail->from = $_post["email"]; $mail->fromname = $_post["email"]; $mail->subject = "quiero contactarme con advanced institute"; $mail->addaddress("carmeng.advanced@terra.cl","advanced institute"); $mail->addreplyto($_post["email"]); $mail->ishtml(true); // el correo se envía como html $body = '<html><body><div>nombre : '.$_post["nombre"].'<br> email...

php - MySQLi random and temporary fatal error -

i have environment use beanstalkd , pheanstalk queue , process jobs asynchronously. 1 of workers passed mysql table name, , row id, along other information. worker updates row of table. this works fine 99% of time. however, worker crashes with: php fatal error: call member function bind_param() on non-object in /path/to/file.php on line 62 as mentioned, same line executes fine 99% of time, crashes every often. job crashed on not yet deleted , stays in queue reprocessed worker. when restart worker, processes same job crashed on moments earlier without issue. my php looks this: $stmt = $mysqli->prepare("update `database`.`$table` set `limit` = ? `d_id` = ?"); $stmt->bind_param("si", $limit, $rowid); $stmt->execute(); $stmt->close(); the best can figure because asynchronous, other process happens locking table/row @ time of execution. imagine mysql query wait it's turn though , not out right crash. unfortunately, if case, have no way...

windows phone 8.1 - MdilXapCompile error 1004 when deploying to device in Release mode -

i'm building windows phone 8.1 application. localization resources used in it's views, uses 'new' .resw files. for several reasons i've built application's view models in portable class library. these view models use localizable texts i've placed in .resx files inside same project. initially, seemed working well. today, noticed i'm unable deploy application physical device in release mode , i've determined resx-files somehow causing this. visual studio gives me error when try deploy: dep6810 : mdilxapcompile.exe failed error code 1004. see log file 'c:\mysolution\mypclproject\obj\release\mdil\mdilxapcompilelog.txt' more details. in log file itself: error: compile filter argument specified non-existent file: c:\mysolution\mypclproject\obj\release\msil\en\mypclproject.resources.dll invalid argument microsoft (r) mdil xap compiler - version 4.0.0.0 copyright (c) microsoft corporation. rights reserved. ...

iphone - SIM-Application access via iOS App -

i want create shortcut sim-application. somehow possible access sim-app via ios app? other ideas? it not possible access sim card ios public apis. you can search private headers use in project, won't approved release on appstore.

windows - How to Resolve this Out of Memory Issue for a Small Variable in Matlab? -

i running 32-bit version of matlab r2013a on computer (4gb ram, , 32-bit windows 7). have dataset (~ 60 mb) , want read using ds = dataset('file', myfile, 'delimiter', ','); and each time face out of memory error. theoretically, should able use 2gb of ram, there should no problem reading such small files. here got when typed memory maximum possible array: 36 mb (3.775e+07 bytes) * memory available arrays: 421 mb (4.414e+08 bytes) ** memory used matlab: 474 mb (4.969e+08 bytes) physical memory (ram): 3317 mb (3.478e+09 bytes) * limited contiguous virtual address space available. ** limited virtual address space available. i followed every instructions found (this not new issue), case seems rather weird, because cannot run simple program now. system: windows 7 32 bit matlab: r2013a ram: 4 gb clearly issue right here. maximum possible array: 36 mb (3.775e+07 bytes) * you either using lot of memory in system and/or hav...

objective c - How to manage the code of multiple, very similar Xcode projects -

greetings stackoverflow community, i have taken on task of 'unifying' 4 mobile iphone apps share 95% of code , differ in 5% (this of over-simplification, never mind). each of apps has own hefty set of resources (media files). after 'unifying' 4 apps, adding new functionality apps, functionality apps share. i appreciate hearing opinions on what's best way manage code of these apps. here approach i'm taking @ moment. i'm maintaining 1 xcode project includes functionality of 4 apps. functionality not shared among apps enclosed in condition such as: if (appname == 'x')... each app has own info.plist file, have 4 of such files: infox.plist, infoy.plist, ... before build app, 2 things done: a. in build settings, specify name of info.plist use. b. ensure app's resources (media files) in project. delete other apps' resources. as apps 95% similar in code, having "one app rule them all" ensures when code gets upgraded, apps...

Google Places API - Get address, phone number etc -

i trying further information places showing on map, such place address, phone number etc. can see code here: http://jsfiddle.net/aboother/4q3jcg1s/ i have done 'console_log(place)' below: function createmarker(place) { var placeloc = place.geometry.location; var marker = new google.maps.marker({ map: map, position: place.geometry.location }); console.log(place); var request = { reference: place.reference }; service.getdetails(request, function(details, status) { google.maps.event.addlistener(marker, 'click', function() { console.log(place); infowindow.setcontent(place.name + "<br />" + place.vicinity); infowindow.open(map, this); }); }); } but can't see address or phone number in object though know can information. can see 'vicinity', 'name' , other basic information. can help? well used service: service.nearbysearch(...

oracle - drop everything to the right of a hyphen in sql -

i using oracle sql developer 2012. data looks 'valuea-valueb' . want strip content after - , populate rest. you can use combination of substr , instr : select substr(my_column, 1, instr(my_column, '-') - 1) my_table

php - How to get year of a movie or TV Show from IMDB -

is 1 tell me how year of specific movie or tv show imdb in php? the omdb abi might of in instance. need send http request (including movie's title service). assuming match, json-formatted string containing movie in question's year. for example: request: http://www.omdbapi.com/?t=batman&y=&plot=short&r=json response: {"title":"batman", "year":"1989" ,"rated":"pg-13","released":"23 jun 1989","runtime":"126 min","genre":"action, adventure","director":"tim burton","writer":"bob kane (batman characters), sam hamm (story), sam hamm (screenplay), warren skaaren (screenplay)","actors":"michael keaton, jack nicholson, kim basinger, robert wuhl","plot":"the dark knight of gotham city begins war on crime first major enemy being clownishly homicidal joker....

c++ - How to get total number of rows/records in an sqlite table -

i want know how total number of rows/records in sqlite table , assign variable. did this; qsqlquery query("select count(*) class1_bills"); but problem is, how assign result variable? tried; int rows = query.seek(0); and; int rows = query.value(0).toint(); yes, know doing accesses record @ field position 0 in table. seems qt's query methods accessing particular records @ field positions only. if i'm wrong please correct me. how total row count in table? the query returns single column , single row. just read value: query.first(); count = query.value(0).toint();

javascript - Format string with line breaks into paragraphs -

i'm using contentful cms manage content , pulling in content api. the content pulled in json object. 1 of keys in object main block of text entry pulling. string has no actual code in it, have line breaks. in chrome console these appear small return arrow. part of object looks this: var article = { name: "some name here", content: "lorem ipsum dolor sit amet, consectetur adipiscing elit. sed lobortis libero lacus. morbi non elit purus. mauris eu dictum urna. nam vulputate venenatis diam nec feugiat. praesent dapibus viverra ullamcorper. donec euismod purus vitae risus dignissim, id pulvinar enim tristique. donec sed justo justo. sed et ornare lacus. lorem ipsum dolor sit amet, consectetur adipiscing elit. sed lobortis libero lacus. morbi non elit purus. mauris eu dictum urna. nam vulputate venenatis diam nec feugiat. praesent dapibus viverra ullamcorper. donec euismod purus vitae risus dignissim, id pulvinar enim tristique. donec sed justo justo. sed et ...

camera - Canon EDSDK 2.12+ kEdsPropID_BodyIDEx disabled -

since version 2.12 - seems canon edsdk no longer supports getting camera serial numbers connected cameras via kedspropid_bodyidex. means it's impossible tell physical camera which. for instance, if wanted connect 2 cameras , set settings1 camera1 , settings2 camera2, have no way of knowing camera camera1 , camera2 inside application , therefore no way of knowing settings apply each camera. this seems reasonable thing want if camera1 located in dark room , camera2 in brightly lit room , wanted apply specific settings each? i did see post: canon sdk: download latest picture taken 2 devices host unless i'm misunderstanding something, allows differentiate between cameras inside application once you've connected, not let differentiate between physical cameras. anyone found way around issue? cheers! using 2.15 here , bodyidex working fine. sure using string , not uint? other there @ least 2 other ways distinguish camera, both without opening session. ...

c - Sending structure through pipe without losing data -

i have structure: typedef struct { int pid; char arg[100]; int nr; } str; the code this: int main() { int c2p[2]; pipe(c2p); int f = fork(); if (f == 0) { // child str s; s.pid = 1234; strcpy(s.arg, "abcdef"); s.nr = 1; close(c2p[0]); write(c2p[1], &s, sizeof(str*)); close(c2p[1]); exit(0); } // parent wait(0); close(c2p[1]); str s; read(c2p[0], &s, sizeof(str*)); printf("pid: %d nr: %d arg: %s", s.pid, s.nr, s.arg); close(c2p[0]); return 0; } the output this: pid: 1234 nr: 0 arg: abc$%^& pid right, nr 0 , fist few characters arg right followed random characters. i want create structure in child process , send structure parent process through pipe. how can send correctly structure through pipe? write(c2p[1], &s, sizeof(str*)); is not right. write number of bytes size of pointer. should be ...

scikit learn - How to correctly override and call super-method in Python -

Image
first, problem @ hand. writing wrapper scikit-learn class, , having problems right syntax. trying achieve override of fit_transform function, alters input slightly, , calls super -method new parameters: from sklearn.feature_extraction.text import tfidfvectorizer class tidfvectorizerwrapper(tfidfvectorizer): def __init__(self): tfidfvectorizer.__init__(self) # necessary? def fit_transform(self, x, y=none, **fit_params): x = [content.split('\t')[0] content in x] # filtering input return tfidfvectorizer.fit_transform(self, x, y, fit_params) # critical part, ide tells me # fit_params: 'unexpected arguments' the program crashes on place, starting multiprocessing exception , not telling me usefull. how correctly this? additional info: reason why need wrap way because use sklearn.pipeline.featureunion collect feature extractors before putting them sklearn.pipeline.pipelin...

symfony - Swiftmailer not sending immediately -

i have configure symfony webapp sending email using smtp. sending email being put spool directory. this should occurs whem there error in sending. correct? but if execute command swiftmailer:spool:send --env=prod , emails sending correctly. why server not sending email immediately? because fixed error? there way fix this? swiftmailer: spool: type: file path: %kernel.root_dir%/spool a add command swiftmailer:spool:send crontab . step wasn't clear on symfony documentation .

spring data - Extra quotes being added to @Query -

i have following json structure: { "communication": { "office": { "email": "test@example.com" }, "private": { "email": "test2@example.com" }, } } i want query dynamically email based on type e.g. office or private. when use following command: @query(value = "{ 'communication.?0.email' : ?1 }") object findbyemail(string type, string email); the 'communication.?0.email' is converted to 'communication."office".email' and mongo didn't find entry. how can avoid quotes before , after office? simple answer spring mongo doesn't supports looking for. why not passing parameter rather below. @query(value = "{ 'communication.?0.email' : ?1 }") object findbyemail(string type, string email); where email value should type= "communication." + type + ".email"

javascript - Why does a function in my object return undefined? -

Image
consider code: var mse = { module : {} }; mse.module = (function() { 'use-strict'; var app = { tabspre : function() { var tabspre = { init : function() { }, changetab : function(arg) { return arg; } }; tabspre.init(); return tabspre; } }; return app; })(); console.log( mse.module.tabspre() ); console.log( mse.module.tabspre().changetab() ); // undefined console.log( mse.module.tabspre.changetab() ); // uncaught typeerror: mse.module.tabspre.changetab not function i trying access changetab() in tabspre object, don't seem able to. last 2 console.log statements aren't giving me had hoped for. how can this? here's jsfiddle: https://jsfiddle.net/xhb16ql6/ in first console.log , can see function there: any or guidance on i'm doing wrong great. i'm having dumb day , can...

c# - Button Click URL + String -

i trying have click event navigate webbrowser pre-set location + string can't seem work. my biggest issue maybe getting string 1 event click event? using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.data.oledb; namespace ink { public partial class inkform : form { public inkform() { initializecomponent(); } string searchlink; private void searchbutton_click(object sender, eventargs e) { this.acceptbutton = searchbutton; int itemrow = -1; string searchvalue = searchtextbox.text.toupper(); if (searchvalue != null && searchvalue != "") { foreach (datagridviewrow row in inkgridview.rows) { if (row.cells[1...

ocaml - Warning 8: Incomplete pattern matching warning in a let statement -

i pattern matching in let statement, know shape of result. clear cannot expect compiler infer knowledge, perhaps there's more idiomatic way in concise way. as example, please @ following code: type foo = of int | b of string let x = (true, 0) let (b, i) = x in + 2 which correctly warns me, result of (_, b _) not matched. possible way explicitly handle missing case in: let (b,i) = match x | (a, j) -> (a,j+2) | _ -> failwith "implementation error!" but obscures actual computation. there more concise alternative? edit: jeffrey scofield remarked in case without nesting, explicit conversion function work out well. there version nested type matching? if sure right case , using ocaml 4.02 or higher, can add [@@warning "-8"] declaration. see the ocaml manual more details on attributes. on previous versions of ocaml, can disable warning respect whole file (this depends on building workflow) or use explicit pattern matchi...

Generic Sequences -

i have following snippet. second variable declaration not compile though: type coin = ref object pen = ref object let yes : seq[ref object] = @[coin(), coin(), coin()] #compiles no : seq[ref object] = @[coin(), pen(), coin()] #does not compile is possible in nim have generic seqs, java's list ? nim sequences are generic, not putting same kind of objects in them. in java non-primitive types (including arrays) inherit either directly or indirectly object superclass , therefore having list<object> type can put in it. in nim not has have same root, , in case, while objects same, treated different types. need create class hierarchy java: type baseref = ref object of tobject coinref = ref object of baseref penref = ref object of baseref let test1: seq[baseref] = @[(baseref)coinref(), coinref(), coinref()] test2: seq[baseref] = @[(baseref)coinref(), penref(), coinref()] note @[] list constructor still needs prodding in correct dire...

ios - NSMutableDictionary treats NSString value as NSNumber -

Image
i have following value in nsmutabledictionary - see image i'm attempting @ "a" thus: let = dictionary.objectforkey("a") as! string the app crashes @ point with could not cast value of type '__nscfnumber' (0x...) 'nsstring' (0x...). other numbers inside "" treated strings numbers outside of strings cast string without issue. can let me know what's going on? , how @ these values easily? the value nsnumber , not nsstring . can use stringvalue convert it: if let = d["a"] as? nsnumber { let astring = a.stringvalue println(astring) // -1 } else { // either d doesn't have value key "a", or d value not nsnumber } if you're sure exists , nsnumber , can use forced unwrapping, forced casting, , string interpolation: let = d["a"]! as! nsnumber let astring = "\(a)"

list allows duplicates but how to write logic to dis-allow duplicates in list in core java -

list allows duplicates write logic dis-allow duplicates in list import java.util.*; class altest { public static void main(string[] args) { arraylist al=new arraylist(); al.add("a"); al.add("b"); al.add("a"); al.add(10); al.add(20); al.add("list"); system.out.println(al); } } here duplicated should not duplicate the easiest way use linkdhashset instead. prevent duplicates, , can still iterate on elements in same order added set.

opengl - Undefined Behaviour with unused Shadow Samplers -

i have shader performs lighting passes in deferred renderer. takes uniforms various optional features, 1 of them being shadows. i want use same shader performing lighting shadows without (see other question here ). works great. however, there problem when render light without shadows, , such don't bind texture shadow sampler, leaving other texture bound. on system, running nvidia 346.59 drivers, produces following gl error/warning: program undefined behavior warning: sampler object 0 bound non-depth texture 0, yet used program uses shadow sampler . undefined behavior. even though know sampler not used if case. is there way around this? seems unnecessary have bind unused placeholder texture suppress warning. edit: note work. issue warning being spit out driver. edit: ok, here's shader. part relevant question main() function. #version 330 #extension gl_arb_shading_language_420pack : enable #include "headers/blocks/camera" #include "headers/...

Apache ServiceMix 5.4.0 audit.log -

i have installation of smx 5.4.0 logs crazy location {karaf.home}/data/security/audit.log. contains lines: authentication attempted/autentication succeeded - smx. karaf jaas module responsible behavior: karaf-jaas-module.xml any ideas how rid of this? could try this? karaf@root> config:edit org.apache.karaf.jaas karaf@root> config:propset audit.file.enabled false karaf@root> config:update

ruby on rails - activerecord can't recognize the correct class when inside folders -

i have current structure module1 interactions user module2 interactions person user < person when load user module1, module1::user.first , user loaded correctly when try load user module2 ( module2::person.first ) got unable autoload constant user, expected module1/user.rb define it . how can work? edit: person has column type , value "user". sti just solved using ignorable gem. didn't need sti in case, legacy database

oracle - Weblogic with Hibernate getting javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection -

i migrating jboss weblogic 12c, project working on jboss, when trying migrate weblogic have error. context: my database: oracle xe application server: weblogic 12c on start script startweblogic.cmd added: set pre_classpath=%mw_home%\oracle_common\modules\javax.persistence_2.1.jar;%mw_home%\wlserver\modules\com.oracle.weblogic.jpa21support_1.0.0.0_2-1.jar on weblogic console in services -> datasources created data source name: oracleds jndi name: u_interface url: jdbc:oracle:thin:@localhost:1521:xe driver class: oracle.jdbc.xa.client.oraclexadatasource i can see on jndi names u_interface there. i able test connection database on weblogic. now application: pom.xml <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-entitymanager</artifactid> <version>3.6.0.final</version> <scope>test</scope> </dependency> <dependency> <groupid>javax</groupid...