Daily Archives

Articles indexed Monday August 25 2014

Page 4/14 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • .resx file data inaccessible in Visual C#

    - by dsp_099
    What I'm trying to do: include some files along with the executable to extract them later. I have two projects, both with a Resource1.resx file (and some resources included from disk). In one project, I can use File.WriteAllBytes(path, Resource1.Image); to dump the resource to disk. In another, Resource1 is does not exist. I've done this before but all I can find is information about localizations (?) when I search MSDN for how to work with Resources.

    Read the article

  • Why doesn't `stdin.read()` read entire buffer?

    - by Shookie
    I've got the following code: def get_input(self): """ Reads command from stdin, returns its JSON form """ json_string = sys.stdin.read() print("json string is: "+json_string) json_data =json.loads(json_string) return json_data It reads a json string that was sent to it from another process. The json is read from stdin. For some reason I get the following output: json string is: <Some json here> json string is: Traceback (most recent call last): File "/Users/Matan/Documents/workspace/ProjectSH/addonmanager/addon_manager.py", line 63, in <module> manager.accept_commands() File "/Users/Matan/Documents/workspace/ProjectSH/addonmanager/addon_manager.py", line 49, in accept_commands json_data = self.get_input() File "/Users/Matan/Documents/workspace/ProjectSH/addonmanager/addon_manager.py", line 42, in get_input json_data =json.loads(json_string) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads return _default_decoder.decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 383, in raw_decode raise ValueError("No JSON object could be decoded") So for some reason it reads an empty string from stdin instead of reading only the json. I've checked, and the code that writes to this process's stdin writes to it only once. What's wrong here?

    Read the article

  • Change storyboard UIImageView to own class with backgroundcolor

    - by Thomas
    I want to draw the background image on my own, so I decided to implement a UIImageView class and connect it in the Storyboard. As first task I just want to set the backgroundcolor of the image on my own, but it's never shown. Image just stays blank. That's the class: class FirstBackgroundImage : UIImageView { required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) self.backgroundColor = UIColor.redColor() } override init() { super.init() self.backgroundColor = UIColor.redColor() } override required init(image: UIImage!) { super.init(image: image) self.backgroundColor = UIColor.redColor() } } That's how i connected it:

    Read the article

  • lmerTest package install failing on Ubuntu 12.04

    - by Alexandra Tyers
    I'm running Ubuntu 12.04.5 LTS precise 32-bit and trying to install the lmerTest package for R version 2.14.1... When I try to install from the CRAN repository or R-forge: install.packages("lmerTest") or install.packages("lmerTest", repos="http://R-Forge.R-project.org"), I get the error: Warning in install.packages : package ‘lmerTest’ is not available (for R version 2.14.1) So I downloaded the Package Archive File from CRAN and tried to install from this Package source: lmerTest_2.0-11.tar.gz ,but get the error: "installation of package /home/.../lmerTest_2.0-11.tar.gz’ had non-zero exit status" I had a similar problem when trying to install lme4, and using the advice from lme4 package install failing on Ubuntu 12.04 was able to download the package using "sudo apt-get install r-cran-lme4" after which it appeared in my R package list and installed fine from there. I tried a similar tactic with lmerTest "sudo apt-get install r-cran-lmerTest" but just get "Unable to locate package r-cran-lmerTest", so really don't know what to do now, bearing in mind that I'm a novice with both Ubuntu and R, any suggestions/help would be much appreciated

    Read the article

  • Sql case that will use a current table

    - by Dana Ezer
    I have an sql statement that returns this result below,and I want that the num will drag the latest(by date) num that is not null. I can't get it right. I want to add somthing like this: case when num is null then max(num where date<my_date) my result now: Date num 1.1 0 2.1 1 3.1 NULL 4.1 NULL 5.1 4 what I want: Date num 1.1 0 2.1 1 3.1 1 4.1 1 5.1 4

    Read the article

  • Hadoop File Read

    - by user3684584
    Hadoop Distributed Cache Wordcount example in hadoop 2.2.0. Copied file into hdfs filesystem to be used inside setup of mapper class. protected void setup(Context context) throws IOException,InterruptedException { Path[] uris = DistributedCache.getLocalCacheFiles(context.getConfiguration()); cacheData=new HashMap(); for(Path urifile: uris) { try { BufferedReader readBuffer1 = new BufferedReader(new FileReader(urifile.toString())); String line; while ((line=readBuffer1.readLine())!=null) { System.out.println("**************"+line); cacheData.put(line,line); } readBuffer1.close(); } catch (Exception e) { System.out.println(e.toString()); } } } Inside Driver Main class Configuration conf = new Configuration(); String[] otherArgs = new GenericOptionsParser(conf,args).getRemainingArgs(); if (otherArgs.length != 3) { System.err.println("Usage: wordcount <in> <out>"); System.exit(2); } Job job = new Job(conf, "word_count"); job.setJarByClass(WordCount.class); job.setMapperClass(Map.class); job.setReducerClass(Reduce.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); FileInputFormat.addInputPath(job, new Path(otherArgs[0])); Path outputpath=new Path(otherArgs[1]); outputpath.getFileSystem(conf).delete(outputpath,true); FileOutputFormat.setOutputPath(job,outputpath); System.out.println("CachePath****************"+otherArgs[2]); DistributedCache.addCacheFile(new URI(otherArgs[2]),job.getConfiguration()); System.exit(job.waitForCompletion(true) ? 0 : 1); But getting exception java.io.FileNotFoundException: file:/home/user12/tmp/mapred/local/1408960542382/cache (No such file or directory) So Cache functionality not working properly. Any Idea ?

    Read the article

  • App rejected due to "iPhone Apps must also run on iPad without modification, at iPhone resolution, and at 2X iPhone 3GS resolution"

    - by sunny
    My app got rejected by the apple because of the reason "iPhone Apps must also run on iPad without modification, at iPhone resolution, and at 2X iPhone 3GS resolution".Apple suggested that "to support the iPad 3GS 2X, and this issue is usually resolved through settings in "compatibility" mode. "no black bar's or borders"".So,my question is how to set and run the app in compatibility mode.Any one having this issue please help on this issue.I have no idea to go forward. Please any suggestions and help thanks in advance.

    Read the article

  • Only error showing is null, rss feed reader not working

    - by Callum
    I have been following a tutorial which is showing me how to create an rssfeed reader, I come to the end of the tutorial; and the feed is not displaying in the listView. So I am looking for errors in logCat, but the only one I can find is one just saying 'null', which is not helpful at all. Can anyone spot a potential problem with the code I have written? Thanks. DirectRSS(main class): package com.example.rssapplication; import java.util.List; import android.app.ListActivity; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.util.Log; import android.widget.ArrayAdapter; import android.widget.ListView; public class DirectRSS extends ListActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.directrss); //Set to portrait, so that every time the view changes; it does not run the DB query again... setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); try{ RssReader1 rssReader = new RssReader1("http://www.skysports.com/rss/0,20514,11661,00.xml"); ListView list = (ListView)findViewById(R.id.list); ArrayAdapter<RssItem1> adapter = new ArrayAdapter<RssItem1>(this, android.R.layout.simple_list_item_1); list.setAdapter(adapter); list.setOnItemClickListener(new ListListener1(rssReader.getItems(),this)); }catch(Exception e) { String err = (e.getMessage()==null)?"SD Card failed": e.getMessage(); Log.e("sdcard-err2:",err + " " + e.getMessage()); // Log.e("Error", e.getMessage()); Log.e("LOGCAT", "" + e.getMessage()); } } } ListListener1: package com.example.rssapplication; import java.util.List; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; public class ListListener1 implements OnItemClickListener{ List<RssItem1> listItems; Activity activity; public ListListener1(List<RssItem1> listItems, Activity activity) { this.listItems = listItems; this.activity = activity; } @Override public void onItemClick(AdapterView<?> parent, View view, int pos, long id) { // TODO Auto-generated method stub Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(listItems.get(pos).getLink())); activity.startActivity(i); } } RssItem1: package com.example.rssapplication; public class RssItem1 { private String title; private String link; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getLink() { return link; } public void setLink(String link) { this.link = link; } } RssParseHandler1: package com.example.rssapplication; import java.util.ArrayList; import java.util.List; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class RssParseHandler1 extends DefaultHandler{ private List<RssItem1> rssItems; private RssItem1 currentItem; private boolean parsingTitle; private boolean parsingLink; public RssParseHandler1(){ rssItems = new ArrayList<RssItem1>(); } public List<RssItem1> getItems(){ return rssItems; } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if("item".equals(qName)){ currentItem = new RssItem1(); } else if("title".equals(qName)){ parsingTitle = true; } else if("link".equals(qName)){ parsingLink = true; } // TODO Auto-generated method stub super.startElement(uri, localName, qName, attributes); } @Override public void endElement(String uri, String localName, String qName) throws SAXException { if("item".equals(qName)){ rssItems.add(currentItem); currentItem = null; } else if("title".equals(qName)){ parsingTitle = false; } else if("link".equals(qName)){ parsingLink = false; } // TODO Auto-generated method stub super.endElement(uri, localName, qName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { if(parsingTitle) { if(currentItem!=null) { currentItem.setTitle(new String(ch,start,length)); } } else if(parsingLink) { if(currentItem!=null) { currentItem.setLink(new String(ch,start,length)); parsingLink = false; } } // TODO Auto-generated method stub super.characters(ch, start, length); } } RssReader1: package com.example.rssapplication; import java.util.List; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; public class RssReader1 { private String rssUrl; public RssReader1(String rssUrl) { this.rssUrl = rssUrl; } public List<RssItem1> getItems() throws Exception { SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); RssParseHandler1 handler = new RssParseHandler1(); saxParser.parse(rssUrl, handler); return handler.getItems(); } } Here is the logCat also: 08-25 11:13:20.803: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:20.803: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:20.803: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:20.813: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:20.813: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:20.813: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:20.813: W/ApplicationPackageManager(26291): getCSCPackageItemText() 08-25 11:13:20.843: D/AbsListView(26291): Get MotionRecognitionManager 08-25 11:13:20.843: E/sdcard-err2:(26291): SD Card failed null 08-25 11:13:20.843: E/LOGCAT(26291): null 08-25 11:13:20.843: D/AbsListView(26291): onVisibilityChanged() is called, visibility : 4 08-25 11:13:20.843: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:20.873: D/AbsListView(26291): onVisibilityChanged() is called, visibility : 0 08-25 11:13:20.883: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:20.903: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:20.933: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:20.963: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:20.973: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:21.323: D/AbsListView(26291): onVisibilityChanged() is called, visibility : 4 08-25 11:13:21.323: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:21.323: D/AbsListView(26291): onVisibilityChanged() is called, visibility : 4 08-25 11:13:21.323: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:21.323: D/AbsListView(26291): onVisibilityChanged() is called, visibility : 4 08-25 11:13:21.323: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:21.323: D/AbsListView(26291): onVisibilityChanged() is called, visibility : 4 08-25 11:13:21.323: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:21.323: D/AbsListView(26291): onVisibilityChanged() is called, visibility : 4 08-25 11:13:21.323: D/AbsListView(26291): unregisterIRListener() is called 08-25 11:13:21.333: D/AbsListView(26291): onVisibilityChanged() is called, visibility : 4 08-25 11:13:21.333: D/AbsListView(26291): unregisterIRListener() is called

    Read the article

  • if non zero elements in same column count only once

    - by George
    I want to check the elements above the main diagonal and if I found non zero values , count one. If the non zero values are found in the same column ,then count just one ,not the number of the non zero values. For example , it should be count = 2 and not 3 in this example because 12 and 6 are in the same column. A= 1 11 12 4 5 6 0 7 0 #include <stdio.h> #include <stdlib.h> #include <math.h> int main( int argc, const char* argv[] ){ int Rows = 3 , Cols = 3; float *A = (float *) malloc ( Rows * Cols * sizeof (float) ); A[0] = 1.0; A[1] = 11.0; A[2] = 12.0; A[3] = 4.0; A[4] = 5.0; A[5] = 6.0; A[6] = 0.0; A[7] = 7.0; A[8] = 0.0; // print input matrix printf("\n Input matrix \n\n"); for ( int i = 0; i < Rows; i++ ) for ( int j = 0; j < Cols; j++ ) { printf("%f\t",A[ i * Cols + j ]); if( j == Cols-1 ) printf("\n"); } printf("\n"); int count = 0; for ( int j = 0 ; j < Cols; j++ ) { for ( int i = ( Rows - 1 ); i >= 0; i-- ) { // check the diagonal elements above the main diagonal if ( j > i ) { if ( ( A[ i * Cols + j ] != 0 ) ) { printf("\n Above nonzero Elmts = %f\n",( A[i * Cols + j] ) ); count++; } } } } printf("\ncount = %d\n",count ); return 0; }

    Read the article

  • magento login page loads with a white background

    - by megamage
    I use magento 1.8.1 and I just moved my localhost site to a new server and imported my database using phpmyadmin and deleted the contents inside var/cache & var/session folders but when I try to access my backend the login page is loading in left top corner with a white background. However I can access to my backend and my localhost login page is still loading fine but the magento login page in my new server is not loading fine. I don't know what went wrong. Please help me out to solve this issue.Thanks in advance

    Read the article

  • Table header is not shown

    - by Vivien
    My error is that the table headers of my two tables are not shown. Right now I am setting the header with new JTable(data, columnNames). Here is an example which shows, my problem: public class Test extends JFrame { private static final long serialVersionUID = -4682396888922360841L; private JMenuBar menuBar; private JMenu mAbout; private JMenu mMain; private JTabbedPane tabbedPane; public SettingsTab settings = new SettingsTab(); private void addMenuBar() { menuBar = new JMenuBar(); mMain = new JMenu("Main"); mAbout = new JMenu("About"); menuBar.add(mMain); menuBar.add(mAbout); setJMenuBar(menuBar); } public void createTabBar() { tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.addTab("Settings", settings.createLayout()); add(tabbedPane); tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); } private void makeLayout() { setTitle("Test"); setLayout(new BorderLayout()); setPreferredSize(new Dimension(1000, 500)); addMenuBar(); createTabBar(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } public void start() { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { makeLayout(); } }); } public static void main(String[] args) { Test gui = new Test(); gui.start(); } public class SettingsTab extends JPanel { public JScrollPane createLayout() { JPanel panel = new JPanel(new MigLayout("")); JScrollPane sp = new JScrollPane(panel); sp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); panel.add(table1(), "growx, wrap"); panel.add(Box.createRigidArea(new Dimension(0,10))); panel.add(table2()); // panel.add(Box.createRigidArea(new Dimension(0,10))); return sp; } public JPanel table1() { JPanel panel1 = new JPanel(); String[] columnNames = {"First Name", "Last Name"}; Object[][] data = { {"Kathy", "Smith"}, {"John", "Doe"}, {"Sue", "Black"}, {"Jane", "White"}, {"Joe", "Brown"}, {"John", "Doe"}, {"Sue", "Black"}, {"Jane", "White"}, {"Joe", "Brown"} }; final JTable table = new JTable(data, columnNames); tableProperties(table); panel1.add(table); panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); return panel1; } public JPanel table2() { JPanel panel1 = new JPanel(); String[] columnNames = {"First Name", "Last Name"}; Object[][] data = { {"Kathy", "Smith"}, {"John", "Doe"}, {"Sue", "Black"}, {"Jane", "White"}, {"Joe", "Brown"}, {"John", "Doe"}, {"Sue", "Black"}, {"Jane", "White"}, {"Joe", "Brown"} }; final JTable table = new JTable(data, columnNames); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); table.setFillsViewportHeight(true); tableProperties(table); panel1.add(table); panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); return panel1; } public void tableProperties(JTable table) { table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); table.repaint(); table.revalidate(); } } } Any recommendations what I am doing wrong?

    Read the article

  • Toastr.js notifications as modal notfication

    - by Maxsteel
    I know it's not what toastr (or toast notifs in general) are meant to be used for, but I want to use them as a modal notification. My idea is following. On toast show: toastr.options.onShown = function() { //Create an overlay on the entire page} Overlay: #overlay { background-color: rgba(0, 0, 0, 0.8); z-index: 999; position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: none; } And on toast close: toastr.options.onHidden = function() { //make overlay go away } Also, I'm setting timeout of toast to 0 so it won't disappear by itself. Question: I want the toast notification to stay atop the overlay and not behind it as overlay will cover everything. How can I do it?

    Read the article

  • C# Timer -- measuring time slower

    - by Fassenkugel
    I'm writing a code where: I.) The user adds "events" during run-time. (To a flowlayoutpanel) These events are turning some LEDs on/off, after "x" time has elapsed and the LED-turning functions are written in a Led-function.cs class. i.e: 1) Turn left led on After 3500ms 2) Turn right led on After 4000ms II.) When the user hits start a timer starts. // Create timer. System.Timers.Timer _timer; _timer = new System.Timers.Timer(); _timer.Interval = (1); _timer.Elapsed += (sender, e) => { HandleTimerElapsed(LedObject, device, _timer); }; _timer.Start(); III.) The timer's tick event is raised every millisecond and checks if the user definied time has ellapsed. Im measuring the elapsed time with adding +1 to an integer at every tick event. (NumberOfTicks++;) //Timer Handle private void HandleTimerElapsed(Led_Functions LedObject, string device, System.Timers.Timer _timer) { NumberOfTicks++; if (NumberOfTicks >= Start_time[0]) { LedObject.LeftLED_ONnobutton(device); } } IV.) What I noticed was that when the tick was set to 1. (So the tick event is raised every millisecond) Even if I set 3000ms to the evet the LED actually flashed around 6 seconds. When the tick was set to 100. (So every 0,1s) then the flash was more accurate (3,5sec or so). Any Ideas why im having this delay in time? Or do you have any ideas how could I implement it better? Thank you!

    Read the article

  • Connecting PHP Server and Android?

    - by user3439988
    I am trying to create a simple test application to transfer data back and forth between my server and Android device. The following are the things I aim for: Ability to upload data and files to the server. To be able to view my files on the server. To be able to download the files from the server to my android device. Ability of the server to send me updates on the files or notifications to my phone. I need a safe and secure way to do these things. I have tried these: HTTPPost requests onto the server and echoing the output accordingly and capturing the HTTPresponse and parsing it. For files I have tried using MultipartEntity, but I think that has been deprecated.

    Read the article

  • How to add legend to imshow() in matplotlib

    - by rankthefirst
    I am using matplotlib In plot() or bar(), we can easily put legend, if we add labels to them. but what if it is a contourf() or imshow() I know there is a colorbar() which can present the color range, but it is not satisfied. I want such a legend which have names(labels). For what I can think of is that, add labels to each element in the matrix, then ,try legend(), to see if it works, but how to add label to the element, like a value?? in my case, the raw data is like: 1,2,3,3,4 2,3,4,4,5 1,1,1,2,2 for example, 1 represents 'grass', 2 represents 'sand', 3 represents 'hill'... and so on. imshow() works perfectly with my case, but without the legend. my question is: Is there a function that can automatically add legend, for example, in my case, I just have to do like this: someFunction('grass','sand',...) If there isn't, how do I add labels to each value in the matrix. For example, label all the 1 in the matrix 'grass', labell all the 2 in the matrix 'sand'...and so on. Thank you!

    Read the article

  • How to log out from the Facebook in windows phone 7 using facebook api?

    - by Vijay
    I am trying to add Facebook into my application. I have try with a sample. public class FacebookLoginPageViewModel { private static WebBrowser _webBrowser; private Page _page; private const string ExtendedPermissions = "user_about_me,read_stream,publish_stream,user_birthday,offline_access,email"; private readonly FacebookClient _fb = new FacebookClient(); private const string AppId = "1XXX58XXXXXXXX9"; Uri url; public FacebookLoginPageViewModel(Panel container, Page page) { _page = page; _webBrowser = new WebBrowser(); var loginUrl = GetFacebookLoginUrl(AppId, ExtendedPermissions); url = loginUrl; container.Children.Add(_webBrowser); _webBrowser.Navigated += webBrowser_Navigated; _webBrowser.Navigate(loginUrl); } private Uri GetFacebookLoginUrl(string appId, string extendedPermissions) { var parameters = new Dictionary<string, object>(); parameters["client_id"] = appId; parameters["redirect_uri"] = "https://www.facebook.com/connect/login_success.html"; parameters["response_type"] = "token"; parameters["display"] = "touch"; // add the 'scope' only if we have extendedPermissions. if (!string.IsNullOrEmpty(extendedPermissions)) { // A comma-delimited list of permissions parameters["scope"] = extendedPermissions; } return _fb.GetLoginUrl(parameters); } void webBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) { FacebookOAuthResult oauthResult; if (!_fb.TryParseOAuthCallbackUrl(e.Uri, out oauthResult)) { return; } if (oauthResult.IsSuccess) { var accessToken = oauthResult.AccessToken; LoginSucceded(accessToken); } else { // user cancelled MessageBox.Show(oauthResult.ErrorDescription); } } private void LoginSucceded(string accessToken) { var fb = new FacebookClient(accessToken); fb.GetCompleted += (o, e) => { if (e.Error != null) { Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show(e.Error.Message); return; }); } var result = (IDictionary<string, object>)e.GetResultData(); var id = (string)result["id"]; var url = string.Format("/Views/FacebookInfoPage.xaml?access_token={0}&id={1}", accessToken, id); var rootFrame = (App.Current as App).RootFrame; Deployment.Current.Dispatcher.BeginInvoke(() => { rootFrame.Navigate(new Uri(url, UriKind.Relative)); }); }; fb.GetAsync("me?fields=id"); } This is working fine. But i want to Log out from the facebook when i click log out. How to achieve this? I have try with some examples. But it is not working for me. private void logout(object sender, RoutedEventArgs e) { webBrowser1.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(CheckForout); webBrowser1.Navigate(new Uri("http://m.facebook.com/logout.php?confirm=1")); webBrowser1.Visibility = Visibility.Visible; } private void CheckForout(object sender, System.Windows.Navigation.NavigationEventArgs e) { string fbLogoutDoc = webBrowser1.SaveToString(); Regex regex = new Regex ("\\<a href=\\\"/logout(.*)\\\".*data-sigil=\\\"logout\\\""); MatchCollection matches = regex.Matches(fbLogoutDoc); if (matches.Count > 0) { string finalLogout = string.Format("http://m.facebook.com/logout{0}", matches[0].Groups[1].ToString().Replace("amp;", "")); webBrowser1.Navigate(new Uri(finalLogout)); } } Please let me any idea to resolve this problem.

    Read the article

  • Java unchecked method invocation

    - by Sam
    I'm trying to setup a multithreaded application using SQLite4java, and everything is working fine. However, according to the getting started tutorial I am meant to create an object of type "object" and in order to return a value of null (due to use of generic types). Here is the suggested code: queue.execute(new SQLiteJob<Object>() { protected Object job(SQLiteConnection connection) throws SQLiteException { // this method is called from database thread and passed the connection connection.exec(...); return null; } }); Source The following example code I created produces the same error: error: test.java:9: warning: [unchecked] unchecked method invocation: <T,J>execute(J) in com.almworks.sqlite4java.SQLiteQueue is applied to (query<java.lang.Integer>) queue.execute(new query<Integer>()); test.java: import com.almworks.sqlite4java.*; import java.util.ArrayList; import java.io.File; class test{ public static void main(String[] args){ File f = new File("file.db"); SQLiteQueue queue = new SQLiteQueue(f); queue.execute(new query<Integer>()); } } query.java: import com.almworks.sqlite4java.SQLiteException; import com.almworks.sqlite4java.SQLiteJob; import com.almworks.sqlite4java.SQLiteConnection; import com.almworks.sqlite4java.SQLiteStatement; import java.util.ArrayList; class query<T> extends SQLiteJob{ protected ArrayList<Integer> job(SQLiteConnection connection) throws SQLiteException{ ArrayList<Integer> ints = new ArrayList<Integer>(); //DB Stuff return ints; } } I have read a lot about how this particular message appears when people fail to specify a type for an ArrayList. However, I am not attempting to cast the object or do anything with it. It is merely a mechanism implemented by the library developers in order to return a null. I do not believe this to be an issue relating directly to the library, which is why I'm asking this on StackOverflow. I believe it all comes down to my lack of experience with generic types. I've already spent a few hours on this and don't feel like I am getting anywhere. How do I stop the warning?

    Read the article

  • Handling android player errors

    - by stack hoss
    I am anew android developer and i made ashoutcast radio player and work good but when i open app it work for afew time but suddenly stop and need to press stop and play again but i need Handling android player errors to automatic restart on errors package com.test.test; import java.io.IOException; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.media.AudioManager; import android.media.AudioManager.OnAudioFocusChangeListener; import android.media.MediaPlayer; import android.os.IBinder; import android.preference.PreferenceManager; import android.util.Log; public class StreamService extends Service { private static final String TAG = "StreamService"; MediaPlayer mp; boolean isPlaying; Intent MainActivity; SharedPreferences prefs; SharedPreferences.Editor editor; Notification n; NotificationManager notificationManager; // Change this int to some number specifically for this app int notifId = 85; private OnAudioFocusChangeListener focusChangeListener = new OnAudioFocusChangeListener() { public void onAudioFocusChange(int focusChange) { switch (focusChange) { case (AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) : // Lower the volume while ducking. mp.setVolume(0.2f, 0.2f); break; case (AudioManager.AUDIOFOCUS_LOSS_TRANSIENT) : mp.pause(); break; case (AudioManager.AUDIOFOCUS_LOSS) : mp.stop(); break; case (AudioManager.AUDIOFOCUS_GAIN) : // Return the volume to normal and resume if paused. mp.setVolume(1f, 1f); mp.start(); break; default: break; } } }; @Override public IBinder onBind(Intent arg0) { // TODO Auto-generated method stub return null; } @SuppressWarnings("deprecation") @Override public void onCreate() { super.onCreate(); Log.d(TAG, "onCreate"); // Init the SharedPreferences and Editor prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); editor = prefs.edit(); // Set up the buffering notification notificationManager = (NotificationManager) getApplicationContext() .getSystemService(NOTIFICATION_SERVICE); Context context = getApplicationContext(); String notifTitle = context.getResources().getString(R.string.app_name); String notifMessage = context.getResources().getString(R.string.buffering); n = new Notification(); n.icon = R.drawable.ic_launcher; n.tickerText = "Buffering"; n.when = System.currentTimeMillis(); Intent nIntent = new Intent(context, MainActivity.class); nIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pIntent = PendingIntent.getActivity(context, 0, nIntent, 0); n.setLatestEventInfo(context, notifTitle, notifMessage, pIntent); notificationManager.notify(notifId, n); // It's very important that you put the IP/URL of your ShoutCast stream here // Otherwise you'll get Webcom Radio String url = "http://47.182.19.93:9888/"; mp = new MediaPlayer(); mp.setAudioStreamType(AudioManager.STREAM_MUSIC); try { mp.reset(); mp.setDataSource(url); mp.prepare(); mp.start(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block Log.e(TAG, "SecurityException"); } catch (IllegalStateException e) { // TODO Auto-generated catch block Log.e(TAG, "IllegalStateException"); } catch (IOException e) { // TODO Auto-generated catch block Log.e(TAG, "IOException"); } } @SuppressWarnings("deprecation") @Override public void onStart(Intent intent, int startId) { Log.d(TAG, "onStart"); mp.start(); // Set the isPlaying preference to true editor.putBoolean("isPlaying", true); editor.commit(); Context context = getApplicationContext(); String notifTitle = context.getResources().getString(R.string.app_name); String notifMessage = context.getResources().getString(R.string.now_playing); n.icon = R.drawable.ic_launcher; n.tickerText = notifMessage; n.flags = Notification.FLAG_NO_CLEAR; n.when = System.currentTimeMillis(); Intent nIntent = new Intent(context, MainActivity.class); PendingIntent pIntent = PendingIntent.getActivity(context, 0, nIntent, 0); n.setLatestEventInfo(context, notifTitle, notifMessage, pIntent); // Change 5315 to some nother number notificationManager.notify(notifId, n); AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE); // Request audio focus for playback int result = am.requestAudioFocus(focusChangeListener, // Use the music stream. AudioManager.STREAM_MUSIC, // Request permanent focus. AudioManager.AUDIOFOCUS_GAIN); if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { // other app had stopped playing song now , so u can do u stuff now . } } @Override public void onDestroy() { Log.d(TAG, "onDestroy"); mp.stop(); mp.release(); mp = null; editor.putBoolean("isPlaying", false); editor.commit(); notificationManager.cancel(notifId); AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE); am.abandonAudioFocus(focusChangeListener); } }

    Read the article

  • OpenGL textures trigger error 1281 and strange background behavior

    - by user3714670
    I am using SOIL to apply textures to VBOs, without textures i could change the background and display black (default color) vbos easily, but now with textures, openGL is giving an error 1281, the background is black and some textures are not applied. There must be something i didn't understand about applying/loading the textures. BUt the texture IS applied (nothing else is working though), the error is applied when i try to use the shader program however i checked the compilation of these and no problems were written. Here is the code i use to load textures, once loaded it is kept in memory, it mostly comes from the example of SOIL : texture = SOIL_load_OGL_single_cubemap( filename, SOIL_DDS_CUBEMAP_FACE_ORDER, SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_DDS_LOAD_DIRECT ); if( texture > 0 ) { glEnable( GL_TEXTURE_CUBE_MAP ); glEnable( GL_TEXTURE_GEN_S ); glEnable( GL_TEXTURE_GEN_T ); glEnable( GL_TEXTURE_GEN_R ); glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP ); glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP ); glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP ); glBindTexture( GL_TEXTURE_CUBE_MAP, texture ); std::cout << "the loaded single cube map ID was " << texture << std::endl; } else { std::cout << "Attempting to load as a HDR texture" << std::endl; texture = SOIL_load_OGL_HDR_texture( filename, SOIL_HDR_RGBdivA2, 0, SOIL_CREATE_NEW_ID, SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS ); if( texture < 1 ) { std::cout << "Attempting to load as a simple 2D texture" << std::endl; texture = SOIL_load_OGL_texture( filename, SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_DDS_LOAD_DIRECT ); } if( texture > 0 ) { // enable texturing glEnable( GL_TEXTURE_2D ); // bind an OpenGL texture ID glBindTexture( GL_TEXTURE_2D, texture ); std::cout << "the loaded texture ID was " << texture << std::endl; } else { glDisable( GL_TEXTURE_2D ); std::cout << "Texture loading failed: '" << SOIL_last_result() << "'" << std::endl; } } and how i apply it when drawing : GLuint TextureID = glGetUniformLocation(shaderProgram, "myTextureSampler"); if(!TextureID) cout << "TextureID not found ..." << endl; // glEnableVertexAttribArray(TextureID); glActiveTexture(GL_TEXTURE0); if(SFML) sf::Texture::bind(sfml_texture); else { glBindTexture (GL_TEXTURE_2D, texture); // glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 768, 0, GL_RGB, GL_UNSIGNED_BYTE, &texture); } glUniform1i(TextureID, 0); I am not sure that SOIL is adapted to my program as i want something as simple as possible (i used sfml's texture object which was the best but i can't anymore), but if i can get it to work it would be great. EDIT : After narrowing the code implied by the error, here is the code that provokes it, it is called between texture loading and bos drawing : glEnableClientState(GL_VERTEX_ARRAY); //this gives the error : glUseProgram(this->shaderProgram); if (!shaderLoaded) { std::cout << "Loading default shaders" << std::endl; if(textured) loadShaderProgramm(texture_vertexSource, texture_fragmentSource); else loadShaderProgramm(default_vertexSource,default_fragmentSource); } glm::mat4 Projection = camera->getPerspective(); glm::mat4 View = camera->getView(); glm::mat4 Model = glm::mat4(1.0f); Model[0][0] *= scale_x; Model[1][1] *= scale_y; Model[2][2] *= scale_z; glm::vec3 translate_vec(this->x,this->y,this->z); glm::mat4 object_transform = glm::translate(glm::mat4(1.0f),translate_vec); glm::quat rotation = QAccumulative.getQuat(); glm::mat4 matrix_rotation = glm::mat4_cast(rotation); object_transform *= matrix_rotation; Model *= object_transform; glm::mat4 MVP = Projection * View * Model; GLuint ModelID = glGetUniformLocation(this->shaderProgram, "M"); if(ModelID ==-1) cout << "ModelID not found ..." << endl; GLuint MatrixID = glGetUniformLocation(this->shaderProgram, "MVP"); if(MatrixID ==-1) cout << "MatrixID not found ..." << endl; GLuint ViewID = glGetUniformLocation(this->shaderProgram, "V"); if(ViewID ==-1) cout << "ViewID not found ..." << endl; glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]); glUniformMatrix4fv(ModelID, 1, GL_FALSE, &Model[0][0]); glUniformMatrix4fv(ViewID, 1, GL_FALSE, &View[0][0]); drawObject();

    Read the article

  • Is there an iconv with //TRANSLIT equivalent in java?

    - by Keith
    Is there a way to achieve transliteration of characters between charsets in java? something similar to the unix command (or similar php function): iconv -f UTF-8 -t ASCII//TRANSLIT < some_doc.txt > new_doc.txt preferably operating on strings, not having anything to do with files I know you can can change encodings with the String constructor, but that doesn't handle transliteration of characters that aren't in the resulting charset.

    Read the article

  • Left outer join null using VB.NET and LINQ

    - by jvcoach23
    I've got what I think is a working left outer join LINQ query, but I'm having problems with the select because of null values in the right hand side of the join. Here is what I have so far Dim Os = From e In oExcel Group Join c In oClassIndexS On c.tClassCode Equals Mid(e.ClassCode, 1, 4) Into right1 = Group _ From c In right1.DefaultIfEmpty I want to return all of e and one column from c called tClassCode. I was wondering what the syntax would be. As you can see, I'm using VB.NET. Update... Here is the query doing join where I get the error: _message = "Object reference not set to an instance of an object." Dim Os = From e In oExcel Group Join c In oClassIndexS On c.tClassCode Equals Mid(e.ClassCode, 1, 4) Into right1 = Group _ From c In right1.DefaultIfEmpty Select e, c.tClassCode If I remove the c.tClassCode from the select, the query runs without error. So I thought perhaps I needed to do a select new, but I don't think I was doing that correctly either.

    Read the article

  • DocumentDB - Another Azure NoSQL Storage Service

    - by Shaun
    Originally posted on: http://geekswithblogs.net/shaunxu/archive/2014/08/25/documentdb---another-azure-nosql-storage-service.aspxMicrosoft just released a bunch of new features for Azure on 22nd and one of them I was interested in most is DocumentDB, a document NoSQL database service on the cloud.   Quick Look at DocumentDB We can try DocumentDB from the new azure preview portal. Just click the NEW button and select the item named DocumentDB to create a new account. Specify the name of the DocumentDB, which will be the endpoint we are going to use to connect later. Select the capacity unit, resource group and subscription. In resource group section we can select which region our DocumentDB will be located. Same as other azure services select the same location with your consumers of the DocumentDB, for example the website, web services, etc.. After several minutes the DocumentDB will be ready. Click the KEYS button we can find the URI and primary key, which will be used when connecting. Now let's open Visual Studio and try to use the DocumentDB we had just created. Create a new console application and install the DocumentDB .NET client library from NuGet with the keyword "DocumentDB". You need to select "Include Prerelase" in NuGet Package Manager window since this library was not yet released. Next we will create a new database and document collection under our DocumentDB account. The code below created an instance of DocumentClient with the URI and primary key we just copied from azure portal, and create a database and collection. And it also prints the document and collection link string which will be used later to insert and query documents. 1: static void Main(string[] args) 2: { 3: var endpoint = new Uri("https://shx.documents.azure.com:443/"); 4: var key = "LU2NoyS2fH0131TGxtBE4DW/CjHQBzAaUx/mbuJ1X77C4FWUG129wWk2oyS2odgkFO2Xdif9/ZddintQicF+lA=="; 5:  6: var client = new DocumentClient(endpoint, key); 7: Run(client).Wait(); 8:  9: Console.WriteLine("done"); 10: Console.ReadKey(); 11: } 12:  13: static async Task Run(DocumentClient client) 14: { 15:  16: var database = new Database() { Id = "testdb" }; 17: database = await client.CreateDatabaseAsync(database); 18: Console.WriteLine("database link = {0}", database.SelfLink); 19:  20: var collection = new DocumentCollection() { Id = "testcol" }; 21: collection = await client.CreateDocumentCollectionAsync(database.SelfLink, collection); 22: Console.WriteLine("collection link = {0}", collection.SelfLink); 23: } Below is the result from the console window. We need to copy the collection link string for future usage. Now if we back to the portal we will find a database was listed with the name we specified in the code. Next we will insert a document into the database and collection we had just created. In the code below we pasted the collection link which copied in previous step, create a dynamic object with several properties defined. As you can see we can add some normal properties contains string, integer, we can also add complex property for example an array, a dictionary and an object reference, unless they can be serialized to JSON. 1: static void Main(string[] args) 2: { 3: var endpoint = new Uri("https://shx.documents.azure.com:443/"); 4: var key = "LU2NoyS2fH0131TGxtBE4DW/CjHQBzAaUx/mbuJ1X77C4FWUG129wWk2oyS2odgkFO2Xdif9/ZddintQicF+lA=="; 5:  6: var client = new DocumentClient(endpoint, key); 7:  8: // collection link pasted from the result in previous demo 9: var collectionLink = "dbs/AAk3AA==/colls/AAk3AP6oFgA=/"; 10:  11: // document we are going to insert to database 12: dynamic doc = new ExpandoObject(); 13: doc.firstName = "Shaun"; 14: doc.lastName = "Xu"; 15: doc.roles = new string[] { "developer", "trainer", "presenter", "father" }; 16:  17: // insert the docuemnt 18: InsertADoc(client, collectionLink, doc).Wait(); 19:  20: Console.WriteLine("done"); 21: Console.ReadKey(); 22: } the insert code will be very simple as below, just provide the collection link and the object we are going to insert. 1: static async Task InsertADoc(DocumentClient client, string collectionLink, dynamic doc) 2: { 3: var document = await client.CreateDocumentAsync(collectionLink, doc); 4: Console.WriteLine(await JsonConvert.SerializeObjectAsync(document, Formatting.Indented)); 5: } Below is the result after the object had been inserted. Finally we will query the document from the database and collection. Similar to the insert code, we just need to specify the collection link so that the .NET SDK will help us to retrieve all documents in it. 1: static void Main(string[] args) 2: { 3: var endpoint = new Uri("https://shx.documents.azure.com:443/"); 4: var key = "LU2NoyS2fH0131TGxtBE4DW/CjHQBzAaUx/mbuJ1X77C4FWUG129wWk2oyS2odgkFO2Xdif9/ZddintQicF+lA=="; 5:  6: var client = new DocumentClient(endpoint, key); 7:  8: var collectionLink = "dbs/AAk3AA==/colls/AAk3AP6oFgA=/"; 9:  10: SelectDocs(client, collectionLink); 11:  12: Console.WriteLine("done"); 13: Console.ReadKey(); 14: } 15:  16: static void SelectDocs(DocumentClient client, string collectionLink) 17: { 18: var docs = client.CreateDocumentQuery(collectionLink + "docs/").ToList(); 19: foreach(var doc in docs) 20: { 21: Console.WriteLine(doc); 22: } 23: } Since there's only one document in my collection below is the result when I executed the code. As you can see all properties, includes the array was retrieve at the same time. DocumentDB also attached some properties we didn't specified such as "_rid", "_ts", "_self" etc., which is controlled by the service.   DocumentDB Benefit DocumentDB is a document NoSQL database service. Different from the traditional database, document database is truly schema-free. In a short nut, you can save anything in the same database and collection if it could be serialized to JSON. We you query the document database, all sub documents will be retrieved at the same time. This means you don't need to join other tables when using a traditional database. Document database is very useful when we build some high performance system with hierarchical data structure. For example, assuming we need to build a blog system, there will be many blog posts and each of them contains the content and comments. The comment can be commented as well. If we were using traditional database, let's say SQL Server, the database schema might be defined as below. When we need to display a post we need to load the post content from the Posts table, as well as the comments from the Comments table. We also need to build the comment tree based on the CommentID field. But if were using DocumentDB, what we need to do is to save the post as a document with a list contains all comments. Under a comment all sub comments will be a list in it. When we display this post we just need to to query the post document, the content and all comments will be loaded in proper structure. 1: { 2: "id": "xxxxx-xxxxx-xxxxx-xxxxx", 3: "title": "xxxxx", 4: "content": "xxxxx, xxxxxxxxx. xxxxxx, xx, xxxx.", 5: "postedOn": "08/25/2014 13:55", 6: "comments": 7: [ 8: { 9: "id": "xxxxx-xxxxx-xxxxx-xxxxx", 10: "content": "xxxxx, xxxxxxxxx. xxxxxx, xx, xxxx.", 11: "commentedOn": "08/25/2014 14:00", 12: "commentedBy": "xxx" 13: }, 14: { 15: "id": "xxxxx-xxxxx-xxxxx-xxxxx", 16: "content": "xxxxx, xxxxxxxxx. xxxxxx, xx, xxxx.", 17: "commentedOn": "08/25/2014 14:10", 18: "commentedBy": "xxx", 19: "comments": 20: [ 21: { 22: "id": "xxxxx-xxxxx-xxxxx-xxxxx", 23: "content": "xxxxx, xxxxxxxxx. xxxxxx, xx, xxxx.", 24: "commentedOn": "08/25/2014 14:18", 25: "commentedBy": "xxx", 26: "comments": 27: [ 28: { 29: "id": "xxxxx-xxxxx-xxxxx-xxxxx", 30: "content": "xxxxx, xxxxxxxxx. xxxxxx, xx, xxxx.", 31: "commentedOn": "08/25/2014 18:22", 32: "commentedBy": "xxx", 33: } 34: ] 35: }, 36: { 37: "id": "xxxxx-xxxxx-xxxxx-xxxxx", 38: "content": "xxxxx, xxxxxxxxx. xxxxxx, xx, xxxx.", 39: "commentedOn": "08/25/2014 15:02", 40: "commentedBy": "xxx", 41: } 42: ] 43: }, 44: { 45: "id": "xxxxx-xxxxx-xxxxx-xxxxx", 46: "content": "xxxxx, xxxxxxxxx. xxxxxx, xx, xxxx.", 47: "commentedOn": "08/25/2014 14:30", 48: "commentedBy": "xxx" 49: } 50: ] 51: }   DocumentDB vs. Table Storage DocumentDB and Table Storage are all NoSQL service in Microsoft Azure. One common question is "when we should use DocumentDB rather than Table Storage". Here are some ideas from me and some MVPs. First of all, they are different kind of NoSQL database. DocumentDB is a document database while table storage is a key-value database. Second, table storage is cheaper. DocumentDB supports scale out from one capacity unit to 5 in preview period and each capacity unit provides 10GB local SSD storage. The price is $0.73/day includes 50% discount. For storage service the highest price is $0.061/GB, which is almost 10% of DocumentDB. Third, table storage provides local-replication, geo-replication, read access geo-replication while DocumentDB doesn't support. Fourth, there is local emulator for table storage but none for DocumentDB. We have to connect to the DocumentDB on cloud when developing locally. But, DocumentDB supports some cool features that table storage doesn't have. It supports store procedure, trigger and user-defined-function. It supports rich indexing while table storage only supports indexing against partition key and row key. It supports transaction, table storage supports as well but restricted with Entity Group Transaction scope. And the last, table storage is GA but DocumentDB is still in preview.   Summary In this post I have a quick demonstration and introduction about the new DocumentDB service in Azure. It's very easy to interact through .NET and it also support REST API, Node.js SDK and Python SDK. Then I explained the concept and benefit of  using document database, then compared with table storage.   Hope this helps, Shaun All documents and related graphics, codes are provided "AS IS" without warranty of any kind. Copyright © Shaun Ziyan Xu. This work is licensed under the Creative Commons License.

    Read the article

  • nagios contact groups to check_mk

    - by Skiaddict
    I have Nagios installed with traditional configuration files. I have created some contact groups and assigned them to hosts. For web UI I'm using check_mk. And here's the question: Check_mk supports showing hosts/services based on contact group membership. But I can't use the Nagios contact groups in check_mk. (Result should be that if person XYZ is logged in, he see only hosts and services assigned to him.) My users are in LDAP (I'm using check_mk login form, not apache authorisation). I can't find any information about this in documentation so if someone have experience, please tell me how this works. The problem is that I cannot let everybody be admin and receive all alerts...

    Read the article

  • ERR_INCOMPLETE_CHUNKED_ENCODING apache 2.4

    - by Bujanca Mihai
    I upgraded my Ubuntu server to 14.04 and Apache 2.4.7. Now my images don't load and console yields net::ERR_INCOMPLETE_CHUNKED_ENCODING. Also, I can sometimes see some of the images load for a little while (1 sec max) and then they disappear. .htaccess RewriteEngine On # Serve the favicon file from img folder RewriteCond %{REQUEST_URI} ^/favicon.ico$ RewriteRule ^(.*)$ /img/$1 [NC,L] # Redirect HTTP traffic to WWW subdomain RewriteCond %{HTTPS} off [NC] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] # Redirect HTTPS traffic to WWW subdomain RewriteCond %{HTTPS} on [NC] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] # Auto Versioning rules RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.*)\.[\d]+\.(css|js)$ $1.$2 [L] # Default Zend rewrite rules RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] VHost <VirtualHost *:80> ServerAdmin admin@localhost ServerName localhost DocumentRoot /home/mihai/ARTD/www/public/website # Omit this in production environment SetEnv APPLICATION_ENV local <Directory /home/mihai/ARTD/www/public/website > Options Indexes FollowSymLinks MultiViews AllowOverride All #Order deny,allow #Allow from all Require all granted </Directory> <IfModule mod_php5.c> php_value memory_limit 128M php_value upload_max_filesize 20M php_value post_max_size 20M </IfModule> ErrorLog /var/log/apache2/ARTD-error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/ARTD-access.log combined </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin admin@localhost ServerName localhost DocumentRoot /home/mihai/ARTD/www/public/website # Omit this in production environment SetEnv APPLICATION_ENV local <Directory /home/mihai/ARTD/www/public/website > Options Indexes FollowSymLinks MultiViews AllowOverride All #Order deny,allow #Allow from all Require all granted </Directory> <IfModule mod_php5.c> php_value memory_limit 128M php_value upload_max_filesize 20M php_value post_max_size 20M </IfModule> ErrorLog /var/log/apache2/ARTD-ssl-error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/ARTD.log combined # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # A self-signed (snakeoil) certificate can be created by installing # the ssl-cert package. See # /usr/share/doc/apache2.2-common/README.Debian.gz for more info. # If both key and certificate are stored in the same file, only the # SSLCertificateFile directive is needed. SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt # Certificate Authority (CA): # Set the CA certificate verification path where to find CA # certificates for client authentication or alternatively one # huge file containing all of them (file must be PEM encoded) # Note: Inside SSLCACertificatePath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCACertificatePath /etc/ssl/certs/ #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt # Certificate Revocation Lists (CRL): # Set the CA revocation path where to find CA CRLs for client # authentication or alternatively one huge file containing all # of them (file must be PEM encoded) # Note: Inside SSLCARevocationPath you need hash symlinks # to point to the certificate files. Use the provided # Makefile to update the hash symlinks after changes. #SSLCARevocationPath /etc/apache2/ssl.crl/ #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl # Client Authentication (Type): # Client certificate verification type and depth. Types are # none, optional, require and optional_no_ca. Depth is a # number which specifies how deeply to verify the certificate # issuer chain before deciding the certificate is not valid. #SSLVerifyClient require #SSLVerifyDepth 10 # Access Control: # With SSLRequire you can do per-directory access control based # on arbitrary complex boolean expressions containing server # variable checks and other lookup directives. The syntax is a # mixture between C and Perl. See the mod_ssl documentation # for more details. #<Location /> #SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \ # and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \ # and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \ # and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \ # and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \ # or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/ #</Location> # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the # server (always existing) and the client (only existing when client # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o StrictRequire: # This denies access when "SSLRequireSSL" or "SSLRequire" applied even # under a "Satisfy any" situation, i.e. when it applies access is denied # and no other module can change it. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire #<FilesMatch "\.(cgi|shtml|phtml|php)$"> # SSLOptions +StdEnvVars #</FilesMatch> # SSL Protocol Adjustments: # The safe and default but still SSL/TLS standard compliant shutdown # approach is that mod_ssl sends the close notify alert but doesn't wait for # the close notify alert from client. When you need a different shutdown # approach you can use one of the following variables: # o ssl-unclean-shutdown: # This forces an unclean shutdown when the connection is closed, i.e. no # SSL close notify alert is send or allowed to received. This violates # the SSL/TLS standard but is needed for some brain-dead browsers. Use # this when you receive I/O errors because of the standard approach where # mod_ssl sends the close notify alert. # o ssl-accurate-shutdown: # This forces an accurate shutdown when the connection is closed, i.e. a # SSL close notify alert is send and mod_ssl waits for the close notify # alert of the client. This is 100% SSL/TLS standard compliant, but in # practice often causes hanging connections with brain-dead browsers. Use # this only for browsers where you know that their SSL implementation # works correctly. # Notice: Most problems of broken clients are also related to the HTTP # keep-alive facility, so you usually additionally want to disable # keep-alive for those clients, too. Use variable "nokeepalive" for this. # Similarly, one has to force some clients to use HTTP/1.0 to workaround # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and # "force-response-1.0" for this. #BrowserMatch ".*MSIE.*" \ # nokeepalive ssl-unclean-shutdown \ # downgrade-1.0 force-response-1.0 </VirtualHost> </IfModule> logs Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.3 OpenSSL/1.0.1f (internal dummy connection) 127.0.0.1 - - [25/Aug/2014:13:09:53 +0300] "GET /img/header/top-nav-separator.png HTTP/1.1" 200 462 "https://localhost/art" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.132 Safari/537.36"

    Read the article

  • CentOS 5 : error in installing php-imap

    - by TMMDev
    can someone please help me with this CentOS 5 question? I am trying to install php-imap, i tried yum install php-imap but I am getting the following output: Loaded plugins: fastestmirror, priorities, security Loading mirror speeds from cached hostfile * base: centos.hostingxtreme.com * epel: mirror.steadfast.net * extras: mirror.team-cymru.org * updates: mirror.beyondhosting.net Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package php-imap.x86_64 0:5.1.6-44.el5_10 set to be updated --> Processing Dependency: php-common = 5.1.6-44.el5_10 for package: php-imap --> Finished Dependency Resolution php-imap-5.1.6-44.el5_10.x86_64 from updates has depsolving problems --> Missing Dependency: php-common = 5.1.6-44.el5_10 is needed by package php-imap-5.1.6-44.el5_10.x86_64 (updates) Error: Missing Dependency: php-common = 5.1.6-44.el5_10 is needed by package php-imap-5.1.6-44.el5_10.x86_64 (updates) You could try using --skip-broken to work around the problem You could try running: package-cleanup --problems package-cleanup --dupes rpm -Va --nofiles --nodigest The program package-cleanup is found in the yum-utils package. I already have php-common installed, I ran "yum install php-common" and got the following output Loaded plugins: fastestmirror, priorities, security Loading mirror speeds from cached hostfile * base: centos.hostingxtreme.com * epel: mirror.steadfast.net * extras: mirror.team-cymru.org * updates: mirror.beyondhosting.net Setting up Install Process Package matching php-common-5.1.6-44.el5_10.x86_64 already installed. Checking for update. Nothing to do how can I fix this problem?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >