Posts

Showing posts from April, 2012

c++ - store byte[4] in an int -

c++ - store byte[4] in an int - i want take byte array 4 bytes in it, , store in int. for illustration (non-working code): unsigned char _bytes[4]; int * combine; _bytes[0] = 1; _bytes[1] = 1; _bytes[2] = 1; _bytes[3] = 1; combine = &_bytes[0]; i not want utilize bit shifting set bytes in int, point @ bytes memory , utilize them int if possible. in standard c++ it's not possible reliably. strict aliasing rule says when read through look of type int , must designate int object (or const int etc.) otherwise causes undefined behaviour. however can opposite: declare int , fill in bytes: int combine; unsigned char *bytes = reinterpret_cast<unsigned char *>(&combine); bytes[0] = 1; bytes[1] = 1; bytes[2] = 1; bytes[3] = 1; std::cout << combine << std::endl; of course, which value out of depends on how scheme represents integers. if want code utilize same mapping on different systems can't utilize memory aliasing; you...

android - JSONObject put method in try block causing error but catch block not executed -

android - JSONObject put method in try block causing error but catch block not executed - this issue driving me little crazy 1 of fine people point me in right direction. attempting prepare jsonobject passed client server. next problematic method stripped downwards essentials: private jsonobject getjsonparam(int id) { jsonobject param = new jsonobject(); seek { param.put("functioncode", 50); param.put("id", id); homecoming param; } grab (jsonexception e) { e.printstacktrace(); } grab (throwable e) { e.printstacktrace(); } homecoming null; } i have traced code in debug mode. in actual method, set many more paramters in jsonobject , until lastly param.put() method effort insert id. when current execution line, can visualize param variable , looks good. when perform step function execute lastly param.put call, jumps homecoming null statement. have set breakpoints...

mysql - Issue in retrieve data from sql database in php -

mysql - Issue in retrieve data from sql database in php - i have created register form using php. have index.php,submit.php,functions.php , script. now works fine, , need retrieve info database , display in front end end. i new php, , learning. please help me this. this data.php: <?php include ('condb.php'); $query = mysql_query("select * test id='".$_get['id']."'"); $row = mysql_fetch_array($query); ?> <body> <h3>employee detail</h3> <p>emp name:</p> <?php echo $row['fname'];?> <p>lastname:</p> <?php echo $row['lname'];?> </body> <?php ?> and action.php: <?php include('condb.php'); extract($_post); $que=mysql_query("insert test (id, fname, lname) values ('$id', '$fname', '$lname')") or die("error msg!"); if($que) { ...

batch file - git command to get local path of repository -

batch file - git command to get local path of repository - is there way path of local repository git can executed batch file? set gitbin="c:\program files (x86)\git\bin" set repodir1=c:\randompath1\repository1 set repodir2=c:\randompath2\repository2 pushd %tgacoredir% @echo on %gitbin%\git pull @if %errorlevel% neq 0 ( goto :pullerror ) i'd repodir1 , repodir2 git, developers can run script, if have local repositories in different locations 1 another. there way repodir1 , repodir2 don't have hardcoded in .bat file? this command should want git rev-parse --show-toplevel git batch-file repository

2D Binary Tree in SML -

2D Binary Tree in SML - i having hard time figuring out how implement 2d binary tree using sml this have far tycon mismatch. datatype btree = empty | node of int * btree * btree; fun addnode (i:int, empty) = node(i, empty, empty) | addnode(i:int, node(j, left, right)) = if = j node(i, left, right) else if < j node(j, addnode(i, left), right) else node(j, left, addnode(i, right)); fun printinorder empty = () | printinorder (node(i,left,right)) = (printinorder left; print(int.tostring ^ " "); printinorder right); datatype twotree = empty | node of int * twotree * twotree * btree; fun add2node(int:i, int:j, empty) = node(i, btree, empty, empty) | add2node(int:i, int:j, node(k, btree, left, right)) = if = k node(i, addnode(j, root), left, right) else if < k node(k, root, add2node(i, j, left), right) else node(k, root,...

css - Aligning HTML special charaters bottom relative to parent -

css - Aligning HTML special charaters bottom relative to parent - so i'm building website client in wordpress , design has square total stops on few headings font have used has round total stops. i have solved issue shortcode '[stop]' , homecoming next code: <span class="square-stop">&#9632;</span> this html square symbol ■ wrapped in span styling. but can seem align bottom text. see illustration here: http://jsfiddle.net/9a8x844n/ <h1>this heading of kind<span class="square-stop">&#9632;</span></h1> use next css align square: h1{ position:relative; } .square-stop { font-size: 0.7em; position: absolute; bottom: 0; } html css special-characters vertical-alignment symbols

sql server 2008 - how to update a database with dataset changes -

sql server 2008 - how to update a database with dataset changes - i have table general_ledg 4 fields. created dataset named general_ledgdataset , dragged on form. when create changes info in dataset, should update database . not updating. tried next code when update button clicked private con new sqlclient.sqlconnection("server=.\sqlexpress;attachdbfilename=c:\program files\microsoft sql server\mssql10.sqlexpress\mssql\data\nxtrading.mdf;integrated security=true;user instance=true") con.open() general_ledgtableadapter.update(general_ledgdataset) me.general_ledgdataset.acceptchanges() sql-server-2008 ado.net dataset

sql - Making a tableau extract in to marimekko chart -

sql - Making a tableau extract in to marimekko chart - i'm using tableau 8.2, , i'm trying create tableau extract marimekko chart. i looked online, , consensus utilize custom sql this, looks before versions of tableau, , in 8.2 have utilize legacy connection this. problem is, can select excel file , legacy connection alternative leads me custom sql option, when seek utilize legacy connection on tableau extract, alternative doesn't pop up. i'm wondering if have convert tableau extract excel in order alternative of legacy connection , custom sql or if there improve way this? thanks! sql extract tableau

javascript - deserialize nested json object in c# -

javascript - deserialize nested json object in c# - i have json object in javascript {"categoryid":"1","countryid":"1","countryname":"united arab emirates", "billerid":"23","accountno":"1234567890", "authenticators":"{\"consumernumber\":\"1234567890\",\"lastbilldate\":\"14-10-2014\",\"lastbillduedate\":\"24-11-2014\"}", "shortname":"0000000001"} i have similar c# class as [serializable] public class usercontext { public string categoryid { get; set; } public string billerid { get; set; } public string accountno { get; set; } public string authenticators { get; set; } public string shortname { get; set; } public string countryid { get; set; } public string countryname { get; set; } } i can each element valu...

Script works only when run in cuda-memcheck -

Script works only when run in cuda-memcheck - i'm writing convnet using torch , cudnn , having memory issues. tried debugging script cuda-memcheck notice runs when fed through cuda-memcheck (albeit slower should). turns out if cuda-memcheck running in background, separate instantiation of script runs fine. any thought might happening here? cuda cuda-gdb torch

c++ - Sort the list alphabetically in descending order and print the list -

c++ - Sort the list alphabetically in descending order and print the list - a. store 5 names in list. allow user input each name. b. sort list alphabetically in ascending order , print list. c. sort list alphabetically in descending order , print list. d. ensure code can executed without bugs or errors. im stuck in sorting list in descending order please help:( below source code of ascending order. #include <iostream> #include <set> #include <algorithm> void print(const std::string& item) { std::cout << item << std::endl; } int main() { std::set<std::string> sorteditems; for(int = 1; <= 5; ++i) { std::string name; std::cout << << ". "; std::cin >> name; sorteditems.insert(name); } std::for_each(sorteditems.begin(), sorteditems.end(), &print); homecoming 0; } to display set in reverse order, may use: std::for_each(s...

How to fix "Headers already sent" error in PHP -

How to fix "Headers already sent" error in PHP - when running script, getting several errors this: warning: cannot modify header info - headers sent (output started @ /some/file.php:12) in /some/file.php on line 23 the lines mentioned in error messages contain header() , setcookie() calls. what reason this? , how prepare it? no output before sending headers! functions send/modify http headers must invoked before output made. summary ⇊ otherwise phone call fails: warning: cannot modify header info - headers sent (output started @ script:line) some functions modifying http header are: header / header_remove session_start / session_regenerate_id setcookie / setrawcookie output can be: unintentional: whitespace before <?php or after ?> the utf-8 byte order mark specifically previous error messages or notices intentional: print , echo , other functions producing output raw <html> sections prior <?php...

.net - Write Date only to Registry vb net -

.net - Write Date only to Registry vb net - with code i'm writing current time , date registry. what if want store date ? tried date.now instead of now . private function handleregistry() boolean dim firstrundate date firstrundate = my.computer.registry.getvalue("hkey_local_machine\software\myprog", "firstrun", nothing) if firstrundate = nil firstrundate = my.computer.registry.setvalue("hkey_local_machine\software\myprog", "firstrun", firstrundate) elseif (now - firstrundate).days > 15 homecoming false end if homecoming true end function also if looking hash in vb.net . there says id can used md5 there stronger protection because first time seek unhash md5 ? custom made has take asci value of each letter add together number "3" , read asci value 1 time again ? understand me ? now , datetime.now same thing. want today or datetime.today these give dat...

android - Resizing a view to its Contents -

android - Resizing a view to its Contents - i have custom view class draw bitmap view protected void onsizechanged(int w, int h, int oldw, int oldh) { super.onsizechanged(w, h, oldw, oldh); log.d("log","called w , h " + w +"," + h); // method called multiple times initialized 1 time if (wheelheight == 0 || wheelwidth == 0) { wheelheight = h; wheelwidth = w; // resize image matrix resize = new matrix(); resize.postscale((float)0.60, (float)0.60); imagescaled = bitmap.createbitmap(imageoriginal, 0, 0, imageoriginal.getwidth(), imageoriginal.getheight(), resize, false); // translate matrix image view's center float translatex = wheelwidth / 2 - imagescaled.getwidth() / 2; float translatey = wheelheight / 2 - imagescaled.getheig...

javascript - Is there an easy way to specify a wildcard character in a regex for coffeescript? -

javascript - Is there an easy way to specify a wildcard character in a regex for coffeescript? - i want able if target.hostname == string.match(/attacker./) and match hostname has string such "attacker1", "attacker2", etc. i can't seem find equivalent in coffeescript. perhaps knows regex syntax? update: i have used illustration here: http://www.elijahmanor.com/regular-expressions-in-coffeescript-are-awesome/ to create regex: attackerpattern = /// ^ # begin of line /attacker/ # word "attacker" ([0-9]+) # followed number \. # followed dot ([a-za-z]+) # followed 1 or more letters \. # followed dot ([/com/]) # followed com ///i # end of line , ignore case because want grab said "attacker1.node.com" or "attacker2.node.com", etc. i seem able grab pattern: attackerpattern = /attacker/i and maybe plenty (because won't care rest of hos...

Preventing Visual Studio Online (TFS) from Auto Deploying to Azure Websites on Build Success -

Preventing Visual Studio Online (TFS) from Auto Deploying to Azure Websites on Build Success - i have visual studio online (microsoft team foundation server) using free account, hooked msvc 2013 web update 3 , deploying direct azure website. the build definition trigger set manual. current build process template azurecontinous deployment.11.xaml. 1 time build process kick-started using online portal, if succeeds, website automatically deployed. i'd know how stop project automatically deploying website, can build , deploy when want - using "ready deploy" maybe. i'm guessing can switch build process template 1 of others, 1 should utilize , why?! azure visual-studio-online

javascript - How to consider if for loop is completed? -

javascript - How to consider if for loop is completed? - for (var = 1; < 99999; i++) { window.clearinterval(i); console.log('interval cleared'); } the above code log 99999 times "interval cleared". how log if loop completed? if(for loop completed){ console.log('interval cleared'); } a loop synchronous , code within loop, written, synchronous. loop finish before code after executes. for (var = 1; < 99999; i++) { window.clearinterval(i); console.log('interval cleared'); } console.log("all intervals cleared"); javascript

AngularJS Touch Carousel -

AngularJS Touch Carousel - this follow-up 1 of previous questions , i'm looking far can't seem working. i'm trying work here , i've tried: index.html <head> <title>building angular directives</title> <link href="css/angular-carousel.css" rel="stylesheet" type="text/css"/> <!-- angular components --> <script type = "text/javascript" src = "angular/angular.js"></script> <script type = "text/javascript" src = "angular/angular-route.js"></script> <script type = "text/javascript" src = "angular/angular-mocks.js"></script> <script type = "text/javascript" src = "angular/angular-loader.js"></script> <!-- app definition --> <script type = "text/javascript" src = "app.js"></script> <!-- directives --...

testing - Is there an Acceptance Test management approach that can live with the code in git? -

testing - Is there an Acceptance Test management approach that can live with the code in git? - we moving acceptance test driven development approach defining features. seems working well, we're starting run issues test management. @ moment, utilize sharepoint/excel track acceptance tests. because non-technical customers, qa , dev update tests. problem tests don't live code, aren't branched/versioned along code, , manual. we're looking @ total on test case management software (e.g., zephyr, testrail, etc), feels little heavy, , test info still doesn't live code. is there test management application friendly non-devs, stores info in way work git? trying maintain tests alongside code fool's errand? thanks, erick yes, thought maintain tests code. one framework utilize accomplish goal fitnesse. known test management tool supports collaboration between business guys, developers, , testers. git plugin fitnesse can maintain tests within gi...

android - How to make Icon appear on Action Bar? -

android - How to make Icon appear on Action Bar? - https://developer.android.com/images/training/basics/actionbar-actions.png where in code type android:icon="@drawable/icon" create icon appear left of mtitle? i've tried looking in layout , menu xmls , can't figure out i'd type create icon appear? i'm using navigation drawer base of operations template if helps. go android manifest->application, in application there's icon->browse alter icon of want or delete it.. android xml icons

c++ - cannot find -lqwtE -

c++ - cannot find -lqwtE - i succesfully compiled qt 4.8.6 using arm-linux-gnueabihf- compiled qwt 6.0.0 except qwtsvg, qwtdesigner, qwtmath, qwtexamples and copied qwt-bin (compiled path of qwt) features qt features directory. after those, tried compile project, got error "cannot find -lqwte". dont understand why got error, paths correct, didnt error when i'm compiling in target machine. output of project compile: arm-linux-gnueabihf-g++ -wl,-o1 -wl,-rpath,/opt/qt-arm/lib -o p main.o #object files removed me# -l/opt/qt-arm/lib -lqtserialporte -l/opt/projects/p/trunk/qwt-bin/lib -lqwte -lqtdeclarativee -l/opt/qt-arm/lib -lqtscripte -lqtsqle -lqtguie -lqtnetworke -lqtcoree -lpthread /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lqwte collect2: error: ld returned 1 exit status make: *** [p] error 1 any help appreciated! m. e tag added qt cause compiled embedded. libraries have e tag. qwt 3rd part...

umbraco7 - How to use Yelp API v2 C# example in Umbraco site -

umbraco7 - How to use Yelp API v2 C# example in Umbraco site - i'm new .net , umbraco in general. have basic site setup , want utilize yelp api display content on site. i've played code sample git: https://github.com/yelp/yelp-api/tree/master/v2/csharp and have built that, produces executable command line program. question is, how convert code sample utilize straight on website, umbraco v7? any help much appreciated, thanks. your code should not differ lot illustration combined normal asp.net. if in partial view or template in umbraco razor code like: @{ // todo: add together other relevant code or link other classes encapsulating calls jobject response = client.search(term, location); jarray businesses = (jarray)response.getvalue("businesses"); } <ul> @foreach(var item in businesses) { <li>id: @item["id"]</li> } </ul> c# umbraco7 yelp

Primefaces switches between multiple dialogs -

Primefaces switches between multiple dialogs - i`m using primefaces 4.0. have page 3 dialog components (dialog 1, dialog 2, dialog 3) , 3 button components (button 1, button 2, button 3), dialog 1 showed click button 1, dialog 2 showed click button 2, , dialog 3 showed click button 3. user can open these 3 dialogs in same time, means user can work these 3 dialogs been on show, this: when user work in dialog, need alter values in backing bean , update components @ first, , when user show dialog click button, there no problem , can alter values when actionlistener of button user clicked fired, when user showed 3 dialogs, , changes active dialog click dialog this: how can alter active dialog 'dialog 1' 'dialog 2'? here xhtml code: <p:commandlink onclick="dialog1.show()" update="outputtext" actionlistener="#{testbean.changeactivedialog('dialog 1')}">button 1</p:commandlink><br/> <p:comm...

sql - Unexpected output when using a CASE statement -

sql - Unexpected output when using a CASE statement - i trying out random things using case statement when stumbled upon scenario. first statement throws error sec 1 works fine. can help me understand execution of case statement here. select case when 1 = 1 'case 1' when 2 = 2 2 else 10 end select case when 1 = 1 1 when 2 = 2 'case 2' else 10 end a case statement cannot homecoming more 1 single type. when there mix of types such int , varchar, type int has higher precedence , hence chosen type homecoming type of case statements. see http://msdn.microsoft.com/en-us/library/ms190309.aspx list of info type precedence. your sec case statement fail if seek homecoming sec value ( 'case 2' ); illustration with: select case when 1=0 1 when 2=2 'case 2' else 10 end sql sql-server tsql

razor - ActionLink doesn't work -

razor - ActionLink doesn't work - i'm pretty sure i'm doing stupid. please have , allow me know i'm doing wrong. here actionlink @html.actionlink("edit","edit","userprofile", new { id = model.applicationuserid },null) when click throws bad request exception , noticed url https://localhost:44304/userprofile/edit/92b1347c-c9ec-4728-8dff-11bc9f935d0b not https://localhost:44304/userprofile/edit?userid=92b1347c-c9ec-4728-8dff-11bc9f935d0b i have httpget edit method in controller , takes userid . when pass route values manually works.please help me. help much appreciated , someday, pay forward. thanks! cheers! if parameter expecting userid , utilize @html.actionlink this: @html.actionlink("edit","edit","userprofile", new { userid = model.applicationuserid },null) if pass parameter name id , mvc route mentioned: https://localhost:44304/userprofile/edit/92b1347c-c9ec-4728...

syntax checking - Suitable Scenario to Handle with XText & XTend? -

syntax checking - Suitable Scenario to Handle with XText & XTend? - i need provide , ide syntax checker , validator simple dsl. the dsl's interpreter exists there no need one. dsl suitable xtext & xtend except allows 1 escape javascript, have heard quite messy language. is xtext suitable scenario? have heard extremely hard adapt xtext javascript , haven't seen open source xtext javascript project link or extend. thanks! edit: dsl working nools rule language. looks this: rule "rule study user" { when{ $ctr: counter $ctr.count % 1000 == 0 {count: $count} } then{ console.log("progressing..."); modify($ctr, function(){this.count = $count + 1;}); } } javascript appears in pattern in each statement in when clause. in illustration pattern "$ctr.count % 1000 == 0"). there limited number of non-javascript substitutions in patterns e.g. back upwards regex operator '=~'...

php - Codeigniter cannot run a loop -

php - Codeigniter cannot run a loop - my model returns array "user ids" , want run loop each of user ids errors "undefined variable: users" , "invalid argument supplied foreach()". please check wrong controller code. my model: public function get_user_id($post_id){ $this->db->select('user_id'); $this->db->from('comments'); $this->db->where('post_id', $post_id); $query = $this->db->get(); if ($query && $query->num_rows() >= 1){ homecoming $query->result(); } else { homecoming false; } } my controller: $this->model_a->get_user_id($post_id); $data["users"] = $this->model_a->get_user_id($post_id); foreach($users $user){ $user_id = $user['user_id']; //loop code } try $data["users"] = $this->model_a->get_user_id($post_id); foreach($data["users...

eclipse - How to set background to the outer portion of frame in android using surfaceview -

eclipse - How to set background to the outer portion of frame in android using surfaceview - hello guys, my problem how can fill outer portion of frame. need show photographic camera moments within frame only. rest of portion filled color take fill. here whole background captured photographic camera don't want this. please suggest me should do? your true guidance , back upwards additional , efforts highly appreciated 1 time you're sure done this. you have 2 options if don't want photographic camera preview fill entire area covered surfaceview: draw on top of surfaceview. use opengl es render photographic camera preview in whatever shape want. option #1 pretty straightforward. surfaceview surface composited below view ui layer, draw in view appear on top (e.g. bluish circle in image included). draw opaque pixels everywhere don't want photographic camera preview appear. should able utilize surfaceview's view specifying custom ...

jena - How to relax an RDF graph -

jena - How to relax an RDF graph - i want know if there way relax rdf graph using jena. i'm using dbpedia spotlight. example, have uri: http://dbpedia.org/resource/halloween , generate rdf graph it, wonder if there way relax rdf graph other resources may useful user. i'm beginner in semantic web. help appreciated. rdf jena

list - How to repeat the first characters of every word in a sentence timed by three in python? -

list - How to repeat the first characters of every word in a sentence timed by three in python? - i want create function takes string (sentence) argument takes first word , saves every character konsonant first vowel (including vowel) , save in empty string. want take sec 1 , same thing... , on... , on... ex. input -> "this good" output -> thithithi iii gogogo this have came far: def lang(text): alist=text.split() kons="nrmg" nytext=" " word in alist: tkn in word: if tkn in kons: nytext+=tkn else: nytext+=tkn nytext=nytext*3 nytext=nytext+"" break homecoming nytext print(lang("this good")) what -> t t ti t t ti t t ti what doing wrong? any help appreciated! thanks :) so first thing if want maintain track of each word differently, need utilize ...

visual studio 2013 - Database Schema Viewer functionality in vs2013 -

visual studio 2013 - Database Schema Viewer functionality in vs2013 - recently migrated vs 2010 -> vs 2013. observed there no database schema viewer in vs 2013 db projects. sql server explorer similar when add together new items (say new table) project, noticed 2 things: 1. new table file gets created in root folder , not under schema objects\schemas\dbo\tables\ 2. in vs2010, table scripts used have extension xx.table.sql in vs2013, xx.sql what actions can take accomplish above 2 behaviors in vs 2010 schema view no longer part of visual studio. you'll have utilize 3rd party tool. if have sql server management studio can utilize database diagrams feature. visual studio no longer manages folder construction in database projects. when adding new item, should add together appropriate folder yourself. to include schema name in files go database project's properties, select project settings tab, , check include schema name in file name. alter not retroacti...

gnuplot - Data values greater than float capacity - plotting in Octave -

gnuplot - Data values greater than float capacity - plotting in Octave - i have pretty simple octave script , i'm trying plot few values i'm getting error: warning: gl-render: info values greater float capacity. (1) scale data, or (2) utilize gnuplot the script is: a = 0.2; z = 160; l = 8; w = 31.12; x = 0; g = 9.81; k = 0.785; rho = 1025; t = 0:10 eta_0 = -(1/g)*exp(0)*cos(k*x-w*t); u_x = a*w*exp(k*z)*cos(k*x-w*t); w_x = a*w*exp(k*z)*sin(k*x-w*t); p_d = -rho*a*g*exp(k*z)*cos(k*x-w*t); endfor plot(t,eta_0); hold on plot(t,u_x); hold on plot(t, w_x); hold on plot(t,p_d); i can't find useful error after searching online , new using octave , gnuplot not sure how utilize gnuplot instead. using ubuntu 12.04. advice or help appreciated. thanks! you want loop follows, otherwise, you'll single info point, not curve: for t = 0:10 eta_0(t) = -(1/g)*exp(0)*cos(k*x-w*t); u_x(t) = a*w*exp(k*z)*cos(k*x-w*...

R: Creating Latex tables without environment code -

R: Creating Latex tables without environment code - how can print latex-formatted tables (e.g. summary statistics, no regression output) in r, without environment code \begin{table}[!htbp] \centering ? i tried many packages listed in tools making latex tables in r. stargazer bundle seems have alternative suppressing latex environment code, namely out.header=false . alternative seems have no effect. other packages seem haven less options. background: have 2 table of similar kind (spearman , pearson correlation, in case) have in 1 table in latex. think of calling r generated, latex-formatted output in 3rd latex file, called in latex document. if there other possibilities create 2 r generated latex-style tables in 1 .tex document, i'd glad utilize them. you can xtable: here's default behavior: > print(xtable(table(1:5))) % latex table generated in r 3.1.1 xtable 1.7-4 bundle % sat nov 08 14:57:56 2014 \begin{table}[ht] \centering \begin{tabular}{rr} ...

audiotoolbox - Simply Playing A Sound in iOS -

audiotoolbox - Simply Playing A Sound in iOS - i'm trying play sound when button clicked. first, imported audiotoolbox in header file, added code ibaction fires when button pressed, so: - (void)viewdidload { [super viewdidload]; } - (ibaction)button1:(id)sender { nsstring *soundpath = [[nsbundle mainbundle] pathforresource:@"mysong" oftype:@"wav"]; systemsoundid soundid; audioservicescreatesystemsoundid((__bridge cfurlref)[nsurl fileurlwithpath:soundpath], &soundid); audioservicesplaysystemsound (soundid); } i threw nslog in method create sure it's firing. is. in foo path in string see if crash, did. made sure dragged , dropped short sound file app well. tested speakers, tested sound on device simulator going youtube on simulator, everything. can't figure out i'm doing wrong. when changed code this: - (ibaction)button1:(id)sender { avaudioplayer *testaudioplayer; // *** implementation... *** ...

javascript - jQuery Autogrow and Autosize - They're not applying to my input -

javascript - jQuery Autogrow and Autosize - They're not applying to my input - these 2 scripts i'm trying use. need 1 work, right can't either: autogrow autosize in head element, called scripts: <script src="js/jquery.autosize.js"></script> <script src="js/autogrow.js"></script> this element i'm dealing with. it's not alternative assign autoresize (below) data-integer-question, or id. <form method="post" action="submit.php" class="questionformcss"> <input type="text" name="username" class="questioninputcss" data-integer-question="863"> </form> at bottom of page, used jquery phone call them: $(document).ready(function(){ $('.questioninputcss').autogrow(); }); i tried autosize instead of autogrow. in neither case, form resize when text added. , autogrow, there's sup...

go - Working in the console via exec.Command -

go - Working in the console via exec.Command - please help. have pass console commando number of parameters. there many. that is, ideally, should follows: test.go --distr example: test.go --distr mc curl cron i create function func chroot_create() { cmd := exec.command("urpmi", "--urpmi-root", *fldir, "--no-verify-rpm", "--nolock", "--auto", "--ignoresize", "--no-suggests", "basesystem-minimal", "rpm-build", "sudo", "urpmi", "curl") if err := cmd.run(); err != nil { log.println(err) } } and grab parameter distr through flag.parse () how rid of "rpm-build", "sudo", ...

hive - sqoop from MySQL where the data contains carriage returns -

hive - sqoop from MySQL where the data contains carriage returns - i have mysql table of values in varchar column end '^m' (i.e. carriage homecoming or '\r') while others not. mysql database part of production environment not control, , i'm unable remove trailing carriage returns simple update mytable set mycol = trim(mycol); . when sqoop mysql table cluster, notice records carriage homecoming end misaligned resulting in unusual query results. sqoop (v 1.4.4) command looks this: sqoop import \ --connect jdbc:mysql://myhost:3306/mydb --username myuser --password mypass --table mytable --target-dir user/hive/warehouse/mydb.db/mytable --hive-import --hive-table mydb.mytable --hive-overwrite -m 1 q) possible sqoop info contains carriage returns straight mysql without having sort of intermediate step remove carriage returns? the ideal workflow simple sqoop command scheduled oozie . staging info , stripping out \r ...

compare 2 2Dimensional arrays - Java -

compare 2 2Dimensional arrays - Java - why isn't true? int[][] arrayofsets = {{1,2},{9,10},{1,2},{3,5}}; int[][] test = {{1,2},{9,10},{1,2},{3,5}}; if(arrayofsets==test){ //{{1,2},{9,10},{1,2},{3,5}}){ system.out.println("exactly same"); } the output should "exactly same". or how can compare 2 variables 2dimensional arrays? you utilize == thats why failed, it's identical of object check utilize : boolean check = arrays.deepequals(arrayofsets, test); java multidimensional-array compare

json - PHP4: Json_encode method which accepts multi byte chars -

json - PHP4: Json_encode method which accepts multi byte chars - in company have webservice zu send info old projects pretty new ones. old projects run php4.4 has natively no json_encode method. used pear class service_json instead. http://www.abeautifulsite.net/using-json-encode-and-json-decode-in-php4/ today, found out, class can not deal multi byte chars because extensively uses ord() in order charcodes string , replace chars. there no mb_ord() implementation, not in newer php versions. uses $string{$index} access char @ index, i'm not sure if supports multi byte chars. //excerpt encode() method // strings expected in ascii or utf-8 format $ascii = ''; $strlen_var = $this->strlen8($var); /* * iterate on every character in string, * escaping slash or encoding utf-8 necessary */ ($c = 0; $c < $strlen_var; ++$c) { $ord_var_c = ord($var{$c}); ...

SQL Server multiple values in where clause -

SQL Server multiple values in where clause - how create sql query counts same value in same column? for illustration client can have multiple invoices same name different id. so carl has 2 invoices name phone. how utilize in query? if want list persons having 2 invoices specific name? try this, select invoicenumber, name, count (select invoicenumber, name, count(1) count table1 grouping invoicenumber, name) count = 2; sql sql-server-2008

dir - node.js file upload Error: ENOENT, rename ' tmp/xxxxxx.jpeg', think the fault is in my path, what am I doing wrong? -

dir - node.js file upload Error: ENOENT, rename ' tmp/xxxxxx.jpeg', think the fault is in my path, what am I doing wrong? - my code looks this: and terminal output looks this: but dont want path under "routes". rather under bears/public/... appreciate help! in current setup, you're joining path string. doesn't allow move levels within folder structure. var path = require("path") var target_path = path.join(__dirname, "../public/images/bjornar") the path module bring together them if moving around in command line. node.js dir

ubuntu 14.04 - Caffe ImageNet 32X32 images -

ubuntu 14.04 - Caffe ImageNet 32X32 images - so problem consists of not beingness able train imagenet smaller images (32x32) when resize them 256x256 starts training fine. know issue settings. i tried set own settings for: deploy.prototxt: set lastly 2 input_dims 32 solver.prototxt: set solver_mode: cpu (left else alone) train_val.prototxt: set crop_size: 31 both of settings all paths right training runs fine images resized 256x256 but setup described above error: i1114 11:53:38.484948 4566 net.cpp:96] setting fc6 f1114 11:53:38.484967 4566 blob.cpp:72] check failed: data_ *** check failure stack trace: *** @ 0x7f82ed8a0daa (unknown) @ 0x7f82ed8a0ce4 (unknown) @ 0x7f82ed8a06e6 (unknown) @ 0x7f82ed8a3687 (unknown) @ 0x45814e caffe::blob<>::mutable_cpu_data() @ 0x4c12fa caffe::gaussianfiller<>::fill() @ 0x4e5719 caffe::innerproductlayer<>::layersetup() @ 0x4705e1 caffe::net<>::init() @ 0x471eee caffe::net<>::net() @ 0x452560 caffe::sol...

r - randomForest did not predict serial samples -

r - randomForest did not predict serial samples - i have data.frame tc , 17744 observations of 13 variables. lastly variable target: factor w/ 2 levels "0", "1" . i do: n.col <- ncol(tc) x.train.or <- tc[1:12000, -n.col] y.train.or <- tc[1:12000, n.col] x.test.or <- tc[12000:17000, -n.col] y.test.or <- tc[12000:17000, n.col] rf.or <- randomforest(y=y.train.or, x=x.train.or, ntree=500, mtry=5, importance=true, keep.forest=true, na.action=na.roughfix, replace=false) pr.or <- predict(rf.or, x.test.or) table(y.test.or, pr.or, dnn=c("actual", "predicted")) # predicted # actual 0 1 # 0 2424 780 # 1 1056 741 very bad result. then repeat model fitting random sample: set.seed <- 123 t.t <- holdout(tc[, n.col], ratio=3/5, mode = "random") x.train.r <- tc[t.t$tr, - (n.col)] y.train.r <- tc[t.t$tr, (n.col)] x.test.r ...

rewrite - WordPress - Custom Post Type and Taxonomy -

rewrite - WordPress - Custom Post Type and Taxonomy - currently have create : one new taxonomy : project one new post type : task and want have : // 1- list of all project www.example.com/projets/ // 2- see 1 project , list task www.example.com/projet/un-projet/ // 3- see 1 task of 1 project www.example.com/projet/un-projet/introduction/ number 1 , 2 don't work. how can this? edit : i have add together in functions.php <?php add_action( 'init', 'tache_type_register' ); /** * ajoute united nations type de post "les tâches" d'un projet * @link http://codex.wordpress.org/function_reference/register_post_type */ function tache_type_register() { $labels = array( 'name' => 'tâches', 'singular_name' => 'tâche', 'menu_name' => 'tâches', 'name_admin_bar' => 'tâche', 'add...

javascript - how to get the values from add remove selection box -

javascript - how to get the values from add remove selection box - i have 2 multiple selection box caste , sub-caste. add together / remove button used in both selection box. want filter sub-caste based on caste. how can value of caste selection box. i'm using code add together / remove is $('#btn-add').click(function(){ $('#caste option:selected').each( function() { $('#caste_new').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>"); $(this).remove(); }); }); $('#btn-remove').click(function(){ $('#caste_new option:selected').each( function() { $('#caste').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>"); $(this).remove(); }); }); and using ajax fetch values database. please help. in advance. $("#caste :input"); ...

Python regex not working in code -

Python regex not working in code - i've uploaded here.. http://regex101.com/r/hc2eh3/1 let email.body = > from: "fasttech" <support@fasttech.com> > > == ship == > illustration name > > shipping via registered airmail w/tracking > > == shipping eta == > > == items ordered == > > == other services == > > > == order total == > $2.63 > > > > > give thanks 1 time again choosing fasttech. > > kind regards, > > fasttech team > > > fasttech - gadget , electronics > http://www.fasttech.com > support@fasttech.com > > > email automatically generated i can't work in script - using code: regex = r'> == ship == *\n. (\w+\s\w+)' link = re.findall(regex, email.body) print link print link returns [] when should matching 'example name' your regex works fine me. >>> import re >>> s = ""...

ember.js - Ember Data store.unloadAll('myType') not unloading records -

ember.js - Ember Data store.unloadAll('myType') not unloading records - i need unload types ember info store. doing in didtransition route hook. odd of types seek unload unloaded, not types are. records types remain in store after phone call store.unloadall. weirder can unload remaining types manually running unloadall 1 time again in console. what causing unloadall work @ 1 point, not another? relationships? note: none of objects dirty. var typestounload = ['typeone', 'typetwo', 'typethree']; typestounload.foreach(function(type) { store.unloadall(type); }); ember.js ember-data store

Openshift: memory limit and gear stop -

Openshift: memory limit and gear stop - the command oo-cgroup-read memory.failcnt shows positive number after gear stop , gear start . 'gear stop' mean memory cleaned? my application shows 84946 oo-cgroup-read memory.failcnt after pushing new commit server. not know reason because before memory enough. that number not cleared automatically, seek keeping track of , see if going application runs. indication application needs either run on larger gear, or have kind of memory leak. depending on how much memory application goes on limit, application may oom killed (out of memory) , not restart automatically, either way, it's time maybe application memory profiling, or seek installing new relic see how much memory using , might leaky. openshift

fluid - TYPO3 Extbase switchableControllerActions -

fluid - TYPO3 Extbase switchableControllerActions - i have own extension has controller 2 actions: listaction , showaction. question: can display 2 actions @ same page. at specific page i've created insert plugin record own plugin in flexform of backend configuration of plugin i've choosen "list action" via switchablecontrolleractions field. list action contains list of products link show action of product. so want? f.e. have page products. url example.com/products (here list action) , show action want url example.com/products/name-of-product i've found extension functionality. it's gb_events. , noticed in switchablecontrolleractions field of flexform of plugin there this: <switchablecontrolleractions> <tceforms> <label>lll:ext:gb_events/resources/private/language/locallang_db.xlf:flexform.default.switchablecontrolleractions</label> <config> <type>select</type> ...

javascript - jQuery to set css value of one element to another -

javascript - jQuery to set css value of one element to another - i need little help setting "padding left" of <div id="menu"> equal width of <ol> here's illustration code reference <ol style="width:80%">some code</ol> <div id="menu">some text</div> i'm trying jquery, don't know attempt $("#menu").css({"paddingleft": "$('ol').width()"}); it works if come in value myself 400px in here $("#menu").css({"paddingleft": "400px"}); but responsive design , want automaticaly value of <ol> element , in pixes remove " "$('ol').width()" otherwise not work $("#menu").css({"paddingleft": $('ol').width()}); if want alter padding while changing size set within window resize() event $(window).resize(function() { $("#menu").css({...

java - how to get new request object after ajax called -

java - how to get new request object after ajax called - i developing web project using jsp , servlet. i trying upload file using ajax called. file uploaded. but, while ajax called controller (servlet file) send request , response object jsp file. jsp file $(document).ready(function(){ $(':file').change(function(){ var fileobj = this.files[0]; var form = $('#mobj'); var fd = new formdata(); fd.append( 'file', fileobj); $.ajax({ url:form.attr('action'), type:form.attr('method'), data:fd, processdata: false, contenttype: false, async:false, }).done(function(){ alert('ajax complete'); //////////////////////////////////////////////////////////////// here getting old request value. want n...

php - How to check is someone is online? -

php - How to check is someone is online? - so have made simple log in scheme in php how go on making function on php check if online can done in php login system <?php if (empty($_post) === false) { $username = $_post['username']; $password = $_post['password']; if (empty($username) === true || empty($password) === true) { $errors[] = 'please come in username , password'; } else if (user_exists($username) === false) { $errors[] ='sorry user entered dose not exist'; } else if (user_active($username) === false) { $errors[] ='you have not activated business relationship please check email activate account'; } else { if (strlen($password) > 32){ $errors[] ='passwords long !'; } $login = login($username, $password); if ($login === false) { $errors[] ='incorrect username or password'; } else { $_session['user_id'] = $login; header('location: index.php'); exit(); } }...

java - How can I make a class field become a tag name using JAXB? -

java - How can I make a class field become a tag name using JAXB? - i using java , jaxb xml processing. i have next class: public class characteristic { private string characteristic; private string value; @xmlattribute public string getcharacteristic() { homecoming characteristic; } public void setcharacteristic(string characteristic) { this.characteristic = characteristic; } @xmlvalue public string getvalue() { homecoming value; } public void setvalue(string value) { this.value = value; } } public static void main(string[] args) { characteristic c = new characteristic(); c.setcharacteristic("store_capacity"); c.setvalue(40); characteristic c2 = new characteristic(); c2.setcharacteristic("number_of_doors"); c2.setvalue(4); } this result get: <characteristics characteristic="store_capacity">40</characteristics> <ch...